netcdf-java icon indicating copy to clipboard operation
netcdf-java copied to clipboard

[5.x]: Fix GRIB IOSP so time coords are monotonically increasing, for 1-D time datasets only

Open ethanrd opened this issue 3 years ago • 1 comments

Description of Changes

Fix GRIB IOSP code that creates time coordinate variables from a set of irregularly overlapping time intervals to ensure the resulting time coordinate is monotonically increasing. This fix only applies to datasets with 1-D time (not FMRCs with 2-D time).

Rather than simply using the interval mid-points, start with the mid-points and then use the current and previous time intervals to ensure the resulting time coordinate is monotonically increasing.

This change includes test and test dataset. Test passes with this change.

PR Checklist

  • [x] Indicate the version associated with this PR in the Title (e.g. "[5.x]: This is my PR title")
  • [x] Link to any issues that the PR addresses
  • [x] Add labels, especially if the PR should be ported to other versions (these labels start with "port: ")
  • [x] Open as a draft PR until ready for review
  • [x] Make sure GitHub tests pass
  • [x] Mark PR as "Ready for Review"

ethanrd avatar Aug 26 '22 23:08 ethanrd

This PR addresses part of issue #1060; it addresses datasets with 1-D time. (PR for 2-D time datasets still to come.)

ethanrd avatar Aug 26 '22 23:08 ethanrd

Thanks Tara @tdrwenski !

ethanrd avatar Dec 22 '22 17:12 ethanrd