source: trunk/MESOSCALE/PLOT/PYTHON/scripts/domain.py @ 182

Last change on this file since 182 was 181, checked in by aslmd, 14 years ago

MESOSCALE:PYTHON: petites ameliorations pour rendre les scripts applicables si on n'a pas les droits dans le dossier ou se trouvent les donnees.

  • Property svn:executable set to *
File size: 1.1 KB
Line 
1#!/usr/bin/env python
2
3### A. Spiga LMD 29/05/2011
4
5def usage():
6    print 'USAGE:  plot.py file (target)'
7    print 'file  : name of input netcdf file.'
8    print '(target) : a directory with write rights.'
9    print 'Example:  domain.py /d5/aslmd/LMD_MM_MARS_SIMUS/OM/OM6_TI85/wrfout_d01_2024-06-43_06:00:00 ~/'
10
11def domain (namefile,proj="ortho",back="molabw",target=None): #vishires
12    from netCDF4 import Dataset
13    from myplot import getcoord2d,define_proj,makeplotpng,simplinterv
14    from matplotlib.pyplot import contourf
15    nc  = Dataset(namefile)
16    [lon2d,lat2d] = getcoord2d(nc)
17    [wlon,wlat] = simplinterv(lon2d,lat2d)
18    m = define_proj(proj,wlon,wlat,back=back)
19    x, y = m(lon2d, lat2d)
20    contourf(x, y, nc.variables['HGT'][0,:,:] / 1000., 50)
21    if not target:   zeplot = namefile+".domain"
22    else:            zeplot = target+"domain"
23    makeplotpng(zeplot,pad_inches_value=0.35)
24
25if __name__ == "__main__":
26    import sys
27    if (len(sys.argv)) == 2:     domain( str(sys.argv[1]) )
28    elif (len(sys.argv)) == 3:   domain( str(sys.argv[1]) , target = str(sys.argv[2]) )
Note: See TracBrowser for help on using the repository browser.