Example #1
0
 def get_data(self, url):
     '''
     return the data needed.
     url is from get_roms.get_url(starttime, endtime)
     '''
     data = jata.get_nc_data(url, 'lon_rho', 'lat_rho', 'mask_rho','u', 'v', 'h', 's_rho')
     return data
Example #2
0
 def get_data(self,url):
     '''
     ??? Retrieves data?
     '''
     self.data = jata.get_nc_data(url,'lon','lat','latc','lonc',
                                  'u','v','siglay','h')
     return self.data
Example #3
0
 def get_data(self, url):
     '''
     return the data needed.
     url is from water_roms.get_url(starttime, endtime)
     '''
     data = jata.get_nc_data(url, 'lon_rho', 'lat_rho', 'mask_rho','u', 'v', 'h', 's_rho')
     return data
Example #4
0
 def get_data(self, url):
     '''
     return the data needed.
     url is from water_roms.get_url(starttime, endtime)
     '''
     data = jata.get_nc_data(url, 'lon_rho', 'lat_rho', 'temp','h','s_rho', 'ocean_time')
     return data
Example #5
0
 def get_data(self, url):
     self.data = jata.get_nc_data(url, 'lon', 'lat', 'latc', 'lonc', 'u',
                                  'v', 'siglay', 'h', 'time', 'temp')
     return self.data
import numpy as np
import matplotlib.pyplot as plt
import jata
from mpl_toolkits.basemap import Basemap

url = 'http://www.smast.umassd.edu:8080/thredds/dodsC/fvcom/hindcasts/30yr_gom3?lat[0:1:48450],latc[0:1:90414],lon[0:1:48450],lonc[0:1:90414]'
data = jata.get_nc_data(url, 'lon', 'lat', 'lonc', 'latc')

lonsize = [-76, -55]
latsize = [35, 46.5]
interval_lat, interval_lon = 0.5, 0.5
fig = plt.figure()
ax = plt.subplot(111)
dmap = Basemap(projection='cyl',
               llcrnrlat=min(latsize)-0.01,
               urcrnrlat=max(latsize)+0.01,
               llcrnrlon=min(lonsize)-0.01,
               urcrnrlon=max(lonsize)+0.01,
               resolution='h',ax=ax)
dmap.drawparallels(np.arange(int(min(latsize)),
                             int(max(latsize))+1,interval_lat),
                   labels=[1,0,0,0])
dmap.drawmeridians(np.arange(int(min(lonsize))-1,
                             int(max(lonsize))+1,interval_lon),
                   labels=[0,0,0,1])
dmap.drawcoastlines()
dmap.fillcontinents(color='grey')
dmap.drawmapboundary()

# ax.plot(data['lon'], data['lat'], '.', label='nodal')
ax.plot(data['lonc'], data['latc'], '.', label='zonal')
 def get_data(self, url):
     data = jata.get_nc_data(url, 'h', 'lat_rho', 'lon_rho', 'temp', 's_rho','ocean_time')
     return data
        ax2.plot(dtime, dtemp)
        plt.title('lon:{0},lat:{1},From:{2}'.format(lon, lat, starttime))
        plt.show()
    '''
    tempobj = temp()
    url = tempobj.get_url(starttime, endtime)
    dtemp, dtime = tempobj.templine(x, y, url)
    fig = plt.figure()
    ax = fig.add_subplot(111)
    ax.plot(dtime, dtemp)
    plt.show()
    '''
starttime, endtime= datetime(2006,05,19), datetime(2006,05,21)
depth = -1
url = 'http://tds.marine.rutgers.edu:8080/thredds/dodsC/roms/espresso/2013_da/avg_Best/ESPRESSO_Real-Time_v2_Averages_Best_Available_best.ncd?h[0:1:81][0:1:129],temp[0:1:307][0:1:35][0:1:81][0:1:129],lon_rho[0:1:81][0:1:129],lat_rho[0:1:81][0:1:129]'
data = jata.get_nc_data(url, 'lon_rho', 'lat_rho', 'h', 'temp')
lonsize = np.amin(data['lon_rho'][:])-1, np.amax(data['lon_rho'][:])+1
latsize = np.amin(data['lat_rho'][:])-1, np.amax(data['lat_rho'][:])+1
'''
fig = plt.figure()
ax = fig.add_subplot(111)
x = range(1, 309)
ax.plot(range(1, 309), data['temp'][:, 0, 25, 35])
# cid = fig.canvas.mpl_connect('button_press_event', left_button_down)
# plt.xticks(x, range(5,308,50))
plt.show()
'''
fig = plt.figure()
ax = plt.subplot(111)
cid = fig.canvas.mpl_connect('button_press_event', left_button_down)
dmap = Basemap(projection = 'cyl',
                        labels=[0,0,0,1])
    bsmap.drawcoastlines()
    bsmap.fillcontinents(color='gray')
    bsmap.drawmapboundary()
def smallest_multpr(x, z):
    '''
    return the smallest y, while x*y>=z
    x, y, z are all positive num.
    '''
    y = 1
    while True:
        z1 = x*y
        if z1>=z: break
        y+=1
    return y
