Hi,
I am just getting started with python and the arcgis api and I’m trying to use jupyter notebook to analyse sentinel data for pre and post fire processing assignment. I found some help online but I keep getting stuck calling in the sentinel data and wonder if someone could please help me?
I would like to try filter by the date and intersection. Do I need to obtain a Token for the sentinel dataset?
from arcgis import GIS
gis = GIS()
sentinel_item = gis.content.search('Sentinel-2 Views', outside_org=True)[0]
sentinel_item
import arcgis
sentinel = sentinel_item.layers[0]
aoi = {'spatialreference': 'WGS 1984',
'xmax': 15804453,
'xmin': 17113072,
'ymax': -3049737,
'ymin': -3888071}
arcgis.env.analysis_extent = aoi
sentinel.extent = aoi
import pandas as pd
from datetime import datetime
startdate = pd.to_datetime(input("What is the fire start date "))
enddate = pd.to_datetime(input("What is the fire end date "))
selected = sentinel.filter_by(where="acquisitiondate BETWEEN timestamp 'startdate' AND timestamp 'enddate'",
geometry=arcgis.geometry.filters.intersects(aoi))
df = selected.query(out_fields='AcquisitionDate, Tile_ID, CloudCover', order_by_fields='AcquisitionDate').df
df['acquisitiondate'] = pd.to_datetime(df['acquisitiondate'], unit = 'ms')
Thanks,
Bob