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 dtype is preserved after regridding #239

Merged
merged 12 commits into from
May 29, 2024

Conversation

stephenworsley
Copy link
Contributor

Adresses #238.

@stephenworsley
Copy link
Contributor Author

Note: this will still change the dtype if you start with integer data (by design). This does mean that the dask array also will have to be changed to better align with the underlying data in this case. This should be a seperable issue which can be addressed in its own PR.

@codecov
Copy link

codecov bot commented Feb 22, 2023

Codecov Report

Attention: Patch coverage is 98.71795% with 1 line in your changes missing coverage. Please review.

Project coverage is 98.85%. Comparing base (a50b2b8) to head (b587641).
Report is 16 commits behind head on main.

Files with missing lines Patch % Lines
esmf_regrid/schemes.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #239      +/-   ##
==========================================
- Coverage   98.85%   98.85%   -0.01%     
==========================================
  Files          36       37       +1     
  Lines        3855     3929      +74     
==========================================
+ Hits         3811     3884      +73     
- Misses         44       45       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@pp-mo pp-mo left a comment

Choose a reason for hiding this comment

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

I'm not convinced that there aren't a few more cases to address here. I think I would create test examples where both weights + source_array can be integer / float32 / float64, and check that output dtypes are as expected in all those cases.
But I may have missed that dtypes for the weights array are always known, or more limited ?

esmf_regrid/esmf_regridder.py Outdated Show resolved Hide resolved
esmf_regrid/esmf_regridder.py Outdated Show resolved Hide resolved
@github-actions
Copy link
Contributor

@SciTools-incubator/esmf-regrid-devs This pull-request is stale due to a lack of activity in the last 90 days. Remove stale label or comment, otherwise this pull-request will close automatically in 7 days time.

@github-actions github-actions bot added the Stale: Closure warning This stale issue or pull-request has been marked for closure label May 29, 2023
@stephenworsley stephenworsley removed the Stale: Closure warning This stale issue or pull-request has been marked for closure label May 30, 2023
@trexfeathers trexfeathers linked an issue Jun 21, 2023 that may be closed by this pull request
@trexfeathers trexfeathers assigned HGWright and unassigned pp-mo Sep 20, 2023
@CLAassistant
Copy link

CLAassistant commented Oct 26, 2023

CLA assistant check
All committers have signed the CLA.

stephenworsley and others added 5 commits April 25, 2024 15:13
* main: (42 commits)
  Update lockfiles and fix for new esmpy (SciTools#342)
  Fix for esmpy (SciTools#353)
  Fix usage of map_blocks (SciTools#338)
  Revert "Updated environment lockfiles (SciTools#335)" (SciTools#341)
  Updated environment lockfiles (SciTools#335)
  Bump actions/cache from 3 to 4 (SciTools#333)
  Bump actions/upload-artifact from 3 to 4 (SciTools#324)
  Bump actions/stale from 8.0.0 to 9.0.0 (SciTools#322)
  fix asv (SciTools#339)
  [pre-commit.ci] pre-commit autoupdate (SciTools#330)
  Bump scitools/workflows from 2023.09.0 to 2024.01.0 (SciTools#334)
  Updated environment lockfiles (SciTools#327)
  [pre-commit.ci] pre-commit autoupdate (SciTools#328)
  Updated environment lockfiles (SciTools#304)
  Add CITATION.cff (SciTools#319)
  updated for enums (SciTools#293)
  Flake8 compliant type checking. (SciTools#316)
  update to v0.10.dev0 (SciTools#314)
  Update to v0.9 (SciTools#313)
  First pass at mesh to mesh (SciTools#311)
  ...

# Conflicts:
#	CHANGELOG.md
#	esmf_regrid/esmf_regridder.py
#	esmf_regrid/schemes.py
Copy link
Member

@pp-mo pp-mo left a comment

Choose a reason for hiding this comment

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

Basically OK except for a possible tidy in the tests.

esmf_regrid/tests/unit/schemes/test_ESMFAreaWeighted.py Outdated Show resolved Hide resolved
esmf_regrid/schemes.py Show resolved Hide resolved
* main:
  Move benchmark code from nox to bm_runner (SciTools#361)
  Bump scitools/workflows from 2024.01.0 to 2024.04.3 (SciTools#356)
  Bump peter-evans/create-pull-request from 5.0.2 to 6.0.5 (SciTools#355)
  [pre-commit.ci] pre-commit autoupdate (SciTools#336)
  Updated environment lockfiles (SciTools#344)

# Conflicts:
#	CHANGELOG.md
@pp-mo pp-mo merged commit cf86c1d into SciTools:main May 29, 2024
16 checks passed
stephenworsley added a commit to stephenworsley/iris-esmf-regrid that referenced this pull request May 30, 2024
* main:
  Ensure dtype is preserved after regridding (SciTools#239)
stephenworsley added a commit to stephenworsley/iris-esmf-regrid that referenced this pull request Jul 18, 2024
* main:
  Bump scitools/workflows from 2024.06.0 to 2024.06.5 (SciTools#377)
  Fix typo (SciTools#371)
  Bump scitools/workflows from 2024.04.3 to 2024.06.0 (SciTools#365)
  Update to v0.11.dev0. (SciTools#363)
  Update to v0.10.0 (SciTools#362)
  Extend regridder saving/loading to all regridders (SciTools#357)
  Ensure dtype is preserved after regridding (SciTools#239)
  Move benchmark code from nox to bm_runner (SciTools#361)

# Conflicts:
#	esmf_regrid/schemes.py
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 of regridded cube changes after realizing the data
4 participants