-
Notifications
You must be signed in to change notification settings - Fork 49
/
export_vector.py
39 lines (27 loc) · 987 Bytes
/
export_vector.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
import os, ee, datetime, csv, time
startTime = datetime.datetime(2001, 1, 1)
endTime = datetime.datetime(2001, 2, 1)
lst = ee.ImageCollection('FORA0125_H002').filterDate(startTime, endTime)
# Get the time series at these points.
points = [ee.Geometry.Point(-85.16516, 30.850000000000001)]
collection = ee.FeatureCollection(points)
# Extract the values by running reduceRegions over each image in the image collection.
def myfunction(i):
return i.reduceRegions(collection, 'first')
values = lst.map(myfunction).flatten()
# Turn the result into a feature collection and export it.
taskParams = {
'driveFolder': 'image',
'driveFileNamePrefix': 'TylerTest',
'fileFormat': 'CSV'
}
MyTry = ee.batch.Export.table(values, 'lst_timeseries', taskParams)
MyTry.start()
state = MyTry.status()['state']
while state in ['READY', 'RUNNING']:
print(state, '...')
time.sleep(1)
state = MyTry.status()['state']
print('Done.', MyTry.status())
# Display the map.
Map