-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgcli.py
115 lines (91 loc) · 3.12 KB
/
gcli.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
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
"""
Command line interface for geepy allows users to download products from terminal
"""
import click
import geepy
@click.command()
@click.option('--product', '-p', 'product')
def check_metadata(product):
"""
check an image product's meta data
"""
geepy.get_metadata(product)
@click.command()
@click.option('--shapefile', '-shp', 'shp')
def check_features(shp):
"""
check shapefile readiness for processing
"""
features = geepy.get_features(shp)
print(features)
@click.command()
@click.option('--product', '-p', 'product')
@click.option('--area-of-interest', '-a', 'aoi')
@click.option('--start-date', '-sd', 'start_date')
@click.option('--end-date', '-ed', 'end_date')
@click.option('--band', '-b', 'band')
def download_modis(product, aoi, start_date, end_date,
band=['NDVI'], export=True):
"""
download modis products in area of interest
"""
geepy.get_modis(product, aoi, start_date, end_date,
band=band, export=export)
@click.command()
@click.option('--product', '-p', 'product')
@click.option('--area-of-interest', '-a', 'aoi')
@click.option('--start-date', '-sd', 'start_date')
@click.option('--end-date', '-ed', 'end_date')
@click.option('--cloud-cover(%)', '-pcc', 'pcc')
@click.option('--band', '-b', 'band')
@click.option('--output-name', '-oo', 'output')
def download_sentinel(product, aoi,
start_date, end_date,
pcc=3, output='output',
export=True):
"""
download sentinel imagery by area of interest
"""
geepy.get_sentinel(product, aoi, start_date, end_date,
pcc, output, export=export)
@click.command()
@click.option('--product', '-p', 'product')
@click.option('--area-of-interest', '-a', 'aoi')
@click.option('--start-date', '-sd', 'start_date')
@click.option('--end-date', '-ed', 'end_date')
def download_chirps(product, aoi, start_date,
end_date, export=True):
"""
download chrips imagery by area of interest
"""
geepy.get_chirps(product, aoi, start_date,
end_date, export=export)
@click.command()
# @click.argument('product')
# @click.argument('aoi')
# @click.argument('start_date')
# @click.argument('end_date')
# @click.argument('band')
@click.option('--product', '-p', 'product')
@click.option('--area-of-interest', '-a', 'aoi')
@click.option('--start-date', '-sd', 'start_date')
@click.option('--end-date', '-ed', 'end_date')
@click.option('--band', '-b', 'band')
def download_terraclimate(product, aoi, start_date, end_date,
band=['aet'], export=True):
"""
download terraclimate data by area of interest
"""
geepy.get_terraclimate(product, aoi, start_date,
end_date, band=band, export=export)
@click.group(chain=True)
def commands():
"""
Access Google Earth Engine Products by Area of Interest
"""
commands.add_command(check_features)
commands.add_command(check_metadata)
commands.add_command(download_modis)
commands.add_command(download_chirps)
commands.add_command(download_sentinel)
commands.add_command(download_terraclimate)