Select to view content in your preferred language

Agriculture field delineation dlpk

1487
8
10-25-2023 11:33 PM
S6
by Esri Contributor
Esri Contributor

Hi,

I am trying to use the Agriculture Field Delineation pre-trained model on a downloaded Sentinel-2 L2A imagery composite. But I always get an empty output. Can you share the right order & resolution of bands to be used for this workflow? It is unclear which bands are used in the guide shared.

Following is a screenshot of the bands used for creating a composite.

S6_0-1698301983935.png

 

0 Kudos
8 Replies
JeffreySwain
Esri Regular Contributor

Hi S6,

From looking at the DLPK information, it seems that it requires the following input.

JeffreySwain_0-1698331566311.png

I do not see a specific default order specified. Can you indicate what raster product or band combination you are currently using?  

 

0 Kudos
S6
by Esri Contributor
Esri Contributor

Hi JefferySwain,

The band order is as shown in the screenshot.

S6_0-1698379103845.png

 

0 Kudos
DavidWright
Esri Contributor

Hello S6,

This model expects the band order you have shared. We trained the model using Sentinel-2 Cloud-Optimized GeoTIFFs from Registry of Open Data on AWS: https://registry.opendata.aws/sentinel-2-l2a-cogs/  Since the bands are separate .tif files and of varying spatial resolutions we used a Mosaic Dataset to manage everything. I've just posted a public repository that you can use to automate creation of your own Mosaic Datasets to use with this Deep Learning Model. https://github.com/dkwright/arcgis-sentinel-2-cog-ag-fields/ . There is an example you can run from the batchfiles folder that will create the Mosaic Dataset for San Luis Valley for the month of July in 2023 using a 20% cloud cover limit and it adds a couple dozen processing templates for rendering various imagery composites and band indices on-the-fly. The batchfile can be modified to use your own Area of Interest, acquisition date range, and cloud cover percentage threshold.

0 Kudos
johnpol
Occasional Contributor

I have a problem running the batchfile? I changed the directories but did not do anything

0 Kudos
DavidWright
Esri Contributor

Hi johnpol, 

Your python environment path (pPath) should be that of ArcGIS Pro. Default path to this is: "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe" Please verify on your system.

Also, be sure and set your mdcsPath to the folder where you have copied the github repo to. This directory should be the one that has 'Requirements.txt' in it. By the way, did you follow the info inside that file? You'll need to 'pip install pystac-client' into your Python environment.
 
Using mdPath be sure and specify a local folder for the output. The script will create the File GeoDataBase, (in this case C:\data\sentinel-2-l2a\SanLuisValley.gdb) and the Mosaic Dataset (SanLuisValley).
set mdPath=C:\data\sentinel-2-l2a\SanLuisValley.gdb\SanLuisValley
 
With each run of the script you should see a corresponding XML logfile created in /logs/  For example: DEA_20231208T144625.xml
 
Can you have a look inside and see what messages you get?
0 Kudos
hafzaal4242
New Contributor

