Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

SST data converted from netCDF to grib2 format - metadata scrambled

This post was from a previous version of the WRF&MPAS-A Support Forum. New replies have been disabled and if you have follow up questions related to this post, then please start a new thread from the forum home page.

kprince

New member
Hi all,

I am reading in some quarter degree SST data which was originally in netCDF format and I converted over to grib2 format using the Iris package in Python. The Python script does successfully convert the data over to grib2 format, however the metadata appears to have gotten mixed up in the conversion process. The output from the g2print command produces:

ungrib - grib edition num 2
reading from grib file =
avhrr-only-v2.20170909.grib2

UKMO
-------------------------------------------------------------------------------
--------
rec Prod Cat Param Lvl Lvl Lvl Prod Name Time
Fcst
num Disc num code one two Templ
hour
-------------------------------------------------------------------------------
--------
1 255 255 255 103 0 0 0 IMGD 2017-09-09_00:00:00 00


Successful completion of g2print

With IMGD being the name and the parameter number being 255 (or missing). Additionally the level code is set as 103, when it should be either 1 (surface) or 102 (sea-level) however I am not sure which. I have come here with the hopes that somebody on here has dealt with this issue in the past and may have some suggestions on what to do, whether it be rewriting the Vtable for reading in the SST, or rewriting the metadata to something that ungrib will accept.
 
When I have SST data in netCDF format (e.g. the many GHRSST datasets at JPL, including the UKMO SST product at https://podaac.jpl.nasa.gov/dataset/UKMO-L4HRfnd-GLOB-OSTIA) I simply convert them to WPS intermediate file format. That skips storing them in yet another file format (GRIB2). However, you have to interpolate them yourself every interval_seconds. I've written Fortran programs to do those two steps, and I have plans to add the ability to sub-set geographically so the temporary SST:YYYY-MM-DD_HH files aren't larger than they need to be. Maybe after that's done I'll post it somewhere, if I can find an appropriate place. Contact me offline if you think my code could be helpful to you.
 
Hi bartbrashers,
I also using SST data for WPS, however I have a problem when convert the sst .nc files to grib file.
Can you kindly teach me how to convert the sst .nc files to the intermediate files for WPS.
Thank you in advance!
Bests,
 
I wrote a program that will read GHRSST (the Global High Resolution Sea Surface Temperature project) files that come in a self-consistent netCDF format, and convert them to WPS Intermediate file format version 5. It does not convert them to GRIB.

The idea here is that we write a program to replace UNGRIB.EXE, to write files in the same format that UNGRIB writes. The only benefit to using UNGRIB is that it also interpolates in time. Why UNGRIB does time interpolation while METGRID does that spatial interpolation is a question for the WRF developers.

In my experience, it's hard to find a program that converts netCDF to GRIB while also getting the GRIB codes right.

See https://github.com/bbrashers, where you can find the packages WPS-ghrsst-to-intermediate, and WPS-interp-intermediate.

The first one converts the files that can be downloaded from https://podaac.jpl.nasa.gov/datasetlist?ids=ProcessingLevel&values=*4*&search=GHRSST&view=list to WPS intermediate file format v5. The second can do time interpolation.

Caution: we've had some problems with GHRSST files downloaded using the THREDDS pathway, if you ask for more than 1 day in each file.

Bart
 
Top