Exemple #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()
Exemple #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
Exemple #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'
Exemple #4
0
"""
This is an example with a step in the observations, which we add artificially.
We model this step through a StepModel.

"""
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)
Exemple #5
0
"""
This test file is meant for developing purposes. Providing an easy method to
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)
Exemple #6
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()

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

# Import tools and real time simulation class
sys.path.append(dr + '/Tools')
from Eref_to_epot import calc_epot  # Function for calculating potential evaporation from reference evaporation
sys.path.append(dr + '/Wrappers')
from rt_simulation import rt_simulation  # Function for performing real-time forecasts
"""
Import data

"""

# Import groundwater data and edit
Pbcode = 'B58C0352'
filternumber = str(1)
gwl = ps.read_dino(dr + '/Data/Real time simulation example/Groundwater/' +
                   Pbcode + '00' + filternumber + '_1.csv')
gwl = gwl.series
gwl = gwl.to_frame()['2001-01-01 00:00:00':]
gwl.columns = ['Stand (cm t.o.v. NAP)']
for i in range(len(gwl)):
    if gwl['Stand (cm t.o.v. NAP)'][i] < gwl['Stand (cm t.o.v. NAP)'].mean(
    ) - (3 * gwl['Stand (cm t.o.v. NAP)'].std()) or gwl[
            'Stand (cm t.o.v. NAP)'][i] > gwl['Stand (cm t.o.v. NAP)'].mean(
            ) + (3 * gwl['Stand (cm t.o.v. NAP)'].std()):
        gwl['Stand (cm t.o.v. NAP)'][i] = 'nan'
gwl = gwl.interpolate()

# Distinguish historical data and year with most recent observations
gwl1 = gwl[:len(gwl) - 360]
gwl2 = gwl[len(gwl) - 360:]
Exemple #8
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()
Exemple #9
0
def test_read_dino():
    ps.read_dino('tests/data/B32D0136001_1.csv')
    return
Exemple #10
0
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 30 16:07:44 2016

@author: ruben
"""

import matplotlib.pyplot as plt
import pastas as ps

# # How to use it?
fname = '../data/B32D0136001_1.csv'
dino = ps.read_dino(fname)

# plot
dino.plot()
plt.show()