Changeset 296 in lmdz_wrf
- Timestamp:
- Feb 25, 2015, 6:27:32 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r295 r296 11098 11098 # newattr = set_attributek(newvar,'_FillValue',fillValue,'npfloat') 11099 11099 ist = ist + 1 11100 11101 if not objofile.variables.has_key('trlon') and Nvardims == 3:11102 # var dimensions11103 newvar = objofile.createVariable('trlon', 'f8', ('time'))11104 newattr = basicvardef(newvar,'trlon','trajectory longitude', \11105 'degrees west_east')11106 newvar[:] = trajvals[:,1]11107 11108 newvar = objofile.createVariable('trlat', 'f8', ('time'))11109 newattr = basicvardef(newvar,'trlat','trajectory latitude', \11110 'degrees north_south')11111 newvar[:] = trajvals[:,2]11112 11113 newvar = objofile.createVariable('time', 'f8', ('time'))11114 newattr = basicvardef(newvar, 'time', 'time', tunits)11115 newvar[:] = trajvals[:,0]11116 11117 newvar = objofile.createVariable('lon', 'f8', ('time', 'y', 'x'), \11118 fill_value=fillValue)11119 newattr = basicvardef(newvar, 'longitude', 'longitude', \11120 'degrees west_east')11121 newvar[:] = lonvals11122 11123 newvar = objofile.createVariable('lat', 'f8', ('time', 'y', 'x'), \11124 fill_value=fillValue)11125 newattr = basicvardef(newvar, 'latitude', 'latitude', \11126 'degrees north_south')11127 newvar[:] = latvals11128 11129 11100 else: 11130 11101 # Other variables … … 11138 11109 print ' uniq variable! removing file and finishing program' 11139 11110 quit() 11111 11112 if not objofile.variables.has_key('trlon') and Nvardims == 3: 11113 # var dimensions 11114 newvar = objofile.createVariable('trlon', 'f8', ('time')) 11115 newattr = basicvardef(newvar,'trlon','trajectory longitude', \ 11116 'degrees west_east') 11117 newvar[:] = trajvals[:,1] 11118 11119 newvar = objofile.createVariable('trlat', 'f8', ('time')) 11120 newattr = basicvardef(newvar,'trlat','trajectory latitude', \ 11121 'degrees north_south') 11122 newvar[:] = trajvals[:,2] 11123 11124 newvar = objofile.createVariable('time', 'f8', ('time')) 11125 newattr = basicvardef(newvar, 'time', 'time', tunits) 11126 newvar[:] = trajvals[:,0] 11127 11128 newvar = objofile.createVariable('lon', 'f8', ('time', 'y', 'x'), \ 11129 fill_value=fillValue) 11130 newattr = basicvardef(newvar, 'longitude', 'longitude', \ 11131 'degrees west_east') 11132 newvar[:] = lonvals 11133 11134 newvar = objofile.createVariable('lat', 'f8', ('time', 'y', 'x'), \ 11135 fill_value=fillValue) 11136 newattr = basicvardef(newvar, 'latitude', 'latitude', \ 11137 'degrees north_south') 11138 newvar[:] = latvals 11140 11139 11141 11140 ivar = ivar + 1
Note: See TracChangeset
for help on using the changeset viewer.