-
Notifications
You must be signed in to change notification settings - Fork 65
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
file = tmp_path / "test_polydetrend.nc" | ||
fx.ds.to_netcdf(file, engine="h5netcdf") | ||
|
||
ds = open_dataset(file) | ||
ds = xr.open_dataset(file) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 inXDG_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 forpython-NetCDF4
).
There was a problem hiding this comment.
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.
Pull Request Checklist:
number
) and pull request (:pull:number
) has been addedWhat kind of change does this PR introduce?
sfcwind_2_uas_vas
anduas_vas_2_sfcwind
converter functions.xclim.testing.open_dataset
to be removed in a future versionDoes 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.