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

261 area selector for url adaptor to accept kwargs #262

Merged
merged 30 commits into from
Jan 17, 2025

Conversation

EddyCMWF
Copy link
Contributor

@EddyCMWF EddyCMWF commented Jan 13, 2025

To handle for some trivial issues with some data formats not meeting CF convenstions (e.g. bad time units and undefined coordinates), we need to be to provide kwargs to the area selection postprocessor.

This PR updates the area_selector post-processor to use the open_file_as_xarray_dict method in the convertors sub-module, and facilitates providing additional keywords. Also, as this function is not concerned with the time dimensions, we default the decode_times kwarg to False so that it does not fail with bad time units.

Summary of the changes in functions :

  1. the area_select method is now xr.Dataset in, xr.Dataset out. Previously it was filepath (str) in, xr.Dataset out
  2. new area_select_path method is filepath (str) in, list of filepaths out. This is to account for the potential future feature that one in file (grib) may result in multiple out files. It: a. opens the file with the general open_file_aas_xarray_dict method from the convertors sub-module; (b) Calls area_select on each xarray.Dataset; (c) Writes the datasets to file[s] and returns
  3. The area_select_paths has been updated to simplly iterate over area_select_path for each filepath

Additionally, the unit-tests have been brought into line with the other unit-tests, along with some minor updates to account for the new API of the funcitons.

@EddyCMWF EddyCMWF linked an issue Jan 13, 2025 that may be closed by this pull request
cads_adaptors/tools/area_selector.py Outdated Show resolved Hide resolved
cads_adaptors/tools/area_selector.py Outdated Show resolved Hide resolved
@EddyCMWF EddyCMWF merged commit fc991a3 into main Jan 17, 2025
9 checks passed
@EddyCMWF EddyCMWF deleted the 261-area-selector-for-url-adaptor-to-accept-kwargs branch January 17, 2025 08:38
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.

Area selector for URL adaptor to accept kwargs
2 participants