Skip to content

Commit

Permalink
Update test_si.py
Browse files Browse the repository at this point in the history
  • Loading branch information
martinvonk committed Mar 14, 2024
1 parent aedd471 commit 47bc330
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tests/test_si.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pandas import Series

from spei import sgi, spei, spi, ssfi
from pandas import Series, Timestamp

from spei import SI, sgi, spei, spi, ssfi
from scipy.stats import norm

def test_spi(prec: Series) -> None:
precr = prec.rolling("30D", min_periods=30).sum().dropna()
Expand All @@ -24,3 +24,11 @@ def test_sffi_timescale(prec: Series) -> None:
def test_window(prec: Series, evap: Series) -> None:
n = (prec - evap).rolling("30D", min_periods=30).sum().dropna()
spei(n, fit_freq="W", fit_window=3)


def test_SI(prec: Series) -> None:
si = SI(prec, dist=norm, timescale=30, fit_freq="ME")
si.fit_distribution()
si.pdf()
dist = si.get_dist(Timestamp("2010-01-01"))
dist.ks_test()

0 comments on commit 47bc330

Please sign in to comment.