Re: [netcdf-java] (External):Re: NetCDF All Jar

Satyakam,

I do not know if ncdump supports conversion to CSV, but conversion from CDL to CSV should be a straightforward text processing exercise, once you decide how to handle the structured and multidimensional nature of the data.

Because all supported GRIB files can opened wherever NetCDF files can be opened, you could instead write a Java application to extract the information you want into CSV. See the NetCDF-Java documentation for examples of how to open a NetCDF file (GRIB files will work the same). This might be a more direct solution than text processing. I would also consider why you are using CSV; is this the final data format? Your application could instead target your final data format.

NetCDF-Java does not use file extensions to detect file type; it looks for magic numbers at the start of the file and detects the file type automatically. All file extensions (and files with no extension) should work. GRIB1, GRIB2, NetCDF-3, and NetCDF-4 are all supported (and some others). Some GRIB GDS templates (coordinate reference systems) are not supported. I do not know what an ".op" file is.

Kind regards,
Ben.

On 30/07/17 12:22, Satyakam Acharya wrote:
Hi Ben,

First of thanks a lot for your response.

We are converting all our input files in .csv format, for loading into our HDFS 
repository for further analysis purpose.

Types of extensions we are trying to convert to csv are as below

.op
.grb (version 1 and 2)
.nc
Netcdf

Can all these be handled by the jar ?

Thanks,
Satyakam



-----Original Message-----
From: Ben Caradoc-Davies [mailto:ben@xxxxxxxxxxxx]
Sent: Saturday, July 29, 2017 4:02 PM
To: Satyakam Acharya <Satyakam.Acharya@xxxxxxx>; netcdf-java@xxxxxxxxxxxxxxxx
Subject: (External):Re: [netcdf-java] NetCDF All Jar

Satyakam,

it appears that Grib2Dump was removed in 2013.

What output format do you want? The CDM utility "ncdump" also reads GRIB
files, or you could use "nccopy" to convert GRIB to NetCDF:
http://www.unidata.ucar.edu/software/thredds/v4.6/netcdf-java/reference/manPages.html

Dump to CDL:

java -Xmx1g -cp /path/to/netcdfAll-4.6.10.jar ucar.nc2.NCdumpW
data/grib2/ndfd.wmo -cdl > ndfd.cdl

Copy to NetCDF-3:

java -Xmx1g -cp /path/to/netcdfAll-4.6.10.jar ucar.nc2.write.Nccopy -i
data/grib2/ndfd.wmo -o ndfd.nc

Kind regards,
Ben.

On 30/07/17 02:56, Satyakam Acharya wrote:
Hi ,

I am new to Java and planning to use NetCDF to decode grib files.

I placed the jar in a folder and referring it for the same, but it errors out 
saying 'Could not find or load main class ucar.grib.grib2.Grib2Dump'.

Command issued is as below

CMD="java -cp <My CP>netcdfAl.jar ucar.grib.grib2.Grib2Dump data/grib2/ndfd.wmo > 
ndfd.dump"

Am I missing anything ?


Thanks ,
Satyakam Acharya

BI - Datawarehousing
Infosys Limited




_______________________________________________
NOTE: All exchanges posted to Unidata maintained email lists are
recorded in the Unidata inquiry tracking system and made publicly
available through the web.  Users who post to any of the lists we
maintain are reminded to remove any personal information that they
do not want to be made public.


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



--
Ben Caradoc-Davies <ben@xxxxxxxxxxxx>
Director
Transient Software Limited <http://transient.nz/>
New Zealand



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