Changeset 418 for trunk/UTIL/PYTHON/mcs.py
- Timestamp:
- Nov 23, 2011, 4:39:01 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/mcs.py
r417 r418 60 60 fields = varznames, \ 61 61 predifined = 'mcs')[0] 62 62 else:filename=opt.file 63 63 # Files 64 64 … … 122 122 for zn in varznames: 123 123 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() 128 130 varz.append(load) 131 load=0. 129 132 print "Found: "+zn+" with dimensions: " 130 133 print np.array(varz[n]).shape … … 193 196 varchk[vv,:,:,:,:]=variable[istart:istop+1,:,:,:] 194 197 vv=vv+1 198 varchk=np.ma.masked_invalid(varchk) 199 varchk.set_fill_value([np.NaN]) 195 200 varchktime=time[istart:istop+1] 196 201 ndays=np.floor(varchktime[len(varchktime)-1])-np.floor(varchktime[0]) … … 199 204 ntmichk=ntimemin[i,:,:] 200 205 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]) 205 210 dtmichk=dtmichk.filled() 206 211 dtmachk=dtmachk.filled() … … 215 220 vartmpnight=np.zeros([nzvar,ndays,nz,ny,nx]) 216 221 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 217 227 nd=0 218 228 print " .time indices MCS grid -> diagfi grid." … … 239 249 vartmpday[vv,nd,:,iy,ix]=np.NaN 240 250 elif nitdtmichk > nitdtmachk: 241 vartmpday[vv,nd,:,iy,ix]=(np.m ean(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. 242 252 else: 243 vartmpday[vv,nd,:,iy,ix]=np.m ean(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) 244 254 if ((nitntmichk is np.NaN) or (nitntmachk is np.NaN)): 245 255 vartmpnight[vv,nd,:,iy,ix]=np.NaN 246 256 elif nitntmichk > nitntmachk: 247 vartmpnight[vv,nd,:,iy,ix]=(np.m ean(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. 248 258 else: 249 vartmpnight[vv,nd,:,iy,ix]=np.m ean(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) 250 260 iy=iy+1 251 261 ix=ix+1 … … 256 266 vartmpdaymasked=np.ma.masked_invalid(vartmpday) 257 267 vartmpnightmasked=np.ma.masked_invalid(vartmpnight) 268 vartmpdaymasked.set_fill_value([np.NaN]) 269 vartmpnightmasked.set_fill_value([np.NaN]) 258 270 for vv in np.arange(nzvar): 259 271 vardayout[vv,i,:,:,:]=np.ma.mean(vartmpdaymasked[vv,:,:,:,:],axis=0)
Note: See TracChangeset
for help on using the changeset viewer.