Skip to content

Commit

Permalink
WIP - no more \* when docstring is raw
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeitsperre committed Nov 26, 2024
1 parent 5205801 commit d3802fd
Show file tree
Hide file tree
Showing 27 changed files with 75 additions and 73 deletions.
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ ignore =
D,
E,
F,
RST210,
RST213,
W503
per-file-ignores =
xclim/core/locales.py:RST399
Expand Down
2 changes: 1 addition & 1 deletion xclim/analog.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def spatial_analogs(
The dimension over which the *distributions* are constructed. This can be a multi-index dimension.
method : {'seuclidean', 'nearest_neighbor', 'zech_aslan', 'kolmogorov_smirnov', 'friedman_rafsky', 'kldiv'}
Which method to use when computing the dissimilarity statistic.
\*\*kwargs : dict
**kwargs : dict
Any other parameter passed directly to the dissimilarity method.
Returns
Expand Down
2 changes: 1 addition & 1 deletion xclim/core/bootstrapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def bootstrap_func(compute_index_func: Callable, **kwargs) -> xarray.DataArray:
----------
compute_index_func : Callable
Index function.
\*\*kwargs : dict
**kwargs : dict
Arguments to `func`.
Returns
Expand Down
16 changes: 8 additions & 8 deletions xclim/core/formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ def format(self, format_string: str, /, *args: Any, **kwargs: dict) -> str:
----------
format_string : str
The string to format.
\*args : Any
*args : Any
Arguments to format.
\*\*kwargs : dict
**kwargs : dict
Keyword arguments to format.
Returns
Expand Down Expand Up @@ -352,7 +352,7 @@ def merge_attributes(
----------
attribute : str
The attribute to merge.
\*inputs_list : xr.DataArray or xr.Dataset
*inputs_list : xr.DataArray or xr.Dataset
The datasets or variables that were used to produce the new object.
Inputs given that way will be prefixed by their `name` attribute if available.
new_line : str
Expand All @@ -361,7 +361,7 @@ def merge_attributes(
missing_str : str
A string that is printed if an input doesn't have the attribute. Defaults to None, in which
case the input is simply skipped.
\*\*inputs_kws : xr.DataArray or xr.Dataset
**inputs_kws : xr.DataArray or xr.Dataset
Mapping from names to the datasets or variables that were used to produce the new object.
Inputs given that way will be prefixes by the passed name.
Expand Down Expand Up @@ -405,12 +405,12 @@ def update_history(
----------
hist_str : str
The string describing what has been done on the data.
\*inputs_list : xr.DataArray or xr.Dataset
*inputs_list : xr.DataArray or xr.Dataset
The datasets or variables that were used to produce the new object.
Inputs given that way will be prefixed by their "name" attribute if available.
new_name : str, optional
The name of the newly created variable or dataset to prefix hist_msg.
\*\*inputs_kws : xr.DataArray or xr.Dataset
**inputs_kws : xr.DataArray or xr.Dataset
Mapping from names to the datasets or variables that were used to produce the new object.
Inputs given that way will be prefixes by the passed name.
Expand Down Expand Up @@ -511,9 +511,9 @@ def gen_call_string(funcname: str, *args, **kwargs) -> str:
----------
funcname : str
Name of the function.
\*args : Any
*args : Any
Arguments given to the function.
\*\*kwargs : dict
**kwargs : dict
Keyword arguments given to the function.
Returns
Expand Down
6 changes: 3 additions & 3 deletions xclim/core/indicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ def _parse_indice(compute, passed_parameters): # noqa: F841
# Remove the \\* symbols from the parameter names
_sanitized_params_dict = {}
for param in params_dict.keys():
_sanitized_params_dict[param.replace("\\*", "")] = params_dict[param]
_sanitized_params_dict[param.replace("*", "")] = params_dict[param]
params_dict = _sanitized_params_dict

# Check that the `Parameters` section of the docstring does not include parameters
Expand Down Expand Up @@ -1353,7 +1353,7 @@ def cfcheck(self, **das) -> None:
Parameters
----------
\*\*das : dict
**das : dict
A dictionary of DataArrays to check.
"""
for varname, vardata in das.items():
Expand All @@ -1377,7 +1377,7 @@ def datacheck(self, **das) -> None:
Parameters
----------
\*\*das : dict
**das : dict
A dictionary of DataArrays to check.
Raises
Expand Down
2 changes: 1 addition & 1 deletion xclim/core/locales.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def get_local_attrs(
Indicator's class name, usually the same as in `xc.core.indicator.registry`.
If multiple names are passed, the attrs from each indicator are merged,
with the highest priority set to the first name.
\*locales : str or tuple of str
*locales : str or tuple of str
IETF language tag or a tuple of the language tag and a translation dict, or a tuple of the language tag
and a path to a json file defining translation of attributes.
names : sequence of str, optional
Expand Down
16 changes: 8 additions & 8 deletions xclim/core/missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class MissingBase:
Resampling frequency.
src_timestep : str, Optional
The expected input frequency. If not given, it will be inferred from the input array.
\*\*indexer : Indexer
**indexer : Indexer
Time attribute and values over which to subset the array. For example, use season='DJF' to select winter
values, month=1 to select January, or month=[6,7,8] to select summer months.
If not indexer is given, all values are considered.
Expand Down Expand Up @@ -153,7 +153,7 @@ def is_null(
Input data.
freq : str
Resampling frequency, from the periods defined in :ref:`timeseries.resampling`.
\*\*indexer : {dim: indexer}, optional
**indexer : {dim: indexer}, optional
The time attribute and values over which to subset the array. For example, use season='DJF' to select winter
values, month=1 to select January, or month=[6,7,8] to select summer months.
Expand Down Expand Up @@ -191,7 +191,7 @@ def prepare(
Resampling frequency, from the periods defined in :ref:`timeseries.resampling`.
src_timestep : str
Expected input frequency, from the periods defined in :ref:`timeseries.resampling`.
\*\*indexer : {dim: indexer}, optional
**indexer : {dim: indexer}, optional
Time attribute and values over which to subset the array. For example, use season='DJF' to select winter
values, month=1 to select January, or month=[6,7,8] to select summer months. If not indexer is given,
all values are considered.
Expand Down Expand Up @@ -279,7 +279,7 @@ def validate(**kwargs) -> bool:
Parameters
----------
\*\*kwargs : dict
**kwargs : dict
Options arguments.
Returns
Expand Down Expand Up @@ -312,7 +312,7 @@ class MissingAny(MissingBase):
Resampling frequency.
src_timestep : {"D", "h", "M"}
Expected input frequency.
\*\*indexer : {dim: indexer, }, optional
**indexer : {dim: indexer, }, optional
Time attribute and values over which to subset the array. For example, use season='DJF' to select winter
values, month=1 to select January, or month=[6,7,8] to select summer months.
If not indexer is given, all values are considered.
Expand All @@ -337,7 +337,7 @@ def is_missing(
Boolean array indicating which values are null.
count : xr.DataArray
Array of expected number of valid values.
\*\*kwargs : dict
**kwargs : dict
Additional arguments.
Returns
Expand Down Expand Up @@ -375,7 +375,7 @@ class MissingWMO(MissingAny):
Number of consecutive missing values per month that should not be exceeded.
src_timestep : {"D"}
Expected input frequency. Only daily values are supported.
\*\*indexer : {dim: indexer, }, optional
**indexer : {dim: indexer, }, optional
Time attribute and values over which to subset the array. For example, use season='DJF' to select winter
Time attribute and values over which to subset the array. For example, use season='DJF' to select winter
values, month=1 to select January, or month=[6,7,8] to select summer months.
Expand Down Expand Up @@ -480,7 +480,7 @@ class MissingPct(MissingBase):
Fraction of missing values that are tolerated [0,1].
src_timestep : {"D", "h"}
Expected input frequency.
\*\*indexer : {dim: indexer, }, optional
**indexer : {dim: indexer, }, optional
Time attribute and values over which to subset the array. For example, use season='DJF' to select winter values,
month=1 to select January, or month=[6,7,8] to select summer months.
If not indexer is given, all values are considered.
Expand Down
4 changes: 2 additions & 2 deletions xclim/core/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ def run_check(func, option, *args, **kwargs):
Function to run.
option : str
Option to use.
\*args : tuple
*args : tuple
Positional arguments to pass to the function.
\*\*kwargs : dict
**kwargs : dict
Keyword arguments to pass to the function.
Raises
Expand Down
4 changes: 2 additions & 2 deletions xclim/core/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,7 @@ def declare_relative_units(**units_by_name) -> Callable:
Parameters
----------
\*\*units_by_name : dict
**units_by_name : dict
Mapping from the input parameter names to dimensions relative to other parameters.
The dimensions can be a single parameter name as `<other_var>` or more complex expressions,
such as `<other_var> * [time]`.
Expand Down Expand Up @@ -1407,7 +1407,7 @@ def declare_units(**units_by_name) -> Callable:
Parameters
----------
\*\*units_by_name : dict
**units_by_name : dict
Mapping from the input parameter names to their units or dimensionality ("[...]").
If this decorates a function previously decorated with :py:func:`declare_relative_units`,
the relative unit declarations are made absolute with the information passed here.
Expand Down
4 changes: 2 additions & 2 deletions xclim/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def ensure_chunk_size(da: xr.DataArray, **minchunks: int) -> xr.DataArray:
----------
da : xr.DataArray
The input DataArray, with or without the dask backend. Does nothing when passed a non-dask array.
\*\*minchunks : dict[str, int]
**minchunks : dict[str, int]
A kwarg mapping from dimension name to minimum chunk size.
Pass -1 to force a single chunk along that dimension.
Expand Down Expand Up @@ -178,7 +178,7 @@ def uses_dask(*das: xr.DataArray | xr.Dataset) -> bool:
Parameters
----------
\*das : xr.DataArray or xr.Dataset
*das : xr.DataArray or xr.Dataset
DataArrays or Datasets to check.
Returns
Expand Down
4 changes: 2 additions & 2 deletions xclim/ensembles/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def create_ensemble(
cal_kwargs : dict, optional
Additional arguments to pass to py:func:`xclim.core.calendar.convert_calendar`.
For conversions involving '360_day', the align_on='date' option is used by default.
\*\*xr_kwargs : dict
**xr_kwargs : dict
Any keyword arguments to be given to `xr.open_dataset` when opening the files (or to `xr.open_mfdataset` if `multifile` is True).
Returns
Expand Down Expand Up @@ -410,7 +410,7 @@ def _ens_align_datasets(
the align_on='date' option is used.
See :py:func:`xclim.core.calendar.convert_calendar`.
'default' is the standard calendar using np.datetime64 objects.
\*\*xr_kwargs
**xr_kwargs
Any keyword arguments to be given to xarray when opening the files.
Returns
Expand Down
2 changes: 1 addition & 1 deletion xclim/ensembles/_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def _concat_hist(da: xr.DataArray, **hist) -> xr.DataArray:
----------
da : xr.DataArray
Input data where the historical scenario is stored alongside other, future, scenarios.
\*\*hist : dict
**hist : dict
Mapping of the scenario dimension name to the historical scenario coordinate, e.g. `scenario="historical"`.
Returns
Expand Down
2 changes: 1 addition & 1 deletion xclim/ensembles/_reduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def kkz_reduce_ensemble(
standardize : bool
Whether to standardize the input before running the selection or not.
Standardization consists in translation as to have a zero mean and scaling as to have a unit standard deviation.
\*\*cdist_kwargs : dict
**cdist_kwargs : dict
All extra arguments are passed as-is to `scipy.spatial.distance.cdist`, see its docs for more information.
Returns
Expand Down
2 changes: 1 addition & 1 deletion xclim/ensembles/_robustness.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def robustness_fractions( # noqa: C901
Name of the statistical test used to determine if there was significant change. See notes.
weights : xr.DataArray
Weights to apply along the 'realization' dimension. This array cannot contain missing values.
\*\*kwargs : dict
**kwargs : dict
Other arguments specific to the statistical test. See notes.
Returns
Expand Down
2 changes: 1 addition & 1 deletion xclim/indicators/atmos/_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def cfcheck(self, **das) -> None:
Parameters
----------
\*\*das : Mapping[str, xarray.DataArray]
**das : Mapping[str, xarray.DataArray]
The input data arrays.
"""
for varname, vardata in das.items():
Expand Down
6 changes: 3 additions & 3 deletions xclim/indices/_agro.py
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,7 @@ def standardized_precipitation_index(
Fit parameters.
The `params` can be computed using ``xclim.indices.stats.standardized_index_fit_params`` in advance.
The output can be given here as input, and it overrides other options.
\*\*indexer : {dim: indexer}, optional
**indexer : {dim: indexer}, optional
Indexing parameters to compute the indicator on a temporal subset of the data.
It accepts the same arguments as :py:func:`xclim.indices.generic.select_time`.
Expand Down Expand Up @@ -1286,7 +1286,7 @@ def standardized_precipitation_evapotranspiration_index(
Fit parameters.
The `params` can be computed using ``xclim.indices.stats.standardized_index_fit_params`` in advance.
The output can be given here as input, and it overrides other options.
\*\*indexer : {dim: indexer}, optional
**indexer : {dim: indexer}, optional
Indexing parameters to compute the indicator on a temporal subset of the data.
It accepts the same arguments as :py:func:`xclim.indices.generic.select_time`.
Expand Down Expand Up @@ -1599,7 +1599,7 @@ def chill_portions(
Hourly temperature.
freq : str
Resampling frequency.
\*\*indexer : {dim: indexer}, optional
**indexer : {dim: indexer}, optional
Indexing parameters to compute the indicator on a temporal subset of the data.
It accepts the same arguments as :py:func:`xclim.indices.generic.select_time`.
Expand Down
2 changes: 1 addition & 1 deletion xclim/indices/_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -2106,7 +2106,7 @@ def wind_profile(
Reference height.
method : {"power_law"}
Method to use. Currently only "power_law" is implemented.
\*\*kwds : dict
**kwds : dict
Additional keyword arguments to pass to the method.For power_law, this is alpha, which takes a default value
of 1/7, but is highly variable based on topography, surface cover and atmospheric stability.
Expand Down
2 changes: 1 addition & 1 deletion xclim/indices/_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ def frost_days(
Freezing temperature.
freq : str
Resampling frequency.
\*\*indexer : {dim: indexer}, optional
**indexer : {dim: indexer}, optional
Indexing parameters to compute the frost days on a temporal subset of the data.
It accepts the same arguments as :py:func:`xclim.indices.generic.select_time`.
Expand Down
12 changes: 6 additions & 6 deletions xclim/indices/_threshold.py
Original file line number Diff line number Diff line change
Expand Up @@ -3193,7 +3193,7 @@ def dry_spell_frequency(
threshold.
"max" checks that the maximal daily precipitation amount within the window is less than the threshold.
This is the same as verifying that each individual day is below the threshold.
\*\*indexer : {dim: indexer}, optional
**indexer : {dim: indexer}, optional
Indexing parameters to compute the indicator on a temporal subset of the data.
It accepts the same arguments as :py:func:`xclim.indices.generic.select_time`.
Indexing is done after finding the dry days, but before finding the spells.
Expand Down Expand Up @@ -3261,7 +3261,7 @@ def dry_spell_total_length(
Resampling frequency.
resample_before_rl : bool
Determines if the resampling should take place before or after the run length encoding (or a similar algorithm) is applied to runs.
\*\*indexer : {dim: indexer}, optional
**indexer : {dim: indexer}, optional
Indexing parameters to compute the indicator on a temporal subset of the data.
It accepts the same arguments as :py:func:`xclim.indices.generic.select_time`.
Indexing is done after finding the dry days, but before finding the spells.
Expand Down Expand Up @@ -3328,7 +3328,7 @@ def dry_spell_max_length(
resample_before_rl : bool
Determines if the resampling should take place before or after the run
length encoding (or a similar algorithm) is applied to runs.
\*\*indexer : {dim: indexer}, optional
**indexer : {dim: indexer}, optional
Indexing parameters to compute the indicator on a temporal subset of the data.
It accepts the same arguments as :py:func:`xclim.indices.generic.select_time`.
Indexing is done after finding the dry days, but before finding the spells.
Expand Down Expand Up @@ -3398,7 +3398,7 @@ def wet_spell_frequency(
threshold.
"min" checks that the maximal daily precipitation amount within the window is more than the threshold.
This is the same as verifying that each individual day is above the threshold.
\*\*indexer : {dim: indexer}, optional
**indexer : {dim: indexer}, optional
Indexing parameters to compute the indicator on a temporal subset of the data.
It accepts the same arguments as :py:func:`xclim.indices.generic.select_time`.
Indexing is done after finding the wet days, but before finding the spells.
Expand Down Expand Up @@ -3465,7 +3465,7 @@ def wet_spell_total_length(
Resampling frequency.
resample_before_rl : bool
Determines if the resampling should take place before or after the run length encoding (or a similar algorithm) is applied to runs.
\*\*indexer : {dim: indexer}, optional
**indexer : {dim: indexer}, optional
Indexing parameters to compute the indicator on a temporal subset of the data.
It accepts the same arguments as :py:func:`xclim.indices.generic.select_time`.
Indexing is done after finding the wet days, but before finding the spells.
Expand Down Expand Up @@ -3534,7 +3534,7 @@ def wet_spell_max_length(
Resampling frequency.
resample_before_rl : bool
Determines if the resampling should take place before or after the run length encoding (or a similar algorithm) is applied to runs.
\*\*indexer : {dim: indexer}, optional
**indexer : {dim: indexer}, optional
Indexing parameters to compute the indicator on a temporal subset of the data.
It accepts the same arguments as :py:func:`xclim.indices.generic.select_time`.
Indexing is done after finding the wet days, but before finding the spells.
Expand Down
Loading

0 comments on commit d3802fd

Please sign in to comment.