1

I am using GDAL to process grib2 data. This data is downloaded from NCEP using HTTP random access based on the byte ranges specified in the index file for each grib file. This .idx file looks like this:

1:0:d=2019101400:PRMSL:mean sea level:30 hour fcst:
2:2285226:d=2019101400:REFD:263 K level:30 hour fcst:
3:2892001:d=2019101400:PRES:1 hybrid level:30 hour fcst:
4:5329680:d=2019101400:CLWMR:1 hybrid level:30 hour fcst:
5:5615579:d=2019101400:CICE:1 hybrid level:30 hour fcst:
6:5880098:d=2019101400:RWMR:1 hybrid level:30 hour fcst:
7:6228703:d=2019101400:SNMR:1 hybrid level:30 hour fcst:
8:6478687:d=2019101400:REFD:1 hybrid level:30 hour fcst:
9:7924976:d=2019101400:TCOND:1 hybrid level:30 hour fcst:
10:8217813:d=2019101400:RIME:1 hybrid level:30 hour fcst:
11:8510802:d=2019101400:HGT:1 hybrid level:30 hour fcst:
12:9925562:d=2019101400:TMP:1 hybrid level:30 hour fcst:
13:12075121:d=2019101400:RH:1 hybrid level:30 hour fcst:
14:14803802:d=2019101400:SPFH:1 hybrid level:30 hour fcst:
15.1:17668539:d=2019101400:UGRD:1 hybrid level:30 hour fcst:
15.2:17668539:d=2019101400:VGRD:1 hybrid level:30 hour fcst:
16:21815010:d=2019101400:VVEL:1 hybrid level:30 hour fcst:

For some models, there is an issue which is shown in the above example. Band 15 has two sub-bands, with identical byte markers. I am not sure how to extract the data pertaining to UGRD and VRGD separately. I have not encountered any documentation that describes this.

Opening the associated grib2 file with GDAL splits those bands up properly, so they are definitely isolated datasets.

2
  • They are u and v components of a vectorial dimension variable. How are you extracting the other messages? Dec 13, 2019 at 21:19
  • 1
    I had to stew on this comment for a bit, but yeah, it makes sense... I guess I have confused IDX file ranges with being per-band, but they are per-variable. So when you pull index 15 (15.1-15.2) you get two bands as the components (ugrd + vgrd) of the variable. So basically, yeah, there's no way to pull each band out specifically but you can at least pull ugrd + vgrd out and be left with two bands that you can parse out, which I didn't realize at first.
    – Thomas
    Jan 21, 2020 at 23:19

1 Answer 1

1

Per Gabriel's comment on my question, there is no way to pull out UGRD or VGRD specifically, however if you specify the range that contains both of them, you get a GRIB2 file with two bands. You can then parse each band to retrieve UGRD or VGRD. This adds an extra step if you are using IDX files to retrieve individual bands, but not bad.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.