I am working on a python notebook in ArcGIS Pro, what is required is to save a part of a sentinel scene in an enterprise portal or in ArcGIS Online, however I get the following error.
I appreciate you can help me.
%matplotlib inline
import pandas as pd
from datetime import datetime
from IPython.display import Image
from IPython.display import HTML
import matplotlib.pyplot as plt
from sklearn.preprocessing import MinMaxScaler
from datetime import datetime as dt
import arcgis
from arcgis.gis import GIS
from arcgis.learn import MLModel, prepare_tabulardata
from arcgis.raster import Raster
from fastai.vision import *
gis = GIS("home")
gis_enterp = GIS("https://pythonapi.playground.esri.com/portal", "arcgis_python", "amazing_arcgis_123")
# get image
s2 = gis.content.get('fd61b9e0c69c4e14bebd50a9a968348c')
sentinel = s2.layers[0]
s2
# extent in 3857 for amazon rainforest
amazon_extent = {
"xmin": -6589488.51,
"ymin": -325145.08,
"xmax": -6586199.09,
"ymax": -327024.74,
"spatialReference": {"wkid": 3857}
}
# The respective scene having the above area is selected
selected = sentinel.filter_by(where="(Category = 1) AND (cloudcover <=0.05)",
geometry=arcgis.geometry.filters.intersects(amazon_extent))
df = selected.query(out_fields="AcquisitionDate, GroupName, CloudCover, DayOfYear",
order_by_fields="AcquisitionDate").sdf
df['AcquisitionDate'] = pd.to_datetime(df['acquisitiondate'], unit='ms')
df
# The scene is selected with the least cloud cover and extracted using the amazon extent
amazon_scene = sentinel.filter_by('OBJECTID=14252850')
amazon_scene.extent = amazon_extent
amazon_scene
amazon_scene.save('amazon_scene'+ str(dt.now().microsecond), gis=gis_enterp)


