Changeset 1409 in lmdz_wrf
- Timestamp:
- Jan 16, 2017, 4:20:52 PM (9 years ago)
- Location:
- trunk/tools
- Files:
-
- 2 edited
-
generic_tools.py (modified) (1 diff)
-
nc_var_tools.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/generic_tools.py
r1405 r1409 11078 11078 exctcurvloc[icv,0] = np.float(exctcurvloc[icv,0]) + curveweights[icv,ipy,ipx]*(ipy-1.) 11079 11079 exctcurvloc[icv,1] = np.float(exctcurvloc[icv,1]) + curveweights[icv,ipy,ipx]*(ipx-1.) 11080 print ' ' + fname + 'ip:', ip, 'ipy:', ipy-1., 'wgt:', curveweights[icv,ipy,ipx], \11081 'exctcurv:', exctcurvloc[icv,0]11082 print ' ' + fname + ' icv:', icv, 'curve:', curve[icv,:], 'ijloc:', ijloc, \11083 'cwgt:', curveweights[icv,:,:], 'exctloc:', exctcurvloc[icv,:]11080 #print ' ' + fname + 'ip:', ip, 'ipy:', ipy-1., 'wgt:', curveweights[icv,ipy,ipx], \ 11081 # 'exctcurv:', exctcurvloc[icv,0] 11082 #print ' ' + fname + ' icv:', icv, 'curve:', curve[icv,:], 'ijloc:', ijloc, \ 11083 # 'cwgt:', curveweights[icv,:,:], 'exctloc:', exctcurvloc[icv,:] 11084 11084 # quit() 11085 11085 -
trunk/tools/nc_var_tools.py
r1400 r1409 18579 18579 print ' ' + fname + ": file '" + ncfile + "' does not have dimension '" + \ 18580 18580 xdimn + "' !!" 18581 print ' available dimensions:', onc.dimensions 18581 print ' available dimensions:', onc.dimensions.keys() 18582 18582 onc.close() 18583 18583 quit(-1) … … 18587 18587 print ' ' + fname + ": file '" + ncfile + "' does not have dimension '" + \ 18588 18588 ydimn + "' !!" 18589 print ' available dimensions:', onc.dimensions 18589 print ' available dimensions:', onc.dimensions.keys() 18590 18590 onc.close() 18591 18591 quit(-1) … … 18748 18748 print ' ' + fname + ": adding section of '" + vn + "' ..." 18749 18749 dimvar = list(ovar.dimensions) 18750 if gen.searchInlist(dimvar, xdimn): dimvar.remove(xdimn) 18751 if gen.searchInlist(dimvar, ydimn): dimvar.remove(ydimn) 18752 18753 varcurve = interp_curve(ovar, xdimn, ydimn, loccurve, curvewgts, Nwgts, \ 18754 curveloc3x3) 18755 18756 # Writing values of variable along the curve 18757 add_dims(onc,newnc,dimvar) 18758 18759 newvar = newnc.createVariable(vn+'curve', 'f4', tuple(dimvar+['curve'])) 18760 newvar[:] = varcurve[:] 18761 add_varattrs(onc,newnc,[vn],[vn+'curve']) 18762 set_attribute(newvar,'along','xcurve,ycurve') 18763 set_attribute(newvar,'curve',curvetype) 18750 # Look if variable has the dimension along the curve 18751 foundxdim = False 18752 foundydim = False 18753 if gen.searchInlist(dimvar, xdimn): 18754 foundxdim = True 18755 if gen.searchInlist(dimvar, ydimn): 18756 foundydim = True 18757 18758 if foundxdim and foundydim: 18759 dimvar.remove(xdimn) 18760 dimvar.remove(ydimn) 18761 varcurve = interp_curve(ovar, xdimn, ydimn, loccurve, curvewgts, \ 18762 Nwgts, curveloc3x3) 18763 # Writing values of variable along the curve 18764 add_dims(onc,newnc,dimvar) 18765 18766 newvar = newnc.createVariable(vn+'curve', 'f4', tuple(dimvar+['curve'])) 18767 newvar[:] = varcurve[:] 18768 add_varattrs(onc,newnc,[vn],[vn+'curve']) 18769 set_attribute(newvar,'along','xcurve,ycurve') 18770 set_attribute(newvar,'curve',curvetype) 18771 newnc.sync() 18772 18773 else: 18774 print warnmsg 18775 print ' ' + fname + ": variable '" + vn + "' does not have curve "+ \ 18776 " dimensions '", xdimn, "' and '", ydimn, "' !!" 18777 print ' keeping as it is in output file' 18778 18779 # Writing values of variable along the curve 18780 add_dims(onc,newnc,dimvar) 18781 18782 newvar = newnc.createVariable(vn, nctype(ovar.dtype), tuple(dimvar)) 18783 print ' Lluis shapes newvar:', newvar.shape, 'ovar:', ovar.shape 18784 newvar[:] = ovar[:] 18785 18764 18786 newnc.sync() 18765 18787
Note: See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/LMDZ_WRF/chrome/site/your_project_logo.png)