Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_create_rechargemodel():
rain = read_csv("tests/data/rain.csv", index_col=0, parse_dates=True,
squeeze=True)
evap = read_csv("tests/data/evap.csv", index_col=0, parse_dates=True,
squeeze=True)
rm = ps.RechargeModel(prec=rain, evap=evap, name='recharge',
recharge="Linear")
return rm
(the csv-files with the data can be found in the examples directory on GitHub)
"""
import pandas as pd
import pastas as ps
oseries = pd.read_csv('data/head_nb1.csv', parse_dates=['date'],
index_col='date', squeeze=True)
rain = pd.read_csv('data/rain_nb1.csv', parse_dates=['date'], index_col='date',
squeeze=True)
evap = pd.read_csv('data/evap_nb1.csv', parse_dates=['date'], index_col='date',
squeeze=True)
ml = ps.Model(oseries)
sm = ps.RechargeModel(prec=rain, evap=evap, rfunc=ps.Exponential,
recharge="Linear", name='recharge')
ml.add_stressmodel(sm)
ml.solve()
ml.plots.decomposition()
# read observations and create the time series model
obs = pd.read_csv("data/head_nb1.csv", index_col=0, parse_dates=True,
squeeze=True)
# Create the time series model
ml = ps.Model(obs, name="head")
# read weather data
rain = pd.read_csv("data/rain_nb1.csv", index_col=0, parse_dates=True,
squeeze=True)
evap = pd.read_csv("data/evap_nb1.csv", index_col=0, parse_dates=True,
squeeze=True)
# Create stress
sm = ps.RechargeModel(prec=rain, evap=evap, rfunc=ps.Exponential,
recharge="Linear", name='recharge')
ml.add_stressmodel(sm)
# Solve
ml.solve()
ml.plot()