[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDFJava #TLG-682846]: Regarding Java netcdf surfer grid files



> Hello sean,
> 
> I have a data regarding latitude and longitude i want to create a nc file 
> using that data in java. Can you tell me how can i create a .nc file in java.
> Thanks,
> Ravi Teja
> 
> 
Greetings Ravi,

Here is a page with several examples of reading and writing netCDF files, 
ranging from very simple to very complex.

http://www.unidata.ucar.edu/software/netcdf/examples/programs/

I would start with 
http://www.unidata.ucar.edu/software/netcdf/examples/programs/Simple_xy_wr.java

There is code in Simple_xy_wr.java that creates some data to store - you would 
just simply need to replace those data with yours. Also, often times it's not 
quite enough to put the data into netCDF format and call it good. It's best to 
also properly document the files with metadata. Check out:

http://motherlode.ucar.edu/repository/entry/show/RAMADDA/Data/IDD+Data/decoded/netcdf/grid/NCEP/GFS/CONUS_80km/GFS_CONUS_80km_20111109_1200.nc?entryid=synth%3Aa136862d-1253-4096-b864-ac53028253d7%3AL2RlY29kZWQvbmV0Y2RmL2dyaWQvTkNFUC9HRlMvQ09OVVNfODBrbS9HRlNfQ09OVVNfODBrbV8yMDExMTEwOV8xMjAwLm5j&output=data.cdl

for an example of a pretty well documented netCDF file. Notice how the 
dimensions of the variables are given, each variable comes with attributes 
(such as name, units, axis dimension, axis type), as well as some global 
attributes, like dataset title, which are shown at the end. There are examples 
from the 'example file page' (first link) that show how to add information like 
those described above. The beauty of a netCDF file is that it can be a self 
describing file - all the information you need about the dataset can be 
contained in one file, as long as it's documented properly.

Cheers,

Sean



Ticket Details
===================
Ticket ID: TLG-682846
Department: Support netCDF Java
Priority: High
Status: Open