Thank you @DavidWright  for sharing this amazing tool. I am able to run this tool, however, I am not getting the raster files. The generated dataset is only giving footprint polygons. The log file is below:

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Projects>
<MDCS>
<StartTime>20231213T033439</StartTime>
<EndTime>20231213T033520</EndTime>
<TotalDuration>41</TotalDuration>
<Message>
Checking for updates..
<Error>
<type>warning</type>
<text>Update Available. Please read C:\Users\19023\Desktop\arcgis-sentinel-2-cog-ag-fields-main\arcgis-sentinel-2-cog-ag-fields-main\scripts\CheckForUpdate.json</text>
</Error>
</Message>
<Message>Using template:C:\Users\19023\Desktop\arcgis-sentinel-2-cog-ag-fields-main\arcgis-sentinel-2-cog-ag-fields-main\Parameter\Config\DEA.xml</Message>
<Message>Processing command(s):CM+SENTINELMODIFYSRC+AF+AR+MARKDUPLICATE+RRFMD+SP+CV</Message>
<Message>Done...</Message>
<CM>
<Message>Command:CM->Create a new mosaic dataset.</Message>
<Message>Creating Geodatabase: (C:/data/sentinel-2-l2a/SanLuisValley.gdb)</Message>
<Message>Creating source mosaic datasets:</Message>
<Message> SanLuisValley</Message>
<Status>OK</Status>
<Duration>3</Duration>
</CM>
<sentinelModifySrc>
<Message>Command:sentinelModifySrc->User defined command (sentinelModifySrc)</Message>
<Message>Adding Field to MasterTiles...</Message>
<Message>adding to the feature class for interverl 2023-07-01/2023-07-31...</Message>
<Message>adding to the feature class S2A_13SDB_20230730_0_L2A...</Message>
<Message>adding to the feature class S2A_13SDC_20230730_0_L2A...</Message>
<Message>adding to the feature class S2B_13SCA_20230725_0_L2A...</Message>
<Message>adding to the feature class S2B_13SDA_20230725_0_L2A...</Message>
<Message>adding to the feature class S2B_13SCB_20230725_0_L2A...</Message>
<Message>adding to the feature class S2B_13SDB_20230725_0_L2A...</Message>
<Message>adding to the feature class S2B_13SDC_20230725_0_L2A...</Message>
<Message>adding to the feature class S2B_13SCA_20230722_0_L2A...</Message>
<Message>adding to the feature class S2B_13SDA_20230722_0_L2A...</Message>
<Message>adding to the feature class S2B_13SCB_20230722_0_L2A...</Message>
<Message>adding to the feature class S2B_13SDB_20230722_0_L2A...</Message>
<Message>adding to the feature class S2A_13SCA_20230720_0_L2A...</Message>
<Message>adding to the feature class S2A_13SDA_20230720_0_L2A...</Message>
<Message>adding to the feature class S2A_13SDB_20230720_0_L2A...</Message>
<Message>adding to the feature class S2A_13SCA_20230717_0_L2A...</Message>
<Message>adding to the feature class S2A_13SDA_20230717_0_L2A...</Message>
<Message>adding to the feature class S2A_13SCB_20230717_0_L2A...</Message>
<Message>adding to the feature class S2A_13SDB_20230717_0_L2A...</Message>
<Message>adding to the feature class S2A_13SDC_20230717_0_L2A...</Message>
<Message>adding to the feature class S2B_13SCA_20230715_0_L2A...</Message>
<Message>adding to the feature class S2B_13SDA_20230715_0_L2A...</Message>
<Message>adding to the feature class S2B_13SCB_20230715_0_L2A...</Message>
<Message>adding to the feature class S2B_13SDB_20230715_0_L2A...</Message>
<Message>adding to the feature class S2B_13SCC_20230715_0_L2A...</Message>
<Message>adding to the feature class S2B_13SDC_20230715_0_L2A...</Message>
<Message>adding to the feature class S2B_13SCA_20230712_0_L2A...</Message>
<Message>adding to the feature class S2B_13SCB_20230712_0_L2A...</Message>
<Message>adding to the feature class S2B_13SDB_20230712_0_L2A...</Message>
<Message>adding to the feature class S2A_13SCB_20230707_0_L2A...</Message>
<Message>adding to the feature class S2A_13SDB_20230707_0_L2A...</Message>
<Message>adding to the feature class S2A_13SDC_20230707_0_L2A...</Message>
<Message>adding to the feature class S2B_13SCA_20230705_0_L2A...</Message>
<Message>adding to the feature class S2B_13SDA_20230705_0_L2A...</Message>
<Message>adding to the feature class S2B_13SCB_20230705_0_L2A...</Message>
<Message>adding to the feature class S2B_13SDB_20230705_0_L2A...</Message>
<Message>adding to the feature class S2B_13SCC_20230705_0_L2A...</Message>
<Message>Adding Field to BandTiles...</Message>
<Message>Calculating the Q and Best value...</Message>
<Message>adding band feature class ...</Message>
<Status>OK</Status>
<Duration>10</Duration>
</sentinelModifySrc>
<AF>
<Message>Command:AF->Add fields.</Message>
<Message>Adding custom fields:</Message>
<Message>Using mosaic dataset:SanLuisValley</Message>
<Message> Creating fields:</Message>
<Message> DayDate</Message>
<Status>OK</Status>
<Duration>5</Duration>
</AF>
<AR>
<Message>Command:AR->Add rasters/data to a mosaic dataset.</Message>
<Message>Adding rasters:</Message>
<Message> Using mosaic dataset/ID:SanLuisValley/Sentinel2</Message>
<Message> Using ART for SANLUISVALLEY: C:\Users\19023\Desktop\arcgis-sentinel-2-cog-ag-fields-main\arcgis-sentinel-2-cog-ag-fields-main\scripts\Base\../../Parameter/RasterType\Sentinel2_MS.art.xml</Message>
<Message>Adding items..</Message>
<Message>Calling (arcpy.AddRastersToMosaicDataset_management)</Message>
<Message>Status: OK</Message>
<Message>Calculating 'Dataset ID' for the mosaic dataset (SanLuisValley) with value (Sentinel2)</Message>
<Status>OK</Status>
<Duration>11</Duration>
</AR>
<markduplicate>
<Message>Command:markduplicate->User defined command (markduplicate)</Message>
<Status>OK</Status>
<Duration>0</Duration>
</markduplicate>
<RRFMD>
<Message>Command:RRFMD->Remove Rasters from Mosaic dataset.</Message>
<Message> Remove rasters from mosaic dataset : SanLuisValley</Message>
<Status>OK</Status>
<Duration>1</Duration>
</RRFMD>
<SP>
<Message>
Command:SP->Set mosaic dataset properties.
<Error>
<type>critical</type>
<text>SP flag is not found!</text>
</Error>
<Error>
<type>critical</type>
<text>Using default for Set property</text>
</Error>
</Message>
<Message>Calling (arcpy.SetMosaicDatasetProperties_management)</Message>
<Message>Status: OK</Message>
<Status>OK</Status>
<Duration>3</Duration>
</SP>
<CV>
<Message>Command:CV->Calculate mosaic dataset values.</Message>
<Message>Calculate values:C:/data/sentinel-2-l2a/SanLuisValley.gdb\SanLuisValley</Message>
<Status>OK</Status>
<Duration>5</Duration>
</CV>
</MDCS>
</Projects>1.png



0 Kudos
DavidWright
Esri Contributor

Thanks hafzaal4242!

Please be sure and zoom in to a scale larger than 1:500k as the Mosaic Dataset gets created with some default values for the *PS fields in the footprint table. These field values control the scale range in which to render rasters. When zoomed out to smaller scales it would take a long time to render every image in the Mosaic Dataset.

0 Kudos
hafzaal4242
New Contributor

Thank you, DavidWright. Worked perfectly.  Will try other areas as well. 

hafzaal4242_0-1702484802429.png

 

 
PREVIEW