Beispiel #1
0
def test_rfunc(rfunc_name):
    if rfunc_name not in []:
        # Import and check the observed groundwater time series
        obs = ps.read_dino('tests/data/dino_gwl_data.csv')

        # 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 the time series model
        ml = ps.Model(obs, name="Test_Model")

        ## Create stress
        rfunc = getattr(ps.rfunc, rfunc_name)
        sm = ps.StressModel2(stress=[rain, evap], rfunc=rfunc, name='test_sm')
        ml.add_stressmodel(sm)

        # Solve the time series model
        ml.solve()
Beispiel #2
0
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
Beispiel #3
0
def test_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 the time series model
    ml.solve()

    return 'model succesfull'
Beispiel #4
0
"""
import pastas as ps

# read observations
obs = ps.read_dino('data/B58C0698001_1.csv')

# add 10 cm to the series from 2007
s = obs.series_original
s['2007':] = s['2007':]+0.1
obs.series_original = s

# Create the time series model
ml = ps.Model(obs)

# read weather data
rain = ps.read_knmi('data/neerslaggeg_HEIBLOEM-L_967-2.txt', variables='RD')
evap = ps.read_knmi('data/etmgeg_380.txt', variables='EV24')

# create stress
sm = ps.StressModel2(stress=[rain, evap], rfunc=ps.Exponential,
                     name='recharge')
ml.add_stressmodel(sm)

# add a stepmodel with an exponential response
sm = ps.stressmodels.StepModel('2007','Step',rfunc=ps.Exponential)
ml.add_stressmodel(sm)

# solve
ml.solve()
ml.plots.decomposition()
Beispiel #5
0
test the functioning of PASTAS during development.

"""
import pandas as pd
import pastas as ps

# Read observations
obs = ps.read_dino('data/B58C0698001_1.csv')
obs = obs.iloc[::5]
obs = obs[obs.index > pd.to_datetime('1-1-2010')]

# Create the time series model
ml = ps.Model(obs)

# Read weather data
prec = ps.read_knmi('data/neerslaggeg_HEIBLOEM-L_967-2.txt', variables='RD')
evap = ps.read_knmi('data/etmgeg_380.txt', variables='EV24')

# Create stress
if False:
    sm = ps.StressModel2(stress=[prec, evap],
                         rfunc=ps.Exponential,
                         name='recharge')
    ml.add_stressmodel(sm)
elif False:
    sm = ps.StressModel(prec, rfunc=ps.Exponential, name='prec')
    ml.add_stressmodel(sm)
    sm = ps.StressModel(evap, rfunc=ps.Exponential, name='evap', up=False)
    ml.add_stressmodel(sm)
else:
    sm = ps.stressmodels.NoConvModel(prec,
"""
import pandas as pd

import pastas as ps

ps.set_log_level("ERROR")

# read observations and create the time series model and make meters
obs = pd.read_csv("data/B32C0639001.csv", parse_dates=['date'],
                  index_col='date', squeeze=True)

# Create the time series model
ml = ps.Model(obs, name="head")

# read weather data and make mm/d !
evap = ps.read_knmi("data/etmgeg_260.txt", variables="EV24").series * 1e3
rain = ps.read_knmi("data/etmgeg_260.txt", variables="RH").series * 1e3

# Initialize recharge model and create stressmodel
rch = ps.rch.FlexModel()
# rch = ps.rch.Berendrecht()
# rch = ps.rch.Linear()
sm = ps.RechargeModel(prec=rain, evap=evap, rfunc=ps.Gamma, recharge=rch)

ml.add_stressmodel(sm)

ml.solve(noise=True, tmin="1990")

ml.plots.results()
Beispiel #7
0
"""

@author: ruben

"""

import pastas as ps

fname = '../data/B32D0136001_1.csv'
obs = ps.read_dino(fname)

fname = '../data/KNMI_Bilt.txt'
stress = ps.read_knmi(fname, 'EV24')

obs.plot()
stress.plot()

Beispiel #8
0
"""
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
Beispiel #9
0
"""
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
Beispiel #10
0
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)
Beispiel #11
0
def test_read_knmi():
    ps.read_knmi('tests/data/KNMI_Bilt.txt', "EV24")
    return