struggling to convert sea current NetCDF to grb
Added by Thomas Goerlich 11 months ago
Hi all,
for a re-analysis project I pulled current data from the "Atlantic- European North West Shelf- Ocean Physics Reanalysis" using the Datalayer cmems_mod_nws_phy_uv_my_7km-2D_PT1H-i (Example attached as input_ex.nc).
First, I replace "NaN" with zero:$ cdo setmisstoc,0 input_ex.nc input_ex.0.nc
Then I convert to grib:$ cdo -f -grb copy input_ex.0.nc output_ex.grb
"cdo map" tells me there are values included, however my grib viewer displays the file as "pressure". Geography and time are correct, though.
How do I define the values as current in my grib file?
$ cdo partab input_ex.0.nc
¶meter
name = _default_
datatype = F32
/
¶meter
name = uo
standard_name = eastward_sea_water_velocity
long_name = "Eastward Current Velocity in the Water Column"
units = "m s-1"
chunkType = grid
/
¶meter
name = vo
standard_name = northward_sea_water_velocity
long_name = "Northward Current Velocity in the Water Column"
units = "m s-1"
chunkType = grid
/
many thanks for your advice
Thomas
| input_ex.nc (774 KB) input_ex.nc | original data retrieved from copernicus | ||
| output.ex.grb (384 KB) output.ex.grb | converted to grib | ||
| input_ex.0.nc (791 KB) input_ex.0.nc | changed "NaN" to 0 |
Replies (2)
RE: struggling to convert sea current NetCDF to grb - Added by Thomas Goerlich 11 months ago
$ grib_set -s table2Version=151 output_ex.1.grb output_ex.2.grb $ grib_set -s indicatorOfParameter=131 -w indicatorOfParameter=1 output_ex.2.grb output_ex.3.grb $ grib_set -s indicatorOfParameter=132 -w indicatorOfParameter=2 output_ex.3.grb output_ex.4.grb
ncdump tells me
#============== MESSAGE 47 ( length=8184 ) ==============
GRIB {
editionNumber = 1;
* table2Version = 151;*
# Absent (common/c-1.table)
centre = 0;
generatingProcessIdentifier = 0;
# Unknown code table entry ()
*indicatorOfParameter = 131;*
# Surface (of the Earth, which includes sea surface) (grib1/3.table)
indicatorOfTypeOfLevel = 1;
level = 0;
# P1 occupies octets 19 and 20; product valid at reference time + P1 (grib1/5.table)
timeRangeIndicator = 10;
# Unknown code table entry ()
subCentre = 0;
paramId = 151131;
#-READ ONLY- cfName = *eastward_sea_water_velocity;*
#-READ ONLY- cfVarName = *uoe;*
#-READ ONLY- units = m s**-1;
#-READ ONLY- name = Eastward sea water velocity;
decimalScaleFactor = 0;
dataDate = 20150601;
dataTime = 2300;
# Hour (stepUnits.table)
stepUnits = 1;
stepRange = 0;
startStep = 0;
endStep = 0;
#-READ ONLY- marsParam = 131.151;
shortName = ocu;
that looks promising to me... however, if I open that in my viewer, it is now interpeted as "Surface lifted index".
So I was able to change the parameter, but not how I wanted. What am I missing here?
thanks
Thomas
| output_ex.4.grb (384 KB) output_ex.4.grb |
RE: struggling to convert sea current NetCDF to grb - Added by Thomas Goerlich 11 months ago
fixed it... table2version=3, indicatorOfParameter=49 / 50 does the trick