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

Small clean up of dependencies and environment #1381

Merged
merged 12 commits into from
Jun 8, 2023
13 changes: 6 additions & 7 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- conda-forge
- defaults
dependencies:
- python>=3.8
- python>=3.8,<3.11 # pin due to sphinx-autodoc-typehints errors in Python3.11
- astroid
- boltons>=20.1
- bottleneck>=1.3.1
Expand All @@ -15,25 +15,25 @@ dependencies:
- lmoments3
- numba
- numpy>=1.16
- pandas>=0.23,<2.0 # Pinned due to incompatibility with xarray <=2023.03
- pandas>=0.23
- pint>=0.9
- poppler>=0.67
- pyyaml
- scikit-learn>=0.21.3
- scipy>=1.2
- statsmodels
- xarray>=2022.06.0
# Extras
- clisops
- eofs
- flox
- pytest-json-report # Added due to a packaging bug with ESMPy. See: https://github.com/esmf-org/esmf/issues/115
# Testing and development dependencies
- black>=22.12
- blackdoc
- bump2version
- cairosvg
- coverage
- distributed>=2.0
- filelock
- flake8
- flake8-rst-docstrings
- flit
Expand All @@ -50,17 +50,16 @@ dependencies:
- pre-commit
- pybtex
- pydocstyle
- pylint<2.15
- pylint
- pytest
- pytest-cov
- pytest-xdist>=3.2
- sphinx
- sphinx-autodoc-typehints
- sphinx-codeautolink
- sphinx-copybutton
- sphinx-rtd-theme>=1.0
- sphinx_rtd_theme>=1.0
- sphinxcontrib-bibtex
- statsmodels
- tokenize-rt
- tox
# - tox-conda # Will be added when a [email protected]+ compatible plugin is released.
Expand Down
4 changes: 2 additions & 2 deletions pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ timeout-methods=requests.api.delete,requests.api.get,requests.api.head,requests.
[EXCEPTIONS]

# Exceptions that will emit a warning when caught.
overgeneral-exceptions=BaseException,
Exception
overgeneral-exceptions=builtins.BaseException,
builtins.Exception


[REFACTORING]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ dev = [
"pre-commit >=2.9",
"pydocstyle >=5.1.1",
"pybtex",
"pylint <2.15",
"pylint",
"pytest",
"pytest-cov",
"pytest-xdist[psutil] >=3.2",
Expand Down
28 changes: 14 additions & 14 deletions xclim/core/indicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,30 +302,30 @@ class Indicator(IndicatorRegistrar):
Parameters
----------
identifier : str
Unique ID for class registry, should be a valid slug.
Unique ID for class registry, should be a valid slug.
realm : {'atmos', 'seaIce', 'land', 'ocean'}
General domain of validity of the indicator. Indicators created outside xclim.indicators must set this attribute.
General domain of validity of the indicator. Indicators created outside xclim.indicators must set this attribute.
compute : func
The function computing the indicators. It should return one or more DataArray.
The function computing the indicators. It should return one or more DataArray.
cf_attrs : list of dicts
Attributes to be formatted and added to the computation's output.
See :py:attr:`xclim.core.indicator.Indicator.cf_attrs`.
Attributes to be formatted and added to the computation's output.
See :py:attr:`xclim.core.indicator.Indicator.cf_attrs`.
title : str
A succinct description of what is in the computed outputs. Parsed from `compute` docstring if None (first paragraph).
A succinct description of what is in the computed outputs. Parsed from `compute` docstring if None (first paragraph).
abstract : str
A long description of what is in the computed outputs. Parsed from `compute` docstring if None (second paragraph).
A long description of what is in the computed outputs. Parsed from `compute` docstring if None (second paragraph).
keywords : str
Comma separated list of keywords. Parsed from `compute` docstring if None (from a "Keywords" section).
Comma separated list of keywords. Parsed from `compute` docstring if None (from a "Keywords" section).
references : str
Published or web-based references that describe the data or methods used to produce it. Parsed from
`compute` docstring if None (from the "References" section).
Published or web-based references that describe the data or methods used to produce it. Parsed from
`compute` docstring if None (from the "References" section).
notes : str
Notes regarding computing function, for example the mathematical formulation. Parsed from `compute`
docstring if None (form the "Notes" section).
Notes regarding computing function, for example the mathematical formulation. Parsed from `compute`
docstring if None (form the "Notes" section).
src_freq : str, sequence of strings, optional
The expected frequency of the input data. Can be a list for multiple frequencies, or None if irrelevant.
The expected frequency of the input data. Can be a list for multiple frequencies, or None if irrelevant.
context : str
The `pint` unit context, for example use 'hydro' to allow conversion from kg m-2 s-1 to mm/day.
The `pint` unit context, for example use 'hydro' to allow conversion from kg m-2 s-1 to mm/day.

Notes
-----
Expand Down
9 changes: 8 additions & 1 deletion xclim/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,9 +582,16 @@ class InputKind(IntEnum):
"""


def infer_kind_from_parameter(param: Parameter, has_units: bool = False) -> InputKind:
def infer_kind_from_parameter(param, has_units: bool = False) -> InputKind:
"""Return the appropriate InputKind constant from an ``inspect.Parameter`` object.

Parameters
----------
param : Parameter
has_units : bool

Notes
-----
The correspondence between parameters and kinds is documented in :py:class:`xclim.core.utils.InputKind`.
The only information not inferable through the `inspect` object is whether the parameter
has been assigned units through the :py:func:`xclim.core.units.declare_units` decorator.
Expand Down