It has nothing to do with fortran.
netCDF-3 does not support strings only characters.
sta_id_c = f->stationId
sta_id_s = tostring(sta_id_c)
delete(sta_id_c)
or, better
sta_id = tostring(f->stationId)
print(sta_id)
--- netCDF-4 supports strings Good luck On 11/08/2011 03:58 PM, Gerald Creager wrote: > Howdy! > > I've got a known netcdf file with some interesting attributes. > Apparently string variables are inserted as arrays, perhaps to support > older Fortran applicaitons... > > Excerpting from an ncl_filedump output: > dimensions: > ncl_scalar = 1 > maxLDADmessageLen = 512 > maxSkyCover = 6 > maxSkyLen = 8 > maxStaTypeLen = 11 > maxProviderIdLen = 12 > maxStaIdLen = 6 > maxNameLength = 51 > maxHomeWFOlen = 4 > maxWeatherLen = 25 > maxSensor = 2 > maxLDADtestLen = 51 > QCcheckNum = 10 > QCcheckNameLen = 60 > ICcheckNum = 55 > ICcheckNameLen = 72 > maxStaticIds = 30000 > totalIdLen = 24 > nInventoryBins = 24 > maxPSTEntries = 300 > recNum = 5288 // unlimited > character stationId ( recNum, maxStaIdLen ) > long_name : alphanumeric station Id > reference : station table > > character handbook5Id ( recNum, maxStaIdLen ) > long_name : Handbook5 Id (AFOS or SHEF id) > reference : station table > > character stationName ( recNum, maxNameLength ) > long_name : alphanumeric station name > reference : station table > > And a print of the data for stationName yields: > ncl 16> print(stnName) > > > Variable: stnName > Type: character > Total Size: 269688 bytes > 269688 values > Number of Dimensions: 2 > Dimensions and sizes: [recNum | 5288] x [maxNameLength | 51] > Coordinates: > Number Of Attributes: 2 > long_name : alphanumeric station name > reference : station table > (0,0) C > (0,1) h > (0,2) e > (0,3) r > (0,4) r > (0,5) y > (0,6) > (0,7) P > (0,8) o > (0,9) i > (0,10) n > (0,11) t > (0,12) , > (0,13) > (0,14) W > (0,15) A > (0,16) 0x00 > (0,17) 0x00 > ... > > ncl 19> print (stnId) > > > Variable: stnId > Type: character > Total Size: 31728 bytes > 31728 values > Number of Dimensions: 2 > Dimensions and sizes: [recNum | 5288] x [maxStaIdLen | 6] > Coordinates: > Number Of Attributes: 2 > long_name : alphanumeric station Id > reference : station table > (0,0) C > (0,1) H > (0,2) Y > (0,3) W > (0,4) 1 > (0,5) 0x00 > (1,0) A > (1,1) P > (1,2) 1 > (1,3) 6 > (1,4) 4 > (1,5) 0x00 > (2,0) A > (2,1) P > (2,2) 2 > (2,3) 0 > (2,4) 4 > (2,5) 0x00 > ... > > > Is there a good way to read in the data so that the character data are > read as strings? > > Thanks gerry -- ====================================================== Dennis J. Shea tel: 303-497-1361 | P.O. Box 3000 fax: 303-497-1333 | Climate Analysis Section | Climate & Global Dynamics Div. | National Center for Atmospheric Research | Boulder, CO 80307 | USA email: shea 'at' ucar.edu | ====================================================== _______________________________________________ ncl-talk mailing list List instructions, subscriber options, unsubscribe: http://mailman.ucar.edu/mailman/listinfo/ncl-talkReceived on Tue Nov 8 17:25:47 2011
This archive was generated by hypermail 2.1.8 : Mon Nov 14 2011 - 10:41:55 MST