Donald Denbo wrote:
I have an application for which Groups seem a natural solution. I
have created a small test program to create a file with two groups then
look at the contents as Groups. While the file construction seems to
go fine, reading back using groups doesn't appear to work. All the
attributes, dimensions, and variables appear only in the root group.
Attached is my test program and output. What am I doing wrong?
You cant write netcdf files with Groups, that needs the netcdf-4 file format,
which is not ready. Is that what you're doing?
1) where did Variable.isCoordinateVariable() go? Could I convince
you to retain this method?
that got removed a while ago. equivilent is Variable.getCoordinateDimension()
2) When creating a Variable I have to give it the NetCDF file and
Group, yet without explicitly adding the
variable to the group, it doesn't appear to exist in the nc file.
Looking at the code, it looks like the original declaration is always
overridden when adding to a group (which apparently you must do.)
The problem is that NetcdfFileWriteable doesnt handle groups, since you cant
actuallly write them. But the constructor is there because we do create them
from non-netcdf files, like HDF5.
3) When writing out the data for a group variable I have to use
the NetcdfWriteable.write() method, which doesn't accept any group
designation. To get this to work, I had to write to "groupName/
shortName". Shouldn't Group have a write method? Or better yet,
shouldn't Variable have the write method?
4) I didn't see any example of setting up log4j. I have been
using jdk 1.5 built-in logging.
yes, i need to add a bit on work with that, but log4j is complicated and i
probably will assume people are already using it. do you want to switch to it?
Thanks for you time,
java -classpath "/Users/dwd/ResultService/NJTest/classes:/usr/local/
log4j:WARN No appenders could be found for logger (ucar.nc2.NetcdfFile).
log4j:WARN Please initialize the log4j system properly.
MaxWaveHeight/type = "first estimate maximum wave height"
TravelTime/type = "first estimate travel time"
Latitude = 10; // (has coord.var)
Longitude = 10; // (has coord.var)
float MaxWaveHeight/maxWH(Latitude=10, Longitude=10);
:units = "m";
float TravelTime/tt(Latitude=10, Longitude=10);
:units = "hours";