Skip to content

Conversation

mo-joshuacolclough
Copy link
Contributor

@mo-joshuacolclough mo-joshuacolclough commented Sep 25, 2024

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
Copy link
Contributor Author

Copy link
Collaborator

@matthewrmshin matthewrmshin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice exception. Thanks.

One minor suggestion to consider, feel free to ignore. I'd prefer a YAML or fixed length indentation format (as opposed to a hanging indentation) to present the times available? What do you think? E.g.:

# Either:
Times available:
- 2024-09-25T18:00Z
-  ...
# Or:
Times available: {
  "2024-09-25T18:00Z",
  "..."
}

@mo-joshuacolclough
Copy link
Contributor Author

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
Copy link
Contributor Author

mo-joshuacolclough commented Sep 26, 2024

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

@phlndrwd phlndrwd merged commit 808e2bf into develop Oct 3, 2024
4 checks passed
@phlndrwd phlndrwd deleted the feature/verbose_time_error branch October 3, 2024 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

If a time cannot be found, print out times that are available.
4 participants