-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·158 lines (110 loc) · 6.13 KB
/
Makefile
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# header ####################################################
pdf=manuscripts/dataflowchl.pdf
csl=manuscripts/ecology.csl
refs=manuscripts/dataflowchl.bib
pflags= --template=manuscripts/template.tex --bibliography=$(refs) --csl=$(csl)
#BASE_PATH=/home/jose/Documents/Science/Data/Dataflow
#GOODYEARS=200808 200910 201004 201007 201102 201105 201206 201209 201212 201305 201308 201311 201404 201407 201410 201502 201505 201507 201509
#SURFACE_PATHS = $(foreach yearmon, $(GOODYEARS), $(BASE_PATH)/DF_Surfaces/$(yearmon)/chlext.tif)
#DATA_PATHS = $(foreach yearmon, $(GOODYEARS), $(BASE_PATH)/DF_FullDataSets/$(yearmon)j.csv)
.PHONY: help
.DEFAULT_GOAL := help
help:
@grep -E '^[a-zA-Z0-9\./\_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
help_no_color:
@grep -E '^[a-zA-Z0-9\./\_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "%-30s%s\n", $$1, $$2}'
# convert_docx: ## convert docx ms to markdown
# pandoc -f docx -t markdown manuscripts/DataflowChl.docx -o manuscripts/dataflowchl.md
# data ####################################################
data: data/goodyears.csv data/allstreaming.csv data/allgrabs.csv ## copy data from archives
@echo "data pulled"
data/goodyears.csv: code/goodyears.R ## listing of surveys with good spatial coverage
Rscript -e "source('code/goodyears.R')"
data/allstreaming.csv: ## move streaming data from archive folder
Rscript -e "source('code/allstreaming.R')"
data/allgrabs.csv: code/allgrabs.R ## move grab data from archive folder
Rscript -e "source('code/allgrabs.R')"
# data/dbhydt.csv: ## update DBHYDRO subset and move to local folder
# cd /home/jose/Documents/Science/Data/WQMN/ && Rscript -e "remake::make('updateddb.csv')" && rsync updateddb.csv /home/jose/Documents/Science/JournalSubmissions/DataflowChl/data
# mv data/updateddb.csv data/dbhydt.csv
# data/modelfits.csv: /home/jose/Documents/Science/Data/Dataflow/DF_GrabSamples/extractChlcoef2.csv ## move model fit info from archive folder
# rsync /home/jose/Documents/Science/Data/Dataflow/DF_GrabSamples/extractChlcoef2.csv data
# mv data/extractChlcoef2.csv data/modelfits.csv
# data/flow/ENPOps_flow.csv: ## pull USGS flow data from NWIS
# Rscript code/pull_usgs_flow.R
# figures #######################################################
figures: figures/multipanel.png figures/multipanel_mb.png figures/fbmap.png figures/rain.png figures/chlboxplot.png figures/nonchlboxplot.png figures/trout.png ## create figures
@echo "figures built"
figures/multipanel.png: $(SURFACE_PATHS) code/multipanel.R ## create multipanel figure
Rscript code/multipanel.R
convert multipanel.png -gravity North -chop 0x85 figures/multipanel.png
-rm multipanel.png
figures/multipanel_salinity.png: code/multipanel_salinity.R ## create salinity multipanel
Rscript code/multipanel_salinity.R
convert multipanel.png -gravity North -chop 0x85 figures/multipanel_salinity.png
-rm multipanel.png
figures/multipanel_mb.png: $(SURFACE_PATHS) ## create multipanel figure zoomed to Manatee Bay
Rscript --default-packages=methods,utils R/multipanel_mb.R
figures/multipanel_jb.png: $(SURFACE_PATHS) ## create multipanel figure zoomed to Joe Bay
Rscript --default-packages=methods,utils code/multipanel_jb.R
figures/fbmap_dflow.png: code/fbmap.R ## create Florida Bay basemap with dflow grab points
Rscript code/fbmap.R
figures/fbmap_wqmn.png: code/fbmap.R ## create Florida Bay basemap with wqmn grab points
Rscript code/fbmap.R
figures/fbmap.png: code/fbmap.R ## create 2 panel Florida Bay basemap with grab points
Rscript code/fbmap.R
convert figures/fl-inset_border.png -resize 12% -bordercolor black :- | convert figures/fbmap.png -page +870+1470 - -gravity east -flatten figures/fbmap.png
figures/rain.png: data/rain/NexradRainData.txt ## create rain time-series figure
Rscript code/rain.R
figures/chlboxplot.png: ## create chlorophyll boxplot
Rscript code/chlboxplot.R
figures/nonchlboxplot.png: code/nonchlboxplot.R ## create non-chlorophyll boxplot
Rscript code/nonchlboxplot.R
figures/chltimeseries.png: data/dbhydt.csv code/chltimeseries.R ## create chlorophyll time-series plot
Rscript code/chltimeseries.R
figures/phycoc.png: code/avmap.R
Rscript code/avmap.R
figures/chlext.png: code/avmap.R
Rscript code/avmap.R
figures/avmap.png: figures/phycoc.png figures/chlext.png ## create average chl and phycoc maps
convert phycoc.png -gravity South -crop 100x94%+0+0 phycoc_crop.png
convert chlext.png -gravity South -crop 100x94%+0+0 chlext_crop.png
montage chlext_crop.png phycoc_crop.png -geometry +2+2 -tile x2 \
figures/avmap.png
-rm chlext_crop.png phycoc_crop.png
figures/trout.png: code/trout_creek_salinity_acf.R
Rscript code/trout_creek_salinity_acf.R
montage figures/fbmap_trout.png figures/trout_creek_salinity_acf.png \
-geometry +2+2 -tile 2x -gravity south -trim figures/trout.png
figures/boundaries.png: code/boundaries.R data/goodyears.csv ## create boundaries figure
Rscript code/boundaries.R
# tables #######################################################
tables: manuscripts/est_coast/table_1.tex manuscripts/est_coast/table_2.tex ## create tables
@echo "tables built"
tables/grabs_cor.csv: data/allgrabs_log.csv code/cormat.R
Rscript code/cormat.R
tables/grabs_pvalues.csv: data/allgrabs_log.csv code/cormat.R
Rscript code/cormat.R
manuscripts/est_coast/table_1.tex: tables/grabs_cor.csv tables/grabs_pvalues.csv code/prep_table-1.R
Rscript code/prep_table-1.R
tables/modelfits.csv: code/modelfits.R
Rscript code/modelfits.R
manuscripts/est_coast/table_2.tex: tables/modelfits.csv code/prep_table-2.R ## create table 2
Rscript code/prep_table-2.R
# manuscript #######################################################
ms: #data figures tables clean ## compile ms
cd manuscripts/ecss/ && make pdf
diff: manuscripts/est_coast/dataflowchl.tex ## create latexdiff pdf
cd manuscripts/est_coast && make diff
ms_word:
cd manuscripts/ecss/ && make ms_word
# finalize + cleanup ###############################################
#all: render_rmd
# @echo "built"
clean:
-rm *.log
-rm *.aux
-rm *.tex
-rm *.out
test:
@grep -E '^[a-zA-Z0-9\./\_-]+:.*?## .*$$' $(MAKEFILE_LIST)