Try giving it a full path specification, eg C:/data/example1.nc
Anh Tran wrote:
Institution: Data Center
Package Version: Netcdf-java version 2.2.12
Operating System: Windows
Hardware Information: Window xp
Inquiry: Hi,
I'm new to netcdf java. I would like to convert ncml file to NetCdf file. I used the following code:
InputStream in = new FileInputStream ("Example.ncml");
NcMLReader.writeNcMLToFile(in,"example1.nc");
It gives me the following errors when i executed the program:
java.io.FileNotFoundException: (The system cannot find the path specified)
at java.io.RandomAccessFile.open(Native Method)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:222)
at java.io.RandomAccessFile.<init>(RandomAccessFile.java:115)
at ucar.unidata.io.RandomAccessFile.<init>(RandomAccessFile.java:145)
at ucar.nc2.NetcdfFile.open(NetcdfFile.java:213)
at ucar.nc2.NetcdfFile.open(NetcdfFile.java:163)
at ucar.nc2.dataset.NetcdfDataset.openFile(NetcdfDataset.java:291)
at ucar.nc2.dataset.NetcdfDataset.openDataset(NetcdfDataset.java:148)
at ucar.nc2.ncml.NcMLReader.readNcML(NcMLReader.java:282)
at ucar.nc2.ncml.NcMLReader.readNcML(NcMLReader.java:224)
at ucar.nc2.ncml.NcMLReader.writeNcMLToFile(NcMLReader.java:1855)
at dfo.Meds.argoNetcdf.Examplenc.main(Examplenc.java:97)
ERROR writting file
Can you help me? Thanks you in advance.
Anh
------------------------------------------------------------------------
<?xml version='1.0' encoding='UTF-8'?>
<netcdf xmlns='http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2'
location='' >
<dimension name='lat' length='3' />
<dimension name='lon' length='4' />
<dimension name='time' length='2' isUnlimited='true' />
<attribute name='title' value='Example Data' />
<variable name='rh' type='int' shape='time lat lon' >
<attribute name='long_name' value='relative humidity' />
<attribute name='units' value='percent' />
</variable>
<variable name='T' type='double' shape='time lat lon' >
<attribute name='long_name' value='surface temperature' />
</variable>
<variable name='lat' type='float' shape='lat' >
<attribute name='units' value='degree_north' />
</variable>
<variable name='lon' type='float' shape='lon' >
<attribute name='units' value='degree_east' />
</variable>
<variable name='time' type='int' shape='time' >
<attribute name='units' value='hours' />
</variable>
</netcdf>