Changeset 459 in lmdz_wrf for trunk/tools/TS_ASCII_netCDF.py
- Timestamp:
- Jun 9, 2015, 3:09:58 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/TS_ASCII_netCDF.py
r353 r459 87 87 if iline == 0: 88 88 newvar = objofile.createVariable('station','c') 89 ncvar.set_attribute(newvar, 'name',values[0]) 90 ncvar.set_attribute(newvar, 'acronym',values[3]) 89 valuespar=line.split('(') 90 91 sec = ncvar.reduce_spaces(valuespar[0]) 92 Nsec = len(sec) 93 ncvar.set_attribute(newvar, 'name', ncvar.numVector_String(sec[0:Nsec-3],' ') 94 ncvar.set_attribute(newvar, 'acronym',sec[Nsec-1]) 95 96 sec = ncvar.reduce_spaces(valuespar[1]) 97 Nsec = len(sec) 91 98 ncvar.set_attribute(newvar, 'real_lon', \ 92 np.float( values[6].replace(',','').replace('(','').replace(')','')) )99 np.float(sec[1].replace(',','').replace('(','').replace(')','')) ) 93 100 ncvar.set_attribute(newvar, 'real_lat', \ 94 np.float(values[5].replace(',','').replace('(','').replace(')','')) ) 101 np.float(sec[0].replace(',','').replace('(','').replace(')','')) ) 102 103 sec = ncvar.reduce_spaces(valuespar[2]) 104 Nsec = len(sec) 95 105 ncvar.set_attribute(newvar, 'x_grid_point', \ 96 int( values[8].replace(',','').replace('(','').replace(')','')) )106 int(sec[0].replace(',','').replace('(','').replace(')','')) ) 97 107 ncvar.set_attribute(newvar, 'y_grid_point', \ 98 int(values[9].replace(',','').replace('(','').replace(')','')) ) 108 int(sec[1].replace(',','').replace('(','').replace(')','')) ) 109 110 sec = ncvar.reduce_spaces(valuespar[3]) 111 Nsec = len(sec) 99 112 ncvar.set_attribute(newvar, 'model_lon', \ 100 np.float( values[12].replace(',','').replace('(','').replace(')','')) )113 np.float(sec[1].replace(',','').replace('(','').replace(')','')) ) 101 114 ncvar.set_attribute(newvar, 'model_lat', \ 102 np.float( values[11].replace(',','').replace('(','').replace(')','')) )115 np.float(sec[0].replace(',','').replace('(','').replace(')','')) ) 103 116 ncvar.set_attribute(newvar, 'model_height', \ 104 np.float( values[13].replace(',','').replace('(','').replace(')','')) )117 np.float(sec[2].replace(',','').replace('(','').replace(')','')) ) 105 118 simstarttime = refdate 106 119 else:
Note: See TracChangeset
for help on using the changeset viewer.