Ignore:
Timestamp:
Nov 23, 2011, 4:39:01 PM (13 years ago)
Author:
acolaitis
Message:

PYTHON. Moved the nolow mode to an option (--nolow) and re-arranged the way -H worked in planetoplot, by introducing a new function (hole_bounds). Bounds is called in normal cases and hole_bounds in -H cases. Minor corrections in mcs.py for missing values comming from zrecast.

File:
1 edited

Legend:

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

    r417 r418  
    6060                    fields  = varznames, \
    6161                    predifined = 'mcs')[0]
    62 
     62   else:filename=opt.file
    6363   # Files
    6464
     
    122122   for zn in varznames:
    123123       load=getfield(nc,zn)
    124        if opt.zrecast:
    125           load=np.ma.masked_where(load < -1.e-30,load)
    126           load.set_fill_value([np.NaN])
    127           load=load.filled()
     124       load=np.ma.masked_where(load < -1.e-20,load)
     125       load.set_fill_value([np.NaN])
     126       load=load.filled()
     127       load=np.ma.masked_invalid(load)
     128       load.set_fill_value([np.NaN])
     129       load=load.filled()
    128130       varz.append(load)
     131       load=0.
    129132       print "Found: "+zn+" with dimensions: "
    130133       print np.array(varz[n]).shape
     
    193196              varchk[vv,:,:,:,:]=variable[istart:istop+1,:,:,:]
    194197           vv=vv+1
     198       varchk=np.ma.masked_invalid(varchk)
     199       varchk.set_fill_value([np.NaN])
    195200       varchktime=time[istart:istop+1]
    196201       ndays=np.floor(varchktime[len(varchktime)-1])-np.floor(varchktime[0])
     
    199204       ntmichk=ntimemin[i,:,:]
    200205       ntmachk=ntimemax[i,:,:]
    201        dtmichk.set_fill_value(np.NaN)
    202        dtmachk.set_fill_value(np.NaN)
    203        ntmichk.set_fill_value(np.NaN)
    204        ntmachk.set_fill_value(np.NaN)
     206       dtmichk.set_fill_value([np.NaN])
     207       dtmachk.set_fill_value([np.NaN])
     208       ntmichk.set_fill_value([np.NaN])
     209       ntmachk.set_fill_value([np.NaN])
    205210       dtmichk=dtmichk.filled()
    206211       dtmachk=dtmachk.filled()
     
    215220       vartmpnight=np.zeros([nzvar,ndays,nz,ny,nx])
    216221       vartmpday=np.zeros([nzvar,ndays,nz,ny,nx])
     222       vartmpnight=np.ma.masked_invalid(vartmpnight)
     223       vartmpday=np.ma.masked_invalid(vartmpday)
     224       vartmpnight.set_fill_value([np.NaN])
     225       vartmpday.set_fill_value([np.NaN])
     226
    217227       nd=0
    218228       print "     .time indices MCS grid -> diagfi grid."
     
    239249                       vartmpday[vv,nd,:,iy,ix]=np.NaN
    240250                   elif nitdtmichk > nitdtmachk:
    241                        vartmpday[vv,nd,:,iy,ix]=(np.mean(varchk[vv,daystart+nitdtmichk:daystop+1,:,iy,ix],axis=0)+np.mean(varchk[vv,daystart:daystart+nitdtmachk+1,:,iy,ix],axis=0))/2.
     251                       vartmpday[vv,nd,:,iy,ix]=(np.ma.mean(varchk[vv,daystart+nitdtmichk:daystop+1,:,iy,ix],axis=0)+np.ma.mean(varchk[vv,daystart:daystart+nitdtmachk+1,:,iy,ix],axis=0))/2.
    242252                   else:
    243                        vartmpday[vv,nd,:,iy,ix]=np.mean(varchk[vv,daystart+nitdtmichk:daystart+nitdtmachk+1,:,iy,ix],axis=0)
     253                       vartmpday[vv,nd,:,iy,ix]=np.ma.mean(varchk[vv,daystart+nitdtmichk:daystart+nitdtmachk+1,:,iy,ix],axis=0)
    244254                   if ((nitntmichk is np.NaN) or (nitntmachk is np.NaN)):
    245255                       vartmpnight[vv,nd,:,iy,ix]=np.NaN
    246256                   elif nitntmichk > nitntmachk:
    247                        vartmpnight[vv,nd,:,iy,ix]=(np.mean(varchk[vv,daystart+nitntmichk:daystop+1,:,iy,ix],axis=0)+np.mean(varchk[vv,daystart:daystart+nitntmachk+1,:,iy,ix],axis=0))/2.
     257                       vartmpnight[vv,nd,:,iy,ix]=(np.ma.mean(varchk[vv,daystart+nitntmichk:daystop+1,:,iy,ix],axis=0)+np.ma.mean(varchk[vv,daystart:daystart+nitntmachk+1,:,iy,ix],axis=0))/2.
    248258                   else:                                                           
    249                        vartmpnight[vv,nd,:,iy,ix]=np.mean(varchk[vv,daystart+nitntmichk:daystart+nitntmachk+1,:,iy,ix],axis=0)
     259                       vartmpnight[vv,nd,:,iy,ix]=np.ma.mean(varchk[vv,daystart+nitntmichk:daystart+nitntmachk+1,:,iy,ix],axis=0)
    250260                iy=iy+1
    251261             ix=ix+1
     
    256266       vartmpdaymasked=np.ma.masked_invalid(vartmpday)
    257267       vartmpnightmasked=np.ma.masked_invalid(vartmpnight)
     268       vartmpdaymasked.set_fill_value([np.NaN])
     269       vartmpnightmasked.set_fill_value([np.NaN])
    258270       for vv in np.arange(nzvar):
    259271          vardayout[vv,i,:,:,:]=np.ma.mean(vartmpdaymasked[vv,:,:,:,:],axis=0)
Note: See TracChangeset for help on using the changeset viewer.