6

I am using the latest netcdf jar library from unidata website here: http://www.unidata.ucar.edu/downloads/netcdf/index.jsp

I am looking for a java netcdf 4 tutorial/example but I can't seem to find one on their website or anywhere else for that matter. Version 4 is significantly different than the previous versions in that the write function (to write data to a variable) is no longer used and is replaced by writeCDL...I think. Has anyone used the latest version of netcdf with java? I'd really appreciate if someone could point me in the right direction. Thanks for your help! -Dom

P.S. Here is their tutorial website...with no mention of java: http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-tutorial/index.html

3 Answers 3

2

I'm currently also working on a project using NetCDF.

Unfortunately, the NetCDF API for Java only supports reading from NetCDF-4 files, not writing. This API on support writing to NetCDF-3 files.

As for tutorials or help about using it in Java, you can find the API javadoc here: http://www.unidata.ucar.edu/software/netcdf-java/v4.0/javadoc/overview-summary.html

and tutorial: http://www.unidata.ucar.edu/software/netcdf-java/tutorial/

I sure hope this helps you. NetCDF seems like a great way to store scientific data, but NetCDF-3 lacks a tons of features (multiple unlimited dimensions are only available from 4). My best advice for you is to read every documentation you can find on Unidata website. Not just documentation for the Java API, but documentation on NetCDF in general. Check sample files, small examples of code as well. And play a bit with the netCDF Java utils they distribute in the Java download section.

Sign up to request clarification or add additional context in comments.

3 Comments

Oh that makes sense. Just to clarify, the function to write data to a variable is ncfile.write("var_name",Array) right?
Old post, but for any Googlers that end up here: The easiest way I've found to generate NetCDF from java is to output to a text file and then run NCGEN to create the NetCDF file. They've done some more work on the Java NetCDF writing library since, but it appears that you have to writer entire sections at once. When I write to a text file I can write the data as I generate it, which is great when you don't want to hold a 20k*20k array in memory.
It's also worth mentioning that the new JavaNetCDf writing library is separate from the NetCDF reading library and is called Nujan.
2

Just a note that the netCDF-Java library (as of 4.3.13) has netCDF-4 write support via the netCDF C library. It's still in beta, but it does work and feedback is certainly appreciated!

Please see the netCDF-Java reference docs for more details.

3 Comments

Does this update (v 4.3.xx) deprecate the Nujan library?
Following up with this question. PING
The Nujan is a completely different library that netCDF-Java and is developed by a completely different group. It looks like the Nujan jar has not been updated since April of 2012, so I'd enquire with those developers to see what the status is with that package (ral.ucar.edu/~steves/nujan.html).
0

Have you looked into the Nujan library? It's for writing netcdf4 files

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.