Re: Writing a NetCDF file

Hi John:

You probably want to use the Java-Netcdf library. It can be done now by opening 
an opendap URL as a NetcdfFile, then writing that to a file:

 public static void main( String arg[]) throws IOException {
   String datasetIn = 
   String filenameOut = "C:/temp/";
   NetcdfFile ncfileIn = ucar.nc2.dataset.NetcdfDataset.openFile(datasetIn, 
   ucar.nc2.FileWriter.writeToFile( ncfileIn, filenameOut);

This writes a netcdf-3 file. The difficulty is when there is something in a 
dods URL that doesnt fit into a netcdf-3 file, eg a Structure. Then it will 
barf. We hope to address this long term by coverging DAP4 and the netcdf data 
model together, and using netcdf-4 file format (which is not yet available). 
There are also other things still to do, like make FileWriter do something 
intelligent with Structures, etc.

John Chamberlain wrote:
Hi John, I am looking at potential mechanisms for writing a NetCDF file. I want to output data which is DAP format to NetCDF format. I have the DAP stuff all organized no problem into objects etc. What do you recommend as some of the ways to output a NetCDF file?

I have seen the following page:

This page has links to a "best practices" document and also a "conventions" document, but I could not find an exact spec for NetCDF here.

Best regards, John Chamberlain

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