Question about reading in data

From: Gerald Creager <gerry.creager_at_nyahnyahspammersnyahnyah>
Date: Tue Nov 08 2011 - 15:58:00 MST

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

-- 
Gerry Creager -- gerry.creager@tamu.edu
Texas Mesonet -- AATLT, Texas A&M University
Cell: 979.229.5301 Office: 979.458.4020 FAX: 979.862.3983
Office: 7607 Eastmark Drive, Suite 112, College Station, TX 77840
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Nov 8 15:58:06 2011

This archive was generated by hypermail 2.1.8 : Mon Nov 14 2011 - 10:41:55 MST