SST data converted from netCDF to grib2 format - metadata scrambled

Topics related to running the ungrib.exe program
Post Reply
kprince
Posts: 5
Joined: Tue Dec 03, 2019 2:56 am

SST data converted from netCDF to grib2 format - metadata scrambled

Post by kprince » Wed Feb 26, 2020 7:06 pm

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.

bartbrashers
Posts: 73
Joined: Wed Aug 08, 2018 2:21 pm

Re: Issue reading in SST data

Post by bartbrashers » Thu Feb 27, 2020 10:30 pm

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/UKM ... 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.

ntmanhvn181
Posts: 47
Joined: Thu Jul 04, 2019 4:07 am

Re: SST data converted from netCDF to grib2 format - metadata scrambled

Post by ntmanhvn181 » Wed Jan 13, 2021 11:31 am

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,

bartbrashers
Posts: 73
Joined: Wed Aug 08, 2018 2:21 pm

Re: SST data converted from netCDF to grib2 format - metadata scrambled

Post by bartbrashers » Wed Jan 13, 2021 7:01 pm

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 ... &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

Post Reply

Return to “ungrib”