A climate change scenario-building analysis framework, built with xclim/xarray.
Project description
xscen
A climate change scenario-building analysis framework, built with Intake-esm catalogs and xarray-based packages such as xclim and xESMF.
For documentation concerning xscen, see: https://xscen.readthedocs.io/en/latest/
Features
Supports workflows with YAML configuration files for better transparency, reproducibility, and long-term backups.
Intake_esm-based catalog to find and manage climate data.
Climate dataset extraction, subsetting, and temporal aggregation.
Calculate missing variables through Intake-esm’s DerivedVariableRegistry.
Regridding with xESMF.
Bias adjustment with xclim.
Acknowledgments
This package was created with Cookiecutter and the Ouranosinc/cookiecutter-pypackage project template.
History
v0.5.0 (2023-02-28)
Contributors to this version: Gabriel Rondeau-Genesse (@RondeauG), Juliette Lavoie (@juliettelavoie), Trevor James Smith (@Zeitsperre), Sarah Gammon (@sg2475962) and Pascal Bourgault (@aulemahal).
New features and enhancements
Possibility of excluding variables read from file from the catalog produced by parse_directory. (PR/107).
New functions extract.subset_warming_level and aggregate.produce_horizon. (PR/93).
add round_var to xs.clean_up. (PR/93).
New “timeout_cleanup” option for save_to_zarr, which removes variables that were in the process of being written when receiving a TimeoutException. (PR/106).
New scripting.skippable context, allowing the use of CTRL-C to skip code sections. (PR/106).
Possibility of fields with underscores in the patterns of parse_directory. (PR/111).
New utils.show_versions function for printing or writing to file the dependency versions of xscen. (GH/109, PR/112).
Added previously private notebooks to the documentation. (PR/108).
Notebooks are now tested using pytest with nbval. (PR/108).
New restrict_warming_level argument for extract.search_data_catalogs to filter dataset that are not in the warming level csv. (GH/105, PR/138).
Set configuration value programmatically through CONFIG.set. (PR/144).
New to_dataset method on DataCatalog. The same as to_dask, but exposing more aggregation options. (PR/147).
New templates folder with one general template. (GH/151, PR/158).
Breaking changes
Functions that are called internally can no longer parse the configuration. (PR/133).
Bug fixes
properties_and_measures no longer casts month coordinates to string. (PR/106).
search_data_catalogs no longer crashes if it finds nothing. (GH/42, PR/92).
Prevented fixed fields from being duplicated during _dispatch_historical_to_future (GH/81, PR/92).
Added missing parse_config to functions in reduce.py (PR/92).
Added deepcopy before skipna is popped in spatial_mean (PR/92).
subset_warming_level now validates that the data exists in the dataset provided (GH/117, PR/119).
Adapt stack_drop_nan for the newest version of xarray (2022.12.0). (GH/122, PR/126).
Fix stack_drop_nan not working if intermediate directories don’t exist (GH/128).
Fixed a crash when compute_indicators produced fixed fields (PR/139).
Internal changes
compute_deltas skips the unstacking step if there is no time dimension and cast object dimensions to string. (PR/9)
Added the “2sem” frequency to the translations CVs. (PR/111).
Skip files we can’t read in parse_directory. (PR/111).
Fixed non-numpy-standard Docstrings. (PR/108).
Added more metadata to package description on PyPI. (PR/108).
Faster search_data_catalogs and extract_dataset through a faster DataCatalog.unique, date parsing and a rewrite of the ensure_correct_time logic. (PR/127).
The search_data_catalogs function now accepts str or pathlib.Path variables (in addition to lists of either data type) for performing catalog lookups. (PR/121).
produce_horizons now supports fixed fields (pull:139).
Rewrite of unstack_dates for better performance with dask arrays. (PR/144).
v0.4.0 (2022-09-28)
Contributors to this version: Gabriel Rondeau-Genesse (@RondeauG), Juliette Lavoie (@juliettelavoie), Trevor James Smith (@Zeitsperre) and Pascal Bourgault (@aulemahal).
New features and enhancements
New functions diagnostics.properties_and_measures, diagnostics.measures_heatmap and diagnostics.measures_improvement. (GH/5, PR/54).
Add argument resample_methods to xs.extract.resample. (GH/57, PR/57)
Added a ReadTheDocs configuration to expose public documentation. (GH/65, PR/66).
xs.utils.stack_drop_nans/ xs.utils.unstack_fill_nan will now format the to_file/coords string to add the domain and the shape. (GH/59, PR/67).
New unstack_dates function to “extract” seasons or months from a timeseries. (PR/68).
Better spatial_mean for cases using xESMF and a shapefile with multiple polygons. (PR/68).
- Yet more changes to parse_directory: (PR/68).
Better parallelization by merging the finding and name-parsing step in the same dask tree.
Allow cvs for the variable columns.
Fix parsing the variable names from datasets.
Sort the variables in the tuples (for a more consistent output)
In extract_dataset, add option ensure_correct_time to ensure the time coordinate matches the expected freq. Ex: monthly values given on the 15th day are moved to the 1st, as expected when asking for “MS”. (:issue: 53).
- In regrid_dataset: (PR/68).
Allow passing skipna to the regridder kwargs.
Do not fail for any grid mapping problem, includin if a grid_mapping attribute mentions a variable that doesn’t exist.
Default email sent to the local user. (PR/68).
Special accelerated pathway for parsing catalogs with all dates within the datetime64[ns] range. (PR/75).
New functions reduce_ensemble and build_reduction_data to support kkz and kmeans clustering. (GH/4, PR/63).
ensemble_stats can now loop through multiple statistics, support functions located in xclim.ensembles._robustness, and supports weighted realizations. (PR/63).
New function ensemble_stats.generate_weights that estimates weights based on simulation metadata. (PR/63).
New function catalog.unstack_id to reverse-engineer IDs. (PR/63).
generate_id now accepts Datasets. (PR/63).
Add rechunk option to properties_and_measures (PR/76).
Breaking changes
statistics / stats_kwargs have been changed/eliminated in ensemble_stats, respectively. (PR/63).
Bug fixes
Internal changes
Default method of xs.extract.resample now depends on frequency. (GH/57, PR/58).
Bugfix for _restrict_by_resolution with CMIP6 datasets (PR/71).
More complete check of coverage in _subset_file_coverage. (GH/70, PR/72)
The code that performs common_attrs_only in ensemble_stats has been moved to clean_up. (PR/63).
Removed the default to_level in clean_up. (PR/63).
xscen now has an official logo. (PR/69).
Use numpy max and min in properties_and_measures (PR/76).
Cast catalog date_start and date_end to “%4Y-%m-%d %H:00” when writing to disk. (GH/83, PR/79)
Skip test of coverage on the sum if the list of select files is empty. (PR/79)
Added missing CMIP variable names in conversions.yml and added the ability to provide a custom file instead (GH/86, PR/88)
Changed ‘allow_conversion’ and ‘allow_resample’ default to False in search_data_catalogs (GH/86, PR/88)
v0.3.0 (2022-08-23)
Contributors to this version: Gabriel Rondeau-Genesse (@RondeauG), Juliette Lavoie (@juliettelavoie), Trevor James Smith (@Zeitsperre) and Pascal Bourgault (@aulemahal).
New features and enhancements
parse_directory: Fixes to xr_open_kwargs and support for wildcards (*) in the directories. (PR/19).
New function xscen.ensemble.ensemble_stats added. (GH/3, PR/28).
New functions spatial_mean, climatological_mean and deltas added. (GH/4, PR/35).
Add argument intermediate_reg_grids to xscen.regridding.regrid. (GH/34, PR/39).
Add argument moving_yearly_window to xscen.biasadjust.adjust. (PR/39).
Many adjustments to parse_directory: better wildcards (GH/24), allow custom columns, fastpaths for parse_from_ds, and more (PR/30).
Documentation now makes better use of autodoc to generate package index. (PR/41).
periods argument added to compute_indicators to support datasets with jumps in time (PR/35).
Breaking changes
Patterns in parse_directory start at the end of the paths in directories. (PR/30).
Argument extension of parse_directory has been renamed globpattern. (PR/30).
- The xscen API and filestructure have been significantly refactored. (GH/40, PR/41). The following functions are available from the top-level:
adjust, train, ensemble_stats, clisops_subset, dispatch_historical_to_future, extract_dataset, resample, restrict_by_resolution, restrict_multimembers, search_data_catalogs, save_to_netcdf, save_to_zarr, rechunk, compute_indicators, regrid_dataset, and create_mask.
xscen now requires geopandas and shapely (PR/35).
Following a change in intake-esm xscen now uses “cat:” to prefix the dataset attributes extracted from the catalog. All catalog-generated attributes should now be valid when saving to netCDF. (GH/13, PR/51).
Internal changes
parse_directory: Fixes to xr_open_kwargs. (PR/19).
Fix for indicators removing the ‘time’ dimension. (PR/23).
Security scanning using CodeQL and GitHub Actions is now configured for the repository. (PR/21).
Bumpversion action now configured to automatically augment the version number on each merged pull request. (PR/21).
Add align_on = 'year' argument in bias adjustment converting of calendars. (PR/39).
GitHub Actions using Ubuntu-22.04 images are now configured for running testing ensemble using tox-conda. (PR/44).
import xscen smoke test is now run on all pull requests. (PR/44).
Fix for create_mask removing attributes (PR/35).
v0.2.0 (first official release)
Contributors to this version: Gabriel Rondeau-Genesse (@RondeauG), Pascal Bourgault (@aulemahal), Trevor James Smith (@Zeitsperre), Juliette Lavoie (@juliettelavoie).
Announcements
This is the first official release for xscen!
New features and enhancements
Supports workflows with YAML configuration files for better transparency, reproducibility, and long-term backups.
Intake_esm-based catalog to find and manage climate data.
Climate dataset extraction, subsetting, and temporal aggregation.
Calculate missing variables through Intake-esm’s DerivedVariableRegistry.
Regridding with xESMF.
Bias adjustment with xclim.
Breaking changes
N/A
Internal changes
N/A
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file xscen-0.5.0.tar.gz
.
File metadata
- Download URL: xscen-0.5.0.tar.gz
- Upload date:
- Size: 308.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f31df2cb52e87dd82d2fc7d340788e4edf14abccf04685a9249a2067594b721a |
|
MD5 | 6f18499cda14ed1b93cee6344a9322f3 |
|
BLAKE2b-256 | 58194fffce6679c42baac60d2c874533f5b1940f1c640be90e8f3f47030d475e |
File details
Details for the file xscen-0.5.0-py3-none-any.whl
.
File metadata
- Download URL: xscen-0.5.0-py3-none-any.whl
- Upload date:
- Size: 306.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2ec0e3db6cd7de1669cb6767b5091df2e671271e33ba22c68290762f346d390 |
|
MD5 | 92792078efcc755c5872d4c0a51e7fee |
|
BLAKE2b-256 | b3ae019c22b04663b54c026fbc56eb3a159597f2d90742e7e78133cc2c90deef |