Changeset 324 in lmdz_wrf
- Timestamp:
- Feb 26, 2015, 5:20:33 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r323 r324 12055 12055 if not objnewnc.variables.has_key(vardims[ivdim]): 12056 12056 objvdim = objnc.variables[vardims[ivdim]] 12057 vdimtype = objvdim.dtype 12058 12057 12059 dimsvdim = objvdim.dimensions 12058 12060 dimvslice = [] … … 12067 12069 break 12068 12070 if not found: 12069 dimvslice.append(len(objnc.dimensions[dimsvdim[idmvd]])/2) 12070 12071 newvar = objnewnc.createVariable(vardims[ivdim], 'f8', 12071 print warnmsg 12072 print ' ' + fname + ": dimension '" + dimsvdim[idmvd] + \ 12073 "' not found !!" 12074 print " adding it for variable dimension: '" + \ 12075 vardims[ivdim] + "'" 12076 if not objnewnc.dimensions.has_key(dimsvdim[idmvd]): 12077 dsize = len(objnc.dimensions[dimsvdim[idmvd]]) 12078 objnewnc.createDimension(dimsvdim[idmvd], dsize) 12079 dimvslice.append(slice(len(objnc.dimensions[dimsvdim[idmvd]]))) 12080 dimvdims.append(dimsvdim[idmvd]) 12081 12082 newvar = objnewnc.createVariable(vardims[ivdim], vdimtype, \ 12072 12083 tuple(dimvdims)) 12073 12084 newvar[:] = objvdim[tuple(dimvslice)]
Note: See TracChangeset
for help on using the changeset viewer.