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

Fix window attrs in SPI/SPEI #1554

Merged
merged 10 commits into from
Jan 9, 2024
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ Breaking changes

Bug fixes
^^^^^^^^^
* Fixed passing ``missing=0`` to ``xclim.core.calendar.convert_calendar`` (:issue:`1562`, :pull:`1563`).
* Fixed passing ``missing=0`` to ``xclim.core.calendar.convert_calendar``. (:issue:`1562`, :pull:`1563`).
* Fix wrong `window` attributes in ``xclim.indices.standardized_precipitation_index``, ``xclim.indices.standardized_precipitation_evapotranspiration_index``. (:issue:`1552` :pull:`1554`).

Internal changes
^^^^^^^^^^^^^^^^
Expand Down
15 changes: 15 additions & 0 deletions docs/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -2103,3 +2103,18 @@ @article{Lafferty2023
url = {https://www.nature.com/articles/s41612-023-00486-0},
year = {2023},
}

@article{thom_1958,
title = {A Note on the Gamma Distribution},
author = {Thom, H. C. S.},
year = {1958},
journal = {Monthly Weather Review},
volume = {86},
number = {4},
pages = {117--122},
publisher = {{American Meteorological Society}},
issn = {1520-0493, 0027-0644},
doi = {10.1175/1520-0493(1958)086<0117:ANOTGD>2.0.CO;2},
abstract = {Abstract The general properties of the gamma distribution, which has several applications in meteorology, are discussed. A short review of the general properties of good statistical estimators is given. This is applied to the gamma distribution to show that the maximum likelihood estimators are jointly sufficient. A new, simple approximation of the likelihood solutions is given, and the efficiency of the fitting procedure is computed.},
chapter = {Monthly Weather Review},
}
1 change: 1 addition & 0 deletions xclim/indices/_agro.py
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,7 @@ def standardized_precipitation_index(
spi = standardized_index(pr, params)
spi.attrs = params.attrs
spi.attrs["freq"] = freq or xarray.infer_freq(spi.time)
spi.attrs["window"] = window
spi.attrs["units"] = ""
return spi

Expand Down
2 changes: 1 addition & 1 deletion xclim/indices/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ def _fit_start(x, dist: str, **fitkwargs: Any) -> tuple[tuple, dict]:

References
----------
:cite:cts:`coles_introduction_2001,cohen_parameter_2019`
:cite:cts:`coles_introduction_2001,cohen_parameter_2019, thom_1958`

"""
x = np.asarray(x)
Expand Down
Loading