Ignore:
Timestamp:
Jul 5, 2011, 8:56:29 AM (14 years ago)
Author:
aslmd
Message:

MESOSCALE: python graphics. fix the program so that it guesses the correct local time.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MESOSCALE/PLOT/PYTHON/scripts/winds.py

    r195 r197  
    1818           colorb=None,\
    1919           winds=True,\
    20            addchar=None):
     20           addchar=None,
     21           interv=[0,1]):
    2122
    2223    ####################################################################################################################
     
    7576    else:                    [wlon,wlat] = simplinterv(lon2d,lat2d)
    7677
    77     ##################
    78     ### Get local time
    79     if typefile in ['mesoapi','meso']: 
    80         ltst = int(getattr(nc, 'GMT') + 0.5*(wlon[0]+wlon[1])/15.)
    81         #zetime = nc.variables['Times'][0]
    82         #zetimestart = getattr(nc, 'START_DATE')
    83         #zeday = int(zetime[8]+zetime[9]) - int(zetimestart[8]+zetimestart[9])
    84         #if zeday < 0:    lschar=""  ## might have crossed a month... fix soon
    85         #else:            lschar="_Ls"+str( int( sol2ls ( getattr( nc, 'JULDAY' ) + zeday ) ) )
    86     elif typefile in ['gcm']:           
    87         ltst = 0
     78    ###################
     79    #### Get local time
     80    #if typefile in ['mesoapi','meso']: 
     81    #    ltst = interv[0]
     82    #    #ltst = int(getattr(nc, 'GMT') + 0.5*(wlon[0]+wlon[1])/15.)
     83    #elif typefile in ['gcm']:           
     84    #    ltst = 0
    8885
    8986    ##############################################################################
     
    185182    for i in tabrange:
    186183
     184       ### Which local time ?
     185       ltst = ( interv[0] + 0.5*(wlon[0]+wlon[1])/15.) + i*interv[1]
     186       ltst = int (ltst * 10) / 10.
     187       ltst = ltst % 24
     188
    187189       ### General plot settings
    188190       if numplot > 1:
     
    193195            ### If only one local time is requested (numplot < 0)
    194196       elif numplot <= 0:
    195            if (ltst+i)%24 + numplot != 0:   continue
     197           if ltst + numplot != 0:   continue
    196198           else:                            found_lct = True
    197199
     
    226228       
    227229       ### Next subplot
    228        plottitle = basename + "_LT"+str((ltst+i)%24)
     230       plottitle = basename + "_LT"+str(ltst)
    229231       if addchar:  plottitle = plottitle + addchar
    230232       ptitle( plottitle )
     
    287289    zelevel = opt.nvert   
    288290    stralt = None
    289     lschar = getlschar ( zefile )  ## getlschar from wrfout (or simply return "" if another file)
     291    [lschar,zehour,zehourin] = getlschar ( zefile )  ## getlschar from wrfout (or simply return "" if another file)
    290292
    291293    #####################################################
     
    313315    name = winds (zefile,int(zelevel),\
    314316           proj=opt.proj,back=opt.back,target=opt.target,stride=opt.stride,var=opt.var,numplot=opt.numplot,colorb=opt.colorb,winds=opt.winds,\
    315            addchar=lschar)
     317           addchar=lschar,interv=[zehour,zehourin])
    316318
    317319    #########################################################
Note: See TracChangeset for help on using the changeset viewer.