Re: [netcdf-java] [Q] How to generate NetCDF file from NcML using ToolsUI via "command line"?

Hi Joe,

I delved into the issue you reported, and I'm happy to tell you that we've figured out a solution. The problem you saw was a result of a couple of different issues, mostly to do with our documentation. In the meantime, you'll need to add the path to your netcdf c libraries (C:\Program Files (x86)\netCDF 4.3.0-rc2\bin) to your Windows System Variables Path. At that point, NetcdfDataset library loader will be able to find the necessary dll files without your explicit help at the command line.

Note that for now, the nj22Config.xml file is not used, though John is looking into fixing that.

Ultimately, I was able to issue the command:

java -Xmx1g -classpath ./netcdfAll-4.3.jar ucar.nc2.dataset.NetcdfDataset -in exercise1.ncml -out exercise1.nc4 -netcdf4

and write out a netcdf4 file without issue.

  Lansing Madry

On 3/7/2013 4:08 PM, H. Joe Lee wrote:
I forgot to add the error message:

Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to
load library 'netcdf': The specified module could not be found.

     at com.sun.jna.NativeLibrary.loadLibrary(
     at com.sun.jna.NativeLibrary.getInstance(
     at com.sun.jna.Library$Handler.<init>(
     at com.sun.jna.Native.loadLibrary(
     at com.sun.jna.Native.loadLibrary(
     at ucar.nc2.jni.netcdf.Nc4Iosp.load(
     at ucar.nc2.jni.netcdf.Nc4Iosp.create(
     at ucar.nc2.NetcdfFileWriter.create(
     at ucar.nc2.FileWriter2.write(
     at ucar.nc2.dataset.NetcdfDataset.main(
HDF: Software that Powers Science

On Thu, Mar 7, 2013 at 4:52 PM, H. Joe Lee <hyoklee@xxxxxxxxxxxx> wrote:
Thanks, John for the documents! I succeeded in creating an edited
NetCDF-3 from NcML via command line following your documents.

However, I failed to create NetCDF-4 from NcML. What I tried:

java -Xmx1g -classpath ./netcdfAll-4.3.jar
ucar.nc2.dataset.NetcdfDataset -in grid_1_3d_z.ncml -out
grid_1_3d_z.nc4 -netcdf4 -nj22Config ./n2jjConfig.xml

My n2jjConfig.xml file is simple:

  <?xml version="1.0"?>
      <libraryPath>C:\Program Files (x86)\netCDF 4.3.0-rc2\bin</libraryPath>

I tried a different combination of <libraryName> value such as
netcdf-7, netcdf.dll but it did not work.
I also tried replacing '\' to '/ or /bin/' to /lib'' in the path.
I'm using the Windows netCDF-4.3RC2 64-bit from [1].

I also observed something interesting. The original NetCDF-3 file
converted from HDF-EOS2 that I tested was 33K but NetCDF-Java shrunk
it to 2.3K NetCDF-3 file when I edited one attribute NcML, What's the
magic? I couldn't believe my eyes so I checked the edited file using
both ToolsUI and NetCDF-C ncdump; they both could open it


HDF: Software that Powers Science

On Thu, Feb 28, 2013 at 8:58 AM, John Caron <caron@xxxxxxxxxxxxxxxx> wrote:
On 2/28/2013 7:28 AM, H. Joe Lee wrote:

    I know I can create a NetCDF-3 from NcML  file via ToolsUI GUI as
described in [1].

    Is there way to create a NetCDF-3 file from NcML vial command line
interface? I'm looking for something like:

    %java -jar ToolsUI.jar -exec Writer -i test.ncml -o test.nc3

   Also, can I write a NetCDF-4 classic file from NcML using ToolsUI? I
get a pop-up dialog box saying "NetCDF=4 C library is not loaded".
(BTW, I think the dialog box  has typo '=' in 'NetCDF=4'.)

HDF: Software that Powers Science

netcdf-java mailing list
For list information or to unsubscribe, visit:

Hi Joe:




netcdf-java mailing list
For list information or to unsubscribe, visit:
netcdf-java mailing list
For list information or to unsubscribe, visit:

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