Ignore:
Timestamp:
Jul 5, 2011, 12:08:27 AM (14 years ago)
Author:
aslmd
Message:

MESOSCALE: graphics interface. corrected a bug in displaying automatic Ls

Location:
trunk/MESOSCALE/PLOT/PYTHON
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MESOSCALE/PLOT/PYTHON/mylib/api_g95.sh

    r194 r195  
    99\rm loge
    1010f2py -c -m api ../../../LMD_MM_MARS/SRC/POSTPROC/api.F90 --fcompiler=g95 -L$NETCDF/lib -lnetcdf -lm -I$NETCDF/include --f90flags="-Wall -Wno=112,141,137,155 -fno-second-underscore -ffree-form" > logc 2> loge
    11 f2py -c -m timestuff time.F --fcompiler=g95
     11f2py -c -m timestuff time.F --fcompiler=g95 >> logc 2>> loge
  • trunk/MESOSCALE/PLOT/PYTHON/mylib/api_pgf90.sh

    r194 r195  
    1313\rm loge
    1414f2py -c -m api ../../../LMD_MM_MARS/SRC/POSTPROC/api.F90 --fcompiler=pg -L$NETCDF/lib -lnetcdf -lm -I$NETCDF/include --f90flags="-Mfree" > logc 2> loge
    15 f2py -c -m timestuff time.F --fcompiler=pg
     15f2py -c -m timestuff time.F --fcompiler=pg >> logc 2>> loge
  • trunk/MESOSCALE/PLOT/PYTHON/mylib/myplot.py

    r194 r195  
    3939#    return
    4040
     41def getlschar ( namefile ):
     42    #### strangely enough this does not work for api or ncrcat results!
     43    from netCDF4 import Dataset
     44    from timestuff import sol2ls
     45    nc  = Dataset(namefile)
     46    if 'Times' in nc.variables:
     47        zetime = nc.variables['Times'][0]
     48        zetimestart = getattr(nc, 'START_DATE')
     49        zeday = int(zetime[8]+zetime[9]) - int(zetimestart[8]+zetimestart[9])
     50        if zeday < 0:    lschar=""  ## might have crossed a month... fix soon
     51        else:            lschar="_Ls"+str( int( sol2ls ( getattr( nc, 'JULDAY' ) + zeday ) ) )
     52    else:
     53        lschar=""
     54    return lschar
     55
    4156def api_onelevel (  path_to_input   = None, \
    4257                    input_name      = 'wrfout_d0?_????-??-??_??:00:00', \
  • trunk/MESOSCALE/PLOT/PYTHON/scripts/winds.py

    r194 r195  
    1717           var=None,\
    1818           colorb=None,\
    19            winds=True):
     19           winds=True,\
     20           addchar=None):
    2021
    2122    ####################################################################################################################
     
    2930    from matplotlib.pyplot import contourf, subplot, figure, rcParams, savefig, colorbar
    3031    from matplotlib.cm import get_cmap
    31     from timestuff import sol2ls
    3232    import numpy as np
    3333
     
    7575    else:                    [wlon,wlat] = simplinterv(lon2d,lat2d)
    7676
    77     #########################
    78     ### Get local time and Ls
     77    ##################
     78    ### Get local time
    7979    if typefile in ['mesoapi','meso']: 
    8080        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 ) ) )
     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 ) ) )
    8686    elif typefile in ['gcm']:           
    8787        ltst = 0
    88         lschar = ""
    8988
    9089    ##############################################################################
     
    227226       
    228227       ### Next subplot
    229        ptitle( basename + "_LT"+str((ltst+i)%24) + lschar )
     228       plottitle = basename + "_LT"+str((ltst+i)%24)
     229       if addchar:  plottitle = plottitle + addchar
     230       ptitle( plottitle )
    230231       sub += 1
    231232
     
    261262    from optparse import OptionParser    ### to be replaced by argparse
    262263    from api_wrapper import api_onelevel
     264    from netCDF4 import Dataset
     265    from myplot import getlschar
    263266
    264267    #############################
     
    284287    zelevel = opt.nvert   
    285288    stralt = None
     289    lschar = getlschar ( zefile )  ## getlschar from wrfout (or simply return "" if another file)
    286290
    287291    #####################################################
     
    308312    ### Main call
    309313    name = winds (zefile,int(zelevel),\
    310            proj=opt.proj,back=opt.back,target=opt.target,stride=opt.stride,var=opt.var,numplot=opt.numplot,colorb=opt.colorb,winds=opt.winds)
     314           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)
    311316
    312317    #########################################################
Note: See TracChangeset for help on using the changeset viewer.