Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from pandas import read_csv
import pastas as ps
ps.set_log_level("ERROR")
def test_create_project():
pr = ps.Project(name="test")
return pr
def test_project_add_oseries():
pr = test_create_project()
obs = read_csv("tests/data/obs.csv", index_col=0, parse_dates=True,
squeeze=True)
pr.add_oseries(obs, name="heads", metadata={"x": 0.0, "y": 0})
return pr
def test_project_add_stresses():
"""
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
ps.set_log_level("ERROR")
# 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,
# -*- coding: utf-8 -*-
"""
This example is meant to show the logger methods of pastas
"""
import pastas as ps
# using the default logger, we will see some infomration in the console:
obs = ps.read_dino('data/B58C0698001_1.csv')
# when we set the level to WARNING we do not see any output anymore
ps.set_log_level('WARNING')
# which is just a wrapper around
ps.utils.set_console_handler(ps.logger, level='WARNING')
obs = ps.read_dino('data/B58C0698001_1.csv')
# when we also want log-information saved to file, we add file-handlers
ps.utils.add_file_handlers(ps.logger)
obs = ps.read_dino('data/B58C0698001_1.csv')
# to get the default logger back we initialize it again
ps.utils.initialize_logger(ps.logger)
"""
This test file is meant for developing purposes, providing an easy method to
test the functioning of Pastas recharge module during development.
Author: R.A. Collenteur, University of Graz.
"""
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')
import numpy as np
import pandas as pd
import pastas as ps
ps.set_log_level("ERROR")
# read observations and create the time series model
obs = pd.read_csv("data/head_nb1.csv", index_col=0, parse_dates=True,
squeeze=True)
ml = ps.Model(obs, name="groundwater head")
# read weather data and create stressmodel
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)
sm = ps.RechargeModel(prec=rain, evap=evap, rfunc=ps.Exponential,
recharge="Linear", name='recharge')
ml.add_stressmodel(sm)
# Solve
"""
This test file is meant for developing purposes, providing an easy method to
test the functioning of Pastas recharge module during development.
Author: R.A. Collenteur, University of Graz.
"""
import pandas as pd
import pastas as ps
ps.set_log_level("ERROR")
# 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,