This repository has been archived by the owner on May 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
3_visualize.R
91 lines (82 loc) · 3.23 KB
/
3_visualize.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# [Lauren] plot_daily_data and plot_inst_data are not currently used to build
# any targets, leaving the functions here for reference
source("3_visualize/src/plot_daily_data.R")
source("3_visualize/src/plot_inst_data.R")
source("3_visualize/src/do_overview_plots.R")
source("3_visualize/src/summarize_static_attributes.R")
source("3_visualize/src/plot_nhdv2_attr.R")
source("3_visualize/src/map_sites.R")
p3_targets_list <- list(
# Visualize segment/catchment attributes across the DRB and across sites.
tar_target(
p3_nhdv2_attr_png,
plot_nhdv2_attr(attr_data = p2_seg_attr_data,
network_geometry = p1_nhd_reaches_sf,
save_dir = "3_visualize/out/nhdv2_attr_png",
plot_sites = TRUE,
label_sites = TRUE,
sites = p2_sites_w_segs %>%
filter(site_id %in% p2_well_observed_sites),
sites_epsg = 4269),
format = "file"
),
# Generate summary plots (all daily and inst data)
tar_target(
p3_daily_summary_plot_png,
plot_daily_data(p2_daily_data_filtered, fileout = "3_visualize/out/daily_daily_means.png",
fig_cols = 5, fig_width = 8, fig_height = 7),
format = "file"
),
tar_target(
p3_inst_summary_plot_png,
plot_daily_data(p2_inst_data_filtered, fileout = "3_visualize/out/inst_daily_means.png",
fig_cols = 4, fig_width = 6, fig_height = 7),
format = "file"
),
tar_target(
p3_doy_means_png,
plot_doy_means(p2_daily_combined,fileout = "3_visualize/out/doy_means.png",
fig_height = 3, fig_width = 4),
format = "file"
),
# Generate summary plots (well-observed data only)
tar_target(
p3_daily_summary_plot_filtered_png,
plot_daily_data(p2_daily_data_filtered, fileout = "3_visualize/out/filtered_daily_means.png",
min_count = min_obs_days, start_date = "1980-01-01", end_date = "1994-01-01",
fig_cols = 1, fig_width = 4, fig_height = 10),
format = "file"
),
tar_target(
p3_inst_summary_plot_filtered_png,
plot_daily_data(p2_inst_data_filtered, fileout = "3_visualize/out/filtered_inst_means.png",
min_count = min_obs_days, fig_cols = 1, fig_width = 4, fig_height = 10),
format = "file"
),
# Save a table containing summary statistics for the NHDPlusv2 static attributes
# across the well-observed reaches used for modeling.
tar_target(
p3_static_attr_summary_csv,
summarize_static_attributes(filter(p2_seg_attr_data, COMID %in% p2_well_observed_reaches$COMID),
"3_visualize/out/nhdv2_static_attr_summary.csv"),
format = "file"
),
# Save png map of site locations
tar_target(
p3_site_map_png,
map_sites(flowlines = p1_nhd_reaches_sf,
matched_sites = p2a_site_splits,
out_file = "3_visualize/out/do_site_map.png")
),
# Save json map of site locations
tar_target(
p3_well_observed_site_data_json,
{
filename = "3_visualize/out/well_observed_trn_val_test.geojson"
sf::st_write(p2a_site_splits, filename, append = FALSE, delete_dsn = TRUE,
driver = "GeoJSON", quiet = TRUE)
filename
},
format = "file"
)
)