-
Notifications
You must be signed in to change notification settings - Fork 44
/
update_all.R
41 lines (29 loc) · 965 Bytes
/
update_all.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
#Overall update
## check that we're in the right place
origin = getwd()
if(basename(origin) != 'CIDA-Viz'){
stop('Check your locaiton, you should be in base CIDA-Viz path')
}
## Update the drought layer
setwd('ca_drought/R')
## this will probably fail (id doesn't handle how far in the future it should go,
# just goes to the point where it fails)
source('update.R')
setwd(origin)
## Update reservoir data/visualizations
setwd('ca_reservoirs/R')
source('update.R')
setwd(origin)
## Update discharge figure
# need to know last drought layer date
library(jsonlite)
times_json = fromJSON('Vizzies/public_html/data/drought_shp/times.json')
setwd('ca_discharge/R')
source('getRefSites.R')
source('getNWISdata.R')
source('discharge_svg.R')
createSVG(max(times_json$d))
#file.rename(paste0('../Figures/discharge_', max(times_json$d), '.svg'),
# '../../Vizzies/public_html/stream-graph.svg')
##Manual step, update dates in main.js
setwd(origin) #Done!