Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate month fix #21

Merged
merged 4 commits into from
Sep 9, 2024
Merged

Validate month fix #21

merged 4 commits into from
Sep 9, 2024

Conversation

kiihne-noaa
Copy link
Contributor

Added two lines that cause validate step to return a more detailed error message when Months used as time step in yaml file. This message states that month chunks are not implemented yet.

Copy link
Contributor

@ceblanton ceblanton left a comment

Choose a reason for hiding this comment

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

Thanks for looking at this! I agree there is a problem, and the problem is that there are differing days per month. But history file segments in months ARE supported and somewhat common.

A better solution would be to compare the months. So get the months for the big chunk and small chunk and then do the modulo. You can get the years with duration.years and months with duration.years * 12 + duration.months.

Does that make sense?

duration = parse.DurationParser().parse('P1M')
duration
<metomi.isodatetime.data.Duration: P1M>
duration.years
0
duration.months
1
duration = parse.DurationParser().parse('P1M')
duration.months
1
duration = parse.DurationParser().parse('P1Y')
duration.months
0
duration.years
1

big_chunk and small_chunk are now broken into months before division.
@kiihne-noaa
Copy link
Contributor Author

Thanks for looking at this! I agree there is a problem, and the problem is that there are differing days per month. But history file segments in months ARE supported and somewhat common.

A better solution would be to compare the months. So get the months for the big chunk and small chunk and then do the modulo. You can get the years with duration.years and months with duration.years * 12 + duration.months.

Does that make sense?

duration = parse.DurationParser().parse('P1M')
duration
<metomi.isodatetime.data.Duration: P1M>
duration.years
0
duration.months
1
duration = parse.DurationParser().parse('P1M')
duration.months
1
duration = parse.DurationParser().parse('P1Y')
duration.months
0
duration.years
1

I have implemented changes based on this. Does this now look good to you?

Copy link
Contributor

@ceblanton ceblanton left a comment

Choose a reason for hiding this comment

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

Looks good, but the variable names still have "days" in them. Can you update for our future selves?

changed days to months in variable names
@ceblanton
Copy link
Contributor

This is definitely ready, @kiihne-noaa , so I'm going to click "ready for review" and merge it.

@ceblanton ceblanton marked this pull request as ready for review September 9, 2024 15:33
@ceblanton ceblanton merged commit b81338e into main Sep 9, 2024
@ilaflott ilaflott deleted the validate_month_fix branch September 9, 2024 15:52
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.

2 participants