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_model():
# Import and check the observed groundwater time series
obs = ps.read_dino('tests/data/dino_gwl_data.csv')
# Create the time series model
ml = ps.Model(obs, name="Test_Model")
# read weather data
rain = ps.read_knmi('tests/data/knmi_rain_data.txt', variables='RD')
evap = ps.read_knmi('tests/data/knmi_evap_data.txt', variables='EV24')
## Create stress
sm = ps.StressModel2(stress=[rain, evap], rfunc=ps.Exponential,
name='recharge')
ml.add_stressmodel(sm)
## Solve
ml.solve()
return ml
def test_create_model():
# Import and check the observed groundwater time series
obs = ps.read_dino('tests/data/dino_gwl_data.csv')
# Create the time series model
ml = ps.Model(obs, name="Test_Model")
# read weather data
rain = ps.read_knmi('tests/data/knmi_rain_data.txt', variables='RD')
evap = ps.read_knmi('tests/data/knmi_evap_data.txt', variables='EV24')
## Create stress
sm = ps.StressModel2(stress=[rain, evap], rfunc=ps.Exponential,
name='recharge')
ml.add_stressmodel(sm)
## Solve
ml.solve()
return ml
"""
import pastas as ps
import pandas as pd
ps.set_log_level("ERROR")
# read observations
obs = ps.read_dino('data/B58C0698001_1.csv')
# Create the time series model
ml = ps.Model(obs, name="groundwater head")
# read weather data
rain = ps.read_knmi('data/neerslaggeg_HEIBLOEM-L_967-2.txt', variables='RD')
rain.multiply(1000)
evap = ps.read_knmi('data/etmgeg_380.txt', variables='EV24')
evap.multiply(1000)
# Create stress
sm = ps.RechargeModel(prec=rain, evap=evap, rfunc=ps.Exponential,
recharge="Linear", name='recharge')
ml.add_stressmodel(sm)
# Set tmin
ml.settings['tmin'] = pd.Timestamp('2010-1-1')
# Solve
ml.solve()
ml.plot()
"""This file contains an example of the use of the Project class.
R.A. Collenteur - Artesia Water 2017
"""
import pastas as ps
# Create a simple model taken from example.py
obs = ps.read_dino('data/B58C0698001_1.csv')
rain = ps.read_knmi('data/neerslaggeg_HEIBLOEM-L_967-2.txt', variables='RD')
evap = ps.read_knmi('data/etmgeg_380.txt', variables='EV24')
# Create a Pastas Project
mls = ps.Project(name="test_project")
mls.add_series(obs, "GWL", kind="oseries", metadata=dict())
mls.add_series(rain, name="Prec", kind="prec", metadata=dict())
mls.add_series(evap, name="Evap", kind="evap", metadata=dict())
ml = mls.add_model(oseries="GWL")
sm = ps.StressModel2([mls.stresses.loc["Prec", "series"],
mls.stresses.loc["Evap", "series"]],
ps.Exponential, name='recharge')
ml.add_stressmodel(sm)
n = ps.NoiseModel()
ml.add_noisemodel(n)
This test file is meant for developing purposes. Providing an easy method to
test the functioning of PASTA during development.
"""
import pastas as ps
# read observations
fname = 'data/B32D0136001_1.csv'
obs = ps.read_dino(fname)
# Create the time series model
ml = ps.Model(obs)
# read climate data
fname = 'data/KNMI_Bilt.txt'
RH = ps.read_knmi(fname, variables='RH')
EV24 = ps.read_knmi(fname, variables='EV24')
#rech = RH.series - EV24.series
# Create stress
#sm = ps.Recharge(RH, EV24, ps.Gamma, ps.Linear, name='recharge')
#sm = Recharge(RH, EV24, Gamma, Combination, name='recharge')
sm = ps.StressModel2([RH, EV24], ps.Gamma, name='recharge')
#sm = ps.StressModel(RH, ps.Gamma, name='precip')
#sm1 = ps.StressModel(EV24, ps.Gamma, name='evap')
ml.add_stressmodel(sm)
#ml.add_tseries(sm1)
# Add noise model
n = ps.NoiseModel()
ml.add_noisemodel(n)
"""
import pastas as ps
import pandas as pd
# read observations
obs = ps.read_dino('data/B58C0698001_1.csv')
# Create the time series model
ml = ps.Model(obs)
# read weather data
knmi = ps.read.knmi.KnmiStation.fromfile(
'data/neerslaggeg_HEIBLOEM-L_967-2.txt')
rain = ps.TimeSeries(knmi.data['RD'], settings='prec')
evap = ps.read_knmi('data/etmgeg_380.txt', variables='EV24')
if True:
# also add 9 hours to the evaporation
s = evap.series_original
s.index = s.index + pd.to_timedelta(9, 'h')
evap.series_original = s
# Create stress
sm = ps.StressModel2(stress=[rain, evap], rfunc=ps.Exponential,
name='recharge')
ml.add_stressmodel(sm)
# set the time-offset of the model. This should be done automatically in the future.
ml._set_time_offset()
## Solve
ml.solve(freq='D')