MetOffice / monio

Met Office NetCDF I/O (MONIO) written in C++ for file I/O in JEDI-based DA (JADA).
BSD 3-Clause "New" or "Revised" License
3 stars 2 forks source link

Give information when a time cannot be found in a file. #47

Closed mo-joshuacolclough closed 2 months ago

mo-joshuacolclough commented 2 months ago

Description

When a time cannot be found in a file, MONIO throws:

Reader::findTimeStep()> DateTime specified not located in file...

But this doesn't give any information on why the time is not in the file, so it takes some investigating. This PR changes this so that MONIO outputs what times it has available, and what was requested, so it can be compared.

4: Reader::findTimeStep()> DateTime specified not located in file...
4:   Time specified: 2021-06-01T10:00:00Z
4:   Times available:
4:   - 2021-06-01T22:00:00Z
4:   - 2021-06-01T23:00:00Z
4:   - 2021-06-02T00:00:00Z
4:   - 2021-06-02T01:00:00Z
4:   - 2021-06-02T02:00:00Z
4:   - 2021-06-02T03:00:00Z
4:   - 2021-06-02T04:00:00Z
4:   - 2021-06-02T05:00:00Z
4:   - 2021-06-02T06:00:00Z
4:   - 2021-06-02T07:00:00Z
4:   - 2021-06-02T08:00:00Z
4:   - 2021-06-02T09:00:00Z
4:   - 2021-06-02T10:00:00Z
4:   - 2021-06-02T11:00:00Z
4:   - 2021-06-02T12:00:00Z
4:   - 2021-06-02T13:00:00Z
4:   - 2021-06-02T14:00:00Z
4:   - 2021-06-02T15:00:00Z

Issue

Resolves #46

mo-joshuacolclough commented 2 months ago

Testing: http://fcm1/cylc-review/taskjobs/jcolclou/?suite=monio_datetime_err_2509

mo-joshuacolclough commented 2 months ago

Thanks Matt, I like the suggestion of YAML-formatted output. I've changed it to output your first suggestion. Cheers. (Re-testing now... I'll post when done)

mo-joshuacolclough commented 2 months ago

Tests: http://fcm1/cylc-review/cycles/jcolclou/?suite=monio_datetime_err__2609

New error output (noticed I missed a space 3fe29c9):

4: Reader::findTimeStep()> DateTime specified not located in file...
4:   Time specified: 2021-06-01T10:00:00Z
4:   Times available:
4:   - 2021-06-01T22:00:00Z
4:   - 2021-06-01T23:00:00Z
4:   - 2021-06-02T00:00:00Z
4:   - 2021-06-02T01:00:00Z
4:   - 2021-06-02T02:00:00Z
4:   - 2021-06-02T03:00:00Z
4:   - 2021-06-02T04:00:00Z
4:   - 2021-06-02T05:00:00Z
4:   - 2021-06-02T06:00:00Z
4:   - 2021-06-02T07:00:00Z
4:   - 2021-06-02T08:00:00Z
4:   - 2021-06-02T09:00:00Z
4:   - 2021-06-02T10:00:00Z
4:   - 2021-06-02T11:00:00Z
4:   - 2021-06-02T12:00:00Z
4:   - 2021-06-02T13:00:00Z
4:   - 2021-06-02T14:00:00Z
4:   - 2021-06-02T15:00:00Z