Re: [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

  • To: Roland Schweitzer - NOAA Affiliate <roland.schweitzer@xxxxxxxx>
  • Subject: Re: [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
  • From: Aleksander Vines <aleksander.vines@xxxxxxxx>
  • Date: Sat, 25 Jan 2014 11:27:18 +0100
I'm not using FileWriter, I'm using NetcdfFileWriteable, which creates 
NetCDF-3. I figured I needed the "Conventions:CF-1.6" attribute, and that the 
names of the dimensions in the documentation is ambiguous (should I use 
profiles/stations or profile/station)?
One note, both of these classes are deprecated, and I should apparently use 
FileWriter2(?). However then I have to work with already created NetCDF files, 
and I would like to be able to create one programmatically from scratch. But 
this is perhaps something that is not going to be supported by NetCDF-java in 
future versions since those classes are deprecated, and I should really create 
the basic structures in some files so that the software has something to start 

Roland Schweitzer - NOAA Affiliate <roland.schweitzer@xxxxxxxx> , 1/24/2014 
11:47 PM:
What netCDF version do you use in you FileWriter.createNew?
I'm able to make CF files for point features readable by toolsUI, but I 
restrict myself to NetcdfFileWriter.Version.netcdf3? 

On Fri, Jan 24, 2014 at 7:55 AM, Aleksander Vines <aleksander.vines@xxxxxxxx> 
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":
 From 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 
  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: 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: Can't open 
x.ncNestedTable: cant find variable time for coordinate type TimeNestedTable: 
cant find variable lat for coordinate type Lat NestedTable: cant find variable 
lon for coordinate type LonTable Structure(record) featureType POINT: 
lat/lon/time coord not foundFailed to find FeatureDatasetFactory 
datatype=ANY_POINT Could 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: ;(and yes, I 
know NetcdfFileWriteable is deprecated, but in my opinion, your documentation 
is quite difficult to use, and the "latest" examples (  ; ;) seems to be 
using this class) 
Any help with this problem would be greatly appreciated :)
Many Thanks,Aleksander Vines
 netcdf-java mailing list
 For list information or to unsubscribe, visit: 

  • 2014 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: