Changeset 282 in lmdz_wrf
- Timestamp:
- Feb 25, 2015, 2:29:59 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r281 r282 10371 10371 trajvals = np.zeros((Ttraj,3), dtype=np.float) 10372 10372 10373 it = 0 10374 iline = 0 10373 10375 for line in trajobj: 10374 10376 … … 10495 10497 cyrangeslice2D.append([gtrajvals[it,2]-Nrad, gtrajvals[it,2]+Nrad + 1]) 10496 10498 cxrangeslice2D.append([gtrajvals[it,1]-Nrad, gtrajvals[it,1]+Nrad + 1]) 10497 10498 iline = iline + 110499 it = it + 1 10500 iline = iline + 1 10499 10501 10500 10502 trajobj.close() 10501 10502 10503 # Creation of the netCDF file 10503 10504 ## … … 10783 10784 rstatvarvals = np.ones(tuple([Ttraj,6]), dtype=np.float) 10784 10785 10785 for it in range(dimt): 10786 for it0 in range(Ttraj): 10787 it = Tbeg + it0 10788 10786 10789 slicev = [] 10787 10790 slice2D = [] … … 10795 10798 or gtrajvals[it,1]-box2 < 0 or gtrajvals[it,1]+box2 + 1 > dimx + 1: 10796 10799 # box values 10797 slicev.append(slice(yrangeslice[ 0][it],yrangeslice[1][it]))10798 slicev.append(slice(xrangeslice[ 0][it],xrangeslice[1][it]))10799 10800 slicevnoT.append(slice(yrangeslice[ 0][it],yrangeslice[1][it]))10801 slicevnoT.append(slice(xrangeslice[ 0][it],xrangeslice[1][it]))10802 10803 slice2D.append(slice( yrangeslice2D[0][it],yrangeslice2D[1][it]))10804 slice2D.append(slice( xrangeslice2D[0][it],xrangeslice2D[1][it]))10800 slicev.append(slice(yrangeslice[it][0],yrangeslice[it][1])) 10801 slicev.append(slice(xrangeslice[it][0],xrangeslice[it][1])) 10802 10803 slicevnoT.append(slice(yrangeslice[it][0],yrangeslice[it][1])) 10804 slicevnoT.append(slice(xrangeslice[it][0],xrangeslice[it][1])) 10805 10806 slice2D.append(slice(0,yrangeslice[it][1]-yrangeslice[it][0])) 10807 slice2D.append(slice(0,xrangeslice[it][1]-xrangeslice[it][0])) 10805 10808 10806 10809 rvarvalst = np.ones((Nrad*2+1, Nrad*2+1),dtype=np.float)*fillValue 10807 10810 10808 print it,'Lluis: shapes yrangeslice2D:',yrangeslice2D[it],'xrangeslice:',xrangeslice[it]10809 print it,'Lluis: shapes slice2D:',slice2D,'slicev:',slicev10810 print it,'Lluis: shapes varvalst:',varvalst.shape,'varobj:',varobj.shape10811 10811 varvalst[tuple(slice2D)] = varobj[tuple(slicev)] 10812 10812 varvals[it,:,:] = varvalst … … 10841 10841 1)) 10842 10842 10843 print 'Lluis: shapes obj:',varobj.shape,'slice:',slicev10844 10843 varvalst = varobj[tuple(slicev)] 10845 10844 # box values … … 10867 10866 if gtrajvals[it,2]-Nrad < 0 or gtrajvals[it,2]+Nrad + 1 > dimy + 1 \ 10868 10867 or gtrajvals[it,1]-Nrad < 0 or gtrajvals[it,1]+Nrad + 1 > dimx + 1: 10869 cslicev.append(slice(cyrangeslice[it] ))10870 cslicev.append(slice(cxrangeslice[it] ))10871 10872 cslicevnoT.append(slice(cyrangeslice[it] ))10873 cslicevnoT.append(slice(cxrangeslice[it] ))10874 10875 cslice2D.append(slice( cyrangeslice2D[it]))10876 cslice2D.append(slice( cxrangeslice2D[it]))10868 cslicev.append(slice(cyrangeslice[it][0],cyrangeslice[it][1])) 10869 cslicev.append(slice(cxrangeslice[it][0],cxrangeslice[it][1])) 10870 10871 cslicevnoT.append(slice(cyrangeslice[it][0],cyrangeslice[it][1])) 10872 cslicevnoT.append(slice(cxrangeslice[it][0],cxrangeslice[it][1])) 10873 10874 cslice2D.append(slice(0,cyrangeslice[it][1]-cyrangeslice[it][0])) 10875 cslice2D.append(slice(0,cxrangeslice[it][1]-cxrangeslice[it][0])) 10877 10876 10878 10877 rvarvalst = np.ones((Nrad*2+1,Nrad*2+1),dtype=np.float)*fillValue … … 10910 10909 rvarvalst = np.where(cdist > np.float(Nrad),fillValue,rvarvalst) 10911 10910 10912 10913 print 'Lluis shapes: rvarvals:',rvarvals[it,:,:].shape,'rvarvalst:',rvarvalst.shape10914 10911 rvarvals[it,:,:] = rvarvalst 10915 10912 … … 10996 10993 ist = ist + 1 10997 10994 10998 if not objofile. has_key('trlon') and Nvardims == 3:10995 if not objofile.variables.has_key('trlon') and Nvardims == 3: 10999 10996 # var dimensions 11000 10997 newvar = objofile.createVariable('trlon', 'f8', ('time'))
Note: See TracChangeset
for help on using the changeset viewer.