[GIS] How to convert NetCDF file to Grib2 or Grib files

grib-2netcdf

I'm in trouble to read NetCDF file data. Basically NetCDF file contains Ocean current data.
How do you convert a NetCDF file to a Grib2 or Grib file? I already have procedure to read data from Grib2 file using OpenGrads version 2.0.
What I need overall is to generate image for ocean current components available in netCDF and display on map.

Can anyone direct/correct me how to accomplish this task.

Best Answer

GRIB is more limited than NetCDF. You can use a tool like the NetCDF-Java library to read both NetCDF and GRIB1 and GRIB2 files: https://www.unidata.ucar.edu/software/thredds/current/netcdf-java/documentation.htm However, it can write only NetCDF files.

If you use Matlab, the https://github.com/nctoolbox/nctoolbox can read and plot both.