Hi,
I'm having a problem parsing a NetCDF4 file in NetCDF-java.
I've using NetCDF 4.1 (C library with Java JNI bindings) in an attempt to
produce a CDM compliant Station file in NetCDF4 format. I want to put each
stations observation in a compound field. The file generates and parses using
the ncgen and ncdump but I can't open it in NetCDF-Java 4.1. I looks like
there's trouble reading char[] or string fields in the compound attribute type.
The following stack trace is produced on read:
java.lang.NullPointerException
at ucar.ma2.ArrayStructure.extractMemberArray(ArrayStructure.java:407)
at ucar.nc2.iosp.hdf5.H5header.makeAttributes(H5header.java:587)
at ucar.nc2.iosp.hdf5.H5header.makeVariable(H5header.java:1034)
at ucar.nc2.iosp.hdf5.H5header.makeNetcdfGroup(H5header.java:388)
at ucar.nc2.iosp.hdf5.H5header.read(H5header.java:182)
at ucar.nc2.iosp.hdf5.H5iosp.open(H5iosp.java:108)
at ucar.nc2.NetcdfFile.<init>(NetcdfFile.java:1325)
at ucar.nc2.NetcdfFile.open(NetcdfFile.java:761)
at ucar.nc2.NetcdfFile.open(NetcdfFile.java:395)
at ucar.nc2.NetcdfFile.open(NetcdfFile.java:365)
at ucar.nc2.NetcdfFile.open(NetcdfFile.java:352)
at ucar.nc2.NetcdfFile.open(NetcdfFile.java:340)
at edu.unidata.ucar.jni.NetCDFTest.main(NetCDFTest.java:147)
DIgging through the source it looks like
ucar.nc2.iosp.hdf5.H5header.getNCtype(int hdfType, int size) is returning null
for a char[] compound field type when trying to map the attributes to the
compound fields.
With this be supported in the future? Is there another way to assign
attributes to compound type fields?
Here's the CDL I am trying to use (the observation dim will eventually be
UNLIMITED):
netcdf gsod {
types:
compound observation_type {
int time ;
float tempMean ;
float tempMin ;
float tempMax ;
}; // observation_type
compound observation_atts {
char time(32) ;
char tempMean(32) ;
char tempMin(32) ;
char tempMax(32) ;
}; // observation_atts
dimensions:
station = 2 ;
observation = 3 ;
variables:
int station_id(station) ;
float station_description(station) ;
float latitude(station) ;
latitude:units = "degrees_north" ;
float longitude(station) ;
longitude:units = "degrees_east" ;
float altitude(station) ;
altitude:units = "feet" ;
altitude:positive = "up" ;
observation_type station_observations(station, observation) ;
observation_atts station_observations:units = {{"days since
1930-01-01 00 UTC"}, {"degF"}, {"degF"}, {"degF"}} ;
// global attributes:
:cdm_datatype = "Stations" ;
:stationDimension = "station" ;
:observationDimension = "observation" ;
:latitude_coordinate = "latitude" ;
:longitude_coordinate = "longitude" ;
:zaxis_coordinate = "altitude" ;
:time_coordinate = "station_observations.time" ;
data:
station_id = _, _ ;
station_description = _, _ ;
latitude = _, _ ;
longitude = _, _ ;
altitude = _, _ ;
station_observations =
{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0},
{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0} ;
}
Thanks,
Tom Kunicki
Center for Integrated Data Analytics
U.S. Geological Survey
8505 Research Way
Middleton, WI 53562