-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample_usage.py
33 lines (26 loc) · 1.25 KB
/
example_usage.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
from datetime import datetime
from pprint import pprint
from copernicus_odata_wrapper.query import Query
from copernicus_odata_wrapper.filter import Filter
from copernicus_odata_wrapper.attributes import ProcessingLevel
if __name__ == '__main__':
start_date = datetime(2023, 7, 2)
end_date = datetime(2023, 7, 2)
wkt = f'POINT(69.0 61.0)'
# wkt = "POLYGON((69.0 61.0, 70.0 61.0, 70.0 60.0, 69.0 60.0, 69.0 61.0))"
# setting up a filter
f = Filter() # create Filter instance
f.by_sensing_date(start_date, end_date, full_day=True) # filter by sensing dates
f.And() # add `and` to the end of the filter
f.by_geographic_criteria(wkt) # filter by coordinates
f.And()
f.collection('SENTINEL-2') # filter by collection name
f.And()
attributes = [ProcessingLevel() == 'S2MSI1C'] # setting up attributes filter
f.by_attribute(attributes) # apply method `filter by attributes`
query = Query() # create Query instance
query.set_filter(f) # apply filter
query.set_orderby('ContentDate/Start', ascending=True) # sort results by sensing date in ascending order
query.set_expand(attributes=True, assets=True) # show all available information
response = query.send() # send query
pprint(response)