pastastore 1.7.2__py3-none-any.whl → 1.9.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pastastore/base.py +96 -638
- pastastore/connectors.py +917 -18
- pastastore/extensions/hpd.py +4 -4
- pastastore/plotting.py +8 -9
- pastastore/store.py +296 -116
- pastastore/styling.py +4 -4
- pastastore/util.py +15 -11
- pastastore/version.py +1 -1
- pastastore/yaml_interface.py +35 -8
- {pastastore-1.7.2.dist-info → pastastore-1.9.0.dist-info}/LICENSE +1 -1
- {pastastore-1.7.2.dist-info → pastastore-1.9.0.dist-info}/METADATA +37 -45
- pastastore-1.9.0.dist-info/RECORD +28 -0
- {pastastore-1.7.2.dist-info → pastastore-1.9.0.dist-info}/WHEEL +1 -1
- tests/conftest.py +1 -5
- tests/test_003_pastastore.py +28 -10
- tests/test_006_benchmark.py +0 -3
- tests/test_007_hpdextension.py +10 -8
- pastastore-1.7.2.dist-info/RECORD +0 -28
- {pastastore-1.7.2.dist-info → pastastore-1.9.0.dist-info}/top_level.txt +0 -0
pastastore/styling.py
CHANGED
|
@@ -57,12 +57,12 @@ def boolean_styler(b):
|
|
|
57
57
|
"""
|
|
58
58
|
if b:
|
|
59
59
|
return (
|
|
60
|
-
f"background-color: {rgb2hex((231/255, 255/255, 239/255))}; "
|
|
60
|
+
f"background-color: {rgb2hex((231 / 255, 255 / 255, 239 / 255))}; "
|
|
61
61
|
"color: darkgreen"
|
|
62
62
|
)
|
|
63
63
|
else:
|
|
64
64
|
return (
|
|
65
|
-
f"background-color: {rgb2hex((255/255, 238/255, 238/255))}; "
|
|
65
|
+
f"background-color: {rgb2hex((255 / 255, 238 / 255, 238 / 255))}; "
|
|
66
66
|
"color: darkred"
|
|
67
67
|
)
|
|
68
68
|
|
|
@@ -90,11 +90,11 @@ def boolean_row_styler(row, column):
|
|
|
90
90
|
"""
|
|
91
91
|
if row[column]:
|
|
92
92
|
return (
|
|
93
|
-
f"background-color: {rgb2hex((231/255, 255/255, 239/255))}; "
|
|
93
|
+
f"background-color: {rgb2hex((231 / 255, 255 / 255, 239 / 255))}; "
|
|
94
94
|
"color: darkgreen",
|
|
95
95
|
) * row.size
|
|
96
96
|
else:
|
|
97
97
|
return (
|
|
98
|
-
f"background-color: {rgb2hex((255/255, 238/255, 238/255))}; "
|
|
98
|
+
f"background-color: {rgb2hex((255 / 255, 238 / 255, 238 / 255))}; "
|
|
99
99
|
"color: darkred",
|
|
100
100
|
) * row.size
|
pastastore/util.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Useful utilities for pastastore."""
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
|
+
import shutil
|
|
4
5
|
from typing import Dict, List, Optional, Union
|
|
5
6
|
|
|
6
7
|
import numpy as np
|
|
@@ -43,8 +44,6 @@ def delete_arcticdb_connector(
|
|
|
43
44
|
list of library names to delete, by default None which deletes
|
|
44
45
|
all libraries
|
|
45
46
|
"""
|
|
46
|
-
import shutil
|
|
47
|
-
|
|
48
47
|
import arcticdb
|
|
49
48
|
|
|
50
49
|
if conn is not None:
|
|
@@ -75,9 +74,17 @@ def delete_arcticdb_connector(
|
|
|
75
74
|
print()
|
|
76
75
|
print(f" - deleted: {lib}")
|
|
77
76
|
|
|
78
|
-
|
|
77
|
+
# delete .pastastore file if entire pastastore is deleted
|
|
78
|
+
remaining_libs = [
|
|
79
|
+
ilib for ilib in arc.list_libraries() if ilib.split(".")[0] == name
|
|
80
|
+
]
|
|
81
|
+
if remaining_libs == 0:
|
|
82
|
+
os.unlink(os.path.join(uri.split("//")[-1], f"{name}.pastastore"))
|
|
83
|
+
|
|
84
|
+
# check if any remaining libraries in lmdb dir, if none, delete entire folder
|
|
85
|
+
remaining = arc.list_libraries()
|
|
79
86
|
if len(remaining) == 0:
|
|
80
|
-
shutil.rmtree(os.path.join(conn.uri.split("//")[-1]
|
|
87
|
+
shutil.rmtree(os.path.join(conn.uri.split("//")[-1]))
|
|
81
88
|
|
|
82
89
|
print("Done!")
|
|
83
90
|
|
|
@@ -98,8 +105,6 @@ def delete_dict_connector(conn, libraries: Optional[List[str]] = None) -> None:
|
|
|
98
105
|
|
|
99
106
|
def delete_pas_connector(conn, libraries: Optional[List[str]] = None) -> None:
|
|
100
107
|
"""Delete PasConnector object."""
|
|
101
|
-
import shutil
|
|
102
|
-
|
|
103
108
|
print(f"Deleting PasConnector database: '{conn.name}' ... ", end="")
|
|
104
109
|
if libraries is None:
|
|
105
110
|
shutil.rmtree(conn.path)
|
|
@@ -143,7 +148,7 @@ def delete_pastastore(pstore, libraries: Optional[List[str]] = None) -> None:
|
|
|
143
148
|
delete_pas_connector(conn=pstore.conn, libraries=libraries)
|
|
144
149
|
else:
|
|
145
150
|
raise TypeError(
|
|
146
|
-
"Unrecognized pastastore Connector type:
|
|
151
|
+
f"Unrecognized pastastore Connector type: {pstore.conn.conn_type}"
|
|
147
152
|
)
|
|
148
153
|
|
|
149
154
|
|
|
@@ -385,7 +390,7 @@ def copy_database(
|
|
|
385
390
|
conn2,
|
|
386
391
|
libraries: Optional[List[str]] = None,
|
|
387
392
|
overwrite: bool = False,
|
|
388
|
-
progressbar: bool =
|
|
393
|
+
progressbar: bool = True,
|
|
389
394
|
) -> None:
|
|
390
395
|
"""Copy libraries from one database to another.
|
|
391
396
|
|
|
@@ -545,7 +550,7 @@ def frontiers_checks(
|
|
|
545
550
|
ml = pstore.get_models(mlnam)
|
|
546
551
|
|
|
547
552
|
if ml.parameters["optimal"].hasnans:
|
|
548
|
-
print(f"Warning! Skipping model '{mlnam}' because
|
|
553
|
+
print(f"Warning! Skipping model '{mlnam}' because it is not solved!")
|
|
549
554
|
continue
|
|
550
555
|
|
|
551
556
|
checks = pd.DataFrame(columns=["stat", "threshold", "units", "check_passed"])
|
|
@@ -752,8 +757,7 @@ def frontiers_aic_select(
|
|
|
752
757
|
modelnames += pstore.oseries_models[o]
|
|
753
758
|
elif oseries is not None:
|
|
754
759
|
print(
|
|
755
|
-
"Warning! Both 'modelnames' and 'oseries' provided, "
|
|
756
|
-
"using only 'modelnames'"
|
|
760
|
+
"Warning! Both 'modelnames' and 'oseries' provided, using only 'modelnames'"
|
|
757
761
|
)
|
|
758
762
|
|
|
759
763
|
# Dataframe of models with corresponding oseries
|
pastastore/version.py
CHANGED
|
@@ -9,7 +9,7 @@ PASTAS_VERSION = parse_version(ps.__version__)
|
|
|
9
9
|
PASTAS_LEQ_022 = PASTAS_VERSION <= parse_version("0.22.0")
|
|
10
10
|
PASTAS_GEQ_150 = PASTAS_VERSION >= parse_version("1.5.0")
|
|
11
11
|
|
|
12
|
-
__version__ = "1.
|
|
12
|
+
__version__ = "1.9.0"
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
def show_versions(optional=False) -> None:
|
pastastore/yaml_interface.py
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
import datetime
|
|
4
4
|
import logging
|
|
5
5
|
import os
|
|
6
|
+
import tempfile
|
|
7
|
+
from contextlib import contextmanager
|
|
6
8
|
from copy import deepcopy
|
|
7
9
|
from typing import Any, Dict, List, Optional, Union
|
|
8
10
|
|
|
@@ -124,6 +126,18 @@ def reduce_to_minimal_dict(d, keys=None):
|
|
|
124
126
|
reduce_to_minimal_dict(v, keys=keys)
|
|
125
127
|
|
|
126
128
|
|
|
129
|
+
@contextmanager
|
|
130
|
+
def temporary_yaml_from_str(yaml):
|
|
131
|
+
"""Temporary yaml file that is deleted after usage."""
|
|
132
|
+
temp = tempfile.NamedTemporaryFile(delete=False)
|
|
133
|
+
temp.write(yaml.encode("utf-8"))
|
|
134
|
+
temp.close()
|
|
135
|
+
try:
|
|
136
|
+
yield temp.name
|
|
137
|
+
finally:
|
|
138
|
+
os.unlink(temp.name)
|
|
139
|
+
|
|
140
|
+
|
|
127
141
|
class PastastoreYAML:
|
|
128
142
|
"""Class for reading/writing Pastas models in YAML format.
|
|
129
143
|
|
|
@@ -427,7 +441,7 @@ class PastastoreYAML:
|
|
|
427
441
|
.values
|
|
428
442
|
)
|
|
429
443
|
logger.info(
|
|
430
|
-
f" | using {n} nearest stress(es) with kind='{kind}':
|
|
444
|
+
f" | using {n} nearest stress(es) with kind='{kind}': {snames}"
|
|
431
445
|
)
|
|
432
446
|
else:
|
|
433
447
|
snames = [snames]
|
|
@@ -533,7 +547,10 @@ class PastastoreYAML:
|
|
|
533
547
|
if (
|
|
534
548
|
smnam.lower() in ["rch", "rech", "recharge", "rechargemodel"]
|
|
535
549
|
) and not smtyp:
|
|
536
|
-
logger.info(
|
|
550
|
+
logger.info(
|
|
551
|
+
"| no StressModel type provided, using 'RechargeModel' based on "
|
|
552
|
+
"stressmodel name."
|
|
553
|
+
)
|
|
537
554
|
# check if stressmodel dictionary is empty, create (nearly
|
|
538
555
|
# empty) dict so defaults are used
|
|
539
556
|
if smyml is None:
|
|
@@ -547,14 +564,14 @@ class PastastoreYAML:
|
|
|
547
564
|
# cannot make any assumptions for non-RechargeModels
|
|
548
565
|
if smyml is None:
|
|
549
566
|
raise ValueError(
|
|
550
|
-
"Insufficient information
|
|
567
|
+
f"Insufficient information for stressmodel '{name}'!"
|
|
551
568
|
)
|
|
552
569
|
# get stressmodel type, with default StressModel
|
|
553
570
|
if classkey in smyml:
|
|
554
571
|
smtyp = smyml[classkey]
|
|
555
572
|
else:
|
|
556
573
|
logger.info(
|
|
557
|
-
"| no stressmodel class type provided,
|
|
574
|
+
"| no stressmodel class type provided, using 'StressModel'"
|
|
558
575
|
)
|
|
559
576
|
smtyp = "StressModel"
|
|
560
577
|
|
|
@@ -574,7 +591,7 @@ class PastastoreYAML:
|
|
|
574
591
|
sm = self._parse_wellmodel_dict(smyml, onam=onam)
|
|
575
592
|
else:
|
|
576
593
|
raise NotImplementedError(
|
|
577
|
-
"PastaStore.yaml interface does
|
|
594
|
+
f"PastaStore.yaml interface does not (yet) support '{smtyp}'!"
|
|
578
595
|
)
|
|
579
596
|
|
|
580
597
|
# add to list
|
|
@@ -604,7 +621,7 @@ class PastastoreYAML:
|
|
|
604
621
|
Parameters
|
|
605
622
|
----------
|
|
606
623
|
fyaml : str
|
|
607
|
-
path to file
|
|
624
|
+
YAML as str or path to file
|
|
608
625
|
|
|
609
626
|
Returns
|
|
610
627
|
-------
|
|
@@ -618,8 +635,18 @@ class PastastoreYAML:
|
|
|
618
635
|
NotImplementedError
|
|
619
636
|
if unsupported stressmodel is encountered
|
|
620
637
|
"""
|
|
621
|
-
|
|
622
|
-
|
|
638
|
+
if "\n" in fyaml or "\r" in fyaml:
|
|
639
|
+
with temporary_yaml_from_str(fyaml) as fyaml:
|
|
640
|
+
with open(fyaml, "r") as f:
|
|
641
|
+
yml = yaml.load(f, Loader=yaml.CFullLoader)
|
|
642
|
+
elif os.path.exists(fyaml):
|
|
643
|
+
with open(fyaml, "r") as f:
|
|
644
|
+
yml = yaml.load(f, Loader=yaml.CFullLoader)
|
|
645
|
+
else:
|
|
646
|
+
raise ValueError(
|
|
647
|
+
"Could not read YAML file! Check if input is valid YAML "
|
|
648
|
+
"or valid path to YAML file."
|
|
649
|
+
)
|
|
623
650
|
|
|
624
651
|
models = []
|
|
625
652
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: pastastore
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.9.0
|
|
4
4
|
Summary: Tools for managing Pastas time series models.
|
|
5
5
|
Author: D.A. Brakenhoff
|
|
6
6
|
Maintainer-email: "D.A. Brakenhoff" <d.brakenhoff@artesia-water.nl>, "R. Calje" <r.calje@artesia-water.nl>, "M.A. Vonk" <m.vonk@artesia-water.nl>
|
|
7
7
|
License: The MIT License (MIT)
|
|
8
8
|
|
|
9
|
-
Copyright (c) 2020 D.A. Brakenhoff
|
|
9
|
+
Copyright (c) 2020-2025 D.A. Brakenhoff
|
|
10
10
|
|
|
11
11
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
12
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -40,57 +40,49 @@ Classifier: Operating System :: Unix
|
|
|
40
40
|
Classifier: Operating System :: MacOS
|
|
41
41
|
Classifier: Programming Language :: Python
|
|
42
42
|
Classifier: Programming Language :: Python :: 3
|
|
43
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
44
43
|
Classifier: Programming Language :: Python :: 3.10
|
|
45
44
|
Classifier: Programming Language :: Python :: 3.11
|
|
46
45
|
Classifier: Programming Language :: Python :: 3.12
|
|
46
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
47
47
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
48
48
|
Classifier: Topic :: Scientific/Engineering :: Hydrology
|
|
49
|
-
Requires-Python: >=3.
|
|
49
|
+
Requires-Python: >=3.10
|
|
50
50
|
Description-Content-Type: text/markdown
|
|
51
51
|
License-File: LICENSE
|
|
52
|
-
Requires-Dist: pastas
|
|
53
|
-
Requires-Dist: tqdm
|
|
52
|
+
Requires-Dist: pastas>=0.13
|
|
53
|
+
Requires-Dist: tqdm>=4.36
|
|
54
54
|
Requires-Dist: pyyaml
|
|
55
|
-
Provides-Extra: arcticdb
|
|
56
|
-
Requires-Dist: arcticdb ; extra == 'arcticdb'
|
|
57
|
-
Provides-Extra: docs
|
|
58
|
-
Requires-Dist: pastastore[optional] ; extra == 'docs'
|
|
59
|
-
Requires-Dist: sphinx-rtd-theme ; extra == 'docs'
|
|
60
|
-
Requires-Dist: Ipython ; extra == 'docs'
|
|
61
|
-
Requires-Dist: ipykernel ; extra == 'docs'
|
|
62
|
-
Requires-Dist: nbsphinx ; extra == 'docs'
|
|
63
|
-
Requires-Dist: nbsphinx-link ; extra == 'docs'
|
|
64
|
-
Provides-Extra: extensions
|
|
65
|
-
Requires-Dist: hydropandas ; extra == 'extensions'
|
|
66
55
|
Provides-Extra: full
|
|
67
|
-
Requires-Dist: pastastore[arcticdb,optional]
|
|
68
|
-
|
|
69
|
-
|
|
56
|
+
Requires-Dist: pastastore[arcticdb,optional]; extra == "full"
|
|
57
|
+
Requires-Dist: hydropandas; extra == "full"
|
|
58
|
+
Provides-Extra: extensions
|
|
59
|
+
Requires-Dist: hydropandas; extra == "extensions"
|
|
70
60
|
Provides-Extra: optional
|
|
71
|
-
Requires-Dist: contextily
|
|
72
|
-
Requires-Dist: pyproj
|
|
73
|
-
Requires-Dist: adjustText
|
|
61
|
+
Requires-Dist: contextily; extra == "optional"
|
|
62
|
+
Requires-Dist: pyproj; extra == "optional"
|
|
63
|
+
Requires-Dist: adjustText; extra == "optional"
|
|
64
|
+
Provides-Extra: arcticdb
|
|
65
|
+
Requires-Dist: arcticdb; extra == "arcticdb"
|
|
66
|
+
Provides-Extra: lint
|
|
67
|
+
Requires-Dist: ruff; extra == "lint"
|
|
68
|
+
Provides-Extra: pytest
|
|
69
|
+
Requires-Dist: coverage; extra == "pytest"
|
|
70
|
+
Requires-Dist: codecov; extra == "pytest"
|
|
71
|
+
Requires-Dist: pytest; extra == "pytest"
|
|
72
|
+
Requires-Dist: pytest-cov; extra == "pytest"
|
|
73
|
+
Requires-Dist: pytest-dependency; extra == "pytest"
|
|
74
|
+
Requires-Dist: pytest-benchmark; extra == "pytest"
|
|
75
|
+
Requires-Dist: codacy-coverage; extra == "pytest"
|
|
74
76
|
Provides-Extra: test
|
|
75
|
-
Requires-Dist: pastastore[arcticdb,lint,optional]
|
|
76
|
-
Requires-Dist: hydropandas[full]
|
|
77
|
-
|
|
78
|
-
Requires-Dist:
|
|
79
|
-
Requires-Dist:
|
|
80
|
-
Requires-Dist:
|
|
81
|
-
Requires-Dist:
|
|
82
|
-
Requires-Dist:
|
|
83
|
-
Requires-Dist:
|
|
84
|
-
Provides-Extra: test_py312
|
|
85
|
-
Requires-Dist: pastastore[lint,optional] ; extra == 'test_py312'
|
|
86
|
-
Requires-Dist: hydropandas[full] ; extra == 'test_py312'
|
|
87
|
-
Requires-Dist: coverage ; extra == 'test_py312'
|
|
88
|
-
Requires-Dist: codecov ; extra == 'test_py312'
|
|
89
|
-
Requires-Dist: pytest ; extra == 'test_py312'
|
|
90
|
-
Requires-Dist: pytest-cov ; extra == 'test_py312'
|
|
91
|
-
Requires-Dist: pytest-dependency ; extra == 'test_py312'
|
|
92
|
-
Requires-Dist: pytest-benchmark ; extra == 'test_py312'
|
|
93
|
-
Requires-Dist: codacy-coverage ; extra == 'test_py312'
|
|
77
|
+
Requires-Dist: pastastore[arcticdb,lint,optional,pytest]; extra == "test"
|
|
78
|
+
Requires-Dist: hydropandas[full]; extra == "test"
|
|
79
|
+
Provides-Extra: docs
|
|
80
|
+
Requires-Dist: pastastore[optional]; extra == "docs"
|
|
81
|
+
Requires-Dist: sphinx_rtd_theme; extra == "docs"
|
|
82
|
+
Requires-Dist: Ipython; extra == "docs"
|
|
83
|
+
Requires-Dist: ipykernel; extra == "docs"
|
|
84
|
+
Requires-Dist: nbsphinx; extra == "docs"
|
|
85
|
+
Requires-Dist: nbsphinx_link; extra == "docs"
|
|
94
86
|
|
|
95
87
|

|
|
96
88
|
[](https://pastastore.readthedocs.io/en/latest/?badge=latest)
|
|
@@ -101,7 +93,7 @@ Requires-Dist: codacy-coverage ; extra == 'test_py312'
|
|
|
101
93
|
# pastastore
|
|
102
94
|
|
|
103
95
|
This module stores
|
|
104
|
-
[Pastas](https://pastas.readthedocs.io/
|
|
96
|
+
[Pastas](https://pastas.readthedocs.io/latest/) time series and models in a
|
|
105
97
|
database.
|
|
106
98
|
|
|
107
99
|
Storing time series and models in a database allows the user to manage time
|
|
@@ -186,4 +178,4 @@ pstore.to_zip("my_backup.zip")
|
|
|
186
178
|
```
|
|
187
179
|
|
|
188
180
|
For more elaborate examples, refer to the
|
|
189
|
-
[Notebooks](https://pastastore.readthedocs.io/
|
|
181
|
+
[Notebooks](https://pastastore.readthedocs.io/latest/examples.html#example-notebooks).
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
docs/conf.py,sha256=XcZUTmn9fGDhhu8k3mpaLu435SpIRNpABADCCTJJuag,6291
|
|
2
|
+
pastastore/__init__.py,sha256=cWwG9-YeiI4aOU0CDBGKbQgmKmmkcPd64YwPq2rRGt0,416
|
|
3
|
+
pastastore/base.py,sha256=B7sPe1eEpXFSeQsgrPXc5Mvp8Xkbhe_TxML6Zlp19Lk,48172
|
|
4
|
+
pastastore/connectors.py,sha256=MWekEj3CDspgEHKAm4Ml4kV-wHKPBlFgiVmq4ZPVlVM,50166
|
|
5
|
+
pastastore/datasets.py,sha256=FHVfmKqb8beEs9NONsWrCoJY37BmlvFLSEQ1VAFmE8A,6415
|
|
6
|
+
pastastore/plotting.py,sha256=y_20sAxhLelXLWs-aHHankICAMT-m1p3cIg68sIQO8A,46401
|
|
7
|
+
pastastore/store.py,sha256=yPg2jGWCbx3JhKQd75orVMoIiReWpHtkYDBlSa-kPDM,67303
|
|
8
|
+
pastastore/styling.py,sha256=0IEp_r-SpcaslShAZvZV6iuEhTG_YzNq-ad8krib3U0,2304
|
|
9
|
+
pastastore/util.py,sha256=31dzHaK6xdFHGDkYh49qGBq1dGel2m9r7i797S3WUpQ,28505
|
|
10
|
+
pastastore/version.py,sha256=JLSkXbkBpYWqHRJtx-UJKAiORL1Kn48xQAfAYq9PNik,1205
|
|
11
|
+
pastastore/yaml_interface.py,sha256=n6zjQ7ENrUvxszb6zE-jPLa-XVsoEOTJHQmRV1_fFt0,30818
|
|
12
|
+
pastastore/extensions/__init__.py,sha256=lCN9xfX1qefUzUbE2FQ12c6NjLbf5HoNo-D8cGb5CTw,461
|
|
13
|
+
pastastore/extensions/accessor.py,sha256=kftQM6dqMDoySbyTKcvmkjC5gJRp465KA18G4NVXUO0,367
|
|
14
|
+
pastastore/extensions/hpd.py,sha256=NAB9_24ClohVjZWN5erFgkcadhzdZqXOQUIz4aCycBY,27472
|
|
15
|
+
tests/conftest.py,sha256=TB0ZUH1m45gvQd_EZO7iudvhFw4JA-8rTJ71GT6Nf1w,5061
|
|
16
|
+
tests/test_001_import.py,sha256=g8AaJzWZ088A4B30_w-MrDfAVeeg8m78l--j7Onsklc,208
|
|
17
|
+
tests/test_002_connectors.py,sha256=k9etSRuSFVOrSEtZyxqsCF9GwIg0T7VdDJ2SjSe6i_s,7742
|
|
18
|
+
tests/test_003_pastastore.py,sha256=nhcUJHC2KiF9KREP_2uj_T2skKooUk13T1EVtkbwQnM,10051
|
|
19
|
+
tests/test_004_yaml.py,sha256=3hMNjb9s0S2rbmpyEjW6FDRAxfUZS_U1qoPl4wB-cCo,4440
|
|
20
|
+
tests/test_005_maps_plots.py,sha256=L0ppGf-cudsrdxteWy3qsV4We96DW4bCBE7c6jEm6aM,1866
|
|
21
|
+
tests/test_006_benchmark.py,sha256=VZG0bY7uz8DkfIZTgRCzkEDG8rguBEt_-mdGSMQLN2w,4930
|
|
22
|
+
tests/test_007_hpdextension.py,sha256=1QNUahq3hzqxjKbzsjofi9Yuyqe_oDGL0vWp6iouYe4,3004
|
|
23
|
+
tests/test_008_stressmodels.py,sha256=733fyCvuzjKcaLjvSMt5dTTLp-T4alzNJAToSxTIUug,4003
|
|
24
|
+
pastastore-1.9.0.dist-info/LICENSE,sha256=MB_6p4kXDCUsYNjslcMByBu6i7wMNRKPC36JnhzpN4o,1087
|
|
25
|
+
pastastore-1.9.0.dist-info/METADATA,sha256=XJLzfcZ8CKYUqQ8vJwZXrDq0fZdj1tLGVtsouX5EiSQ,7578
|
|
26
|
+
pastastore-1.9.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
27
|
+
pastastore-1.9.0.dist-info/top_level.txt,sha256=1bgyMk1p23f04RK83Jju2_YAQBwyoQD_fInxoPB4YRw,22
|
|
28
|
+
pastastore-1.9.0.dist-info/RECORD,,
|
tests/conftest.py
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
# ruff: noqa: D100 D103
|
|
2
2
|
import importlib
|
|
3
3
|
from importlib import metadata
|
|
4
|
-
from platform import python_version
|
|
5
4
|
|
|
6
5
|
import pandas as pd
|
|
7
6
|
import pastas as ps
|
|
8
7
|
import pytest
|
|
9
|
-
from packaging.version import parse as parse_version
|
|
10
8
|
|
|
11
9
|
import pastastore as pst
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
params = ["dict", "pas", "arcticdb"] if not IS_PY312 else ["dict", "pas"]
|
|
11
|
+
params = ["dict", "pas", "arcticdb"]
|
|
16
12
|
|
|
17
13
|
|
|
18
14
|
def initialize_project(conn):
|
tests/test_003_pastastore.py
CHANGED
|
@@ -168,6 +168,7 @@ def test_create_models(pstore):
|
|
|
168
168
|
["oseries1", "oseries2"], store=True, progressbar=False
|
|
169
169
|
)
|
|
170
170
|
_ = pstore.conn.models
|
|
171
|
+
assert pstore.n_models == 2
|
|
171
172
|
|
|
172
173
|
|
|
173
174
|
@pytest.mark.dependency
|
|
@@ -210,7 +211,8 @@ def test_solve_models_parallel(request, pstore):
|
|
|
210
211
|
def test_apply(request, pstore):
|
|
211
212
|
depends(request, [f"test_solve_models_and_get_stats[{pstore.type}]"])
|
|
212
213
|
|
|
213
|
-
def func(
|
|
214
|
+
def func(ml_name):
|
|
215
|
+
ml = pstore.conn.get_models(ml_name)
|
|
214
216
|
return ml.parameters.loc["recharge_A", "optimal"]
|
|
215
217
|
|
|
216
218
|
result = pstore.apply("models", func)
|
|
@@ -251,15 +253,12 @@ def test_update_ts_settings(request, pstore):
|
|
|
251
253
|
|
|
252
254
|
ml2 = pstore.get_models(ml.name, update_ts_settings=True)
|
|
253
255
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
pstore.del_models("ml_oseries2")
|
|
261
|
-
pstore.set_check_model_series_values(True)
|
|
262
|
-
raise
|
|
256
|
+
assert ml2.oseries.settings["tmax"] == o.index[-1]
|
|
257
|
+
assert ml2.stressmodels["recharge"].prec.settings["tmax"] == tmax
|
|
258
|
+
assert ml2.stressmodels["recharge"].evap.settings["tmax"] == tmax
|
|
259
|
+
assert ml2.stressmodels["prec"].stress[0].settings["tmax"] == p2.index[-1]
|
|
260
|
+
pstore.del_models("ml_oseries2")
|
|
261
|
+
pstore.set_check_model_series_values(True)
|
|
263
262
|
|
|
264
263
|
|
|
265
264
|
# @pytest.mark.dependency()
|
|
@@ -295,6 +294,16 @@ def test_to_from_zip(pstore):
|
|
|
295
294
|
os.remove(zipname)
|
|
296
295
|
|
|
297
296
|
|
|
297
|
+
def test_load_pastastore_from_config_file(pstore):
|
|
298
|
+
if pstore.type == "pas" or pstore.type == "arcticdb":
|
|
299
|
+
path = (
|
|
300
|
+
pstore.conn.path if pstore.type == "pas" else pstore.conn.uri.split("//")[1]
|
|
301
|
+
)
|
|
302
|
+
fname = os.path.join(path, f"{pstore.conn.name}.pastastore")
|
|
303
|
+
pstore2 = pst.PastaStore.from_pastastore_config_file(fname)
|
|
304
|
+
assert not pstore2.empty
|
|
305
|
+
|
|
306
|
+
|
|
298
307
|
def test_example_pastastore():
|
|
299
308
|
from pastastore.datasets import example_pastastore
|
|
300
309
|
|
|
@@ -318,3 +327,12 @@ def test_meta_with_name(pstore):
|
|
|
318
327
|
pstore.add_stress(s, "what_i_want", kind="special", metadata=smeta)
|
|
319
328
|
assert "what_i_want" in pstore.stresses.index, "This is not right."
|
|
320
329
|
pstore.del_stress("what_i_want")
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
@pytest.mark.dependency
|
|
333
|
+
def test_models_metadata(request, pstore):
|
|
334
|
+
# depends(request, [f"test_create_models[{pstore.type}]"])
|
|
335
|
+
pstore.create_models_bulk(["oseries1", "oseries2"], store=True, progressbar=False)
|
|
336
|
+
df = pstore.models.metadata
|
|
337
|
+
assert df.index.size == 2
|
|
338
|
+
assert (df["n_stressmodels"] == 1).all()
|
tests/test_006_benchmark.py
CHANGED
tests/test_007_hpdextension.py
CHANGED
|
@@ -25,7 +25,7 @@ def test_hpd_download_precipitation_from_knmi():
|
|
|
25
25
|
activate_hydropandas_extension()
|
|
26
26
|
pstore = pst.PastaStore()
|
|
27
27
|
pstore.hpd.download_knmi_precipitation(
|
|
28
|
-
stns=[260], tmin="2022-01-01", tmax="2022-01-31"
|
|
28
|
+
stns=[260], meteo_var="RH", tmin="2022-01-01", tmax="2022-01-31"
|
|
29
29
|
)
|
|
30
30
|
assert pstore.n_stresses == 1
|
|
31
31
|
|
|
@@ -50,10 +50,10 @@ def test_update_oseries():
|
|
|
50
50
|
activate_hydropandas_extension()
|
|
51
51
|
|
|
52
52
|
pstore = pst.PastaStore.from_zip("tests/data/test_hpd_update.zip")
|
|
53
|
-
pstore.hpd.update_bro_gmw(tmax="
|
|
53
|
+
pstore.hpd.update_bro_gmw(tmax="2022-02-28")
|
|
54
54
|
tmintmax = pstore.get_tmin_tmax("oseries")
|
|
55
|
-
assert tmintmax.loc["GMW000000036319_1", "tmax"] >= Timestamp("
|
|
56
|
-
assert tmintmax.loc["GMW000000036327_1", "tmax"] >= Timestamp("
|
|
55
|
+
assert tmintmax.loc["GMW000000036319_1", "tmax"] >= Timestamp("2022-02-27")
|
|
56
|
+
assert tmintmax.loc["GMW000000036327_1", "tmax"] >= Timestamp("2022-02-27")
|
|
57
57
|
|
|
58
58
|
|
|
59
59
|
@pytest.mark.xfail(reason="KNMI is being flaky, so allow this test to xfail/xpass.")
|
|
@@ -64,9 +64,9 @@ def test_update_stresses():
|
|
|
64
64
|
activate_hydropandas_extension()
|
|
65
65
|
|
|
66
66
|
pstore = pst.PastaStore.from_zip("tests/data/test_hpd_update.zip")
|
|
67
|
-
pstore.hpd.update_knmi_meteo(tmax="
|
|
67
|
+
pstore.hpd.update_knmi_meteo(tmax="2022-02-28", normalize_datetime_index=True)
|
|
68
68
|
tmintmax = pstore.get_tmin_tmax("stresses")
|
|
69
|
-
assert (tmintmax["tmax"] >= Timestamp("2024-
|
|
69
|
+
assert (tmintmax["tmax"] >= Timestamp("2024-02-27")).all()
|
|
70
70
|
|
|
71
71
|
|
|
72
72
|
@pytest.mark.xfail(reason="KNMI is being flaky, so allow this test to xfail/xpass.")
|
|
@@ -78,8 +78,10 @@ def test_nearest_stresses():
|
|
|
78
78
|
|
|
79
79
|
pstore = pst.PastaStore.from_zip("tests/data/test_hpd_update.zip")
|
|
80
80
|
pstore.hpd.download_nearest_knmi_precipitation(
|
|
81
|
-
"GMW000000036319_1", tmin="2024-01-01"
|
|
81
|
+
"GMW000000036319_1", tmin="2024-01-01", tmax="2024-01-31"
|
|
82
82
|
)
|
|
83
83
|
assert "RD_GROOT-AMMERS" in pstore.stresses_names
|
|
84
|
-
pstore.hpd.download_nearest_knmi_evaporation(
|
|
84
|
+
pstore.hpd.download_nearest_knmi_evaporation(
|
|
85
|
+
"GMW000000036319_1", tmin="2024-01-01", tmax="2024-01-31"
|
|
86
|
+
)
|
|
85
87
|
assert "EV24_CABAUW-MAST" in pstore.stresses_names
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
docs/conf.py,sha256=XcZUTmn9fGDhhu8k3mpaLu435SpIRNpABADCCTJJuag,6291
|
|
2
|
-
pastastore/__init__.py,sha256=cWwG9-YeiI4aOU0CDBGKbQgmKmmkcPd64YwPq2rRGt0,416
|
|
3
|
-
pastastore/base.py,sha256=gngnJOL4b4TNgPysRsxdyeg726ZNV2anQviNr5nnrqs,69101
|
|
4
|
-
pastastore/connectors.py,sha256=YK3I_Jb2uNwzBQvN2VwZvmTRfPeUETW-4ddcFSWkHVw,16820
|
|
5
|
-
pastastore/datasets.py,sha256=FHVfmKqb8beEs9NONsWrCoJY37BmlvFLSEQ1VAFmE8A,6415
|
|
6
|
-
pastastore/plotting.py,sha256=t6gEeHVGzrwvM6q1l8V3OkklpU75O2Y4h6nKEHRWdjo,46416
|
|
7
|
-
pastastore/store.py,sha256=xbv1prv6QqYj8M-2c77CT0ZQejjmNSldpuqu_M4WxoU,60906
|
|
8
|
-
pastastore/styling.py,sha256=4xAY0FmhKrvmAGIuoMM7Uucww_X4KAxTpEoHlsxMldc,2280
|
|
9
|
-
pastastore/util.py,sha256=iXHoGHfK6VDbUpufNsnzdV71oBVp-koZUD4VJj6MOwo,28250
|
|
10
|
-
pastastore/version.py,sha256=CNSMFFOsy1MPe400qfRtqb8M-LE8iUmm7u0QSZZUOfE,1205
|
|
11
|
-
pastastore/yaml_interface.py,sha256=MddELxWe8_aqJRMUydOCbjoU1-ZodzxFKYnAaqJ5SqA,29947
|
|
12
|
-
pastastore/extensions/__init__.py,sha256=lCN9xfX1qefUzUbE2FQ12c6NjLbf5HoNo-D8cGb5CTw,461
|
|
13
|
-
pastastore/extensions/accessor.py,sha256=kftQM6dqMDoySbyTKcvmkjC5gJRp465KA18G4NVXUO0,367
|
|
14
|
-
pastastore/extensions/hpd.py,sha256=w8_13Y_1bzgxCT8RJ2L6D_eTpYGpniSbxA4CoUw_CgI,27464
|
|
15
|
-
tests/conftest.py,sha256=u097z7LGAnviuzXPzvER9oPjsZWqdij1CJLnW_sPY8E,5258
|
|
16
|
-
tests/test_001_import.py,sha256=g8AaJzWZ088A4B30_w-MrDfAVeeg8m78l--j7Onsklc,208
|
|
17
|
-
tests/test_002_connectors.py,sha256=k9etSRuSFVOrSEtZyxqsCF9GwIg0T7VdDJ2SjSe6i_s,7742
|
|
18
|
-
tests/test_003_pastastore.py,sha256=uVGqM0RwYqnt2dxlj3i3YO7lG0LAfeg8gSG2QLm4lTI,9320
|
|
19
|
-
tests/test_004_yaml.py,sha256=3hMNjb9s0S2rbmpyEjW6FDRAxfUZS_U1qoPl4wB-cCo,4440
|
|
20
|
-
tests/test_005_maps_plots.py,sha256=L0ppGf-cudsrdxteWy3qsV4We96DW4bCBE7c6jEm6aM,1866
|
|
21
|
-
tests/test_006_benchmark.py,sha256=yuExF35qqxhw04uYMH3OIOlGr71c4AJSJDMjGD8GefY,4983
|
|
22
|
-
tests/test_007_hpdextension.py,sha256=ZYrJ16hNE2Cy6gucMW_0-NoCmlimsPQ5oNA5H67HGBg,2937
|
|
23
|
-
tests/test_008_stressmodels.py,sha256=733fyCvuzjKcaLjvSMt5dTTLp-T4alzNJAToSxTIUug,4003
|
|
24
|
-
pastastore-1.7.2.dist-info/LICENSE,sha256=DtHftfUEm99KzgwLr3rQUTg8H3kAS0Z-p5WWJgLf_OY,1082
|
|
25
|
-
pastastore-1.7.2.dist-info/METADATA,sha256=j_lnxfuDY6aLfSjm71PVA79hUCn18AuIxGycHUhXAcc,8021
|
|
26
|
-
pastastore-1.7.2.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
|
|
27
|
-
pastastore-1.7.2.dist-info/top_level.txt,sha256=1bgyMk1p23f04RK83Jju2_YAQBwyoQD_fInxoPB4YRw,22
|
|
28
|
-
pastastore-1.7.2.dist-info/RECORD,,
|
|
File without changes
|