示例#1
0
if ncfile is not None:
    if not ncfile.startswith('http://') and not os.path.exists(ncfile):
        parser.error('Netcdf file not found: '+ncfile)
    options.cfgfile = None
    options.name = ncfile

# Import
try:
    from vacumm.bathy.bathy import NcGriddedBathy
except:
    sys.exit("Can't import vacumm bathymetry module")

# Get and plot bathy
kw = {'maxvalue':None} if options.land else {}
b = NcGriddedBathy(lon=lon, lat=lat, name=options.name,
    cfgfile=options.cfgfile, varname=options.varname, lonname=options.lonname,
    latname=options.latname, reverse=options.reverse, **kw)
kw = {}
if options.land:
    kw['fillcontinents'] = False
    kw['drawcoastlines_color'] = 'r'
    kw['drawcoastlines_linewidth'] = 1
if options.figsize is not None:
    options.figsize = eval(options.figsize)
if options.clsize is not None:
    if options.clsize:
        kw['clabel_size'] = options.clsize
    else:
        kw['clabel'] = options.clsize
b.plot(proj=options.proj, title=options.title, figsize=options.figsize,
    shadow=not options.noshadow,
示例#2
0
    options.cfgfile = None
    options.name = ncfile

# Import
try:
    from vacumm.bathy.bathy import NcGriddedBathy
except:
    sys.exit("Can't import vacumm bathymetry module")

# Get and plot bathy
kw = {'maxvalue': None} if options.land else {}
b = NcGriddedBathy(lon=lon,
                   lat=lat,
                   name=options.name,
                   cfgfile=options.cfgfile,
                   varname=options.varname,
                   lonname=options.lonname,
                   latname=options.latname,
                   reverse=options.reverse,
                   **kw)
kw = {}
if options.land:
    kw['fillcontinents'] = False
    kw['drawcoastlines_color'] = 'r'
    kw['drawcoastlines_linewidth'] = 1
if options.figsize is not None:
    options.figsize = eval(options.figsize)
if options.clsize is not None:
    if options.clsize:
        kw['clabel_size'] = options.clsize
    else:
示例#3
0
    from vacumm.misc.grid import transect_specs
    from vacumm.misc.grid.regridding import grid2xy
    from vacumm.misc.axes import create_lon, create_lat
    import cdms2, numpy as N
    from vacumm.misc.plot import curve2, minimap
    from vacumm.misc.color import cmap_custom
except:
    sys.exit("Can't import needed vacumm modules")

# Load bathy
b = NcGriddedBathy(lon=lon,
                   lat=lat,
                   name=options.name,
                   cfgfile=options.cfgfile,
                   varname=options.varname,
                   lonname=options.lonname,
                   latname=options.latname,
                   imargin=2,
                   jmargin=2,
                   maxvalue=None,
                   reverse=options.reverse)

# Interpolate on section
bathy = b.bathy()
lons, lats, xx, yy = transect_specs(bathy.getGrid(),
                                    options.x0,
                                    options.y0,
                                    options.x1,
                                    options.y1,
                                    getxy=True)
tbathy = grid2xy(bathy, lons, lats)
示例#4
0
# Import
try:
    from vacumm.bathy.bathy import NcGriddedBathy
    from vacumm.misc.grid import transect_specs
    from vacumm.misc.grid.regridding import grid2xy
    from vacumm.misc.axes import create_lon, create_lat
    import cdms2, numpy as N
    from vacumm.misc.plot import curve2, minimap
    from vacumm.misc.color import cmap_custom
except:
    sys.exit("Can't import needed vacumm modules")

# Load bathy
b = NcGriddedBathy(lon=lon, lat=lat, name=options.name,
    cfgfile=options.cfgfile, varname=options.varname, lonname=options.lonname,
    latname=options.latname, imargin=2, jmargin=2, maxvalue=None,
    reverse=options.reverse)

# Interpolate on section
bathy = b.bathy()
lons, lats, xx, yy = transect_specs(bathy.getGrid(),
    options.x0, options.y0, options.x1, options.y1, getxy=True)
tbathy = grid2xy(bathy, lons, lats)
if not isinstance(options.along, basestring) or options.along not in ['lon', 'lat', 'm', 'km', 'dist', 'auto']:
    options.along = 'auto'
if options.along=='auto':
    options.along = 'lon' if xx.max()-xx.min() > yy.max()-yy.min() else 'lat'
if options.along=='lon':
    taxis = create_lon(lons)
elif options.along=='lat':
    taxis = create_lat(lats)
示例#5
0
# Creation de l'objet de bathy grillee
bathy = GriddedBathy(var)

# Versions masquees
bathy_masked1 = bathy.masked_bathy()                        # -> nb de points masques ?
bathy.set_shoreline('f')                                    # -> essayer 'i'
bathy_masked2 = bathy.masked_bathy()                        # -> nb de points masques ?

# Plot
bathy.plot(title='Direct')


# Bathy standard
from vacumm.bathy.bathy import NcGriddedBathy, bathy_list
print bathy_list().keys()
sbathy = NcGriddedBathy(lon=(-5.2, -3), lat=(48., 48.9), name='etopo2')
sbathy.plot(title='Bathy par defaut')


# Fusion de bathy
mgrid = create_grid((-6.1, -3, 0.01), (47.8, 48.9, .006))   # -> changer la grille
from vacumm.bathy.bathy import GriddedBathyMerger
merger = GriddedBathyMerger(mgrid)
merger += sbathy
merger += bathy
merger.plot(title='Fusion / plot direct')

# Plot via plot_bathy
mbathy = merger.merge()
plot_bathy(mbathy, title='Fusion / plot via plot_bathy')