[netcdf-java] Can't seem to be able to create a NetCDF file with NetCDF-Java that conforms to the CF-1.6/H5.3 format

I need some help with the creation of a NetCDF file.
I'm attempting to create the NetCDF file programmatically. I have a lot of 
point data, and I want to be able to create different types of NetCDF-files 
after extracting different subsets of these points. I want the files to conform 
to CF-1.6 (as far as its possible with the input I got). 
I'm using NetCDF-java 4.3. 
I've found a "Short guide to writing files using CF-1.6 Discrete Sampling 
Features Conventions": 
 this guide, I concluded that I should support the format specified in CF-1.6 
H5.3 (see below) in my application (I'm also writing other kind of formats) 
 I've figured one obvious error in this example, and that is that they referred 
to name_strlen as a dimension without specifying it in the dimension 
list.ncdump of the file I've created:  http://pastebin.com/fsPGX5LD I've 
changed station_info to a 2D char array (as far as I understand, this is just 
some extra info and it shouldn't make a difference that I changed it to be a 
char/String(2D)?) I miss a few long_names, and a few standard names are not the 
"correct" standard names, but I can't figure out why this is not working. All 
seems nice so far, but when I try to read this netCDF-file with ToolsUI 4.3, I 
get this error message: http://i.stack.imgur.com/kmAqR.pngCan't open 
x.ncNestedTable: cant find variable time for coordinate type TimeNestedTable: 
cant find variable lat for coordinate type LatNestedTable: cant find variable 
lon for coordinate type LonTable Structure(record) featureType POINT: 
lat/lon/time coord not foundFailed to find FeatureDatasetFactory for=x.nc 
datatype=ANY_POINTCould the problem have something to do with the following 
comment in the "Short guide to writing files using CF-1.6 Discrete Sampling 
Features Conventions", under 9.5: "CDM: A variable representing the instance id 
is required, indicated by an attribute named cf_role, which follows all the CF 
rules above."
It is absolutely not a requirement that the file is read by ToolsUI 4.3, but 
the fact that it can't be read from there probably indicates that something is 
wrong with the format (ncWMS can't read the file either).
I'm not sure if it makes any difference to show the code here, but here is the 
method that writes to the netCDF file: http://pastebin.com/QTHKUyw8 ;(and yes, I 
know NetcdfFileWriteable is deprecated, but in my opinion, your documentation 
is quite difficult to use, and the "latest" examples ( 
https://www.unidata.ucar.edu/software/thredds/current/netcdf-java/tutorial/  ;
http://www.unidata.ucar.edu/software/netcdf/examples/programs/ ;) seems to be 
using this class)
Any help with this problem would be greatly appreciated :)
Many Thanks,Aleksander Vines
  • 2014 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: