NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Hi Don: Donald Denbo wrote:
John,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?
Other questions:1) where did Variable.isCoordinateVariable() go? Could I convince you to retain this method?
that got removed a while ago. equivilent is Variable.getCoordinateDimension() != null
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, Don/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/bin/ java -classpath "/Users/dwd/ResultService/NJTest/classes:/usr/local/ java/junit3.8.1/junit.jar:/Developer/Applications/Borland/ JBuilder2005/JBuilder.framework/lib/unittest.jar:/Users/dwd/ ResultService/NJTest/lib/netcdf-2.2.18.jar:/Users/dwd/ResultService/ NJTest/lib/nlog4j-1.2.21.jar:/System/Library/Frameworks/ JavaVM.framework/Versions/1.5.0/Classes/.compatibility/ 14compatibility.jar:/System/Library/Frameworks/JavaVM.framework/ Versions/1.5.0/Classes/charsets.jar:/System/Library/Frameworks/ JavaVM.framework/Versions/1.5.0/Classes/classes.jar:/System/Library/ Frameworks/JavaVM.framework/Versions/1.5.0/Classes/dt.jar:/System/ Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/jce.jar:/ System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/ jconsole.jar:/System/Library/Frameworks/JavaVM.framework/Versions/ 1.5.0/Classes/jsse.jar:/System/Library/Frameworks/JavaVM.framework/ Versions/1.5.0/Classes/laf.jar:/System/Library/Frameworks/ JavaVM.framework/Versions/1.5.0/Classes/ui.jar:/System/Library/ Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/deploy.jar:/ System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ dt.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/ Home/lib/ext/apple_provider.jar:/System/Library/Frameworks/ JavaVM.framework/Versions/1.5.0/Home/lib/ext/dnsns.jar:/System/ Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext/ localedata.jar:/System/Library/Frameworks/JavaVM.framework/Versions/ 1.5.0/Home/lib/ext/sunjce_provider.jar:/System/Library/Frameworks/ JavaVM.framework/Versions/1.5.0/Home/lib/ext/sunpkcs11.jar:/System/ Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/im/ indicim.jar:/System/Library/Frameworks/JavaVM.framework/Versions/ 1.5.0/Home/lib/im/thaiim.jar:/System/Library/Frameworks/ JavaVM.framework/Versions/1.5.0/Home/lib/jce.jar:/System/Library/ Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/plugin.jar:/ System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/sa- jdi.jar" njtest.CreateNJ22log4j:WARN No appenders could be found for logger (ucar.nc2.NetcdfFile). log4j:WARN Please initialize the log4j system properly. Root group MaxWaveHeight/type = "first estimate maximum wave height" TravelTime/type = "first estimate travel time" Latitude = 10; // (has coord.var) Longitude = 10; // (has coord.var) float Latitude(Latitude=10); float Longitude(Longitude=10); float MaxWaveHeight/maxWH(Latitude=10, Longitude=10); :units = "m"; float TravelTime/tt(Latitude=10, Longitude=10); :units = "hours";
netcdf-java
archives: