-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathwbeep_model_map_gif.yml
96 lines (79 loc) · 3.15 KB
/
wbeep_model_map_gif.yml
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
91
92
93
94
95
96
# Run `make(remake_file = "wbeep_model_map_gif.yml")` to execute the whole thing.
packages:
- aws.signature
- aws.s3
- sf
- dplyr
- ggplot2
- maps
- lwgeom
- rmapshaper
sources:
- WBEEP/rscripts/generate_gif_images/interact_with_s3.R
- WBEEP/rscripts/generate_gif_images/create_model_output_maps.R
- WBEEP/rscripts/generate_gif_images/build_gif.R
targets:
all:
depends:
- maps_created
- maps_pushed
- WBEEP/rscripts/generate_gif_images/onhm_model.gif
- onhm_gif_pushed
# Local file path info
local_cache_loc:
command: c(I("WBEEP/rscripts/generate_gif_images/s3_data/"))
# S3 bucket & folder locations
s3_bucket:
command: c(I("prod-owi-resources"))
s3_model_output_loc:
command: c(I("resources/Application/wbeep/model_output_csv"))
s3_map_img_loc:
command: c(I("resources/Application/wbeep/gif_images"))
s3_auto_gif_name:
command: c(I("onhm_draft.gif"))
# Dates to download
# 10/29 - 11/15 = 4 active CA wildfires dry out natural water storage (10/29 not downloading ...?)
# # Center for Disaster Philanthropy: https://disasterphilanthropy.org/disaster/2019-california-wildfires/
# 11/19 - 11/22 = flooding/heavy rain from tropical storm raymond Nov 19-20 brings moisture
northern_wet_dates:
command: c(I("2019-11-06"), I("2019-11-06"))
wildfire_dates:
command: c(I("2019-11-12"), I("2019-11-12"))
raymond_dates:
command: c(I("2019-11-21"), I("2019-11-21"))
date_ranges:
command: list(northern_wet_dates, wildfire_dates, raymond_dates)
proj:
command: c(I("+proj=laea +lat_0=45 +lon_0=-100 +x_0=0 +y_0=0 +a=6370997 +b=6370997 +units=m +no_defs"))
# Need to crop to just US boundaries to remove HRUs that extend beyond US borders
conus_sf:
command: create_conus_sf(proj)
# Takes a VERY LONG TIME. So I manually saved the result as an RDS file to skip this step (see next target).
# This loads & creates an sf object from the geodatabase that Blodgett shared
#hru_sf:
# command: load_hru_shape(I("WBEEP/cache/GF_nat_reg.gdb"), proj)
# Created an intermediate RDS object that is the sf object already validated.
# Much faster to load
hru_sf:
command: readRDS("WBEEP/cache/valid_hru_sf.rds")
# Was taking wayyyyy too long (> 30 min) so gave up and just build without simplifying
# Simplify the hru spatial data
#hru_simple_sf:
# command: simplify_hru_sf(hru_sf)
# Crop hru spatial data to just CONUS
hru_conus_sf:
command: crop_hru_to_conus(hru_sf, conus_sf)
# Fetch data from S3
data_downloaded:
command: fetch_s3_model_output(date_ranges, s3_bucket, s3_model_output_loc, local_cache_loc)
# Create maps
maps_created:
command: create_maps(data_downloaded, hru_conus_sf)
# Push images back up
maps_pushed:
command: push_s3_model_maps(maps_created, s3_bucket, s3_map_img_loc)
# Create GIF & push to s3
WBEEP/rscripts/generate_gif_images/onhm_model.gif:
command: generate_gif("WBEEP/rscripts/generate_gif_images/onhm_model.gif", maps_created)
onhm_gif_pushed:
command: push_s3_gif("WBEEP/rscripts/generate_gif_images/onhm_model.gif", s3_bucket, s3_map_img_loc, s3_auto_gif_name)