data = jata.get_nc_data(url, 'mask_rho', 'lon_rho', 'lat_rho', 'time', 'u', 'v') 
mask = data['mask_rho'][:]
lon_rho = data['lon_rho'][:]
lat_rho = data['lat_rho'][:]
u = data['u'][:,-1]
v = data['v'][:,-1]
# nc = netCDF4.Dataset(url)
# mask = nc.variables['mask_rho'][:]
# lon_rho = nc.variables['lon_rho'][:]
# lat_rho = nc.variables['lat_rho'][:]
# time = nc.variables['time'][:]
# u = nc.variables['u'][:, -1]
# v = nc.variables['v'][:, -1]
lons = shrink(lon_rho, mask[1:, 1:].shape)
lats = shrink(lat_rho, mask[1:, 1:].shape) 
lon_p, lat_p = [], []
Example #10
0
 def get_data(self, url):
     data = jata.get_nc_data(url, 'h', 'lat_rho', 'lon_rho', 'temp',
                             's_rho', 'ocean_time')
     return data
Example #11
0
        plt.show()
    '''
    tempobj = temp()
    url = tempobj.get_url(starttime, endtime)
    dtemp, dtime = tempobj.templine(x, y, url)
    fig = plt.figure()
    ax = fig.add_subplot(111)
    ax.plot(dtime, dtemp)
    plt.show()
    '''


starttime, endtime = datetime(2006, 05, 19), datetime(2006, 05, 21)
depth = -1
url = 'http://tds.marine.rutgers.edu:8080/thredds/dodsC/roms/espresso/2013_da/avg_Best/ESPRESSO_Real-Time_v2_Averages_Best_Available_best.ncd?h[0:1:81][0:1:129],temp[:][0:1:35][0:1:81][0:1:129],lon_rho[0:1:81][0:1:129],lat_rho[0:1:81][0:1:129]'
data = jata.get_nc_data(url, 'lon_rho', 'lat_rho', 'h', 'temp')
lonsize = np.amin(data['lon_rho'][:]) - 1, np.amax(data['lon_rho'][:]) + 1
latsize = np.amin(data['lat_rho'][:]) - 1, np.amax(data['lat_rho'][:]) + 1
'''
fig = plt.figure()
ax = fig.add_subplot(111)
x = range(1, 309)
ax.plot(range(1, 309), data['temp'][:, 0, 25, 35])
# cid = fig.canvas.mpl_connect('button_press_event', left_button_down)
# plt.xticks(x, range(5,308,50))
plt.show()
'''
fig = plt.figure()
ax = plt.subplot(111)
cid = fig.canvas.mpl_connect('button_press_event', left_button_down)
dmap = Basemap(projection='cyl',
 def get_data(self,url):
     self.data = jata.get_nc_data(url,'lon','lat','latc','lonc',
                                  'u','v','siglay','h')
     return self.data
Example #13
0
import numpy as np
import matplotlib.pyplot as plt
import jata
from mpl_toolkits.basemap import Basemap

url = 'http://www.smast.umassd.edu:8080/thredds/dodsC/fvcom/hindcasts/30yr_gom3?lat[0:1:48450],latc[0:1:90414],lon[0:1:48450],lonc[0:1:90414]'
data = jata.get_nc_data(url, 'lon', 'lat', 'lonc', 'latc')

lonsize = [-76, -55]
latsize = [35, 46.5]
interval_lat, interval_lon = 0.5, 0.5
fig = plt.figure()
ax = plt.subplot(111)
dmap = Basemap(projection='cyl',
               llcrnrlat=min(latsize) - 0.01,
               urcrnrlat=max(latsize) + 0.01,
               llcrnrlon=min(lonsize) - 0.01,
               urcrnrlon=max(lonsize) + 0.01,
               resolution='h',
               ax=ax)
dmap.drawparallels(np.arange(int(min(latsize)),
                             int(max(latsize)) + 1, interval_lat),
                   labels=[1, 0, 0, 0])
dmap.drawmeridians(np.arange(
    int(min(lonsize)) - 1,
    int(max(lonsize)) + 1, interval_lon),
                   labels=[0, 0, 0, 1])
dmap.drawcoastlines()
dmap.fillcontinents(color='grey')
dmap.drawmapboundary()
Example #14
0

def smallest_multpr(x, z):
    '''
    return the smallest y, while x*y>=z
    x, y, z are all positive num.
    '''
    y = 1
    while True:
        z1 = x * y
        if z1 >= z: break
        y += 1
    return y


data = jata.get_nc_data(url, 'mask_rho', 'lon_rho', 'lat_rho', 'time', 'u',
                        'v')
mask = data['mask_rho'][:]
lon_rho = data['lon_rho'][:]
lat_rho = data['lat_rho'][:]
u = data['u'][:, -1]
v = data['v'][:, -1]
# nc = netCDF4.Dataset(url)
# mask = nc.variables['mask_rho'][:]
# lon_rho = nc.variables['lon_rho'][:]
# lat_rho = nc.variables['lat_rho'][:]
# time = nc.variables['time'][:]
# u = nc.variables['u'][:, -1]
# v = nc.variables['v'][:, -1]
lons = shrink(lon_rho, mask[1:, 1:].shape)
lats = shrink(lat_rho, mask[1:, 1:].shape)
lon_p, lat_p = [], []