Skip to content

Commit

Permalink
Add xr.apply_ufunc wrapper to fit_gev (#58)
Browse files Browse the repository at this point in the history
* Wrap fit_gev in xr.apply_ufunc

* Update fit_gev and check_gev_fit

* Add scipy minimum version

For scipy.stats.goodness_of_fit

* Create test_eva.py

Add some tests for fit_gev

* Update general_utils.py

Update apply_ufunc kw to dask="allowed". Add pvalue alpha to check_gev_fit.

* Update test_eva.py

Add non stationary gev fit tests

* Update test_eva assertions and update fit_gev return type

* Update pre-commit.yml

* Update .pre-commit-config.yaml (run pre-commit autoupdate)

* Fix E721 lint error

* Update test_eva.py (fix nanosecond warning)

* Update fit_gev dask options and edit test_eva docstrings

* Add xclim min version to ci/environment.yml

---------

Co-authored-by: Damien Irving <[email protected]>
  • Loading branch information
stellema and DamienIrving authored Nov 17, 2023
1 parent c850bea commit 26f5650
Show file tree
Hide file tree
Showing 7 changed files with 411 additions and 135 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/action@v2.0.0
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/action@v3.0.0
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
repos:
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 23.11.0
hooks:
- id: black
language_version: python3
- repo: https://github.com/pycqa/flake8
rev: 3.9.2
rev: 6.1.0
hooks:
- id: flake8
language_version: python3
Expand Down
25 changes: 13 additions & 12 deletions ci/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,24 @@ name: unseen-test
channels:
- conda-forge
dependencies:
- python
- geopandas
- regionmask
- xarray
- cftime
- cmdline_provenance
- dask-core
- dask-jobqueue
- geopandas
- gitpython
- netcdf4
- numpy
- pip
- pytest
- cftime
- gitpython
- cmdline_provenance
- xclim
- xskillscore
- python
- regionmask
- scipy>=1.10.0
- seaborn
- xarray
- xclim>=0.39.0
- xskillscore
- zarr
- netcdf4
- dask-jobqueue
- pip
- pip:
- codecov
- pytest-cov
Expand Down
4 changes: 2 additions & 2 deletions unseen/fileio.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def open_dataset(
for var, target_units in units.items():
ds[var] = general_utils.convert_units(ds[var], target_units)

assert type(ds) == xr.core.dataset.Dataset
assert isinstance(ds, xr.core.dataset.Dataset)
ds = ds.squeeze(drop=True)

return ds
Expand Down Expand Up @@ -495,7 +495,7 @@ def _guess_file_format(file_names):
"""

if type(file_names) == list:
if isinstance(file_names, list):
file_name = file_names[0]
else:
file_name = file_names
Expand Down
Loading

0 comments on commit 26f5650

Please sign in to comment.