forked from wri/gppd-ai4earth-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
104 lines (76 loc) · 4.92 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
HYDROBASINS_LOCAL_DIR := models/source_files/HydroBasins
CDS_KEY := ADD_YOUR_KEY_HERE
# no arguments = test
.PHONY: default
default: test
# tests
.PHONY: test
test:
python tests/tests.py
# fetch most recent GPPD
.PHONY: models/global_power_plant_database.csv
models/global_power_plant_database.csv:
wget -O models/global_power_plant_database.csv https://raw.githubusercontent.com/wri/global-power-plant-database/master/output_database/global_power_plant_database.csv
# fetch all HydroBASINS shapefiles
.PHONY: models/source_files/HydroBasins
models/source_files/HydroBasins: hydrobasins_af hydrobasins_ar hydrobasins_as hydrobasins_au hydrobasins_eu hydrobasins_gr hydrobasins_na hydrobasins_sa hydrobasins_si
# HydroBASINS Africa
.PHONY: hydrobasins_af
hydrobasins_af:
mkdir -p $(HYDROBASINS_LOCAL_DIR)
wget -nv -O $(HYDROBASINS_LOCAL_DIR)/hybas_af_lev12_v1c.zip https://www.dropbox.com/sh/hmpwobbz9qixxpe/AABSBGFylsZ9KoG8zYRvOTzqa/HydroBASINS/standard/af/hybas_af_lev12_v1c.zip?dl=1
unzip $(HYDROBASINS_LOCAL_DIR)/hybas_af_lev12_v1c.zip -d $(HYDROBASINS_LOCAL_DIR)/hybas_af_lev12_v1c && rm $(HYDROBASINS_LOCAL_DIR)/hybas_af_lev12_v1c.zip
# HydroBASINS Arctic
.PHONY: hydrobasins_ar
hydrobasins_ar:
mkdir -p $(HYDROBASINS_LOCAL_DIR)
wget -nv -O $(HYDROBASINS_LOCAL_DIR)/hybas_ar_lev12_v1c.zip https://www.dropbox.com/sh/hmpwobbz9qixxpe/AADaA0icxaPYgaQGuLbSaKfna/HydroBASINS/standard/ar/hybas_ar_lev12_v1c.zip?dl=1
unzip $(HYDROBASINS_LOCAL_DIR)/hybas_ar_lev12_v1c.zip -d $(HYDROBASINS_LOCAL_DIR)/hybas_ar_lev12_v1c && rm $(HYDROBASINS_LOCAL_DIR)/hybas_ar_lev12_v1c.zip
# HydroBASINS Asia
.PHONY: hydrobasins_as
hydrobasins_as:
mkdir -p $(HYDROBASINS_LOCAL_DIR)
wget -O $(HYDROBASINS_LOCAL_DIR)/hybas_as_lev12_v1c.zip https://www.dropbox.com/sh/hmpwobbz9qixxpe/AADWZKiGaCncO5JdRLmkIduMa/HydroBASINS/standard/as/hybas_as_lev12_v1c.zip?dl=1
unzip $(HYDROBASINS_LOCAL_DIR)/hybas_as_lev12_v1c.zip -d $(HYDROBASINS_LOCAL_DIR)/hybas_as_lev12_v1c && rm $(HYDROBASINS_LOCAL_DIR)/hybas_as_lev12_v1c.zip
# HydroBASINS Australia
.PHONY: hydrobasins_au
hydrobasins_au:
mkdir -p $(HYDROBASINS_LOCAL_DIR)
wget -O $(HYDROBASINS_LOCAL_DIR)/hybas_au_lev12_v1c.zip https://www.dropbox.com/sh/hmpwobbz9qixxpe/AAA5lwuZZ5EZsxrx_EBQGW3ma/HydroBASINS/standard/au/hybas_au_lev12_v1c.zip?dl=1
unzip $(HYDROBASINS_LOCAL_DIR)/hybas_au_lev12_v1c.zip -d $(HYDROBASINS_LOCAL_DIR)/hybas_au_lev12_v1c && rm $(HYDROBASINS_LOCAL_DIR)/hybas_au_lev12_v1c.zip
# HydroBASINS Europe
.PHONY: hydrobasins_eu
hydrobasins_eu:
mkdir -p $(HYDROBASINS_LOCAL_DIR)
wget -O $(HYDROBASINS_LOCAL_DIR)/hybas_eu_lev12_v1c.zip https://www.dropbox.com/sh/hmpwobbz9qixxpe/AADULrBSkGy5dHOZ8vMxWpWxa/HydroBASINS/standard/eu/hybas_eu_lev12_v1c.zip?dl=1
unzip $(HYDROBASINS_LOCAL_DIR)/hybas_eu_lev12_v1c.zip -d $(HYDROBASINS_LOCAL_DIR)/hybas_eu_lev12_v1c && rm $(HYDROBASINS_LOCAL_DIR)/hybas_eu_lev12_v1c.zip
# HydroBASINS Greenland
.PHONY: hydrobasins_gr
hydrobasins_gr:
mkdir -p $(HYDROBASINS_LOCAL_DIR)
wget -O $(HYDROBASINS_LOCAL_DIR)/hybas_gr_lev12_v1c.zip https://www.dropbox.com/sh/hmpwobbz9qixxpe/AACNOTXj-M1T-rpz5k_QJd6Ka/HydroBASINS/standard/gr/hybas_gr_lev12_v1c.zip?dl=1
unzip $(HYDROBASINS_LOCAL_DIR)/hybas_gr_lev12_v1c.zip -d $(HYDROBASINS_LOCAL_DIR)/hybas_gr_lev12_v1c && rm $(HYDROBASINS_LOCAL_DIR)/hybas_gr_lev12_v1c.zip
# HydroBASINS North America
.PHONY: hydrobasins_na
hydrobasins_na:
mkdir -p $(HYDROBASINS_LOCAL_DIR)
wget -O $(HYDROBASINS_LOCAL_DIR)/hybas_na_lev12_v1c.zip https://www.dropbox.com/sh/hmpwobbz9qixxpe/AAA1ofV7PhSY_x7vQluubYyNa/HydroBASINS/standard/na/hybas_na_lev12_v1c.zip?dl=1
unzip $(HYDROBASINS_LOCAL_DIR)/hybas_na_lev12_v1c.zip -d $(HYDROBASINS_LOCAL_DIR)/hybas_na_lev12_v1c && rm $(HYDROBASINS_LOCAL_DIR)/hybas_na_lev12_v1c.zip
# HydroBASINS South America
.PHONY: hydrobasins_sa
hydrobasins_sa:
mkdir -p $(HYDROBASINS_LOCAL_DIR)
wget -O $(HYDROBASINS_LOCAL_DIR)/hybas_sa_lev12_v1c.zip https://www.dropbox.com/sh/hmpwobbz9qixxpe/AABPzWxd07pmshjZl6Y0NPXNa/HydroBASINS/standard/sa/hybas_sa_lev12_v1c.zip?dl=1
unzip $(HYDROBASINS_LOCAL_DIR)/hybas_sa_lev12_v1c.zip -d $(HYDROBASINS_LOCAL_DIR)/hybas_sa_lev12_v1c && rm $(HYDROBASINS_LOCAL_DIR)/hybas_sa_lev12_v1c.zip
# HydroBASINS Siberia
.PHONY: hydrobasins_si
hydrobasins_si:
mkdir -p $(HYDROBASINS_LOCAL_DIR)
wget -O $(HYDROBASINS_LOCAL_DIR)/hybas_si_lev12_v1c.zip https://www.dropbox.com/sh/hmpwobbz9qixxpe/AABtI2KbgItfLp4jmHcvZhDea/HydroBASINS/standard/si/hybas_si_lev12_v1c.zip?dl=1
unzip $(HYDROBASINS_LOCAL_DIR)/hybas_si_lev12_v1c.zip -d $(HYDROBASINS_LOCAL_DIR)/hybas_si_lev12_v1c && rm $(HYDROBASINS_LOCAL_DIR)/hybas_si_lev12_v1c.zip
# Hydro Runoff
.PHONY: models/source_files/hydro_runoff
models/source_files/hydro_runoff:
python models/source_files/hydro_runoff_tool_scripts/download_ERA5_monthly_averages.py $(CDS_KEY) models/source_files/hydro_runoff \
&& python models/source_files/hydro_runoff_tool_scripts/transform_ERA5_monthly_averages.py models/source_files/hydro_runoff \
&& rm models/source_files/hydro_runoff/**/*_monthly_avg.nc