[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 = 
"http://motherlode.ucar.edu:9080/thredds/dodsC/nexrad/level2/KVTX/20070206/Level2_KVTX_20070206_2341.ar2v";;
   String filenameOut = "C:/temp/testWriteRadar.nc";
   NetcdfFile ncfileIn = ucar.nc2.dataset.NetcdfDataset.openFile(datasetIn, 
null);
   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:

http://www.unidata.ucar.edu/software/netcdf/docs/

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