Changeset 200 in lmdz_wrf for trunk/tools
- Timestamp:
- Dec 5, 2014, 11:36:40 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r199 r200 8460 8460 else: 8461 8461 newval = True 8462 elif vtype = '|S1': 8463 newval = char(val) 8462 elif vtype == '|S1': 8463 newval = val 8464 elif vtype == 'str': 8465 print val, type(val) 8466 newval = str(val) 8464 8467 else: 8465 8468 print errormsg … … 8513 8516 values = np.zeros((objvar.shape), dtype=vartype) 8514 8517 8515 valfinal = np.zeros((1), dtype=vartype)8516 8517 8518 it = 0 8518 8519 if Ndims == 1: 8520 valfinal = np.zeros((1), dtype=vartype) 8519 8521 for line in objasciif: 8520 8522 val = (line.replace('\n','').replace(' ','').replace('\t','')) … … 8526 8528 iline=0 8527 8529 for line in objasciif: 8528 val = (line.replace('\n','').replace(' ','').replace('\t','')) 8529 valfinal[0] = retype(val, vartype) 8530 if it <= values.shape[0]-1: 8531 values[iline,it] = retype(valfinal[0], vartype) 8532 it = it +1 8530 vals = line.replace('\n','').replace('\t','').split(' ') 8531 if len(vals) != values.shape[1]: 8532 print errormsg 8533 print ' ' + fname + ': given: ',len(vals),' but variable reaquires: ',values.shape[1],'!!!' 8534 exit(-1) 8535 for i1 in range(len(vals)): 8536 values[iline,i1] = retype(vals[i1], vartype) 8533 8537 iline=iline+1 8534 8538 else:
Note: See TracChangeset
for help on using the changeset viewer.