Changeset 427


Ignore:
Timestamp:
Nov 30, 2011, 10:05:32 AM (13 years ago)
Author:
acolaitis
Message:

PYTHON. Corrected bugs related to contour plots with overlines, and mymath.mean() with no Axis specified. Now working on LES format for pp.py... :)

Location:
trunk/UTIL/PYTHON
Files:
4 edited

Legend:

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

    r418 r427  
    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]')
    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]')
    35 
     35   parser.add_option('--ditch', action='store_true', dest='ditch', default=False, help='Ditch recasted file when interpolation is performed. [False]')
    3636   #############################
    3737   ### Get options and variables
     
    302302                        zvariables=all, \
    303303                        znames=fullnames)
     304   if opt.zrecast and opt.ditch:
     305      print "removing interpolated file"
     306      system("rm -f "+opt.file[0:len(opt.file)-3]+"_P.nc")
  • trunk/UTIL/PYTHON/mymath.py

    r403 r427  
    2626              field.set_fill_value(np.NaN)
    2727              zout=np.ma.array(field).mean(axis=axis)
    28               zout.set_fill_value(np.NaN)
    29               return zout.filled()
     28              if axis is not None:
     29                 zout.set_fill_value(np.NaN)
     30                 return zout.filled()
     31              else:return zout
    3032           elif (np.isnan(np.sum(field)) and (type(field).__name__ not in 'MaskedArray')):
    3133              zout=np.ma.masked_invalid(field).mean(axis=axis)
    32               zout.set_fill_value([np.NaN])
    33               return zout.filled()
     34              if axis is not None:
     35                 zout.set_fill_value([np.NaN])
     36                 return zout.filled()
     37              else:return zout
    3438           else:
    3539              return np.array(field).mean(axis=axis)
  • trunk/UTIL/PYTHON/myplot.py

    r426 r427  
    113113             output = mean(input[d4,:,:,:],axis=0)
    114114             output = reduce_zaxis(output[d3,:,:],ax=0,yint=yint,vert=alt,indice=d3)
    115              if anomaly: output = 100. * ((output / smooth(output,csmooth)) - 1.) 
     115             if anomaly: output = 100. * ((output / smooth(output,csmooth)) - 1.)
    116116             output = mean(output[d2,:],axis=0)
    117117             output = mean(output[d1],axis=0)
     
    685685             "TEMP_NIGHT":   "%.0f",\
    686686             # Variables from MCS and mcs.py ncdf format
    687              "DTEMP":     "%.0f",\
    688              "NTEMP":   "%.0f",\
     687             "DTEMP":        "%.0f",\
     688             "NTEMP":        "%.0f",\
     689             "DNUMBINTEMP":  "%.0f",\
     690             "NNUMBINTEMP":  "%.0f",\
    689691             # other stuff
    690692             "TPOT":         "%.0f",\
  • trunk/UTIL/PYTHON/planetoplot.py

    r426 r427  
    280280              if var2 == 'HGT':  zelevels = np.arange(-10000.,30000.,2000.)
    281281              if mapmode == 0:
    282                   x, y = define_axis(lon,lat,vert,time,indexlon,indexlat,indexvert,\
    283                         indextime,what_I_plot.shape, len(all_var2[index_f].shape),vertmode)
     282                  what_I_plot, x, y = define_axis(lon,lat,vert,time,indexlon,indexlat,indexvert,\
     283                        indextime,what_I_plot, len(all_var2[index_f].shape),vertmode)
    284284              ### If we plot a 2-D field
    285285              if len(what_I_plot.shape) is 2:
    286286                  cs = contour(x,y,what_I_plot, zelevels, colors='k', linewidths = 1 ) #0.33 colors='w' )# , alpha=0.5)
    287                   #if typefile in ['gcm']: clabel(cs,fmt = '%1.2e')
     287#                  clabel(cs,#zelevels[::2],
     288#                     inline=3,
     289#                     fmt='%1.1e',
     290#                     fontsize=7)
    288291              ### If we plot a 1-D field
    289292              elif len(what_I_plot.shape) is 1:
Note: See TracChangeset for help on using the changeset viewer.