Due to the current gap in continued funding from the U.S. National Science Foundation (NSF), the NSF Unidata Program Center has temporarily paused most operations. See NSF Unidata Pause in Most Operations for details.
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 with? Aleksander 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? Roland On Fri, Jan 24, 2014 at 7:55 AM, Aleksander Vines <aleksander.vines@xxxxxxxx> wrote: Hi, 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": http://www.unidata.ucar.edu/software/thredds/current/netcdf-java/reference/FeatureDatasets/CFpointImplement.html 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 formats) http://cf-pcmdi.llnl.gov/documents/cf-conventions/1.6/cf-conventions.html#idp8432528 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.png 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 for=x.nc 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: 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 _______________________________________________ netcdf-java mailing list netcdf-java@xxxxxxxxxxxxxxxx For list information or to unsubscribe, visit: http://www.unidata.ucar.edu/mailing_lists/
netcdf-java
archives: