Skip to content
Snippets Groups Projects
Commit b148a5cb authored by Max Lensing's avatar Max Lensing
Browse files

fixed a bug in trends that occurred randomly when using an incomplete time...

fixed a bug in trends that occurred randomly when using an incomplete time series, updated toarstats to 0.6.9
parent 8e118a3b
No related tags found
No related merge requests found
# Changelog
All notable changes to this project will be documented in this file.
## v0.6.9 - 2025-04-04 - fixed bug in trends/moving_block_bootstrap
### technical:
* when calculating a trend on a timeseries which is not complete, the method
`moving_block_bootstrap` may throw a `ValueError` based on randomly chosen blocks
## v0.6.8 - 2025-03-07 - bugfix in time harmonizing
## v0.6.7 - 2025-02-21 - fixed output format
......
File added
[metadata]
name = toarstats
version = 0.6.8
version = 0.6.9
author = Niklas Selke, Martin Schultz, Max Lensing
author_email = n.selke@fz-juelich.de, m.schultz@fz-juelich.de, m.lensing@fz-juelich.de
description = Collection of statistics for the TOAR community
......
......@@ -63,9 +63,12 @@ def moving_block_bootstrap(method, data, quantile=None, num_samples=1000):
for _ in range(num_samples):
bn = rng.choice(len(blocks), nblocks)
samp_data = data.iloc[blocks[bn].flatten()]
try:
if method == "quant":
mod = smf.quantreg("value~datetime", samp_data).fit(q=quantile)
else:
mod = smf.ols("value~datetime", samp_data).fit(method="qr")
except ValueError:
continue
samples.append(mod.params)
return samples
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment