Skip to content

Commit edc76f5

Browse files
committed
.
1 parent 6faa66e commit edc76f5

20 files changed

+23433
-23456
lines changed

gis/output/coastal_eco_imp.csv

Lines changed: 109 additions & 109 deletions
Large diffs are not rendered by default.

gis/output/coastal_eco_imp.pdf

0 Bytes
Binary file not shown.

gis/output/coastal_eco_imp_MA.csv

Lines changed: 109 additions & 109 deletions
Large diffs are not rendered by default.

gis/output/coastal_eco_obs.csv

Lines changed: 109 additions & 109 deletions
Large diffs are not rendered by default.

gis/output/coastal_eco_obs.pdf

0 Bytes
Binary file not shown.

gis/output/lakes_eco_imp.csv

Lines changed: 987 additions & 987 deletions
Large diffs are not rendered by default.

gis/output/lakes_eco_imp.pdf

0 Bytes
Binary file not shown.

gis/output/lakes_eco_imp_MA.csv

Lines changed: 987 additions & 987 deletions
Large diffs are not rendered by default.

gis/output/lakes_eco_obs.csv

Lines changed: 987 additions & 987 deletions
Large diffs are not rendered by default.

gis/output/lakes_eco_obs.pdf

0 Bytes
Binary file not shown.

gis/output/streams_VP_stats.csv

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1 @@
11
,Sparse subset,Observed subset,All in VP3
2-
Small,0.7645461598138091,0.6499756137213462,0.6556765627331046
3-
Medium,0.18076027928626842,0.292635343846529,0.2827092346710428
4-
Large,0.01047323506594259,0.021947650788489675,0.022676413546173356
5-
Soft bottom,0.04422032583397983,0.03544139164363518,0.03893778904967925
6-
Natural,0.895655546935609,0.9270037392293936,0.9115321497836789
7-
DK2,0.07796741660201707,0.16387579255405624,0.1654483067283306
8-
basis,2.6574350234341715,2.6447368421052633,2.647725321888412
9-
n,2578.0,6151.0,6703.0

gis/output/streams_VP_stats.tex

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +0,0 @@
1-
\begin{tabular}{llll}
2-
\toprule
3-
& Sparse subset & Observed subset & All in VP3 \\
4-
\midrule
5-
Small & 0.7645 & 0.6500 & 0.6557 \\
6-
Medium & 0.1808 & 0.2926 & 0.2827 \\
7-
Large & 0.0105 & 0.0219 & 0.0227 \\
8-
Soft bottom & 0.0442 & 0.0354 & 0.0389 \\
9-
Natural & 0.8957 & 0.9270 & 0.9115 \\
10-
DK2 & 0.0780 & 0.1639 & 0.1654 \\
11-
basis & 2.6574 & 2.6447 & 2.6477 \\
12-
n & 2578 & 6151 & 6703 \\
13-
\bottomrule
14-
\end{tabular}

gis/output/streams_eco_imp.csv

Lines changed: 6704 additions & 6704 deletions
Large diffs are not rendered by default.

gis/output/streams_eco_imp.pdf

0 Bytes
Binary file not shown.

gis/output/streams_eco_imp_MA.csv

Lines changed: 6704 additions & 6704 deletions
Large diffs are not rendered by default.

gis/output/streams_eco_obs.csv

Lines changed: 6704 additions & 6704 deletions
Large diffs are not rendered by default.

gis/output/streams_eco_obs.pdf

0 Bytes
Binary file not shown.

gis/sandbox.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -502,12 +502,12 @@ def process_string(s):
502502
# Imputed ecological status using a continuous scale
503503
dfEcoObs = dfIndicator.copy()
504504

505+
# Save CSV of data on mean ecological status by water body and year
506+
dfEcoObs.to_csv("output\\" + j + "_eco_" + suffix + ".csv")
507+
505508
# Merge observed ecological status each year with basis analysis for VP3
506509
dfEco = dfEcoObs.merge(dfVP[["basis"]], on="wb")
507510

508-
# Save CSV of data on mean ecological status by water body and year
509-
dfEco.to_csv("output\\" + j + "_eco_" + suffix + ".csv")
510-
511511
if suffix != "obs":
512512
# Prepare for statistics and missing values graph
513513
for t in dfEco.columns:

gis/script_module.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -845,12 +845,12 @@ def ecological_status(self, j, dfIndicator, dfVP, suffix="obs", index=None):
845845
# Imputed ecological status using a continuous scale
846846
dfEcoObs = dfIndicator.copy()
847847

848+
# Save CSV of data on mean ecological status by water body and year
849+
dfEcoObs.to_csv("output\\" + j + "_eco_" + suffix + ".csv")
850+
848851
# Merge observed ecological status each year with basis analysis for VP3
849852
dfEco = dfEcoObs.merge(dfVP[["basis"]], on="wb")
850853

