Ouranosinc / xclim

Library of derived climate variables, ie climate indicators, based on xarray.
https://xclim.readthedocs.io/en/stable/
Apache License 2.0
318 stars 55 forks source link

The `phase` parameter of precip_accumulation is not included in the indicator docstring but discussed in the docstring #1763

Open huard opened 3 months ago

huard commented 3 months ago

Setup Information

Description

Here is the docstring from indicator precip_accumulation. Note that the phase parameter is referenced, and its docstring exist for the corresponding indice, but it's not included in the indicator.

Signature:      
xclim.indicators.atmos.precip_accumulation(
    pr: Union[xarray.core.dataarray.DataArray, str] = 'pr',
    *,
    thresh: 'Quantified' = '0 degC',
    freq: 'str' = 'YS',
    ds: xarray.core.dataset.Dataset = None,
    **indexer,
) -> xarray.core.dataarray.DataArray
Call signature:  xclim.indicators.atmos.precip_accumulation(*args, **kwds)
Type:            PRCPTOT
String form:     <xclim.indicators.atmos._precip.PRCPTOT object at 0x7f89e5211130>
File:            ~/.conda/envs/ing12/lib/python3.12/site-packages/xclim/indicators/atmos/_precip.py
Docstring:      
Total accumulated precipitation (solid and liquid) (realm: atmos)

Total accumulated precipitation. If the average daily temperature is given, the phase parameter can be used to restrict the calculation to precipitation of only one phase (liquid or solid). Precipitation is considered solid if the average daily temperature is below 0°C (and vice versa).

This indicator will check for missing values according to the method "from_context".
Based on indice :py:func:`~xclim.indices._multivariate.precip_accumulation`.
With injected parameters: tas=None, phase=None.
Keywords : precipitation.

Parameters
----------
pr : str or DataArray
    Mean daily precipitation flux.
    Default : `ds.pr`. [Required units : [precipitation]]
thresh : quantity (string or DataArray, with units)
    Threshold of `tas` over which the precipication is assumed to be liquid rain.
    Default : 0 degC. [Required units : [temperature]]
freq : offset alias (string)
    Resampling frequency. See https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#offset-aliases for available options.
    Default : YS. 
ds : Dataset, optional
    A dataset with the variables given by name.
    Default : None. 
indexer 
    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`.
    Required. 

Steps To Reproduce

No response

Additional context

No response

Contribution

Code of Conduct

huard commented 3 months ago

I think that what is confusing is that the phase is correctly set to None to return both liquid and solid precip, but the thresh parameter is still there, although it's useless when phase is None.