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

Only try to work out the differences between points for multiple #4367

Merged
merged 4 commits into from
Nov 29, 2021

Conversation

wjbenfold
Copy link
Contributor

@wjbenfold wjbenfold commented Oct 12, 2021

🚀 Pull Request

Description

Causes iris.util.points_step to check whether there are multiple points to check before trying (thus averting a warning is caused by only one point being provided).

Fixes #4250.

Questions for reviewer

  • Is it better to apply the fix here, or to apply it in coords.from_regular and thus leave this so that it warns when called with a single point (albeit cryptically) so that people calling it are aware that they may not be doing what they meant? I personally think that the np.nan return value of avdiff (which matches the current behaviour) is sufficient.

Consult Iris pull request check list

Copy link
Member

@bjlittle bjlittle left a comment

Choose a reason for hiding this comment

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

@wjbenfold Awesome! Thanks for picking up this PR 😄

Just a few minor suggestions to service, and perhaps bolster the iris.tests.unit.util.test__coord_regular.Test_points_step class with some minimal test coverage?

Then we're good to go 👍

lib/iris/util.py Outdated Show resolved Hide resolved
lib/iris/util.py Outdated Show resolved Hide resolved
lib/iris/util.py Show resolved Hide resolved
@wjbenfold
Copy link
Contributor Author

Changes made as requested. Unit tests raised questions of what the correct behaviour with an empty array supplied is.

Will rebase then fix whatsnew once @bjlittle is happy with everything else

@rcomer
Copy link
Member

rcomer commented Oct 18, 2021

@wjbenfold if you change “Fixes issue #4250” to “Fixes #4250” in your original post, it should link it so the issue gets closed automatically when this is merged. See https://docs.github.com/en/[email protected]/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword

@wjbenfold wjbenfold force-pushed the wjbenfold-coord-regular-warn branch from 3f97027 to fe2cb9a Compare October 22, 2021 12:24
@lbdreyer
Copy link
Member

This looks good to go! I'd like to get it merged. @wjbenfold could I ask you to rebase to resolve the conflicting files?

wjbenfold pushed a commit to wjbenfold/iris that referenced this pull request Nov 26, 2021
@wjbenfold wjbenfold force-pushed the wjbenfold-coord-regular-warn branch from fe2cb9a to 04b388d Compare November 26, 2021 17:31
bjlittle pushed a commit that referenced this pull request Nov 29, 2021
@bjlittle bjlittle merged commit 91b01be into SciTools:main Nov 29, 2021
@rcomer
Copy link
Member

rcomer commented Nov 29, 2021

Thanks All for sorting this 😊

tkknight added a commit to tkknight/iris that referenced this pull request Dec 7, 2021
* main:
  [pre-commit.ci] pre-commit autoupdate (SciTools#4452)
  Whatsnew (SciTools#4451)
  Explicitly define tests so nose can find them (SciTools#4450)
  Updated environment lockfiles (SciTools#4449)
  Update CI environment lockfiles (SciTools#4424)
  Disable GHA workflows on non-SciTools branches (SciTools#4444)
  Add new contributor to whatsnew (SciTools#4443)
  Use dask-core instead of dask in ci (SciTools#4434)
  Mesh recombine (SciTools#4437)
  Mesh full comparison (SciTools#4439)
  Only try to work out the differences between points for multiple (SciTools#4367)
  [pre-commit.ci] pre-commit autoupdate (SciTools#4430)
  Fix license PyPI classifier (SciTools#4435)
  Whatsnew for PR SciTools#4367 (SciTools#4440)
@wjbenfold wjbenfold deleted the wjbenfold-coord-regular-warn branch December 14, 2021 16:07
tkknight added a commit to tkknight/iris that referenced this pull request Dec 14, 2021
* upstream/main: (78 commits)
  Updated environment lockfiles (SciTools#4458)
  remove asv package dependency (SciTools#4456)
  cube.aggregated_by output bounds (SciTools#4315)
  [pre-commit.ci] pre-commit autoupdate (SciTools#4452)
  Whatsnew (SciTools#4451)
  Explicitly define tests so nose can find them (SciTools#4450)
  Updated environment lockfiles (SciTools#4449)
  Update CI environment lockfiles (SciTools#4424)
  Disable GHA workflows on non-SciTools branches (SciTools#4444)
  Add new contributor to whatsnew (SciTools#4443)
  Use dask-core instead of dask in ci (SciTools#4434)
  Mesh recombine (SciTools#4437)
  Mesh full comparison (SciTools#4439)
  Only try to work out the differences between points for multiple (SciTools#4367)
  [pre-commit.ci] pre-commit autoupdate (SciTools#4430)
  Fix license PyPI classifier (SciTools#4435)
  Whatsnew for PR SciTools#4367 (SciTools#4440)
  Suggest type hinting (SciTools#4390)
  area weight regrid test fixes (SciTools#4432)
  Update latest.rst (SciTools#4425)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Avoid warning when creating a coordinate with one point
4 participants