Changeset 4042


Ignore:
Timestamp:
15/07/08 14:20:56 (11 years ago)
Author:
domlowe
Message:

strings may be encountered when reading inline data - map to floats before writing to netcdf

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI02-CSML/trunk/csml/API/ops_PointSeriesFeature.py

    r3627 r4042  
    164164    #Now write out the NetCDF File:    
    165165    nc=cdms.open(pathToSubsetNetCDF,'w') 
     166    #inline data may be strings, so convert to float 
     167    if type(data[0]) is str: 
     168        data=map(lambda x: float(x), data[:]) 
    166169    var=MV.array(data) 
    167170    var.id=varname 
     
    181184    timeAx.id='time' 
    182185    timeAx.units=tbase   
    183     var.setAxis(0,timeAx)       
     186    var.setAxis(0,timeAx)      
    184187    nc.write(var) 
    185188    nc.close()    
Note: See TracChangeset for help on using the changeset viewer.