Hi All, I'm stumped on how to get data out of the nested sequence data in the attached BUFR file using NetCDF-Java. I can read all variables in the top-level Sequence (obs), but I can't get them out of the nested Sequence (seq1). I've tried all the method calls I can think of. Any suggestions or help would be greatly appreciated? Here's some pseudo code I've used to get the variable and try to read it.: netcdf = // Open the BUFR file seq1 = netcdf.findVariable("obs.seq1); // --- METHOD 1L Try using the recommended structure iterator i = seq1.getStructureIterator(); while (i.hasNext()) { v = i.next(); d = v.getArray(); } // METHOD 1 OUTPUT 2013-05-14 14:55:24,154 [main] WARN ucar.nc2.dataset.StructureDS - StructureDataDS.convert Cant find member time 2013-05-14 14:55:24,154 [main] WARN ucar.nc2.dataset.StructureDS - StructureDataDS.convert Cant find member WMO block number 2013-05-14 14:55:24,154 [main] WARN ucar.nc2.dataset.StructureDS - StructureDataDS.convert Cant find member WMO station number 2013-05-14 14:55:24,155 [main] WARN ucar.nc2.dataset.StructureDS - StructureDataDS.convert Cant find member Type of station 2013-05-14 14:55:24,155 [main] WARN ucar.nc2.dataset.StructureDS - StructureDataDS.convert Cant find member Year 2013-05-14 14:55:24,155 [main] WARN ucar.nc2.dataset.StructureDS - StructureDataDS.convert Cant find member Month 2013-05-14 14:55:24,155 [main] WARN ucar.nc2.dataset.StructureDS - StructureDataDS.convert Cant find member Day 2013-05-14 14:55:24,155 [main] WARN ucar.nc2.dataset.StructureDS - StructureDataDS.convert Cant find member Hour 2013-05-14 14:55:24,155 [main] WARN ucar.nc2.dataset.StructureDS - StructureDataDS.convert Cant find member Minute 2013-05-14 14:55:24,155 [main] WARN ucar.nc2.dataset.StructureDS - StructureDataDS.convert Cant find member Latitude (coarse accuracy) 2013-05-14 14:55:24,155 [main] WARN ucar.nc2.dataset.StructureDS - StructureDataDS.convert Cant find member Longitude (coarse accuracy) 2013-05-14 14:55:24,155 [main] WARN ucar.nc2.dataset.StructureDS - StructureDataDS.convert Cant find member Height of station 2013-05-14 14:55:24,155 [main] WARN ucar.nc2.dataset.StructureDS - StructureDataDS.convert Cant find member Short station or site name 2013-05-14 14:55:24,155 [main] WARN ucar.nc2.dataset.StructureDS - StructureDataDS.convert Cant find member Type of measuring equipment used 2013-05-14 14:55:24,155 [main] WARN ucar.nc2.dataset.StructureDS - StructureDataDS.convert Cant find member Time significance 2013-05-14 14:55:24,155 [main] WARN ucar.nc2.dataset.StructureDS - StructureDataDS.convert Cant find member Time period or displacement 2013-05-14 14:55:24,156 [main] WARN ucar.nc2.dataset.StructureDS - StructureDataDS.convert Cant find member seq1 Java exception occurred: java.lang.NullPointerException at ucar.nc2.dataset.StructureDS.convert(StructureDS.java:445) at ucar.nc2.dataset.SequenceDS$StructureDataConverter.next(SequenceDS.java:78) // --- METHOD 2: Try calling read vt = netcdf.findVariable('obs.seq1.Virtual temperature); vt.read(); // METHOD 2 OUTPUT java.lang.ClassCastException: ucar.ma2.ArrayObject$D1 cannot be cast to ucar.ma2.ArrayStructure at ucar.nc2.Variable.reallyRead(Variable.java:854) at ucar.nc2.Variable._read(Variable.java:831) at ucar.nc2.Variable.read(Variable.java:709) at ucar.nc2.dataset.VariableDS.reallyRead(VariableDS.java:518) at ucar.nc2.dataset.VariableDS._read(VariableDS.java:502) at ucar.nc2.Variable.read(Variable.java:709) The CDL is: netcdf 5900.20030601.rass { types: enum Type of station { 'Automatic' = 0, 'Manned' = 1, 'Hybrid: both manned and automatic' = 2, 'Missing value' = 3}; enum Type of measuring equipment used { 'Pressure Instrument associated with wind measuring equipment' = 0, 'Optical theodolite' = 1, 'Radio theodolite' = 2, 'Radar' = 3, 'VLF-Omega' = 4, 'Loran C' = 5, 'Wind profiler' = 6, 'Satellite navigation' = 7, 'Radio-acoustic Sounding System (RASS)' = 8, 'Sodar' = 9, 'Pressure instrument associated with wind measuring equipment but pressure element failed during ascent' = 14, 'Missing value' = 15}; enum Time significance { 'Time series' = 1, 'Time averaged (see Note 1)' = 2, 'Accumulated' = 3, 'Forecast' = 4, 'Forecast time series' = 5, 'Forecast time averaged' = 6, 'Forecast accumulated' = 7, 'Ensemble mean (see Note 2)' = 8, 'Ensemble mean time series' = 9, 'Ensemble mean time averaged' = 10, 'Ensemble mean accumulated' = 11, 'Ensemble mean forecast' = 12, 'Ensemble mean forecast time series' = 13, 'Ensemble mean forecast time averaged' = 14, 'Ensemble mean forecast accumulated' = 15, 'Start of phenomenon' = 17, 'Analysis' = 16, 'Start of orbit' = 19, 'Radiosonde launch time' = 18, 'Time of ascending node' = 21, 'End of orbit' = 20, 'Monitoring period' = 23, 'Time of occurrence of wind shift' = 22, 'Nominal reporting time' = 25, 'Agreed time limit for report reception' = 24, 'First guess' = 27, 'Time of last known position' = 26, 'End of scan or time of ending' = 29, 'Start of scan' = 28, 'Missing value' = 31, 'Time of occurrence' = 30}; variables: Sequence { String time; :units = "minutes since 2003-06-01 00:00:00Z"; :long_name = "time of observation"; :_CoordinateAxisType = "Time"; byte WMO block number; :missing_value = 127B; // byte :BUFR:TableB_descriptor = "0-1-1"; :BUFR:bitWidth = 7; // int short WMO station number; :missing_value = 1023S; // short :standard_name = "station_WMO_id"; :BUFR:TableB_descriptor = "0-1-2"; :BUFR:bitWidth = 10; // int String Type of station; :units = "CodeTable 0-2-1"; :BUFR:CodeTable = "Type of station (0-2-1)"; :BUFR:TableB_descriptor = "0-2-1"; :BUFR:bitWidth = 2; // int short Year; :units = "Year"; :missing_value = 4095S; // short :BUFR:TableB_descriptor = "0-4-1"; :BUFR:bitWidth = 12; // int byte Month; :units = "Month"; :missing_value = 15B; // byte :BUFR:TableB_descriptor = "0-4-2"; :BUFR:bitWidth = 4; // int byte Day; :units = "Day"; :missing_value = 63B; // byte :BUFR:TableB_descriptor = "0-4-3"; :BUFR:bitWidth = 6; // int byte Hour; :units = "Hour"; :missing_value = 31B; // byte :BUFR:TableB_descriptor = "0-4-4"; :BUFR:bitWidth = 5; // int byte Minute; :units = "Minute"; :missing_value = 63B; // byte :BUFR:TableB_descriptor = "0-4-5"; :BUFR:bitWidth = 6; // int float Latitude (coarse accuracy); :units = "degrees_north"; :_CoordinateAxisType = "Lat"; :BUFR:TableB_descriptor = "0-5-2"; :BUFR:bitWidth = 15; // int float Longitude (coarse accuracy); :units = "degrees_east"; :_CoordinateAxisType = "Lon"; :BUFR:TableB_descriptor = "0-6-2"; :BUFR:bitWidth = 16; // int float Height of station; :units = "m"; :_CoordinateAxisType = "Height"; :BUFR:TableB_descriptor = "0-7-1"; :BUFR:bitWidth = 15; // int char Short station or site name(5); :standard_name = "station_id"; :BUFR:TableB_descriptor = "0-1-18"; :BUFR:bitWidth = 40; // int String Type of measuring equipment used; :units = "CodeTable 0-2-3"; :BUFR:CodeTable = "Type of measuring equipment used (0-2-3)"; :BUFR:TableB_descriptor = "0-2-3"; :BUFR:bitWidth = 4; // int String Time significance; :units = "CodeTable 0-8-21"; :BUFR:CodeTable = "Time significance (0-8-21)"; :BUFR:TableB_descriptor = "0-8-21"; :BUFR:bitWidth = 5; // int float Time period or displacement; :units = "Second"; :BUFR:TableB_descriptor = "0-4-26"; :BUFR:bitWidth = 13; // int Sequence { short Height above station; :units = "m"; :missing_value = 32767S; // short :_CoordinateAxisType = "Height"; :BUFR:TableB_descriptor = "0-7-6"; :BUFR:bitWidth = 15; // int float Virtual temperature; :units = "K"; :BUFR:TableB_descriptor = "0-12-7"; :BUFR:bitWidth = 12; // int byte Wind profiler quality control test results; :units = "FlagTable 0-25-34"; :missing_value = 15B; // byte :BUFR:TableB_descriptor = "0-25-34"; :BUFR:bitWidth = 4; // int } seq1; } obs(*); :history = "Direct read of BUFR data by CDM"; :location = "5900.20030601.rass"; :BUFR:edition = 3; // int :BUFR:categoryName = "Vertical soundings (other than satellite)"; :BUFR:category = 2; // int :BUFR:subCategory = 0; // int :BUFR:localSubCategory = -1; // int :BUFR:centerName = "59.0 (The NOAA Forecast Systems Laboratory, Boulder, CO, USA)"; :BUFR:center = 59; // int :BUFR:subCenter = 0; // int :BUFR:table = 0; // int :BUFR:tableVersion = 3; // int :BUFR:localTableVersion = 3; // int :WMO Header = ""; :Conventions = "BUFR/CDM"; :_CoordSysBuilder = "ucar.nc2.dataset.conv.DefaultConvention"; } -- Brian Schlining
Attachment:
5900.20030601.rass
Description: Binary data
netcdf-java
archives: