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

[met downscaling] Fix for non-hour timesteps in cfmet.downscale.daily #3270

Merged
merged 1 commit into from
Mar 7, 2024

Conversation

infotroph
Copy link
Member

@infotroph infotroph commented Mar 7, 2024

I think this was a flipped multiply/divide -- the now-replaced 0:(23 * output.dt)/output.dt (which has been there for a looong time!) works when output.dt == 1, but gives too many rows for larger timesteps.

I assume the original intention was to write 0:(23/output.dt)*output.dt, but I replaced it with seq(0, 23, by = output.dt) -- that behaves identically and is a lot clearer to me.

Motivation and Context

Noticed while reviewing #3218

Review Time Estimate

  • Immediately
  • Within one week
  • When possible

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • My name is in the list of CITATION.cff
  • I have updated the CHANGELOG.md.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

I bet the intention was to write 0:(23/output.dt)*output.dt,
which produces same output as this seq call.
Copy link
Member

@mdietze mdietze left a comment

Choose a reason for hiding this comment

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

Bonus points for adding a unit test!

@mdietze mdietze added this pull request to the merge queue Mar 7, 2024
@infotroph
Copy link
Member Author

Bonus points for adding a unit test!

This one was a poster child for test-driven development: I saw some funny behavior, wrote the test to decide whether it was a bug, and the answer was yes. I wish they were all this easy to test!

Merged via the queue into PecanProject:develop with commit ffd96be Mar 7, 2024
12 checks passed
@infotroph infotroph deleted the downscale-daily-timesteps branch May 18, 2024 20:40
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