本文整理汇总了Python中mpl_toolkits.basemap.shiftgrid函数的典型用法代码示例。如果您正苦于以下问题:Python shiftgrid函数的具体用法?Python shiftgrid怎么用?Python shiftgrid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了shiftgrid函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: get_era_winds
def get_era_winds(m, rawdatapath, start_year, end_year, start_month, end_month, xyres):
wind_data = Dataset(rawdatapath+'/WINDS/ERA/DATA/ERAI_WINDS_MONTHLY_1979-2014.nc', 'r')
lats = wind_data.variables['latitude'][::-1]
lons = wind_data.variables['longitude'][:]
time = wind_data.variables['time'][:]/(24.*30.)
time = time-time[0]
time=time.reshape(time.shape[0]/12,12)
u10 = wind_data.variables['u10'][:, ::-1, :]
v10 = wind_data.variables['v10'][:, ::-1, :]
u10=u10.reshape(u10.shape[0]/12, 12,u10.shape[1],u10.shape[2])
v10=v10.reshape(v10.shape[0]/12, 12, v10.shape[1],v10.shape[2])
u10_winter_mean= np.mean(u10[start_year-1979:end_year-1979+1,start_month:end_month+1], axis=tuple(range(0, 2)))
v10_winter_mean= np.mean(v10[start_year-1979:end_year-1979+1,start_month:end_month+1], axis=tuple(range(0, 2)))
u10_winter_meanS, lonsS = shiftgrid(180.,u10_winter_mean,lons,start=False)
v10_winter_meanS, lonsS = shiftgrid(180.,v10_winter_mean,lons,start=False)
u10_winter_meanSC, lonsSC = addcyclic(u10_winter_meanS, lonsS)
v10_winter_meanSC, lonsSC = addcyclic(v10_winter_meanS, lonsS)
xyres=100
xvel,yvel,xptsW,yptsW = m.transform_vector(u10_winter_meanSC,v10_winter_meanSC,lonsSC,lats,xyres,xyres,returnxy=True,masked=True)
wind_speed = sqrt((xvel**2) + (yvel**2))
wind_speed = sqrt((xvel**2) + (yvel**2))
return xptsW, yptsW, xvel, yvel, wind_speed
开发者ID:akpetty,项目名称:ibtopo2016,代码行数:31,代码来源:IB_functions.py
示例2: vars
def vars(self, index):
var_array1 = self.f_u.variables[self.varname1][index,::-1, ::]
var_array2 = self.f_v.variables[self.varname2][index,::-1, ::]
var_temp1, lons_temp = shiftgrid(180.,var_array1,self.lons0,start=False)
var_temp2, lons_temp = shiftgrid(180.,var_array2,self.lons0,start=False)
return var_temp1, var_temp2
开发者ID:akpetty,项目名称:bgdrift2016,代码行数:8,代码来源:BG_functions.py
示例3: updatefig
def updatefig(nt):
global CS1,CS2,Q
date = dates[nt]
for c in CS1.collections: c.remove()
CS1 = m.contour(x,y,slp[nt,:,:],clevs,linewidths=0.5,colors='k')
for c in CS2.collections: c.remove()
CS2 = m.contourf(x,y,slp[nt,:,:],clevs,cmap=plt.cm.RdBu_r)
ugrid,newlons = shiftgrid(180.,u[nt,:,:],longitudes,start=False)
vgrid,newlons = shiftgrid(180.,v[nt,:,:],longitudes,start=False)
urot,vrot,xx,yy = m.transform_vector(ugrid,vgrid,newlons,latitudes,51,51,returnxy=True,masked=True)
txt.set_text('SLP and Wind Vectors '+str(date))
Q.set_UVC(urot,vrot)
开发者ID:matplotlib,项目名称:basemap,代码行数:12,代码来源:animate.py
示例4: dummy_plot
def dummy_plot(ldata, lats, lons, tit, fname):
plt.figure(figsize=(20,10))
m = Basemap(projection = 'robin', lon_0 = 0)
data = np.zeros((ldata.shape[0],ldata.shape[1]+1))
data[:,:-1] = ldata
data[:,-1] = data[:,0]
llons = lons.tolist()
llons.append(360)
lons = np.array(llons)
lat_ndx = np.argsort(lats)
lats = lats[lat_ndx]
data = data[lat_ndx, :]
data, lons = basemap.shiftgrid(180.,data,lons,start=False)
m.fillcontinents(color = "#ECF0F3", lake_color = "#A9E5FF", zorder = 0)
m.drawmapboundary(fill_color = "#A9E5FF")
m.drawcoastlines(linewidth = 2, color = "#333333")
m.drawcountries(linewidth = 1.5, color = "#333333")
m.drawparallels(np.arange(-90, 120, 30), linewidth = 1.2, labels = [1,0,0,0], color = "#222222", size = 15)
m.drawmeridians(np.arange(-180, 180, 60), linewidth = 1.2, labels = [0,0,0,1], color = "#222222", size = 15)
x, y = m(*np.meshgrid(lons, lats))
cs = m.contourf(x, y, data, 20, cmap = plt.get_cmap('CMRmap_r'))
plt.colorbar(cs)
plt.title(tit, size = 25)
if fname is not None:
plt.savefig(fname, bbox_inches='tight')
else:
plt.show()
开发者ID:jajcayn,项目名称:multi-scale,代码行数:27,代码来源:NCEP_autocoherence.py
示例5: plot_2Ddata_with_underlay
def plot_2Ddata_with_underlay(data_array, lons=None, lats=None):
""" Plot of a 2D array on top of coast lines and country lines.
"""
figure()
# Create the basemap instance and draw the continents
# Basemap kw args: llcrnrlon = lower left corner longitude, and so on
m = Basemap(llcrnrlon=-180, llcrnrlat=-90, urcrnrlon=180, urcrnrlat=90, projection="mill")
m.drawcoastlines(linewidth=1.25)
m.drawcountries(linewidth=0.5)
# m.fillcontinents(color='0.8')
m.drawparallels(np.arange(-90, 91, 20), labels=[1, 1, 0, 0])
m.drawmeridians(np.arange(-180, 180, 60), labels=[0, 0, 0, 1])
# Shift the data by 180 in longitude to center the map on longitude=0
data_array, lon_out = shiftgrid(180, data_array, lons)
# Add the data, and place origin in upper left since the origin of the numpy
# array corresponds tolat = 90 and long = 0
m.imshow(data_array, origin="upper")
# More complex version that involves interpolation on a grid of points in
# map coordinates.
# nx = int((m.xmax-m.xmin)/500.)+1; ny = int((m.ymax-m.ymin)/500.)+1
# dat_array = m.transform_scalar(data_array, lons,lats,nx,ny)
# m.imshow(dat_array, origin = 'upper')
# figure()
# m = Basemap(projection='ortho',lon_0=-105,lat_0=40)
# m.drawcoastlines(linewidth=1.25)
# m.drawcountries(linewidth=0.5)
# dat_transformed = m.transform_scalar(data_array,
return
开发者ID:jonathanrocher,项目名称:Code-samples,代码行数:34,代码来源:read_netCDF_basemap.py
示例6: doplot
def doplot(nc_file=None,varname=None,vmin=None,vmax=None,
title=None):
lons=nc_file.variables['lon'][...]
lats=nc_file.variables['lat'][...]
vals=nc_file.variables[varname]
vals.set_auto_maskandscale(True)
vals=vals[...]
vals,lons=shiftgrid(180.,vals,lons,start=False)
vals,lons=addcyclic(vals,lons)
fig,ax = plt.subplots(1,1)
ax.cla()
cmap=cm.RdBu_r
cmap.set_over('y')
cmap.set_under('k')
the_norm=Normalize(vmin=vmin,vmax=vmax,clip=False)
params=dict(projection='moll',lon_0= 0,resolution='c')
m = Basemap(**params)
x, y = m(*np.meshgrid(lons, lats))
im=m.pcolormesh(x,y,vals,cmap=cmap,norm=the_norm,ax=ax)
cb=m.colorbar(im,extend='both',location='bottom')
m.drawcoastlines()
m.drawparallels(np.arange(-90.,120.,30.))
m.drawmeridians(np.arange(0.,420.,60.))
ax.set_title(title)
return fig,m,ax,vals,lons
开发者ID:phaustin,项目名称:pcmdi,代码行数:25,代码来源:plot_land.py
示例7: transform
def transform(bm, args):
from numpy import meshgrid, ndarray
from mpl_toolkits.basemap import shiftgrid
from warnings import warn
# X, Y, U, V
if len(args) == 4:
X, Y, U, V = args
U, newX = shiftgrid(180, U, X, start=False)
V, newX = shiftgrid(180, V, X, start=False)
#newX, Y = meshgrid(newX, Y)
#UP, VP, XX, YY = bm.transform_vector(U, V, newX, Y, 31, 31, returnxy=True)
UP, VP, XX, YY = bm.rotate_vector(U, V, newX, Y, returnxy=True)
return XX, YY, UP, VP
#TODO: finish the rest of the cases
warn("Don't know what to do for the coordinate transformation")
return args
开发者ID:aerler,项目名称:pygeode,代码行数:16,代码来源:basemap.py
示例8: __init__
def __init__(self, filepath, varname):
self.f = Dataset(filepath, 'r')
self.varname = varname
self.var_array = self.f.variables[varname][0,::-1, ::]
self.lats = self.f.variables['latitude'][::-1]
self.lons0 = self.f.variables['longitude'][:]
var_temp, self.lons_s = shiftgrid(180.,self.var_array,self.lons0,start=False)
开发者ID:akpetty,项目名称:bgdrift2016,代码行数:8,代码来源:BG_functions.py
示例9: render_component_oneframe
def render_component_oneframe(gf, templ):
with open(FILE_NAME_COMPS, 'r') as f:
d = cPickle.load(f)
mn = d['mean']
Nc = mn.shape[1]
mn_mask = (np.abs(mn) > 1.0 / mn.shape[0]**0.5)
mn_thr = mn * mn_mask
zero_mask = np.all(mn_mask == False, axis = 1)
cid = np.argmax(np.abs(mn) * mn_mask, axis = 1)[:, np.newaxis] + 1
cid[zero_mask, :] = 0
mnd = gf.reshape_flat_field(cid)
# in case lats are not in ascending order, fix this
lat_ndx = np.argsort(gf.lats)
lats_s = gf.lats[lat_ndx]
# shift the grid by 180 degs and remap lons to -180, 180
Cout, lons_s = basemap.shiftgrid(180, mnd[0, :, :], gf.lons)
lons_s -= 360
fig = plt.figure()
# construct the projection from the remapped data
m = basemap.Basemap(projection='mill',
llcrnrlat=lats_s[0], urcrnrlat=lats_s[-1],
llcrnrlon=lons_s[0], urcrnrlon=lons_s[-1],
resolution='c')
m.drawcoastlines()
m.drawparallels(np.arange(-90.,91.,30.), labels=[1,0,0,1])
m.drawmeridians(np.arange(-120., 121.,60.), labels=[1,0,0,1])
nx = int((m.xmax-m.xmin) / 20000) + 1
ny = int((m.ymax-m.ymin) / 20000) + 1
f = m.transform_scalar(Cout[lat_ndx, :], lons_s, lats_s, nx, ny, order = 0)
plt.title('Components [%s]' % METHOD_NAME)
imgplt = m.imshow(f, alpha = 0.8, cmap = plt.get_cmap('Paired'))
fig.savefig('figs/%s_component_clusters.pdf' % templ, bbox_inches = 'tight', pad_inches = 0.5, transparent = True)
print('Uncovered area: %d grid points' % (np.sum(cid==0)))
c_size = np.zeros((Nc+1,))
for i in range(Nc+1):
c_size[i] = np.sum(cid == i)
f = plt.figure()
plt.title('Cluster sizes')
plt.bar(np.arange(Nc) - 0.3 + 1, c_size[1:], 0.6)
plt.xlabel('Cluster id')
plt.ylabel('Grid points in cluster')
f.savefig('figs/%s_cluster_sizes.pdf' % templ)
开发者ID:vejmelkam,项目名称:ndw-climate,代码行数:58,代码来源:examine_computed_results.py
示例10: normalize_lat_lon_values
def normalize_lat_lon_values(lats, lons, values):
''' Normalize lat/lon values
Ensure that lat/lon values are within [-180, 180)/[-90, 90) as well
as sorted. If the values are off the grid they are shifted into the
expected range.
:param lats: A 1D numpy array of sorted lat values.
:type lats: :class:`numpy.ndarray`
:param lons: A 1D numpy array of sorted lon values.
:type lons: :class:`numpy.ndarray`
:param values: A 3D array of data values.
:returns: A :func:`tuple` of the form (adjust_lats, adjusted_lons, adjusted_values)
:raises ValueError: If the lat/lon values are not sorted.
'''
if lats.ndim ==1 and lons.ndim ==1:
# Avoid unnecessary shifting if all lons are higher than 180
if lons.min() > 180:
lons-=360
# Make sure lats and lons are monotonically increasing
lats_decreasing = np.diff(lats) < 0
lons_decreasing = np.diff(lons) < 0
# If all values are decreasing then they just need to be reversed
lats_reversed, lons_reversed = lats_decreasing.all(), lons_decreasing.all()
# If the lat values are unsorted then raise an exception
if not lats_reversed and lats_decreasing.any():
raise ValueError('Latitudes must be sorted.')
# Perform same checks now for lons
if not lons_reversed and lons_decreasing.any():
raise ValueError('Longitudes must be sorted.')
# Also check if lons go from [0, 360), and convert to [-180, 180)
# if necessary
lons_shifted = lons.max() > 180
lats_out, lons_out, data_out = lats[:], lons[:], values[:]
# Now correct data if latlon grid needs to be shifted
if lats_reversed:
lats_out = lats_out[::-1]
data_out = data_out[..., ::-1, :]
if lons_reversed:
lons_out = lons_out[::-1]
data_out = data_out[..., ::-1]
if lons_shifted:
data_out, lons_out = shiftgrid(180, data_out, lons_out, start=False)
return lats_out, lons_out, data_out
else:
lons[lons > 180] = lons[lons > 180] - 360.
return lats, lons, values
开发者ID:MBoustani,项目名称:climate,代码行数:58,代码来源:utils.py
示例11: apply
def apply(self):
from mpl_toolkits.basemap import shiftgrid, cm
common.ShowQuestion
display = self.VpyartDisplay.value
if (isinstance(display, pyart.graph.RadarMapDisplay) or
isinstance(display, pyart.graph.GridMapDisplay)):
pass
elif (isinstance(display, pyart.graph.RadarDisplay) or
isinstance(display, pyart.graph.AirborneRadarDisplay)):
common.ShowWarning(
"Topography require a MapDisplay, be sure to "
"check the 'use MapDisplay' box in the 'Display Options' Menu")
return
else:
common.ShowWarning(
"Need a pyart display instance, be sure to "
"link this components (%s), to a radar or grid display" %
self.name)
return
filename = str(self.lineEdit.text())
if filename != self.current_open:
if filename.startswith("http"):
resp = common.ShowQuestion(
"Loading a file from the internet may take long." +
" Are you sure you want to continue?")
if resp != QtWidgets.QMessageBox.Ok:
return
self.etopodata = Dataset(filename)
self.current_open = filename
topoin = np.maximum(0, self.etopodata.variables['ROSE'][:])
lons = self.etopodata.variables['ETOPO05_X'][:]
lats = self.etopodata.variables['ETOPO05_Y'][:]
# shift data so lons go from -180 to 180 instead of 20 to 380.
topoin, lons = shiftgrid(180., topoin, lons, start=False)
# plot topography/bathymetry as an image.
# create the figure and axes instances.
# setup of basemap ('lcc' = lambert conformal conic).
# use major and minor sphere radii from WGS84 ellipsoid.
m = self.VpyartDisplay.value.basemap
# transform to nx x ny regularly spaced 5km native projection grid
nx = int((m.xmax - m.xmin)/500.) + 1
ny = int((m.ymax - m.ymin)/500.) + 1
topodat = m.transform_scalar(topoin, lons, lats, nx, ny)
# plot image over map with imshow.
# draw coastlines and political boundaries.
ls = LightSource(azdeg=90, altdeg=20)
# convert data to rgb array including shading from light source.
# (must specify color map)
rgb = ls.shade(topodat, cm.GMT_relief)
im = m.imshow(rgb)
self.VpyartDisplay.update(strong=False)
开发者ID:gamaanderson,项目名称:artview,代码行数:58,代码来源:background.py
示例12: imshowmap
def imshowmap(
lat,
lon,
indata,
ax=None,
projection="cyl",
mapbound="all",
gridstep=(30, 30),
shift=False,
colorbar=True,
colorbarlabel=None,
*args,
**kwargs
):
"""
Purpose: plot a map on cyl projection.
Arguments:
ax --> An axes instance
lat,lon --> geographic coordinate variables;
mapbound --> tuple containing (lat1,lat2,lon1,lon2);
lat1 --> lower parallel; lat2 --> upper parallel;
lon1 --> left meridian; lon2 --> right meridian;
default 'all' means plot the extent of input lat, lon
coordinate variables;
gridstep --> the step for parallel and meridian grid for the map,
tuple containing (parallel_step, meridian_step).
vmin,vmax --> as in plt.imshow function
indata --> numpy array with dimension of len(lat)Xlen(lon)
shift --> boolean value. False for longtitude data ranging [-180,180];
for longtitude data ranging [0,360] set shift to True if
a 180 east shift is desired.
"""
print "Deprecate Warning! imshowmap replaced by mapimshow"
# handle the case ax==None:
if ax == None:
fig, axt = g.Create_1Axes()
else:
axt = ax
if shift == True:
indata, lon = bmp.shiftgrid(180, indata, lon, start=False)
# make the map and use mapbound to cut the data
m, lonpro, latpro, latind, lonind = makemap(axt, projection, mapbound, lat, lon, gridstep)
pdata = indata[latind[0] : latind[-1] + 1, lonind[0] : lonind[-1] + 1]
cs = m.imshow(pdata, origin="upper", *args, **kwargs)
if colorbar == True:
cbar = m.colorbar(cs)
if colorbarlabel != None:
cbar.set_label(colorbarlabel)
else:
cbar = None
return m, cs, cbar
开发者ID:bnordgren,项目名称:pylsce,代码行数:54,代码来源:bmap.py
示例13: load
def load(self):
c = client.open_url(self.url)
lon = c.ugrdtrop.lon[:]
#lon[lon > 180] -= 360 # Basemap runs from -180 to +180
lat = c.ugrdtrop.lat[:]
u_component = c.ugrdtrop.ugrdtrop[0][0] # units m/s
v_component = c.vgrdtrop.vgrdtrop[0][0] # units m/s
windspeed = 3.6 * np.sqrt(u_component**2, v_component**2) # units km/h
# Shift grid from 0 to 360 => -180 to 180
windspeed, lon = basemap.shiftgrid(180, windspeed, lon, start=False)
self.lon, self.lat, self.windspeed = lon, lat, windspeed
开发者ID:barentsen,项目名称:jetstream.py,代码行数:11,代码来源:jetstream.py
示例14: etopo5
def etopo5(self,file='data/etopo5.nc'):
""" read in etopo5 topography/bathymetry. """
etopodata = Dataset(file)
self.topoin = etopodata.variables['bath'][:]
self.elons = etopodata.variables['X'][:]
self.elats = etopodata.variables['Y'][:]
etopodata.close()
self.topoin,self.elons = shiftgrid(0.,self.topoin,self.elons,start=False) # -360 -> 0
开发者ID:shaunwbell,项目名称:ipythonnb,代码行数:12,代码来源:ArgosDrifters.py
示例15: hammer_plot
def hammer_plot(NetworkF,Theta,Phi,theta,phi):
from mpl_toolkits.basemap import Basemap, shiftgrid
fig,ax = plt.subplots()
RAD = 180/np.pi
m = Basemap(projection='hammer',lon_0=0,resolution='c')
Phi, NetworkF = shiftgrid(180,Phi,NetworkF)
m.contourf(Phi*RAD, Theta*RAD, NetworkF, 100, cmap=plt.cm.jet,latlon=True)
plt.plot(phi,theta,'go',markersize=5)
plt.xlabel(r'$\phi$'' (radians)')
plt.ylabel(r'$\theta$'' (radians)')
plt.savefig('hammer.png')
return plt.show()
开发者ID:devanshkv,项目名称:pta_source_loc,代码行数:12,代码来源:plotter.py
示例16: read_ncep2_mask
def read_ncep2_mask(filepath):
#READ IN NCEP 2 LAND MASK
#SHIFT GRID FROM 0-360 to -180-180
filepath_m = filepath+'/land_sfc_gauss.nc'
f = Dataset(filepath_m, 'r')
mask_array = f.variables['land'][0,::-1, ::][60:-1, :]
lats = f.variables['lat'][::-1][60:-1]
lons0 = f.variables['lon'][:]
mask_shift, lons_s = shiftgrid(180.,mask_array,lons0,start=False)
return mask_shift
开发者ID:akpetty,项目名称:bgdrift2016,代码行数:13,代码来源:BG_functions.py
示例17: shade_coord
def shade_coord(xin,yin,datain=None,lon0=None):
from mpl_toolkits.basemap import Basemap, shiftgrid, addcyclic
from mcmath import edges
# invert lat coords if they are descending instead of ascending
if yin[-1] < yin[0]:
yin = yin[::-1]
if datain is not None:
ydimloc = np.where(yin.size == np.array(datain.shape))[0]
if len(ydimloc) == 0:
raise MCPlotError("no dimension in 'datain' matches length of 'yin'")
y_ind = []
for i in xrange(datain.ndim):
y_ind.append(slice(None))
y_ind[ydimloc[0]] = slice(None,None,-1)
datain = datain[y_ind]
yedg = edges(yin)
# convert xin to -180:180 range; roll and addcyclic as needed to have lon0 as central lon
xedg = edges(xin)
xspan = xedg[-1] - xedg[0]
if ((xspan < 365.) & (xspan > 355.)):
xin = np.where(xin >= 180,xin-360,xin)
roll_ind = np.where(xin < np.roll(xin,1))[0]
if len(roll_ind) == 0:
raise MCPlotError("can't find pivot between +180 and -180 in xin")
xin = np.roll(xin,-roll_ind)
if datain is not None:
xdimloc = np.where(xin.size == np.array(datain.shape))[-1]
if len(xdimloc) == 0:
raise MCPlotError("no dimension in 'datain' matches length of 'xin'")
datain = np.roll(datain,-roll_ind,axis=xdimloc)
if (lon0 is not None):
(datain,xin) = addcyclic(datain,xin)
(datain,xin) = shiftgrid(lon0-180,datain,xin)
xedg = edges(xin)
## Fix for keeping the squares near the edges of global maps filled just to the edge (map boundary)
if (lon0 is not None):
if xedg[0] < (lon0-180):
xedg[0] = lon0-180
if xedg[-1] > (lon0+180):
xedg[-1] = lon0+180
return [xedg,yedg,datain,xin,yin]
else:
xedg = edges(xin)
return [xedg,yedg,datain,xin,yin]
开发者ID:koldunovn,项目名称:py_klimacampus,代码行数:51,代码来源:mcp.py
示例18: etopo5_data
def etopo5_data():
""" read in etopo5 topography/bathymetry. """
file = 'data/etopo5.nc'
etopodata = Dataset(file)
topoin = etopodata.variables['bath'][:]
lons = etopodata.variables['X'][:]
lats = etopodata.variables['Y'][:]
etopodata.close()
topoin,lons = shiftgrid(0.,topoin,lons,start=False) # -360 -> 0
#lons, lats = np.meshgrid(lons, lats)
return(topoin, lats, lons)
开发者ID:shaunwbell,项目名称:AtSeaPrograms,代码行数:15,代码来源:IBCAO_Maps_excel_stations_2016.py
示例19: etopo5_data
def etopo5_data(filein='/Users/bell/in_and_outbox/Ongoing_Analysis/MapGrids/etopo5.nc'):
""" read in etopo5 topography/bathymetry. """
etopodata = Dataset(filein)
topoin = etopodata.variables['bath'][:]
lons = etopodata.variables['X'][:]
lats = etopodata.variables['Y'][:]
etopodata.close()
topoin,lons = shiftgrid(0.,topoin,lons,start=False) # -360 -> 0
#lons, lats = np.meshgrid(lons, lats)
return(topoin, lats, lons)
开发者ID:shaunwbell,项目名称:AtSeaPrograms,代码行数:15,代码来源:IconicLinesCruiseMapDB.py
示例20: etopo5_data
def etopo5_data():
""" read in etopo5 topography/bathymetry. """
#file = '/Users/bell/Data_Local/MapGrids/etopo5.nc'
ncdata = '/Users/bell/Programs/Python/AtSeaPrograms/data/etopo5.nc'
etopodata = Dataset(ncdata)
topoin = etopodata.variables['bath'][:]
lons = etopodata.variables['X'][:]
lats = etopodata.variables['Y'][:]
etopodata.close()
topoin,lons = shiftgrid(0.,topoin,lons,start=False) # -360 -> 0
lons, lats = np.meshgrid(lons, lats)
return(topoin, lats, lons)
开发者ID:shaunwbell,项目名称:AtSeaPrograms,代码行数:16,代码来源:CruiseTimeline.py
注:本文中的mpl_toolkits.basemap.shiftgrid函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论