-
Notifications
You must be signed in to change notification settings - Fork 4
/
export.py
75 lines (63 loc) · 1.74 KB
/
export.py
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
import sys
from pathlib import Path
from datetime import date
sys.path.append("..")
from src.exporters import (
GeoWikiExporter,
GeoWikiSentinelExporter,
KenyaPVSentinelExporter,
KenyaNonCropSentinelExporter,
RegionalExporter,
TogoSentinelExporter,
BrazilSentinelExporter,
SudanSentinelExporter,
EthiopiaSentinelExporter,
BrazilMunicipalitiesExporter,
MaliSentinelExporter,
)
def export_geowiki():
"""
Download the raw geowiki labels
"""
exporter = GeoWikiExporter(Path("../data"))
exporter.export()
def export_for_labels():
"""
Download the tif files associated with labels
from google earth engine
"""
for export_class in [
GeoWikiSentinelExporter,
KenyaPVSentinelExporter,
KenyaNonCropSentinelExporter,
TogoSentinelExporter,
BrazilSentinelExporter,
SudanSentinelExporter,
EthiopiaSentinelExporter,
MaliSentinelExporter,
]:
exporter = export_class(Path("../data"))
exporter.export_for_labels(num_labelled_points=None, monitor=False, checkpoint=True)
def export_region():
"""
Export for a specified region
"""
exporter = RegionalExporter(Path("../data"))
exporter.export_for_region(
region_name="Busia",
end_date=date(2020, 4, 16),
monitor=False,
checkpoint=True,
metres_per_polygon=10000,
)
def export_brazil_municipality():
"""
Export for a specific Brazilian municipality
"""
exporter = BrazilMunicipalitiesExporter(Path("../data"))
exporter.export_for_region(end_date=date(2020, 4, 16))
if __name__ == "__main__":
export_geowiki()
export_for_labels()
export_region()
export_brazil_municipality()