'Convert grib file to netcdf (jpeg format)
I've download weather forecast files from the ARPEGE that arrived in a file format like this "GRIBHS020+0000:00.jpeg". According to the person who managed the data, it is still a grib file that has been altered with this function "grib_set -r -s 'packingType=grid_jpeg' $f ${f}.jpeg. I need to convert this file to netcdf, but the data manager does not know how to do this. I've tried nearly everything (cdo: cdo -f nc copy, Eccodes: grib_to_netcdf, NCL ncl_convert2nc), but nothing works. For instance, this is the grib_to_netcdf output.
grib_to_netcdf -o test.nc grid.arpege-forecast.hs020+0024:00.grib grib_to_netcdf: Version 2.12.3 grib_to_netcdf: Processing input file 'grid.arpege-forecast.hs020+0024:00.grib'. grib_to_netcdf: Found 1018 GRIB fields in 1 file. grib_to_netcdf: Ignoring key(s): method, type, stream, refdate, hdate grib_to_netcdf: Creating netCDF file 'test.nc' grib_to_netcdf: NetCDF library version: 4.6.2 of Dec 17 2018 19:36:03 $ grib_to_netcdf: Creating large (64 bit) file format. ECCODES ERROR : Cannot handle fields for different levtypes.
ECCODES ERROR : Please split input data into different files. Exiting!
Any suggestions are highly welcomed!
Solution 1:[1]
You can convert using netcdf-java:
java -cp toolsUI-5.4.2.jar ucar.nc2.write.Nccopy -i GRIBHS020+0114_00.jpeg -o GRIBHS020+0114_00.nc -st standard -sh -f netcdf4_classic
The netcdf-java can be downloaded from: https://www.unidata.ucar.edu/downloads/netcdf-java/
and you will need to setup the netcdf-c library to write as netCDF4 using the nccopy featur: https://docs.unidata.ucar.edu/netcdf-java/current/userguide/cdm_utility_programs.html#nccopy
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Antonio S. CofiƱo |