Skip to content

Removed deprecated functions, deprecate testing.open_dataset #2139

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

Zeitsperre
Copy link
Collaborator

@Zeitsperre Zeitsperre commented Mar 31, 2025

Pull Request Checklist:

  • This PR addresses an already opened issue (for bug fixes / features)
    • This PR fixes #xyz
  • Tests for the changes have been added (for bug fixes / features)
    • (If applicable) Documentation has been added / updated (for bug fixes / features)
  • CHANGELOG.rst has been updated (with summary of main changes)
    • Link to issue (:issue:number) and pull request (:pull:number) has been added

What kind of change does this PR introduce?

  • Removes the deprecated sfcwind_2_uas_vas and uas_vas_2_sfcwind converter functions.
  • Adds a deprecation notice to xclim.testing.open_dataset to be removed in a future version

Does this PR introduce a breaking change?

Yes. Functions that were previously deprecated have been removed. Suggestions have been made to use the nimbus class to manage fetching testing data.

@Zeitsperre Zeitsperre added the standards / conventions Suggestions on ways forward label Mar 31, 2025
@Zeitsperre Zeitsperre added this to the v0.57.0 milestone Mar 31, 2025
@Zeitsperre Zeitsperre self-assigned this Mar 31, 2025
@github-actions github-actions bot added the indicators Climate indices and indicators label Mar 31, 2025
@Zeitsperre Zeitsperre requested review from aulemahal and coxipi April 1, 2025 15:52
@github-actions github-actions bot added the sdba Issues concerning the sdba submodule. label Apr 4, 2025
Copy link
Contributor

@coxipi coxipi left a comment

Choose a reason for hiding this comment

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

approved!

@@ -69,13 +69,12 @@ def open_dataset(nimbus): # numpydoc ignore=PR01
"""

def _open_session_scoped_file(file: str | os.PathLike, **xr_kwargs):
nimbus_kwargs = dict(branch=TESTDATA_BRANCH, repo=TESTDATA_REPO_URL, cache_dir=nimbus.path)
Copy link
Contributor

@coxipi coxipi Apr 7, 2025

Choose a reason for hiding this comment

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

didn't you change the conventions on how to define dict? aren't we suppose to use {} exclusively and not dict?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Right. I think I went for readability here, but let's be consistent.

Comment on lines 32 to +35
file = tmp_path / "test_polydetrend.nc"
fx.ds.to_netcdf(file, engine="h5netcdf")

ds = open_dataset(file)
ds = xr.open_dataset(file)
Copy link
Contributor

Choose a reason for hiding this comment

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

so the tmp_path function differently, they don't need nimbus?

Copy link
Contributor

Choose a reason for hiding this comment

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

where exactly are they stored anyways?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good question! It depends on how the tests are launched:

  • If the tests are launched with numprocesses (no distributed testing), the files are found in XDG_CACHE_HOME (or equivalent for macOS/Windows).
  • If the tests are launched with parallel execution, the first worker able to start downloading test data places the data into XDG_CACHE_HOME (if not already there) and afterwards, all workers copy this folder to a new temporary location. This prevents synonymous reads of shared files by multiple workers (which cause problems for python-NetCDF4).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Woops, hold on. In this case, yes, the tmp_path is worker-dependent. nimbus is used for resolving dataset locations that identify true testing data. Within a test, the temp filepath is a full location, self-contained to that test * worker.

@github-actions github-actions bot added the approved Approved for additional tests label Apr 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Approved for additional tests indicators Climate indices and indicators sdba Issues concerning the sdba submodule. standards / conventions Suggestions on ways forward
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants