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

Ensure most_common returns correct dtype #53

Merged
merged 7 commits into from
Oct 23, 2024
Merged

Conversation

BSchilperoort
Copy link
Contributor

@BSchilperoort BSchilperoort commented Oct 21, 2024

Fixes #52

I had forgotten to expose fill_value. Additionally, the .where call in restore_properties casts the data to NaN even when the data can cover the target grid.

With this PR, when using most_common:

  • if the grid can be covered the dtype should stay the same
  • if the grid cannot be covered and fill_value is None, the result will be cast to float and the user is warned
  • if the grid cannot be covered and fill_value is provided, the uncovered grid cells are filled with the fill_value

@BSchilperoort BSchilperoort requested a review from slevang October 22, 2024 12:57
@BSchilperoort BSchilperoort merged commit f2120b8 into main Oct 23, 2024
11 checks passed
@BSchilperoort
Copy link
Contributor Author

Thanks for the review @slevang !

@BSchilperoort BSchilperoort deleted the most-common-dtype branch October 23, 2024 06:01
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.

dtype changes after most_common
2 participants