コード例 #1
0
ファイル: station_info.py プロジェクト: jfleroux/vacumm
 def _print_one(self,station):
     """ Print info for one station"""
     import types,vacumm.misc as M
     # Name and position
     self._print_one_arg('Nom',station['nom'])
     self._print_one_arg('Position','%s / %s' % \
       (M.lonlab(station['longitude']),M.latlab(station['latitude'])))
     self._print_one_arg('Zone',station['zone'])
     # Ids
     for id in self._ids:
         self._print_one_arg(id.upper(),station[id])
     # Properties
     keys = self._numerics.keys()
     keys.sort()
     for att in keys:
         if station[att] is not None:
             if type(station[att]) is types.StringType:
                 fmt = '%s'
             else:
                 fmt = '%g'
             self._print_one_arg(att.upper(),fmt % station[att])
コード例 #2
0
 def _print_one(self, station):
     """ Print info for one station"""
     import types, vacumm.misc as M
     # Name and position
     self._print_one_arg('Nom', station['nom'])
     self._print_one_arg('Position','%s / %s' % \
       (M.lonlab(station['longitude']),M.latlab(station['latitude'])))
     self._print_one_arg('Zone', station['zone'])
     # Ids
     for id in self._ids:
         self._print_one_arg(id.upper(), station[id])
     # Properties
     keys = self._numerics.keys()
     keys.sort()
     for att in keys:
         if station[att] is not None:
             if type(station[att]) is types.StringType:
                 fmt = '%s'
             else:
                 fmt = '%g'
             self._print_one_arg(att.upper(), fmt % station[att])
コード例 #3
0
ファイル: showgrid.py プロジェクト: acoat/vacumm
    sys.exit('Error when loading vacumm')

# Dimension
gg = (lon, lat)
lonn, latn = get_xy(gg, num=True)
grid = create_grid(*gg)
print 'Dimensions           : nx=%i ny=%i' % grid.shape[::-1]
print 'Axes                 : lon="%s" lat="%s" (%iD)' % (lon.id, lat.id,
                                                          lonn.ndim)

# Extension
print 'Zonal extent         : %s -> %s  [%s -> %s]' % (
    lonn.min(), lonn.max(), lonlab(
        lonn.min(), decimal=False), lonlab(lonn.max(), decimal=False))
print 'Meridional extent    : %s -> %s  [%s -> %s]' % (
    latn.min(), latn.max(), latlab(
        latn.min(), decimal=False), latlab(latn.max(), decimal=False))

# Resolution
lonres, latres = resol(gg, proj=False)
xres, yres = resol(gg, proj=True)
xres /= 1000.
yres /= 1000.
print 'Zonal resolution     : %g° / %gkm' % (lonres, xres)
print 'Meridional resolution: %g° / %gkm' % (latres, yres)

# Plot
if options.plot or options.out:

    xmin, ymin, xmax, ymax = scalebox(grid, 1 / options.zoom)
    for att in 'xmin', 'xmax', 'ymin', 'ymax':
        if getattr(options, att) is not None:
コード例 #4
0
ファイル: showgrid.py プロジェクト: jfleroux/vacumm
except:
    sys.exit('Error when loading vacumm')

# Dimension
gg = (lon, lat)
lonn, latn = get_xy(gg, num=True)
grid = create_grid(*gg)
print 'Dimensions           : nx=%i ny=%i'%grid.shape[::-1]
print 'Axes                 : lon="%s" lat="%s" (%iD)'%(lon.id, lat.id, lonn.ndim)


# Extension
print 'Zonal extent         : %s -> %s  [%s -> %s]'%(
    lonn.min(), lonn.max(), lonlab(lonn.min(), decimal=False), lonlab(lonn.max(), decimal=False))
print 'Meridional extent    : %s -> %s  [%s -> %s]'%(
    latn.min(), latn.max(), latlab(latn.min(), decimal=False), latlab(latn.max(), decimal=False))

# Resolution
lonres, latres = resol(gg, proj=False)
xres, yres = resol(gg, proj=True)
xres /= 1000.
yres /= 1000.
print 'Zonal resolution     : %g° / %gkm'%(lonres, xres)
print 'Meridional resolution: %g° / %gkm'%(latres, yres)

# Plot
if options.plot or options.out:

    xmin, ymin, xmax, ymax = scalebox(grid, 1/options.zoom)
    for att in 'xmin', 'xmax', 'ymin', 'ymax':
        if getattr(options, att) is not None: exec att+" = %s"%getattr(options, att)