Skip to content

Commit

Permalink
📚 revise docs incl. notebooks (#709)
Browse files Browse the repository at this point in the history
* myst-nb

* use sphinx_book_theme

* add stars and forks to index

* add edit botton

* adapt xclim refs

* rename workflows for shorter badges

* intake-esm app connect

* ignore np FutureWarning

* binder link
  • Loading branch information
aaronspring authored Dec 18, 2021
1 parent 617223b commit 4defc70
Show file tree
Hide file tree
Showing 64 changed files with 18,062 additions and 2,981 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-pre-commit.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: linting
name: Linting

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/climpred_installs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: climpred installs
name: install

on:
push:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/climpred_testing.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: climpred testing # based on https://github.com/pydata/xarray/blob/master/.github/workflows/ci.yaml
name: CI # based on https://github.com/pydata/xarray/blob/master/.github/workflows/ci.yaml

on:
push:
Expand Down Expand Up @@ -128,7 +128,7 @@ jobs:
run: |
python -m pytest --doctest-modules climpred --ignore climpred/tests
docs_notebooks: # Checks that pre-compiled notebooks in docs still work.
notebooks: # Checks that pre-compiled notebooks in docs still work.
runs-on: ubuntu-latest
defaults:
run:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Lint
name: Linting

on: pull_request

Expand Down
232 changes: 116 additions & 116 deletions CHANGELOG.rst

Large diffs are not rendered by default.

28 changes: 25 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Verification of weather and climate forecasts.
* - license
- |license|
* - community
- |gitter| |contributors|
- |gitter| |contributors| |forks| |stars| |issues| |PRs|
* - tutorials
- |gallery| |workshop| |cloud|

Expand All @@ -40,7 +40,7 @@ Verification of weather and climate forecasts.

.. |upstream| image:: https://github.com/pangeo-data/climpred/actions/workflows/upstream-dev-ci.yml/badge.svg
:target: https://github.com/pangeo-data/climpred/actions/workflows/upstream-dev-ci.yml
:alt: upstream
:alt: CI upstream

.. |codecov| image:: https://codecov.io/gh/pangeo-data/climpred/branch/main/graph/badge.svg
:target: https://codecov.io/gh/pangeo-data/climpred
Expand Down Expand Up @@ -86,6 +86,22 @@ Verification of weather and climate forecasts.
:alt: climpred cloud demo
:target: https://github.com/aaronspring/climpred-cloud-demo

.. |forks| image:: https://img.shields.io/github/forks/pangeo-data/climpred
:alt: GitHub forks
:target: https://github.com/pangeo-data/climpred/network/members

.. |stars| image:: https://img.shields.io/github/stars/pangeo-data/climpred
:alt: GitHub stars
:target: https://github.com/pangeo-data/climpred/stargazers

.. |issues| image:: https://img.shields.io/github/issues/pangeo-data/climpred
:alt: GitHub issues
:target: https://github.com/pangeo-data/climpred/issues

.. |PRs| image:: https://img.shields.io/github/issues-pr/pangeo-data/climpred
:alt: GitHub PRs
:target: https://github.com/pangeo-data/climpred/pulls

..
.. note::
Expand Down Expand Up @@ -117,7 +133,13 @@ You can install the latest release of ``climpred`` using ``pip`` or ``conda``:
conda install -c conda-forge climpred
You can also install the bleeding edge (pre-release versions) by cloning this
repository and running ``pip install . --upgrade`` in the main directory or
repository or installing directly from GitHub:

.. code-block:: bash
git clone https://github.com/pangeo-data/climpred.git
cd climpred
pip install . --upgrade
.. code-block:: bash
Expand Down
5 changes: 3 additions & 2 deletions ci/requirements/climpred-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ channels:
dependencies:
- python>=3.7
# Documentation
- nbsphinx
- myst-nb
- nbstripout
- sphinx_rtd_theme
- sphinx
- sphinxcontrib-napoleon
# IDE
Expand Down Expand Up @@ -49,10 +48,12 @@ dependencies:
- eofs
- esmtools>=1.1.3
- xskillscore>=0.0.19
- xrft
# Visualization
- matplotlib-base
- nc-time-axis>=1.4.0
- pip
- pip:
- pytest-lazy-fixture
- nb_black # notebook linting
- sphinx_book_theme
12 changes: 8 additions & 4 deletions ci/requirements/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,26 @@ channels:
- nodefaults
dependencies:
- python=3.8
- importlib_metadata
- matplotlib-base
- nbsphinx
- myst-nb
- esmpy=*=mpi* # Ensures MPI works with version of esmpy.
- xesmf
- esmtools
- nc-time-axis>=1.4.0
- netcdf4
- sphinx
- sphinxcontrib-napoleon
- sphinx_rtd_theme
- sphinx-copybutton
- toolz
- xarray>=0.19.0
- xskillscore>=0.0.18
- numba>=0.52
- xclim
- xrft
- bias_correction
- pip
- pip:
# Install latest version of climpred.
# Install latest version of climpred
- -e ../..
- nb_black
- sphinx_book_theme
8 changes: 4 additions & 4 deletions ci/requirements/docs_notebooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ channels:
- nodefaults
dependencies:
- python>=3.7
- importlib_metadata
#- ipykernel
- jupyterlab
- matplotlib-base
- nbsphinx
- myst-nb
- nbstripout
- netcdf4
- numpy
Expand All @@ -16,7 +16,6 @@ dependencies:
- dask-core
- sphinx
- sphinxcontrib-napoleon
- sphinx_rtd_theme
- sphinx-copybutton
- toolz
- xarray>=0.19.0
Expand All @@ -28,9 +27,10 @@ dependencies:
- esmpy
- bottleneck
- nc-time-axis>=1.4.0
- xrft # used for varweighted_mean_period
- xrft
- pip
- pip:
# Install latest version of climpred.
- -e ../..
- nb_black
- sphinx_book_theme
6 changes: 4 additions & 2 deletions climpred/bias_removal.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ def leave_one_out_drop(bias, dim):
"""
bias_nan = []
for i in range(bias[dim].size):
bias_nan.append(bias.drop_isel({dim: i}).rename({dim: "sample"}).drop("sample"))
bias_nan.append(
bias.drop_isel({dim: i}).rename({dim: "sample"}).drop_vars("sample")
)
bias_nan = xr.concat(bias_nan, dim).assign_coords(
{dim: bias[dim], "sample": np.arange(bias[dim].size - 1)}
)
Expand Down Expand Up @@ -361,7 +363,7 @@ def gaussian_bias_removal(
dim="member",
alignment=alignment,
)
bias = bias.drop("skill")
bias = bias.drop_vars("skill")

# how to remove bias
if "mean" in how:
Expand Down
2 changes: 1 addition & 1 deletion climpred/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def resample_uninitialized_from_initialized(init, resample_dim=["init", "member"
# take time dim and overwrite with sorted
resampled_uninit = (
resampled_uninit.swap_dims({"init": "valid_time"})
.drop("init")
.drop_vars("init")
.rename({"valid_time": "time"})
)
resampled_uninit = resampled_uninit.assign_coords(
Expand Down
Loading

0 comments on commit 4defc70

Please sign in to comment.