Hi. I'm completely new to netcdf and have been given some netcdf data to
read.
I'm using netcdfAll-4.6.10.jar
I found the example program in the tutorial and have implemented something
very similar:
import ucar.nc2.NetcdfFile;
public class ReadNetCDF {
public static void main(String[] args) throws Exception {
ReadNetCDF x = new ReadNetCDF();
x.read("netCDF/example_nc");
}
public void read(String fileName) throws Exception {
NetcdfFile ncFile = null;
try {
ncFile = NetcdfFile.open(fileName);
System.out.println("ncFile = " + ncFile);
this.read(ncFile);
} finally {
if (ncFile != null) {
ncFile.close();
}
}
}
private void read(NetcdfFile nf) throws Exception {
System.out.println("nf = " + nf);
}
}
When I run that I get:
Exception in thread "main" java.io.IOException: java.io.IOException: Cant
read netCDF/example_nc: not a valid CDM file.
at ucar.nc2.NetcdfFile.open(NetcdfFile.java:427)
Suggestions? Is the example_nc file I was given likely corrupt?
David
--
E-Mail to and from me, in connection with the transaction
of public business, is subject to the Wyoming Public Records
Act and may be disclosed to third parties.