Converting netcdf file to grib2
Added by Alton Daley over 4 years ago
Hello,
I am trying to convert a NetCDF file with cloud mask information to grb2. However, I am having a few problems. I first tried the command:
cdo -b 16 -f grb2 copy OR_ABI-L2-ACMC-M6_G16_s20200530901153_e20200530903526_c20200530904317.nc file.grb2
and got the result:
!!! grib_set_string( grib_handle* h, "cfName", "cloud_binary_mask") !!!
Warning (gribapiDefParam): grib_api: No match for cfName=cloud_binary_mask
ECCODES ERROR : concept: no match for shortName=BCM
ECCODES ERROR : concept: input handle edition=1
!!! grib_set_string( grib_handle* h, "shortName", "BCM") !!!
Warning (gribapiDefParam): grib_api: No match for shortName=BCM
Additionally, it seems like my grid may not be supported. Would you be able to assist me, please?
Thanks,
Alton
Replies (5)
RE: Converting netcdf file to grib2 - Added by Ralf Mueller over 4 years ago
hi Alton!
- your input is not CF-conform, you can check it with
cdo sinfov ...
- grib1/2 is self-decribing format like netcdf - you have to use certain
standard_name
values, because grib only allows a certain catalogue of variables (https://apps.ecmwf.int/codes/grib/param-db)
hth
ralf
RE: Converting netcdf file to grib2 - Added by Alton Daley over 4 years ago
Thanks Ralf,
I managed to make the necessary changes with nco. I had to change the variable name as well as the standard name with the commands.
ncrename -h -O -v old_var_name,new_var_name file_input.nc
and
ncatted -a standard_name,~,o,c,"standard_name" file_input.nc
The issue is now remapping my grid.
I tried this recommendation.
cdo -f nc -sellonlatbox,lon1,lon2,lat1,lat2 -random,r1440x720 template.nc
cdo -remapcon,template.nc input.nc output.nc
and the result was:
cdo remapcon (Abort): Unsupported projection coordinates (Variable: ctoph)!
Do you have any recommendations as to how to solve this problem?
Thanks,
Alton
RE: Converting netcdf file to grib2 - Added by Ralf Mueller over 4 years ago
hi Alton!
I am no expert when it comes to projections, sorry. But I cannot commend on your error, because the initially uploaded files does not have any variable called 'ctoph'.
cheers
ralf
RE: Converting netcdf file to grib2 - Added by Alton Daley over 4 years ago
Ok, I will attach the file that has this variable in it so you can have a better look.
Thanks,
Alton
RE: Converting netcdf file to grib2 - Added by Alton Daley over 4 years ago
The grids I have are attached below:
# gridID 1 # gridtype = projection gridsize = 150000 xsize = 500 ysize = 300 xname = x xlongname = "GOES Projection x-Coordinate" xunits = "rad" yname = y ylongname = "GOES Projection y-Coordinate" yunits = "rad" xfirst = -0.10122 xinc = 0.00028 yfirst = 0.1281 yinc = -0.00028 scanningMode = 64 grid_mapping = goes_imager_projection grid_mapping_name = geostationary long_name = "GOES-R ABI fixed grid projection" perspective_point_height = 35786023. semi_major_axis = 6378137. semi_minor_axis = 6356752.31414 inverse_flattening = 298.2572221 latitude_of_projection_origin = 0. longitude_of_projection_origin = -75. sweep_angle_axis = "x" # # gridID 2 # gridtype = generic gridsize = 2 xsize = 2 scanningMode = 64 # # gridID 3 # gridtype = projection gridsize = 1 datatype = float ysize = 1 yname = y_image ylongname = "GOES-R fixed grid projection y-coordinate center of image" yunits = "rad" yvals = 0.08624 scanningMode = 64 grid_mapping = goes_imager_projection grid_mapping_name = geostationary long_name = "GOES-R ABI fixed grid projection" perspective_point_height = 35786023. semi_major_axis = 6378137. semi_minor_axis = 6356752.31414 inverse_flattening = 298.2572221 latitude_of_projection_origin = 0. longitude_of_projection_origin = -75. sweep_angle_axis = "x" # # gridID 4 # gridtype = generic gridsize = 1 datatype = float xsize = 1 ysize = 1 xname = x_image xlongname = "GOES-R fixed grid projection x-coordinate center of image" xunits = "rad" yname = y_image ylongname = "GOES-R fixed grid projection y-coordinate center of image" yunits = "rad" xvals = -0.03136 yvals = 0.08624 scanningMode = 64 gridtype = projection gridsize = 1 datatype = float ysize = 1 yname = y_image ylongname = "GOES-R fixed grid projection y-coordinate center of image" yunits = "rad" yvals = 0.08624 scanningMode = 64 grid_mapping = goes_imager_projection grid_mapping_name = geostationary long_name = "GOES-R ABI fixed grid projection" perspective_point_height = 35786023. semi_major_axis = 6378137. semi_minor_axis = 6356752.31414 inverse_flattening = 298.2572221 latitude_of_projection_origin = 0. longitude_of_projection_origin = -75. sweep_angle_axis = "x"
I suspect that the first grid is the correct one but the coordinate system seems to be in radians. I think if there is a way to convert to degrees this may work.