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_project():
pr = ps.Project(name="test")
return pr
def load_project(data):
"""Method to load a Pastas project.
Parameters
----------
data: dict
Dictionary containing all information to construct the project.
Returns
-------
mls: Pastas.Project class
Pastas Project class object
"""
mls = ps.Project(name=data["name"])
mls.metadata = data["metadata"]
mls.file_info = data["file_info"]
oseries = DataFrame(data["oseries"], columns=data["oseries"].keys()).T
mls.oseries = mls.oseries.append(oseries, sort=False)
stresses = DataFrame(data=data["stresses"],
columns=data["stresses"].keys()).T
mls.stresses = mls.stresses.append(stresses, sort=False)
for ml_name, ml in data["models"].items():
name = str(ml["oseries"]["name"])
ml_name = str(ml_name)
ml["oseries"]["series"] = mls.oseries.loc[name, "series"]
if ml["stressmodels"]:
"""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)
ml.solve(freq="D", warmup=1000, report=False)
mls.to_file("test_project.pas")