pastastore 1.9.0__py3-none-any.whl → 1.10.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/connectors.py +1 -1
- pastastore/extensions/hpd.py +7 -0
- pastastore/plotting.py +281 -26
- pastastore/store.py +51 -49
- pastastore/version.py +1 -1
- {pastastore-1.9.0.dist-info → pastastore-1.10.0.dist-info}/METADATA +1 -1
- {pastastore-1.9.0.dist-info → pastastore-1.10.0.dist-info}/RECORD +10 -10
- {pastastore-1.9.0.dist-info → pastastore-1.10.0.dist-info}/LICENSE +0 -0
- {pastastore-1.9.0.dist-info → pastastore-1.10.0.dist-info}/WHEEL +0 -0
- {pastastore-1.9.0.dist-info → pastastore-1.10.0.dist-info}/top_level.txt +0 -0
pastastore/connectors.py
CHANGED
|
@@ -1223,7 +1223,7 @@ class PasConnector(BaseConnector, ConnectorUtil):
|
|
|
1223
1223
|
config = {
|
|
1224
1224
|
"connector_type": self.conn_type,
|
|
1225
1225
|
"name": self.name,
|
|
1226
|
-
"path": self.parentdir,
|
|
1226
|
+
"path": os.path.abspath(self.parentdir),
|
|
1227
1227
|
}
|
|
1228
1228
|
with open(
|
|
1229
1229
|
os.path.join(self.path, f"{self.name}.pastastore"), "w", encoding="utf-8"
|
pastastore/extensions/hpd.py
CHANGED
|
@@ -45,6 +45,13 @@ class HydroPandasExtension:
|
|
|
45
45
|
"""
|
|
46
46
|
self._store = store
|
|
47
47
|
|
|
48
|
+
def __repr__(self):
|
|
49
|
+
"""Return string representation of HydroPandasExtension."""
|
|
50
|
+
methods = "".join(
|
|
51
|
+
[f"\n - {meth}" for meth in dir(self) if not meth.startswith("_")]
|
|
52
|
+
)
|
|
53
|
+
return "HydroPandasExtension, available methods:" + methods
|
|
54
|
+
|
|
48
55
|
def add_obscollection(
|
|
49
56
|
self,
|
|
50
57
|
libname: str,
|
pastastore/plotting.py
CHANGED
|
@@ -42,6 +42,13 @@ class Plots:
|
|
|
42
42
|
"""
|
|
43
43
|
self.pstore = pstore
|
|
44
44
|
|
|
45
|
+
def __repr__(self):
|
|
46
|
+
"""Return string representation of Plots submodule."""
|
|
47
|
+
methods = "".join(
|
|
48
|
+
[f"\n - {meth}" for meth in dir(self) if not meth.startswith("_")]
|
|
49
|
+
)
|
|
50
|
+
return "Plotting submodule, available methods:" + methods
|
|
51
|
+
|
|
45
52
|
def _timeseries(
|
|
46
53
|
self,
|
|
47
54
|
libname,
|
|
@@ -477,6 +484,7 @@ class Plots:
|
|
|
477
484
|
figsize=(6, 6),
|
|
478
485
|
label=None,
|
|
479
486
|
legend=True,
|
|
487
|
+
progressbar=True,
|
|
480
488
|
):
|
|
481
489
|
"""Plot a cumulative step histogram for a model statistic.
|
|
482
490
|
|
|
@@ -500,6 +508,8 @@ class Plots:
|
|
|
500
508
|
of models
|
|
501
509
|
legend: bool, optional
|
|
502
510
|
show legend, by default True
|
|
511
|
+
progressbar: bool, optional
|
|
512
|
+
show progressbar, default is True.
|
|
503
513
|
|
|
504
514
|
Returns
|
|
505
515
|
-------
|
|
@@ -507,7 +517,7 @@ class Plots:
|
|
|
507
517
|
The axes in which the cumulative histogram is plotted
|
|
508
518
|
"""
|
|
509
519
|
statsdf = self.pstore.get_statistics(
|
|
510
|
-
[statistic], modelnames=modelnames, progressbar=
|
|
520
|
+
[statistic], modelnames=modelnames, progressbar=progressbar
|
|
511
521
|
)
|
|
512
522
|
|
|
513
523
|
if ax is None:
|
|
@@ -579,15 +589,15 @@ class Plots:
|
|
|
579
589
|
The CompareModels object containing the comparison results.
|
|
580
590
|
"""
|
|
581
591
|
models = self.pstore.get_models(modelnames)
|
|
582
|
-
names = []
|
|
592
|
+
names = kwargs.pop("names", [])
|
|
583
593
|
onames = [iml.oseries.name for iml in models]
|
|
584
|
-
if len(np.unique(onames)) == 1:
|
|
594
|
+
if len(np.unique(onames)) == 1 and len(names) == 0:
|
|
585
595
|
for modelname in modelnames:
|
|
586
596
|
if onames[0] in modelname:
|
|
587
597
|
names.append(modelname.replace(onames[0], ""))
|
|
588
598
|
else:
|
|
589
599
|
names.append(modelname)
|
|
590
|
-
|
|
600
|
+
elif len(np.unique(onames)) > 1:
|
|
591
601
|
names = modelnames
|
|
592
602
|
cm = ps.CompareModels(models, names=names)
|
|
593
603
|
cm.plot(**kwargs)
|
|
@@ -617,6 +627,13 @@ class Maps:
|
|
|
617
627
|
"""
|
|
618
628
|
self.pstore = pstore
|
|
619
629
|
|
|
630
|
+
def __repr__(self):
|
|
631
|
+
"""Return string representation of Maps submodule."""
|
|
632
|
+
methods = "".join(
|
|
633
|
+
[f"\n - {meth}" for meth in dir(self) if not meth.startswith("_")]
|
|
634
|
+
)
|
|
635
|
+
return "Mapping submodule, available methods:" + methods
|
|
636
|
+
|
|
620
637
|
def stresses(
|
|
621
638
|
self,
|
|
622
639
|
names=None,
|
|
@@ -627,6 +644,7 @@ class Maps:
|
|
|
627
644
|
figsize=(10, 8),
|
|
628
645
|
backgroundmap=False,
|
|
629
646
|
label_kwargs=None,
|
|
647
|
+
show_legend: bool = True,
|
|
630
648
|
**kwargs,
|
|
631
649
|
):
|
|
632
650
|
"""Plot stresses locations on map.
|
|
@@ -653,6 +671,9 @@ class Maps:
|
|
|
653
671
|
by OpenStreetMap.Mapnik. Default option is False.
|
|
654
672
|
label_kwargs: dict, optional
|
|
655
673
|
dictionary with keyword arguments to pass to add_labels method
|
|
674
|
+
show_legend : bool, optional
|
|
675
|
+
add legend with each kind of stress and associated color, only possible
|
|
676
|
+
if colors are not explicitly passed. Default is True.
|
|
656
677
|
|
|
657
678
|
Returns
|
|
658
679
|
-------
|
|
@@ -679,7 +700,8 @@ class Maps:
|
|
|
679
700
|
mask0 = (stresses["x"] != 0.0) | (stresses["y"] != 0.0)
|
|
680
701
|
|
|
681
702
|
if "c" in kwargs:
|
|
682
|
-
c = kwargs.pop("c"
|
|
703
|
+
c = kwargs.pop("c")
|
|
704
|
+
kind_to_color = None
|
|
683
705
|
else:
|
|
684
706
|
c = stresses.loc[mask0, "kind"]
|
|
685
707
|
kind_to_color = {k: f"C{i}" for i, k in enumerate(c.unique())}
|
|
@@ -687,7 +709,7 @@ class Maps:
|
|
|
687
709
|
|
|
688
710
|
r = self._plotmap_dataframe(stresses.loc[mask0], c=c, figsize=figsize, **kwargs)
|
|
689
711
|
if "ax" in kwargs:
|
|
690
|
-
ax = kwargs
|
|
712
|
+
ax = kwargs.pop("ax")
|
|
691
713
|
else:
|
|
692
714
|
ax = r
|
|
693
715
|
if labels:
|
|
@@ -695,6 +717,11 @@ class Maps:
|
|
|
695
717
|
label_kwargs = {}
|
|
696
718
|
self.add_labels(stresses, ax, adjust=adjust, **label_kwargs)
|
|
697
719
|
|
|
720
|
+
if show_legend and kind_to_color is not None:
|
|
721
|
+
for k, color in kind_to_color.items():
|
|
722
|
+
ax.plot([], [], color=color, label=k, **kwargs, marker="o", ls="none")
|
|
723
|
+
ax.legend(loc=(0, 1), frameon=False, ncol=5)
|
|
724
|
+
|
|
698
725
|
if backgroundmap:
|
|
699
726
|
self.add_background_map(ax)
|
|
700
727
|
|
|
@@ -815,6 +842,81 @@ class Maps:
|
|
|
815
842
|
|
|
816
843
|
return ax
|
|
817
844
|
|
|
845
|
+
def _map_helper(
|
|
846
|
+
self,
|
|
847
|
+
df,
|
|
848
|
+
column,
|
|
849
|
+
label=True,
|
|
850
|
+
adjust=False,
|
|
851
|
+
cmap="viridis",
|
|
852
|
+
norm=None,
|
|
853
|
+
vmin=None,
|
|
854
|
+
vmax=None,
|
|
855
|
+
figsize=(10, 8),
|
|
856
|
+
backgroundmap=False,
|
|
857
|
+
**kwargs,
|
|
858
|
+
):
|
|
859
|
+
"""Help function for plotting values on map.
|
|
860
|
+
|
|
861
|
+
Parameters
|
|
862
|
+
----------
|
|
863
|
+
df: pd.DataFrame
|
|
864
|
+
dataframe containing plotting information
|
|
865
|
+
column: str
|
|
866
|
+
column with values to plot
|
|
867
|
+
label: bool, optional
|
|
868
|
+
label points, by default True
|
|
869
|
+
adjust: bool, optional
|
|
870
|
+
automated smart label placement using adjustText, by default False
|
|
871
|
+
cmap: str or colormap, optional
|
|
872
|
+
(name of) the colormap, by default "viridis"
|
|
873
|
+
norm: norm, optional
|
|
874
|
+
normalization for colorbar, by default None
|
|
875
|
+
vmin: float, optional
|
|
876
|
+
vmin for colorbar, by default None
|
|
877
|
+
vmax: float, optional
|
|
878
|
+
vmax for colorbar, by default None
|
|
879
|
+
ax : matplotlib.Axes, optional
|
|
880
|
+
axes handle, if not provided a new figure is created.
|
|
881
|
+
figsize: tuple, optional
|
|
882
|
+
figuresize, by default(10, 8)
|
|
883
|
+
backgroundmap: bool, optional
|
|
884
|
+
if True, add background map (default CRS is EPSG:28992) with default tiles
|
|
885
|
+
by OpenStreetMap.Mapnik. Default option is False.
|
|
886
|
+
progressbar: bool, optional
|
|
887
|
+
show progressbar, default is True.
|
|
888
|
+
|
|
889
|
+
Returns
|
|
890
|
+
-------
|
|
891
|
+
ax: matplotlib.Axes
|
|
892
|
+
axes object
|
|
893
|
+
|
|
894
|
+
See Also
|
|
895
|
+
--------
|
|
896
|
+
self.add_background_map
|
|
897
|
+
"""
|
|
898
|
+
scatter_kwargs = {
|
|
899
|
+
"cmap": cmap,
|
|
900
|
+
"norm": norm,
|
|
901
|
+
"vmin": vmin,
|
|
902
|
+
"vmax": vmax,
|
|
903
|
+
"edgecolors": "w",
|
|
904
|
+
"linewidths": 0.7,
|
|
905
|
+
}
|
|
906
|
+
scatter_kwargs.update(kwargs)
|
|
907
|
+
|
|
908
|
+
ax = self._plotmap_dataframe(
|
|
909
|
+
df, column=column, figsize=figsize, **scatter_kwargs
|
|
910
|
+
)
|
|
911
|
+
if label:
|
|
912
|
+
df.set_index("index", inplace=True)
|
|
913
|
+
self.add_labels(df, ax, adjust=adjust)
|
|
914
|
+
|
|
915
|
+
if backgroundmap:
|
|
916
|
+
self.add_background_map(ax)
|
|
917
|
+
|
|
918
|
+
return ax
|
|
919
|
+
|
|
818
920
|
def modelstat(
|
|
819
921
|
self,
|
|
820
922
|
statistic,
|
|
@@ -827,6 +929,7 @@ class Maps:
|
|
|
827
929
|
vmax=None,
|
|
828
930
|
figsize=(10, 8),
|
|
829
931
|
backgroundmap=False,
|
|
932
|
+
progressbar=True,
|
|
830
933
|
**kwargs,
|
|
831
934
|
):
|
|
832
935
|
"""Plot model statistic on map.
|
|
@@ -856,6 +959,8 @@ class Maps:
|
|
|
856
959
|
backgroundmap: bool, optional
|
|
857
960
|
if True, add background map (default CRS is EPSG:28992) with default tiles
|
|
858
961
|
by OpenStreetMap.Mapnik. Default option is False.
|
|
962
|
+
progressbar: bool, optional
|
|
963
|
+
show progressbar, default is True.
|
|
859
964
|
|
|
860
965
|
Returns
|
|
861
966
|
-------
|
|
@@ -867,7 +972,7 @@ class Maps:
|
|
|
867
972
|
self.add_background_map
|
|
868
973
|
"""
|
|
869
974
|
statsdf = self.pstore.get_statistics(
|
|
870
|
-
[statistic], modelnames=modelnames, progressbar=
|
|
975
|
+
[statistic], modelnames=modelnames, progressbar=progressbar
|
|
871
976
|
).to_frame()
|
|
872
977
|
|
|
873
978
|
statsdf["oseries"] = [
|
|
@@ -877,28 +982,177 @@ class Maps:
|
|
|
877
982
|
statsdf = statsdf.reset_index().set_index("oseries")
|
|
878
983
|
df = statsdf.join(self.pstore.oseries, how="left")
|
|
879
984
|
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
985
|
+
return self._map_helper(
|
|
986
|
+
df,
|
|
987
|
+
column=statistic,
|
|
988
|
+
label=label,
|
|
989
|
+
adjust=adjust,
|
|
990
|
+
cmap=cmap,
|
|
991
|
+
norm=norm,
|
|
992
|
+
vmin=vmin,
|
|
993
|
+
vmax=vmax,
|
|
994
|
+
figsize=figsize,
|
|
995
|
+
backgroundmap=backgroundmap,
|
|
996
|
+
**kwargs,
|
|
997
|
+
)
|
|
888
998
|
|
|
889
|
-
|
|
999
|
+
def modelparam(
|
|
1000
|
+
self,
|
|
1001
|
+
parameter,
|
|
1002
|
+
modelnames=None,
|
|
1003
|
+
label=True,
|
|
1004
|
+
adjust=False,
|
|
1005
|
+
cmap="viridis",
|
|
1006
|
+
norm=None,
|
|
1007
|
+
vmin=None,
|
|
1008
|
+
vmax=None,
|
|
1009
|
+
figsize=(10, 8),
|
|
1010
|
+
backgroundmap=False,
|
|
1011
|
+
progressbar=True,
|
|
1012
|
+
**kwargs,
|
|
1013
|
+
):
|
|
1014
|
+
"""Plot model parameter value on map.
|
|
890
1015
|
|
|
891
|
-
|
|
892
|
-
|
|
1016
|
+
Parameters
|
|
1017
|
+
----------
|
|
1018
|
+
parameter: str
|
|
1019
|
+
name of the parameter, e.g. "rech_A" or "river_a"
|
|
1020
|
+
modelnames : list of str, optional
|
|
1021
|
+
list of modelnames to include
|
|
1022
|
+
label: bool, optional
|
|
1023
|
+
label points, by default True
|
|
1024
|
+
adjust: bool, optional
|
|
1025
|
+
automated smart label placement using adjustText, by default False
|
|
1026
|
+
cmap: str or colormap, optional
|
|
1027
|
+
(name of) the colormap, by default "viridis"
|
|
1028
|
+
norm: norm, optional
|
|
1029
|
+
normalization for colorbar, by default None
|
|
1030
|
+
vmin: float, optional
|
|
1031
|
+
vmin for colorbar, by default None
|
|
1032
|
+
vmax: float, optional
|
|
1033
|
+
vmax for colorbar, by default None
|
|
1034
|
+
ax : matplotlib.Axes, optional
|
|
1035
|
+
axes handle, if not provided a new figure is created.
|
|
1036
|
+
figsize: tuple, optional
|
|
1037
|
+
figuresize, by default(10, 8)
|
|
1038
|
+
backgroundmap: bool, optional
|
|
1039
|
+
if True, add background map (default CRS is EPSG:28992) with default tiles
|
|
1040
|
+
by OpenStreetMap.Mapnik. Default option is False.
|
|
1041
|
+
progressbar: bool, optional
|
|
1042
|
+
show progressbar, default is True
|
|
1043
|
+
|
|
1044
|
+
Returns
|
|
1045
|
+
-------
|
|
1046
|
+
ax: matplotlib.Axes
|
|
1047
|
+
axes object
|
|
1048
|
+
|
|
1049
|
+
See Also
|
|
1050
|
+
--------
|
|
1051
|
+
self.add_background_map
|
|
1052
|
+
"""
|
|
1053
|
+
paramdf = self.pstore.get_parameters(
|
|
1054
|
+
[parameter],
|
|
1055
|
+
modelnames=modelnames,
|
|
1056
|
+
progressbar=progressbar,
|
|
1057
|
+
ignore_errors=True,
|
|
1058
|
+
).to_frame()
|
|
1059
|
+
|
|
1060
|
+
paramdf["oseries"] = [
|
|
1061
|
+
self.pstore.get_models(m, return_dict=True)["oseries"]["name"]
|
|
1062
|
+
for m in paramdf.index
|
|
1063
|
+
]
|
|
1064
|
+
paramdf = paramdf.reset_index().set_index("oseries")
|
|
1065
|
+
df = paramdf.join(self.pstore.oseries, how="left")
|
|
1066
|
+
|
|
1067
|
+
return self._map_helper(
|
|
1068
|
+
df,
|
|
1069
|
+
column=parameter,
|
|
1070
|
+
label=label,
|
|
1071
|
+
adjust=adjust,
|
|
1072
|
+
cmap=cmap,
|
|
1073
|
+
norm=norm,
|
|
1074
|
+
vmin=vmin,
|
|
1075
|
+
vmax=vmax,
|
|
1076
|
+
figsize=figsize,
|
|
1077
|
+
backgroundmap=backgroundmap,
|
|
1078
|
+
**kwargs,
|
|
893
1079
|
)
|
|
894
|
-
if label:
|
|
895
|
-
df.set_index("index", inplace=True)
|
|
896
|
-
self.add_labels(df, ax, adjust=adjust)
|
|
897
1080
|
|
|
898
|
-
|
|
899
|
-
|
|
1081
|
+
def signature(
|
|
1082
|
+
self,
|
|
1083
|
+
signature,
|
|
1084
|
+
names=None,
|
|
1085
|
+
label=True,
|
|
1086
|
+
adjust=False,
|
|
1087
|
+
cmap="viridis",
|
|
1088
|
+
norm=None,
|
|
1089
|
+
vmin=None,
|
|
1090
|
+
vmax=None,
|
|
1091
|
+
figsize=(10, 8),
|
|
1092
|
+
backgroundmap=False,
|
|
1093
|
+
progressbar=True,
|
|
1094
|
+
**kwargs,
|
|
1095
|
+
):
|
|
1096
|
+
"""Plot signature value on map.
|
|
900
1097
|
|
|
901
|
-
|
|
1098
|
+
Parameters
|
|
1099
|
+
----------
|
|
1100
|
+
signature: str
|
|
1101
|
+
name of the signature, e.g. "mean_annual_maximum" or "duration_curve_slope"
|
|
1102
|
+
names : list of str, optional
|
|
1103
|
+
list of observation well names to include
|
|
1104
|
+
label: bool, optional
|
|
1105
|
+
label points, by default True
|
|
1106
|
+
adjust: bool, optional
|
|
1107
|
+
automated smart label placement using adjustText, by default False
|
|
1108
|
+
cmap: str or colormap, optional
|
|
1109
|
+
(name of) the colormap, by default "viridis"
|
|
1110
|
+
norm: norm, optional
|
|
1111
|
+
normalization for colorbar, by default None
|
|
1112
|
+
vmin: float, optional
|
|
1113
|
+
vmin for colorbar, by default None
|
|
1114
|
+
vmax: float, optional
|
|
1115
|
+
vmax for colorbar, by default None
|
|
1116
|
+
ax : matplotlib.Axes, optional
|
|
1117
|
+
axes handle, if not provided a new figure is created.
|
|
1118
|
+
figsize: tuple, optional
|
|
1119
|
+
figuresize, by default(10, 8)
|
|
1120
|
+
backgroundmap: bool, optional
|
|
1121
|
+
if True, add background map (default CRS is EPSG:28992) with default tiles
|
|
1122
|
+
by OpenStreetMap.Mapnik. Default option is False.
|
|
1123
|
+
progressbar: bool, optional
|
|
1124
|
+
show progressbar, default is True
|
|
1125
|
+
|
|
1126
|
+
Returns
|
|
1127
|
+
-------
|
|
1128
|
+
ax: matplotlib.Axes
|
|
1129
|
+
axes object
|
|
1130
|
+
|
|
1131
|
+
See Also
|
|
1132
|
+
--------
|
|
1133
|
+
self.add_background_map
|
|
1134
|
+
"""
|
|
1135
|
+
signature_df = self.pstore.get_signatures(
|
|
1136
|
+
[signature],
|
|
1137
|
+
names=names,
|
|
1138
|
+
progressbar=progressbar,
|
|
1139
|
+
ignore_errors=True,
|
|
1140
|
+
)
|
|
1141
|
+
df = signature_df.join(self.pstore.oseries, how="left")
|
|
1142
|
+
|
|
1143
|
+
return self._map_helper(
|
|
1144
|
+
df,
|
|
1145
|
+
column=signature,
|
|
1146
|
+
label=label,
|
|
1147
|
+
adjust=adjust,
|
|
1148
|
+
cmap=cmap,
|
|
1149
|
+
norm=norm,
|
|
1150
|
+
vmin=vmin,
|
|
1151
|
+
vmax=vmax,
|
|
1152
|
+
figsize=figsize,
|
|
1153
|
+
backgroundmap=backgroundmap,
|
|
1154
|
+
**kwargs,
|
|
1155
|
+
)
|
|
902
1156
|
|
|
903
1157
|
@staticmethod
|
|
904
1158
|
def _plotmap_dataframe(
|
|
@@ -948,6 +1202,7 @@ class Maps:
|
|
|
948
1202
|
if ax is None:
|
|
949
1203
|
return_scatter = False
|
|
950
1204
|
fig, ax = plt.subplots(figsize=figsize)
|
|
1205
|
+
ax.set_aspect("equal", adjustable="box")
|
|
951
1206
|
else:
|
|
952
1207
|
return_scatter = True
|
|
953
1208
|
fig = ax.figure
|
|
@@ -1010,8 +1265,8 @@ class Maps:
|
|
|
1010
1265
|
label: bool, optional, default is True
|
|
1011
1266
|
add labels to points on map
|
|
1012
1267
|
metadata_source: str, optional
|
|
1013
|
-
whether to obtain metadata from model
|
|
1014
|
-
metadata in pastastore
|
|
1268
|
+
one of "model" or "store", pick whether to obtain metadata from model
|
|
1269
|
+
Timeseries or from metadata in pastastore, default is "model"
|
|
1015
1270
|
offset : float, optional
|
|
1016
1271
|
add offset to current extent of model time series, useful
|
|
1017
1272
|
for zooming out around models
|
pastastore/store.py
CHANGED
|
@@ -611,7 +611,7 @@ class PastaStore:
|
|
|
611
611
|
modelnames: Optional[List[str]] = None,
|
|
612
612
|
param_value: Optional[str] = "optimal",
|
|
613
613
|
progressbar: Optional[bool] = False,
|
|
614
|
-
ignore_errors: Optional[bool] =
|
|
614
|
+
ignore_errors: Optional[bool] = True,
|
|
615
615
|
) -> FrameorSeriesUnion:
|
|
616
616
|
"""Get model parameters.
|
|
617
617
|
|
|
@@ -633,7 +633,7 @@ class PastaStore:
|
|
|
633
633
|
show progressbar, default is False
|
|
634
634
|
ignore_errors : bool, optional
|
|
635
635
|
ignore errors when True, i.e. when non-existent model is
|
|
636
|
-
encountered in modelnames, by default
|
|
636
|
+
encountered in modelnames, by default True
|
|
637
637
|
|
|
638
638
|
Returns
|
|
639
639
|
-------
|
|
@@ -662,7 +662,10 @@ class PastaStore:
|
|
|
662
662
|
pindex = parameters
|
|
663
663
|
|
|
664
664
|
for c in pindex:
|
|
665
|
-
|
|
665
|
+
if c in mldict["parameters"].index:
|
|
666
|
+
p.loc[mlname, c] = mldict["parameters"].loc[c, param_value]
|
|
667
|
+
else:
|
|
668
|
+
p.loc[mlname, c] = np.nan
|
|
666
669
|
|
|
667
670
|
p = p.squeeze()
|
|
668
671
|
return p.astype(float)
|
|
@@ -806,6 +809,7 @@ class PastaStore:
|
|
|
806
809
|
solve: bool = False,
|
|
807
810
|
store_models: bool = True,
|
|
808
811
|
ignore_errors: bool = False,
|
|
812
|
+
suffix: Optional[str] = None,
|
|
809
813
|
progressbar: bool = True,
|
|
810
814
|
**kwargs,
|
|
811
815
|
) -> Union[Tuple[dict, dict], dict]:
|
|
@@ -826,6 +830,8 @@ class PastaStore:
|
|
|
826
830
|
store the models in the database.
|
|
827
831
|
ignore_errors : bool, optional
|
|
828
832
|
ignore errors while creating models, by default False
|
|
833
|
+
suffix : str, optional
|
|
834
|
+
add suffix to oseries name to create model name, by default None
|
|
829
835
|
progressbar : bool, optional
|
|
830
836
|
show progressbar, by default True
|
|
831
837
|
|
|
@@ -846,7 +852,13 @@ class PastaStore:
|
|
|
846
852
|
desc = "Bulk creation models"
|
|
847
853
|
for o in tqdm(oseries, desc=desc) if progressbar else oseries:
|
|
848
854
|
try:
|
|
849
|
-
|
|
855
|
+
if suffix is not None:
|
|
856
|
+
modelname = f"{o}{suffix}"
|
|
857
|
+
else:
|
|
858
|
+
modelname = o
|
|
859
|
+
iml = self.create_model(
|
|
860
|
+
o, modelname=modelname, add_recharge=add_recharge
|
|
861
|
+
)
|
|
850
862
|
except Exception as e:
|
|
851
863
|
if ignore_errors:
|
|
852
864
|
errors[o] = e
|
|
@@ -1150,13 +1162,19 @@ class PastaStore:
|
|
|
1150
1162
|
|
|
1151
1163
|
# special for WellModels
|
|
1152
1164
|
if stressmodel._name == "WellModel":
|
|
1153
|
-
|
|
1165
|
+
if isinstance(stresses["stress"], list):
|
|
1166
|
+
names = [s.squeeze().name for s in stresses["stress"]]
|
|
1167
|
+
else:
|
|
1168
|
+
names = [stresses["stress"].squeeze().name]
|
|
1169
|
+
stresses["stress"] = [stresses["stress"]] # ugly fix for WellModel
|
|
1154
1170
|
# check oseries is provided
|
|
1155
1171
|
if oseries is None:
|
|
1156
1172
|
raise ValueError("WellModel requires 'oseries' to compute distances!")
|
|
1157
1173
|
# compute distances and add to kwargs
|
|
1158
1174
|
distances = (
|
|
1159
|
-
self.get_distances(oseries=oseries, stresses=names)
|
|
1175
|
+
self.get_distances(oseries=oseries, stresses=names)
|
|
1176
|
+
.T.squeeze(axis=1)
|
|
1177
|
+
.values
|
|
1160
1178
|
)
|
|
1161
1179
|
kwargs["distances"] = distances
|
|
1162
1180
|
# set settings to well
|
|
@@ -1355,56 +1373,40 @@ class PastaStore:
|
|
|
1355
1373
|
):
|
|
1356
1374
|
solve_model(ml_name=ml_name)
|
|
1357
1375
|
|
|
1358
|
-
def
|
|
1359
|
-
|
|
1360
|
-
mls: Optional[Union[ps.Model, list, str]] = None,
|
|
1361
|
-
progressbar: bool = True,
|
|
1362
|
-
): # pragma: no cover
|
|
1363
|
-
"""Get pastas model results.
|
|
1376
|
+
def check_models(self, checklist=None, modelnames=None):
|
|
1377
|
+
"""Check models against checklist.
|
|
1364
1378
|
|
|
1365
1379
|
Parameters
|
|
1366
1380
|
----------
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1381
|
+
checklist : dict, optional
|
|
1382
|
+
dictionary containing model check methods, by default None which
|
|
1383
|
+
uses the ps.checks.checks_brakenhoff_2022 checklist. This includes:
|
|
1384
|
+
- fit metric R² >= 0.6
|
|
1385
|
+
- runs test for autocorrelation
|
|
1386
|
+
- t95 response < half length calibration period
|
|
1387
|
+
- |model parameters| < 1.96 * σ (std deviation)
|
|
1388
|
+
- model parameters are not on bounds
|
|
1389
|
+
modelnames : list of str, optional
|
|
1390
|
+
list of modelnames to perform checks on, by default None
|
|
1372
1391
|
|
|
1373
1392
|
Returns
|
|
1374
1393
|
-------
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
for each model
|
|
1378
|
-
|
|
1379
|
-
Raises
|
|
1380
|
-
------
|
|
1381
|
-
ModuleNotFoundError
|
|
1382
|
-
if the art_tools module is not available
|
|
1394
|
+
pd.DataFrame
|
|
1395
|
+
DataFrame containing pass True/False for each check for each model
|
|
1383
1396
|
"""
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
try:
|
|
1398
|
-
iml = self.conn.get_models(mlname)
|
|
1399
|
-
except Exception as e:
|
|
1400
|
-
print("{1}: '{0}' could not be parsed!".format(mlname, e))
|
|
1401
|
-
continue
|
|
1402
|
-
iresults = pastas_get_model_results(
|
|
1403
|
-
iml, par_selection="all", stats=("evp",), stderrors=True
|
|
1404
|
-
)
|
|
1405
|
-
results_list.append(iresults)
|
|
1406
|
-
|
|
1407
|
-
return pd.concat(results_list, axis=1).transpose()
|
|
1397
|
+
if checklist is None:
|
|
1398
|
+
checklist = ps.check.checks_brakenhoff_2022
|
|
1399
|
+
|
|
1400
|
+
names = self.conn._parse_names(modelnames, libname="models")
|
|
1401
|
+
|
|
1402
|
+
check_dfs = []
|
|
1403
|
+
for n in names:
|
|
1404
|
+
cdf = ps.check.checklist(self.models[n], checklist, report=False)["pass"]
|
|
1405
|
+
cdf.name = n
|
|
1406
|
+
check_dfs.append(cdf)
|
|
1407
|
+
chkdf = pd.concat(check_dfs, axis=1)
|
|
1408
|
+
chkdf.columns.name = "models"
|
|
1409
|
+
return chkdf
|
|
1408
1410
|
|
|
1409
1411
|
def to_zip(self, fname: str, overwrite=False, progressbar: bool = True):
|
|
1410
1412
|
"""Write data to zipfile.
|
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.10.0"
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
def show_versions(optional=False) -> None:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: pastastore
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.10.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>
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
docs/conf.py,sha256=XcZUTmn9fGDhhu8k3mpaLu435SpIRNpABADCCTJJuag,6291
|
|
2
2
|
pastastore/__init__.py,sha256=cWwG9-YeiI4aOU0CDBGKbQgmKmmkcPd64YwPq2rRGt0,416
|
|
3
3
|
pastastore/base.py,sha256=B7sPe1eEpXFSeQsgrPXc5Mvp8Xkbhe_TxML6Zlp19Lk,48172
|
|
4
|
-
pastastore/connectors.py,sha256=
|
|
4
|
+
pastastore/connectors.py,sha256=6D2j1AUMQhHZNUhCD0tKoxf77FlQM5fTdH2m_c8KAnY,50183
|
|
5
5
|
pastastore/datasets.py,sha256=FHVfmKqb8beEs9NONsWrCoJY37BmlvFLSEQ1VAFmE8A,6415
|
|
6
|
-
pastastore/plotting.py,sha256=
|
|
7
|
-
pastastore/store.py,sha256=
|
|
6
|
+
pastastore/plotting.py,sha256=ygKXdi42sPLaehze4EjU8kRE2Dk46wVxSkB9RJ2Re84,54535
|
|
7
|
+
pastastore/store.py,sha256=KOs0L4AICRFRaQRdnnq2o-oadmX1CDkcg_kDtC8Tal0,67703
|
|
8
8
|
pastastore/styling.py,sha256=0IEp_r-SpcaslShAZvZV6iuEhTG_YzNq-ad8krib3U0,2304
|
|
9
9
|
pastastore/util.py,sha256=31dzHaK6xdFHGDkYh49qGBq1dGel2m9r7i797S3WUpQ,28505
|
|
10
|
-
pastastore/version.py,sha256=
|
|
10
|
+
pastastore/version.py,sha256=EyZTJILqRXkQwkj1Pipjq7kjKw-VsZMCFcFt78vCEK0,1206
|
|
11
11
|
pastastore/yaml_interface.py,sha256=n6zjQ7ENrUvxszb6zE-jPLa-XVsoEOTJHQmRV1_fFt0,30818
|
|
12
12
|
pastastore/extensions/__init__.py,sha256=lCN9xfX1qefUzUbE2FQ12c6NjLbf5HoNo-D8cGb5CTw,461
|
|
13
13
|
pastastore/extensions/accessor.py,sha256=kftQM6dqMDoySbyTKcvmkjC5gJRp465KA18G4NVXUO0,367
|
|
14
|
-
pastastore/extensions/hpd.py,sha256=
|
|
14
|
+
pastastore/extensions/hpd.py,sha256=VHMhGZaSIHTZNDYuyxGqWtDqlCSbucq44oT8sZRsu0E,27749
|
|
15
15
|
tests/conftest.py,sha256=TB0ZUH1m45gvQd_EZO7iudvhFw4JA-8rTJ71GT6Nf1w,5061
|
|
16
16
|
tests/test_001_import.py,sha256=g8AaJzWZ088A4B30_w-MrDfAVeeg8m78l--j7Onsklc,208
|
|
17
17
|
tests/test_002_connectors.py,sha256=k9etSRuSFVOrSEtZyxqsCF9GwIg0T7VdDJ2SjSe6i_s,7742
|
|
@@ -21,8 +21,8 @@ tests/test_005_maps_plots.py,sha256=L0ppGf-cudsrdxteWy3qsV4We96DW4bCBE7c6jEm6aM,
|
|
|
21
21
|
tests/test_006_benchmark.py,sha256=VZG0bY7uz8DkfIZTgRCzkEDG8rguBEt_-mdGSMQLN2w,4930
|
|
22
22
|
tests/test_007_hpdextension.py,sha256=1QNUahq3hzqxjKbzsjofi9Yuyqe_oDGL0vWp6iouYe4,3004
|
|
23
23
|
tests/test_008_stressmodels.py,sha256=733fyCvuzjKcaLjvSMt5dTTLp-T4alzNJAToSxTIUug,4003
|
|
24
|
-
pastastore-1.
|
|
25
|
-
pastastore-1.
|
|
26
|
-
pastastore-1.
|
|
27
|
-
pastastore-1.
|
|
28
|
-
pastastore-1.
|
|
24
|
+
pastastore-1.10.0.dist-info/LICENSE,sha256=MB_6p4kXDCUsYNjslcMByBu6i7wMNRKPC36JnhzpN4o,1087
|
|
25
|
+
pastastore-1.10.0.dist-info/METADATA,sha256=xfHn3JQgATCb34Bfn3xImDDhEFGCo5x6SnK6xDQwTbQ,7579
|
|
26
|
+
pastastore-1.10.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
27
|
+
pastastore-1.10.0.dist-info/top_level.txt,sha256=1bgyMk1p23f04RK83Jju2_YAQBwyoQD_fInxoPB4YRw,22
|
|
28
|
+
pastastore-1.10.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|