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.

Cheers,
  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(NativeLibrary.java:145)
     at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:188)
     at com.sun.jna.Library$Handler.<init>(Library.java:123)
     at com.sun.jna.Native.loadLibrary(Native.java:255)
     at com.sun.jna.Native.loadLibrary(Native.java:241)
     at ucar.nc2.jni.netcdf.Nc4Iosp.load(Nc4Iosp.java:139)
     at ucar.nc2.jni.netcdf.Nc4Iosp.create(Nc4Iosp.java:1764)
     at ucar.nc2.NetcdfFileWriter.create(NetcdfFileWriter.java:614)
     at ucar.nc2.FileWriter2.write(FileWriter2.java:182)
     at ucar.nc2.dataset.NetcdfDataset.main(NetcdfDataset.java:1682)
--
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"?>
<nj22Config>
<Netcdf4Clibrary>
      <libraryPath>C:\Program Files (x86)\netCDF 4.3.0-rc2\bin</libraryPath>
      <libraryName>netcdf-7</libraryName>
</Netcdf4Clibrary>
</nj22Config>

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
successfully.

Regards,

[1] http://www.unidata.ucar.edu/netcdf/win_netcdf/netCDF4.3RC2-NC4-64.exe
--
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:
Hi,

    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'.)

[1] http://www.unidata.ucar.edu/software/netcdf/ncml/v2.2/Tutorial.html
--
HDF: Software that Powers Science

_______________________________________________
netcdf-java mailing list
netcdf-java@xxxxxxxxxxxxxxxx
For list information or to unsubscribe, visit:
http://www.unidata.ucar.edu/mailing_lists/


Hi Joe:

see

http://www.unidata.ucar.edu/software/netcdf-java/reference/manPages.html

and

http://www.unidata.ucar.edu/software/netcdf-java/reference/netcdf4Clibrary.html

John

_______________________________________________
netcdf-java mailing list
netcdf-java@xxxxxxxxxxxxxxxx
For list information or to unsubscribe, visit:
http://www.unidata.ucar.edu/mailing_lists/
_______________________________________________
netcdf-java mailing list
netcdf-java@xxxxxxxxxxxxxxxx
For list information or to unsubscribe, visit: 
http://www.unidata.ucar.edu/mailing_lists/



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