Changeset 464


Ignore:
Timestamp:
Dec 9, 2011, 4:22:21 PM (13 years ago)
Author:
acolaitis
Message:

Changed name of the gcm utilities wrapper to gcm_transformations.py. Added hrecast to it, though there are no options yet in pp.py. hrecast will be used in mcs.py and in a future tes.py. It can be implemented in pp.py easily. Added --latreverse option to mcs.py to output files with a south_north latitude axis, as in the data.

Location:
trunk/UTIL/PYTHON
Files:
1 added
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/UTIL/PYTHON/mcs.py

    r427 r464  
    2222   from myplot import getfield,separatenames
    2323   from make_netcdf import make_gcm_netcdf
    24    from zrecast_wrapper import call_zrecast
     24   from gcm_transformations import call_zrecast,call_hrecast
    2525   parser = OptionParser()
    2626
     
    3434   parser.add_option('--override', action='store_true', dest='override', default=False, help='Force zrecast.e to act even if recasted file is already present(will erase previous recasted file) [False]')
    3535   parser.add_option('--ditch', action='store_true', dest='ditch', default=False, help='Ditch recasted file when interpolation is performed. [False]')
     36   parser.add_option('--latreverse', action='store_true', dest='latreverse', default=False, help='Reverse the latitude axis in output diagfi. [False]')
     37
    3638   #############################
    3739   ### Get options and variables
     
    8688            print "Error: could not find controle variable in diagfi."
    8789            day_ini=input("Please type initial sol number:")%669
     90      else:
     91         print "Error: could not find controle variable in diagfi."
     92         day_ini=input("Please type initial sol number:")%669
    8893   time[:]=time[:]+day_ini
    8994   nx=len(lon)
     
    281286   varnightout.set_fill_value([np.NaN])
    282287
     288   if opt.latreverse:
     289       vardayout[:,:,:,:,:]=vardayout[:,:,:,::-1,:]
     290       varnightout[:,:,:,:,:]=varnightout[:,:,:,::-1,:]
     291
    283292   all=[aps,bps]
    284293   for vv in np.arange(nzvar):
     
    293302      all=all[2:]
    294303      fullnames=fullnames[2:]
     304
     305   if opt.latreverse:
     306      lat=lat[::-1]
    295307
    296308   make_gcm_netcdf (zfilename="diagfi_MCS.nc", \
  • trunk/UTIL/PYTHON/myplot.py

    r457 r464  
    6565       out.set_fill_value([np.NaN])
    6666    else:
    67        out=field
     67    # missing values from zrecast or hrecast are -1e-33
     68       masked=np.ma.masked_where(field < -1e-30,field)
     69       masked.set_fill_value([np.NaN])
     70       mask = np.ma.getmask(masked)
     71       if (True in mask):out=masked
     72       else:out=field
    6873    return out
    6974
  • trunk/UTIL/PYTHON/planetoplot.py

    r462 r464  
    163163               vertdim='BOTTOM-TOP_PATCH_END_UNSTAG'
    164164               dumped_vert_stag=True
     165          else: dumped_vert_stag=False
    165166          if varname in ['V']:  latdim='SOUTH-NORTH_PATCH_END_STAG'
    166167          else:                 latdim='SOUTH-NORTH_PATCH_END_UNSTAG'
     
    246247             numplot = numplot + 1 ; all_time[k] = all_time[k-1] ; all_namefile[k] = all_namefile[k-1]
    247248             all_varname[k] = all_varname[k-2] + insert + all_varname[k-1]
    248 
    249249    ##################################
    250250    ### Open a figure and set subplots
     
    354354                            x, y = m(lon2d, lat2d)                                         ## this is dirty, defined above but out of imov loop
    355355                    if typefile in ['mesoapi','meso'] and mapmode == 1:   what_I_plot_frame = dumpbdy(what_I_plot_frame,6,condition=True)
    356                     if typefile in ['mesoideal']:    what_I_plot_frame = dumpbdy(what_I_plot_frame,0,stag='W',condition=dumped_vert_stag)
     356#                   if typefile in ['mesoideal']:    what_I_plot_frame = dumpbdy(what_I_plot_frame,0,stag='W',condition=dumped_vert_stag)
    357357
    358358                    if imov >= 0:
  • trunk/UTIL/PYTHON/pp.py

    r457 r464  
    1010    from optparse import OptionParser    ### to be replaced by argparse
    1111    from api_wrapper import api_onelevel
    12     from zrecast_wrapper import call_zrecast
     12    from gcm_transformations import call_zrecast
    1313    from netCDF4 import Dataset
    1414    from myplot import getlschar, separatenames, readslices, adjust_length, whatkindfile, errormess
     
    111111                    input_name=zefiles,\
    112112                    fields=zevars,\
    113                     predifined=opt.intas)
     113                    predefined=opt.intas)
    114114
    115115            zefiles=interpolated_files
     
    119119                    input_name=[opt.fref],\
    120120                    fields=zevars,\
    121                     predifined=opt.intas)
     121                    predefined=opt.intas)
    122122
    123123               reffile=interpolated_ref[0]
Note: See TracChangeset for help on using the changeset viewer.