Skip to content

Commit

Permalink
[USGS-R#210] weights/results with adding one urban site
Browse files Browse the repository at this point in the history
  • Loading branch information
jsadler2 committed Apr 6, 2023
1 parent 0b238d5 commit 871734f
Show file tree
Hide file tree
Showing 88 changed files with 80,896 additions and 73,868 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4,200 changes: 2,100 additions & 2,100 deletions 2a_model/out/models/combined_FP_metrics.csv

Large diffs are not rendered by default.

17,820 changes: 8,910 additions & 8,910 deletions 2a_model/out/models/combined_month_metrics.csv

Large diffs are not rendered by default.

119,760 changes: 63,120 additions & 56,640 deletions 2a_model/out/models/combined_month_reach_metrics.csv

Large diffs are not rendered by default.

1,620 changes: 810 additions & 810 deletions 2a_model/out/models/combined_overall_metrics.csv

Large diffs are not rendered by default.

11,340 changes: 5,940 additions & 5,400 deletions 2a_model/out/models/combined_reach_metrics.csv

Large diffs are not rendered by default.

18 changes: 14 additions & 4 deletions 2a_model/src/models/Snakefile_base.smk
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,22 @@ rule as_run_config:
run:
asRunConfig(config,output[0])

def mk_list_if_str(value):
if isinstance(value, str):
return list(value)
elif isinstance(value, list):
return value
else:
raise Exception("was expecting a string or a list. got ", type(value))


rule prep_io_data:
input:
"../../../out/well_obs_io.zarr",
output:
"{outdir}/prepped.npz"
run:
val_sites = mk_list_if_str(config['validation_sites'])
prep_all_data(x_data_file=input[0],
y_data_file=input[0],
x_vars=config['x_vars'],
Expand All @@ -48,7 +57,7 @@ rule prep_io_data:
train_end_date=config['train_end_date'],
val_start_date=config['val_start_date'],
val_end_date=config['val_end_date'],
val_sites=config['validation_sites'],
val_sites=val_sites,
out_file=output[0],
normalize_y=False,
trn_offset = config['trn_offset'],
Expand All @@ -61,7 +70,7 @@ rule prep_io_data:
data['times_trn'],
data['ids_trn'],
col_names=data['y_obs_vars'])
df_trn_val_sites = df_trn[df_trn.seg_id_nat.isin(config['validation_sites'])]
df_trn_val_sites = df_trn[df_trn.seg_id_nat.isin(val_sites)]

assert df_trn_val_sites['do_mean'].notna().sum() == 0

Expand Down Expand Up @@ -120,11 +129,12 @@ rule make_predictions:
def filter_predictions(all_preds_file, partition, out_file):
df_preds = pd.read_feather(all_preds_file)
all_sites = df_preds.site_id.unique()
trn_sites = all_sites[~np.isin(all_sites, config["validation_sites"])]
val_sites = mk_list_if_str(config["validation_sites"])
trn_sites = all_sites[~np.isin(all_sites, val_sites)]

df_preds_trn_sites = df_preds[df_preds.site_id.isin(trn_sites)]

df_preds_val_sites = df_preds[df_preds.site_id.isin(config['validation_sites'])]
df_preds_val_sites = df_preds[df_preds.site_id.isin(val_sites)]


if partition == "trn":
Expand Down
4 changes: 1 addition & 3 deletions 2a_model/src/models/config_base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ dropout: 0.2
recurrent_dropout: 0.2
finetune_learning_rate: 0.01
early_stopping: False
validation_sites:
- "01475530"
- "01475548"
validation_sites: "01475548"
train_start_date: '1980-10-01'
train_end_date: '2015-10-01'
val_start_date: '2015-10-01'
Expand Down
2 changes: 1 addition & 1 deletion _targets.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ dummy_date <- "2023-03-02"
#2) Configure model inputs/variables

# Define test and validation sites
val_sites <- c("01475530", "01475548")
val_sites <- c("01475548")

# Define train/val/test dates
train_start_date <- '1980-10-01'
Expand Down

0 comments on commit 871734f

Please sign in to comment.