851-
# Save CSV of data on mean ecological status by water body and year
852-
dfEco.to_csv("output\\" + j + "_eco_" + suffix + ".csv")
853-
854854
if suffix != "obs":
855855
# Prepare for statistics and missing values graph
856856
for t in dfEco.columns:

gis/streams_CV.py

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,14 @@ def stepwise_selection(subset, dummies, data, dfDummies, years, select_all=False
190190
s.loc["Total", "n"] = s["n"].sum()
191191

192192
# Overwrite CSV of accuracy scores and share with less than good ecological status
193-
if subset is sparse:
194-
scores.to_csv("output/streams_eco_imp_accuracy_sparse.csv")
195-
status.to_csv("output/streams_eco_imp_LessThanGood_sparse.csv")
196-
scores_all.to_csv("output/streams_eco_imp_accuracy_sparse_all.csv")
197-
status_all.to_csv("output/streams_eco_imp_LessThanGood_sparse_all.csv")
198-
else:
199-
scores.to_csv("output/streams_eco_imp_accuracy.csv")
200-
status.to_csv("output/streams_eco_imp_LessThanGood.csv")
193+
# if subset is sparse:
194+
# scores.to_csv("output/streams_eco_imp_accuracy_sparse.csv")
195+
# status.to_csv("output/streams_eco_imp_LessThanGood_sparse.csv")
196+
# scores_all.to_csv("output/streams_eco_imp_accuracy_sparse_all.csv")
197+
# status_all.to_csv("output/streams_eco_imp_LessThanGood_sparse_all.csv")
198+
# else:
199+
# scores.to_csv("output/streams_eco_imp_accuracy.csv")
200+
# status.to_csv("output/streams_eco_imp_LessThanGood.csv")
201201

202202
return selected, scores, status # selected predictors; scores and stats by year
203203

@@ -310,26 +310,25 @@ def stepwise_selection(subset, dummies, data, dfDummies, years, select_all=False
310310
# 2. Multivariate feature imputation (note: Forward Stepwise Selection takes ~5 days)
311311
########################################################################################
312312
# # Example data for testing Forward Stepwise Selection with LOO-CV (takes ~5 seconds)
313-
# dfEcoObs = pd.DataFrame(
314-
# {
315-
# 1988: [2.5, 3.0, 3.5, 4.0, np.nan, 5.0],
316-
# 1989: [2.6, 3.1, 3.6, np.nan, 4.6, 5.1],
317-
# 1990: [2.7, 3.2, np.nan, 4.2, 4.7, 5.2],
318-
# 1991: [2.8, np.nan, 3.8, 4.3, 4.8, 5.3],
319-
# 1992: [np.nan, 3.4, 3.9, 4.4, 4.9, 5.4],
320-
# 1993: [3.0, 3.5, 3.8, 4.4, 5.1, 5.5],
321-
# }
322-
# )
323-
# dfEcoObs.index.name = "wb"
324-
# sparse = dfEcoObs[dfEcoObs.notna().sum(axis=1) == 5]
325-
# dfObs = dfEcoObs.copy()
326-
# dfTypology = dfObs.copy()
327-
# dfTypology["Small"] = [0, 0, 1, 1, 0, 0] # effect: 0.2 worse in 1993
328-
# dfNatural = dfTypology.copy()
329-
# dfNatural["Natural"] = [0, 0, 0, 1, 1, 0] # effect: 0.1 better in 1993
330-
# cols = ["Small", "Natural"]
331-
# years = list(range(1989, 1993 + 1))
332-
313+
dfEcoObs = pd.DataFrame(
314+
{
315+
1988: [2.5, 3.0, 3.5, 4.0, np.nan, 5.0],
316+
1989: [2.6, 3.1, 3.6, np.nan, 4.6, 5.1],
317+
1990: [2.7, 3.2, np.nan, 4.2, 4.7, 5.2],
318+
1991: [2.8, np.nan, 3.8, 4.3, 4.8, 5.3],
319+
1992: [np.nan, 3.4, 3.9, 4.4, 4.9, 5.4],
320+
1993: [3.0, 3.5, 3.8, 4.4, 5.1, 5.5],
321+
}
322+
)
323+
dfEcoObs.index.name = "wb"
324+
sparse = dfEcoObs[dfEcoObs.notna().sum(axis=1) == 5]
325+
dfObs = dfEcoObs.copy()
326+
dfTypology = dfObs.copy()
327+
dfTypology["Small"] = [0, 0, 1, 1, 0, 0] # effect: 0.2 worse in 1993
328+
dfNatural = dfTypology.copy()
329+
dfNatural["Natural"] = [0, 0, 0, 1, 1, 0] # effect: 0.1 better in 1993
330+
cols = ["Small", "Natural"]
331+
years = list(range(1989, 1993 + 1))
333332

334333
# Forward stepwise selection of dummies - CV over subset of sparsely observed streams
335334
kwargs = {"data": dfObs, "dfDummies": dfDistrict, "years": years} # shared arguments

0 commit comments

Comments
 (0)