Changeset 465 for trunk


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

Fixed the hrecast for mcs.py. Fixed mcs.py with the -H mode which uses hrecast. Added a README for MCS.PY

Location:
trunk/UTIL/PYTHON
Files:
1 added
2 edited

Legend:

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

    r464 r465  
    8585    # This is for exemple automatically done in mcs.py.
    8686    # This could also be done in a future tes.py.
    87     latitudes_reversed_tes_mcs=-[-88.5, -85.5, -82.5, -79.5, -76.5, -73.5, -70.5, -67.5, -64.5, -61.5, -58.5, -55.5, -52.5, -49.5, -46.5, -43.5, -40.5, -37.5, -34.5, -31.5, -28.5, -25.5, -22.5, -19.5, -16.5, -13.5, -10.5, -7.5, -4.5, -1.5, 1.5, 4.5, 7.5, 10.5, 13.5, 16.5, 19.5, 22.5, 25.5, 28.5, 31.5, 34.5, 37.5, 40.5, 43.5, 46.5, 49.5, 52.5, 55.5, 58.5, 61.5, 64.5, 67.5, 70.5, 73.5, 76.5, 79.5, 82.5, 85.5, 88.5]
     87    latitudes_reversed_tes_mcs=[88.5, 85.5, 82.5, 79.5, 76.5, 73.5, 70.5, 67.5, 64.5, 61.5, 58.5, 55.5, 52.5, 49.5, 46.5, 43.5, 40.5, 37.5, 34.5, 31.5, 28.5, 25.5, 22.5, 19.5, 16.5, 13.5, 10.5, 7.5, 4.5, 1.5, -1.5, -4.5, -7.5, -10.5, -13.5, -16.5, -19.5, -22.5, -25.5, -28.5, -31.5, -34.5, -37.5, -40.5, -43.5, -46.5, -49.5, -52.5, -55.5, -58.5, -61.5, -64.5, -67.5, -70.5, -73.5, -76.5, -79.5, -82.5, -85.5, -88.5]
    8888    longitudes_tes_mcs=[-176.25, -168.75, -161.25, -153.75, -146.25, -138.75, -131.25,-123.75, -116.25, -108.75, -101.25, -93.75, -86.25, -78.75, -71.25, -63.75, -56.25, -48.75, -41.25, -33.75, -26.25, -18.75, -11.25, -3.75, 3.75, 11.25, 18.75, 26.25, 33.75, 41.25, 48.75, 56.25, 63.75, 71.25, 78.75, 86.25, 93.75, 101.25, 108.75, 116.25, 123.75, 131.25, 138.75, 146.25, 153.75, 161.25, 168.75, 176.25]
    8989    system("rm -f hrecast.auto.def")
  • trunk/UTIL/PYTHON/mcs.py

    r464 r465  
    3030   parser.add_option('-m', '--mfile',  action='store',dest='mcsfile',     type="string",  default=None,  help='[NEEDED] filename for MCS comparison.')
    3131   parser.add_option('-v', '--var',    action='append',dest='var',      type="string",  default=None,  help='[NEEDED] Variables to process. (coma-separated list. aps and bps are always included.)')
    32    parser.add_option('-x', action='store_true',dest='recast',     default=False,  help='Force aps and bps to be ommited in output file (usefull if your file is already recasted along z) [False]')
     32   parser.add_option('-x', action='store_false',dest='recast',     default=True,  help='Force aps and bps to be included in output file (usefull if your file is already recasted along z) [True]')
    3333   parser.add_option('-i', '--zrecast', action='store_true', dest='zrecast', default=False, help='Cast zrecast.e on diagfi file with MCS pressure levels. Will pass this operation is recasted file is already present, unless --override is specified. [False]')
     34   parser.add_option('-H', '--hrecast', action='store_true', dest='hrecast', default=False, help='Cast hrecast.e on diagfi file on MCS lat/lon grid. Will pass this operation is recasted file is already present, unless --override is specified. [False]')
    3435   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]')
    3536   parser.add_option('--ditch', action='store_true', dest='ditch', default=False, help='Ditch recasted file when interpolation is performed. [False]')
     
    4748      exit()
    4849
    49    # Zrecast
     50   # Hrecast & Zrecast
    5051
    5152   varznames=separatenames(opt.var[0])
     53   filename=opt.file
     54
     55   if opt.hrecast:
     56      if (path.exists(filename[0:len(filename)-3]+"_h.nc") and (not opt.override)):
     57         print "--> "+filename[0:len(filename)-3]+"_h.nc"
     58         print "Recasted file is already there, skipping interpolation. [use --override to force interpolation]"
     59         filename=filename[0:len(filename)-3]+"_h.nc"
     60      else:
     61         print "--> "+filename[0:len(filename)-3]+"_h.nc"
     62         filename=call_hrecast (  input_name      = [filename], \
     63                    fields  = varznames, \
     64                    predefined = 'mcs')[0]
    5265
    5366   if opt.zrecast:
    54       if (path.exists(opt.file[0:len(opt.file)-3]+"_P.nc") and (not opt.override)):
    55          print "--> "+opt.file[0:len(opt.file)-3]+"_P.nc"
     67      if (path.exists(filename[0:len(filename)-3]+"_P.nc") and (not opt.override)):
     68         print "--> "+filename[0:len(filename)-3]+"_P.nc"
    5669         print "Recasted file is already there, skipping interpolation. [use --override to force interpolation]"
    57          filename=opt.file[0:len(opt.file)-3]+"_P.nc"
     70         filename=filename[0:len(filename)-3]+"_P.nc"
    5871      else:
    59          print "--> "+opt.file[0:len(opt.file)-3]+"_P.nc"
     72         print "--> "+filename[0:len(filename)-3]+"_P.nc"
    6073         filename=call_zrecast (  interp_mode   = 2, \
    61                     input_name      = [opt.file], \
     74                    input_name      = [filename], \
    6275                    fields  = varznames, \
    63                     predifined = 'mcs')[0]
    64    else:filename=opt.file
     76                    predefined = 'mcs')[0]
    6577   # Files
    6678
     
    306318      lat=lat[::-1]
    307319
    308    make_gcm_netcdf (zfilename="diagfi_MCS.nc", \
     320   make_gcm_netcdf (zfilename=filename[0:len(filename)-3]+"_MCS.nc", \
    309321                        zdescription="Temperatures from diagfi reworked to match MCS format", \
    310322                        zlon=lon, \
Note: See TracChangeset for help on using the changeset viewer.