Skip to content

Commit

Permalink
Merge branch 'main' into translation
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeitsperre authored Sep 15, 2023
2 parents 5bac82f + adafdbe commit 9b17a6f
Show file tree
Hide file tree
Showing 13 changed files with 385 additions and 98 deletions.
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"project_slug": "xscen",
"project_short_description": "A climate change scenario-building analysis framework, built with xclim/xarray.",
"pypi_username": "RondeauG",
"version": "0.7.4-beta",
"version": "0.7.5-beta",
"use_pytest": "y",
"use_black": "y",
"add_pyup_badge": "n",
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repos:
rev: v3.10.1
hooks:
- id: pyupgrade
args: [--py39-plus]
args: [ '--py39-plus' ]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
Expand All @@ -27,8 +27,8 @@ repos:
rev: v1.10.0
hooks:
- id: rst-inline-touching-normal
- repo: https://github.com/psf/black
rev: 23.7.0
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.9.1
hooks:
- id: black
exclude: ^docs/
Expand All @@ -53,7 +53,7 @@ repos:
rev: v0.3.8
hooks:
- id: blackdoc
additional_dependencies: [ 'black==23.3.0' ]
additional_dependencies: [ 'black==23.9.1' ]
exclude: config.py
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.32.0
Expand Down
7 changes: 6 additions & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,14 @@ Ready to contribute? Here's how to set up `xscen` for local development.
# or to simply generate the html
$ cd docs/
$ make html
.. note::

9. Submit a pull request through the GitHub website.
When building the documentation, the default behaviour is to evaluate notebooks ('nbsphinx_execute = "always"'), rather than simply parse the content ('nbsphinx_execute = "never"'). Due to their complexity, this can sometimes be a very computationally demanding task and should only be performed when necessary (i.e.: when the notebooks have been modified).

In order to speed up documentation builds, setting a value for the environment variable "SKIP_NOTEBOOKS" (e.g. "$ export SKIP_NOTEBOOKS=1") will prevent the notebooks from being evaluated on all subsequent "$ tox -e docs" or "$ make docs" invocations.

9. Submit a pull request through the GitHub website.

Translating xscen
~~~~~~~~~~~~~~~~~
Expand Down
6 changes: 4 additions & 2 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,20 @@ Announcements

New features and enhancements
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* N/A
* Added the ability to search for simulations that reach a given warming level. (:pull:`251`).

Breaking changes
^^^^^^^^^^^^^^^^
* N/A

Bug fixes
^^^^^^^^^
* N/A
* Fixed a bug in ``xs.search_data_catalogs`` when searching for fixed fields and specific experiments/members. (:pull:`251`).
* Fixed a bug in the documentation build configuration that prevented stable/latest and tagged documentation builds from resolving on ReadTheDocs. (:pull:`256`).

Internal changes
^^^^^^^^^^^^^^^^
* Continued work on adding tests. (:pull:`251`).
* Fixed pre-commit's pretty-format-json so it ignores notebooks. (:pull:`254`).
* Fixed the labeler so docs/CI isn't automatically added for contributions by new collaborators. (:pull:`254`).
* Made it so that `tests` are no longer treated as an installable package. (:pull:`248`).
Expand Down
75 changes: 40 additions & 35 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@
import os
import sys
import warnings
from datetime import datetime
from pathlib import Path

sys.path.insert(0, os.path.abspath('..'))
if os.environ.get('READTHEDOCS') and 'ESMFMKFILE' not in os.environ:
sys.path.insert(0, os.path.abspath(".."))
if os.environ.get("READTHEDOCS") and "ESMFMKFILE" not in os.environ:
# RTD doesn't activate the env, and esmpy depends on a env var set there
# We assume the `os` package is in {ENV}/lib/pythonX.X/os.py
# See conda-forge/esmf-feedstock#91 and readthedocs/readthedocs.org#4067
os.environ['ESMFMKFILE'] = str(Path(os.__file__).parent.parent / 'esmf.mk')
os.environ["ESMFMKFILE"] = str(Path(os.__file__).parent.parent / "esmf.mk")

import xscen # noqa
import xarray # noqa
Expand All @@ -53,7 +54,7 @@
"sphinx.ext.viewcode",
"nbsphinx",
"sphinx_codeautolink",
"sphinx_copybutton"
"sphinx_copybutton",
]

# To ensure that underlined fields (e.g. `_field`) are shown in the docs.
Expand All @@ -68,25 +69,29 @@
autosectionlabel_maxdepth = 2

autosummary_generate = True
nbsphinx_execute = "always"

# To avoid running notebooks on linkcheck
nbsphinx_execute = "always"
# To avoid running notebooks on linkcheck and when building PDF.
try:
skip_notebooks = int(os.getenv("SKIP_NOTEBOOKS"))
except TypeError:
skip_notebooks = False
if skip_notebooks:
warnings.warn("Not executing notebooks.")
warnings.warn("SKIP_NOTEBOOKS is set. Not executing notebooks.")
nbsphinx_execute = "never"
elif os.getenv("READTHEDOCS_VERSION_NAME") in ["latest", "stable"] or os.getenv(
"READTHEDOCS_VERSION_TYPE"
) in ["tag"]:
if os.getenv("READTHEDOCS_OUTPUT") in ["pdf"]:
warnings.warn("Generating PDF version. Not executing notebooks.")
nbsphinx_execute = "never"

