Changeset 483


Ignore:
Timestamp:
Dec 19, 2011, 9:57:26 PM (13 years ago)
Author:
aslmd
Message:

PYTHON UTIL: added a new keyword --redope which allow to plot the minimum/maximum value over times stored in the file. MESOSCALE: provided a small fix in runmeso for case mars=12.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/MESOSCALE/LMD_MM_MARS/SIMU/runmeso

    r482 r483  
    195195       3) scat=1 ;;
    196196      11) echo "!! How many scatterers are you using : 1,2,..." ; read scat ;;
     197      12) echo "!! How many scatterers are you using : 1,2,..." ; read scat ;;
    197198      20) scat=1 ;;
    198199       *) scat=1 ;;
  • trunk/UTIL/PYTHON/README.PP

    r475 r483  
    7171Goal: I want to plot averaged results in the file from one time to another time
    7272pp.py -f diagfi.nc -v tsurf --time 4,7
     73
     74Goal: I want to plot the minimum/maximum value over times stored in the file
     75pp.py -f diagfi.nc -v tsurf --redope mint
     76pp.py -f diagfi.nc -v tsurf --redope maxt
    7377
    7478Goal: I want to plot a globally-averaged 1D temperature profile
  • trunk/UTIL/PYTHON/myplot.py

    r477 r483  
    4444      elif 'vert' in nc.variables:             typefile = 'mesoapi'
    4545      elif 'U' in nc.variables:                typefile = 'meso'
     46      #elif 'HGT_M' in nc.variables:            typefile = 'geo'
     47      elif 'HGT' in nc.variables:              typefile = 'meso'
    4648    elif 'HGT_M' in nc.variables:              typefile = 'geo'
    47     #else:                            errormess("whatkindfile: typefile not supported.")
    4849    else:                                      typefile = 'gcm' # for lslin-ed files from gcm
    4950    return typefile
     
    7576
    7677## Author: AS + TN + AC
    77 def reducefield (input,d4=None,d3=None,d2=None,d1=None,yint=False,alt=None,anomaly=False):
     78def reducefield (input,d4=None,d3=None,d2=None,d1=None,yint=False,alt=None,anomaly=False,redope=None):
    7879    ### we do it the reverse way to be compliant with netcdf "t z y x" or "t y x" or "y x"
    7980    ### it would be actually better to name d4 d3 d2 d1 as t z y x
    8081    ### ... note, anomaly is only computed over d1 and d2 for the moment
    8182    import numpy as np
    82     from mymath import max,mean
     83    from mymath import max,mean,min
    8384    csmooth = 12 ## a fair amount of grid points (too high results in high computation time)
     85    if redope is not None:
     86       if   redope == "mint":     input = min(input,axis=0) ; d1 = None
     87       elif redope == "maxt":     input = max(input,axis=0) ; d1 = None
     88       else:                      errormess("not supported. but try lines in reducefield beforehand.")
     89       #elif redope == "minz":     input = min(input,axis=1) ; d2 = None
     90       #elif redope == "maxz":     input = max(input,axis=1) ; d2 = None
     91       #elif redope == "miny":     input = min(input,axis=2) ; d3 = None
     92       #elif redope == "maxy":     input = max(input,axis=2) ; d3 = None
     93       #elif redope == "minx":     input = min(input,axis=3) ; d4 = None
     94       #elif redope == "maxx":     input = max(input,axis=3) ; d4 = None
    8495    dimension = np.array(input).ndim
    8596    shape = np.array(input).shape
     
    201212        subh = 99999
    202213    elif numplot == 2:
    203         subv = 2
    204         subh = 1
     214        subv = 1 #2
     215        subh = 2 #1
    205216        fig.subplots_adjust(wspace = 0.35)
    206217        rcParams['font.size'] = int( rcParams['font.size'] * 3. / 4. )
  • trunk/UTIL/PYTHON/myscript.py

    r479 r483  
    77    parser.add_option('-d', '--display',action='store_false',dest='display',             default=True,  help='do not pop up created images')
    88    parser.add_option('-O','--output',  action='store',dest='out',       type="string",  default=None,  help='output file name')
     9    parser.add_option('--rate',         action='store'     ,dest='rate', type="int",   default=None, help='output is a movie along Time dimension [None]')
     10    parser.add_option('--quality',      action='store_true',dest='quality',            default=False,help='For movie mode: improves movie quality.(slower)')
    911
    1012    ### WHAT I PLOT
     
    1618    parser.add_option('-M', '--max',    action='append',dest='vmax',     type="float",   default=None,  help='bounding maximum value [max]')
    1719    parser.add_option('-H', '--hole',   action='store_true',dest='hole',                 default=False, help='holes above max and below min')
    18     parser.add_option('--nolow',        action='store_true',dest='nolow',                default=False, help='plot only minima and maxima [false]')
     20    parser.add_option('--nolow',        action='store_true',dest='nolow',                default=False, help='do not plot low |values| [False]')
     21    parser.add_option('--redope',       action='store',dest='redope',    type="string",  default=None,  help='REDuce OPErators: mint,maxt for the moment [None]')
    1922
    2023    ### VERTICAL INTERPOLATION
     
    6568    ### SPECIAL
    6669    parser.add_option('--tsat',         action='store_true',dest='tsat',               default=False,help='convert temperature field T in Tsat-T using pressure')
    67     parser.add_option('--rate',         action='store'     ,dest='rate', type="int",   default=None, help='output is a movie along Time dimension [None]')
    68     parser.add_option('--quality',      action='store_true',dest='quality',            default=False,help='For movie mode: improves movie quality.(slower)')
    6970
    7071    return parser
  • trunk/UTIL/PYTHON/planetoplot.py

    r477 r483  
    5858           trans=1,\
    5959           zarea=None,\
    60            axtime=None):
     60           axtime=None,\
     61           redope=None):
    6162
    6263
     
    181182              if "Times" in nc.variables:   time = count + np.arange(0,len(nc.variables["Times"]),1)
    182183              elif "Time" in nc.variables:  time = count + np.arange(0,len(nc.variables["Time"]),1)
     184              else:                         time = count + np.arange(0,1,1)
    183185              count = time[-1] + 1  ## so that a cat is possible with simple subscripts
    184186          ###
     
    303305       if varname:   ### what is shaded.
    304306           what_I_plot, error = reducefield( all_var[index_f], d4=indextime, d1=indexlon, d2=indexlat, d3=indexvert, \
    305                                              yint=yintegral, alt=vert, anomaly=anomaly )
     307                                             yint=yintegral, alt=vert, anomaly=anomaly, redope=redope )
    306308           what_I_plot = what_I_plot*mult
    307309       if var2:      ### what is contoured.
     
    473475
    474476       ### Next subplot
    475        basename = getname(var=varname,var2=var2,winds=winds,anomaly=anomaly)
     477       zevarname = varname
     478       if redope is not None: zevarname = zevarname + "_" + redope
     479       basename = getname(var=zevarname,var2=var2,winds=winds,anomaly=anomaly)
    476480       if len(what_I_plot.shape) > 3:
    477481           basename = basename + getstralt(nc,level)
  • trunk/UTIL/PYTHON/pp.py

    r479 r483  
    152152                invert_y=opt.inverty,xaxis=zexaxis,yaxis=zeyaxis,ylog=opt.logy,yintegral=opt.column,\
    153153                blat=opt.blat,blon=opt.blon,tsat=opt.tsat,flagnolow=opt.nolow,\
    154                 mrate=opt.rate,mquality=opt.quality,trans=opt.trans,zarea=opt.area,axtime=opt.axtime)
     154                mrate=opt.rate,mquality=opt.quality,trans=opt.trans,zarea=opt.area,axtime=opt.axtime,\
     155                redope=opt.redope)
    155156        print 'DONE: '+name
    156157        system("rm -f to_be_erased")
Note: See TracChangeset for help on using the changeset viewer.