SciTools / iris-grib

GRIB interface for Iris.
https://iris-grib.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
22 stars 43 forks source link

Incomplete hybrid levels should still produce 3-dim cube #134

Open marfel opened 5 years ago

marfel commented 5 years ago

Hi, I have some apparently improperly defined hybrid level GRIB2 files here:

  # Hybrid level (grib2/tables/5/4.5.table)  
  typeOfFirstFixedSurface = 105;
  #-READ ONLY- unitsOfFirstFixedSurface = unknown;
  #-READ ONLY- nameOfFirstFixedSurface = Hybrid level;
  scaleFactorOfFirstFixedSurface = 0;
  scaledValueOfFirstFixedSurface = 1;
  # Missing (grib2/tables/5/4.5.table)  
  typeOfSecondFixedSurface = 255;
  #-READ ONLY- unitsOfSecondFixedSurface = unknown;
  #-READ ONLY- nameOfSecondFixedSurface = Missing;
  scaleFactorOfSecondFixedSurface = MISSING;
  scaledValueOfSecondFixedSurface = MISSING;

Obviously there is no way of correctly assigning pressure or anything to these surfaces, but it would still be very helpful if they could be parsed as a single cube with scaledValueOfFirstFixedSurface specifiying the third dimension coordinate. Instead they come out as individual 2-dim cubes:

 air_pressure / (Pa)                 (projection_y_coordinate: 429; projection_x_coordinate: 499)
     Dimension coordinates:
          projection_y_coordinate                           x                             -
          projection_x_coordinate                           -                             x
     Scalar coordinates:
          forecast_period: 1 hours
          forecast_reference_time: 2018-08-31 23:00:00
          time: 2018-09-01 00:00:00

Is there a workaround for this?

trexfeathers commented 1 year ago

Hi @marfel, we've just picked this up while doing some tidy-up. Sorry no-one ever got back to you, is this still an issue you would like solved?

marfel commented 1 year ago

Wow, thank you! I didn't think anyone would be interested in this after such a long time ;) I'm actually not sure if we still use the data I was referring to (might have been the COSMO REA6 reanalysis), but in principle the issue is still valid. As a workaround, I have disabled the factories that were supposed to generate the pressure levels. IMHO such extra processing should be optional, also because of performance when reading lots of files. We have been working with a patched version of iris-grib for several years now, merging the main branch into it from time to time. If you want to have a look at it, maybe I should upload it as a branch? Perhaps you find some of the modifications useful.

trexfeathers commented 1 year ago

Thanks @marfel for the intriguing offer, we're just waiting for our Iris-GRIB lead to have some time to consider this. Ping @lbdreyer

trexfeathers commented 1 year ago

Hi @marfel, we'd love to take a look at your patched version. Although as you've guessed, the spare resource for Iris-GRIB is limited, so we might not end up incorporating to modifications any time soon.

If you discover future issues, we'd still love to hear from you in an issue or PR - rest assured there is someone listening!

Incidentally we have recently improved the performance of hybrid height factories adding to Cubes - SciTools/iris#4718.

marfel commented 1 year ago

Thanks! Sorry I'm not very well versed in the way of github, but it seems I'm not allowed to push a new branch? Here is the output of

git format-patch origin/main -o /tmp/marfel

marfel.zip

Hope this helps?

trexfeathers commented 1 year ago

Thanks @marfel 🙂

... it seems I'm not allowed to push a new branch?

Yes, the typical work pattern in GitHub is users to have their own copies of a repo under their user name (these are normally forks, but in your case perhaps an independent copy). Is there any chance of you uploading your version of iris-grib to your own user space, then occasionally updating it? That would allow the smoothest collaboration.

os-simopt commented 1 year ago

Good day,

I am a colleague of marfel, who asked me to create the fork and add his modification. You can find it here:

https://github.com/os-simopt/iris-grib