convert .nc to grib
Added by sisma samuel 8 months ago
I want to convert multiple nc file to grb2. I used for file in *.nc; do short_name=$(echo "$file" | cut -c 1-22); cdo -f grb2 copy "$file" "${short_name}.grib"; done.
The input nc file has time double time(time=1);
:units = "Hour since 2021-01-01T00:00:00Z";
:standard_name = "time";
:long_name = "GRIB forecast or observation time";
:calendar = "proleptic_gregorian";
Array is single-valued, with value: 0.0
The output grib has time as In file "amerge.grib"
double time(time=1);
:units = "Hour since 0001-01-01T00:00:00Z";
:standard_name = "time";
:long_name = "GRIB forecast or observation time";
:calendar = "proleptic_gregorian";
Array is single-valued, with value: 0.0
I also tried to use for file in *.nc; do short_name=$(echo "$file" | cut -c 1-22); cdo -f grb copy "$file" "${short_name}.grib"; done.
then my input variable is t(time=1, hybrid_output=42, latitude=181, longitude=360); and output the t(time=1, isobaric=18, lat=181, lon=360); t(time=1, isobaric_surface=21, lat=181, lon=360) is split into two variables. but time dimension is preserved. what can be done
Replies (1)
RE: convert .nc to grib - Added by Karin Meier-Fleischer 8 months ago
Hi Sisma,
hm, the usual way is to convert GRIB into netCDF. For converting a netCDF into GRIB you need a parameter table and have to carry out some other work on the netCDF file. Maybe the following notebook from Copernicus is helpful.
https://gist.github.com/copernicusmarinegist/3b69345ef0352817e1ce1b8232e0df61