# if skip_notebooks or os.getenv("READTHEDOCS_VERSION_TYPE") in [
# "branch",
# "external",
# ]:
# elif os.getenv("READTHEDOCS_VERSION_NAME") in ["latest", "stable"]:
# nbsphinx_execute = "always"
# else:
# nbsphinx_execute = "auto"
# warnings.warn("Not executing notebooks.")
# nbsphinx_execute = "never"

# To avoid having to install these and burst memory limit on ReadTheDocs.
# autodoc_mock_imports = [
Expand Down Expand Up @@ -136,14 +141,14 @@
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = ['.rst']
source_suffix = [".rst"]

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = 'xscen'
copyright = "2022, Ouranos Inc., Gabriel Rondeau-Genesse, and contributors"
project = "xscen"
copyright = f"2022-{datetime.now().year}, Ouranos Inc., Gabriel Rondeau-Genesse, and contributors"
author = "Gabriel Rondeau-Genesse"

# The version info for the project you're documenting, acts as replacement
Expand Down Expand Up @@ -172,7 +177,7 @@
]

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
Expand Down Expand Up @@ -201,13 +206,13 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]


# -- Options for HTMLHelp output ---------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'xscendoc'
htmlhelp_basename = "xscendoc"


# -- Options for LaTeX output ------------------------------------------
Expand All @@ -216,15 +221,12 @@
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',

# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
Expand All @@ -234,21 +236,21 @@
# (source start file, target name, title, author, documentclass
# [howto, manual, or own class]).
latex_documents = [
(master_doc, 'xscen.tex',
'xscen Documentation',
'Gabriel Rondeau-Genesse', 'manual'),
(
master_doc,
"xscen.tex",
"xscen Documentation",
"Gabriel Rondeau-Genesse",
"manual",
),
]


# -- Options for manual page output ------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'xscen',
'xscen Documentation',
[author], 1)
]
man_pages = [(master_doc, "xscen", "xscen Documentation", [author], 1)]


# -- Options for Texinfo output ----------------------------------------
Expand All @@ -257,10 +259,13 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'xscen',
'xscen Documentation',
author,
'xscen',
'One line description of project.',
'Miscellaneous'),
(
master_doc,
"xscen",
"xscen Documentation",
author,
"xscen",
"One line description of project.",
"Miscellaneous",
),
]
6 changes: 4 additions & 2 deletions docs/notebooks/1_catalog.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@
"- `allow_conversion` is used to allow searching for calculable variables, in the case where the requested variable would not be available.\n",
"- `restrict_resolution` is used to limit the results to the finest or coarsest resolution available for each source.\n",
"- `restrict_members` is used to limit the results to a maximum number of realizations for each source.\n",
"- `restrict_warming_level` is used to limit the results to only datasets that are present in the csv used for calculating warming levels.\n",
"- `restrict_warming_level` is used to limit the results to only datasets that are present in the csv used for calculating warming levels. You can also pass a dict to verify that a given warming level is reached.\n",
"\n",
"Note that compared to `search`, the result of `search_data_catalog` is a dictionary with one entry per unique ID. A given unique ID might contain multiple datasets as per `intake-esm`'s definition, because it groups catalog lines per *id - domain - processing_level - xrfreq*. Thus, it would separate model data that exists at different frequencies.\n",
"\n",
Expand Down Expand Up @@ -390,7 +390,9 @@
" data_catalogs=[f\"{Path().absolute()}/samples/pangeo-cmip6.json\"],\n",
" variables_and_freqs=variables_and_freqs,\n",
" match_hist_and_fut=True,\n",
" restrict_warming_level=True, # In this case all models exist in our database, so nothing gets eliminated.\n",
" restrict_warming_level={\n",
" \"wl\": 2\n",
" }, # SSP126 gets eliminated, since it doesn't reach +2°C by 2100.\n",
")\n",
"\n",
"cat_sim"
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.7.4-beta
current_version = 0.7.5-beta
commit = True
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+).(?P<patch>\d+)(\-(?P<release>[a-z]+))?
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,6 @@ def run(self):
test_suite="tests",
extras_require={"dev": dev_requirements},
url="https://github.com/Ouranosinc/xscen",
version="0.7.4-beta",
version="0.7.5-beta",
zip_safe=False,
)
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def remove_data_folder():
request.addfinalizer(remove_data_folder)


@pytest.mark.requires_docs
@pytest.mark.requires_netcdf
@pytest.fixture(scope="session")
def samplecat():
"""Generate a sample catalog with the tutorial netCDFs."""
Expand Down
Loading

0 comments on commit 9b17a6f

Please sign in to comment.