GBDX

ENVI® ROI Statistics

This task computes statistics from one or more ENVI ROIs and their associated raster.

GBDX Registered Name: ENVI_ROIStatistics
Provider: Harris Geospatial Solutions

Quickstart

This is a workflow example for basic processing.

Python

# Initialize the Environment.
import os
from gbdxtools import Interface
gbdx = Interface()

cat_id = '104001002D1B2100'
tasks = []
output_location = 'ENVI/ROIStatistics'

# Auto ordering task parameters
order = gbdx.Task("Auto_Ordering")
order.inputs.cat_id = cat_id
order.impersonation_allowed = True
order.persist = True
order.timeout = 36000
order_data_loc = order.outputs.s3_location.value
tasks += [order]

# AOP task parameters (PAN Only)
aop_task = gbdx.Task("AOP_Strip_Processor")
aop_task.inputs.data = order_data_loc
aop_task.inputs.enable_acomp = True
aop_task.inputs.enable_dra = False
aop_task.inputs.enable_pansharpen = False
aop_task.inputs.bands = 'MS'
aop_task_output = aop_task.outputs.data.value
tasks += [aop_task]

# Creates an ENVI ROI if you do not already have one.
envi_geojson_to_roi_task = gbdx.Task("ENVI_GeoJSONToROI")
envi_geojson = '''{"type": "GeometryCollection","name": "roi_geojson","geometries": [{ "type": "MultiPolygon", "properties": { "name": 1 }, "coordinates": [ [ [ [ -94.28559834878169, 43.16727586294779 ], [ -94.285586915028276, 43.16785127307449 ], [ -94.284557877221843, 43.167409291865695 ], [ -94.283860418264126, 43.166958968099649 ], [ -94.283860418264126, 43.166508641013728 ], [ -94.282865681717894, 43.166291815677198 ], [ -94.28251123536235, 43.166800520059091 ], [ -94.281996716459119, 43.166842216951714 ], [ -94.282031017719333, 43.166491962169012 ], [ -94.28191668018529, 43.165999934201139 ], [ -94.282305427801049, 43.165791446578652 ], [ -94.283517405661996, 43.165399487922009 ], [ -94.282831380457679, 43.164640582097746 ], [ -94.283437369388139, 43.164482128043609 ], [ -94.283848984510712, 43.163689851607927 ], [ -94.284752251029715, 43.163648152563532 ], [ -94.285655517548719, 43.163906686179985 ], [ -94.28559834878169, 43.16727586294779 ] ] ] ] },{ "type": "MultiPolygon", "properties": { "name": 2 }, "coordinates": [ [ [ [ -94.285975662644034, 43.169004161836746 ], [ -94.285904201685256, 43.169060450604327 ], [ -94.285915635438641, 43.168935364383707 ], [ -94.285809873219662, 43.168616393361646 ], [ -94.285964228890634, 43.16865183466858 ], [ -94.285975662644034, 43.169004161836746 ] ] ] ] },{ "type": "MultiPolygon", "properties": { "name": 3 }, "coordinates": [ [ [ [ -94.27333850669315, 43.168658089014706 ], [ -94.272552436146569, 43.168666428141904 ], [ -94.272569586776655, 43.16858929117187 ], [ -94.2733470820082, 43.168597630308462 ], [ -94.27333850669315, 43.168658089014706 ] ] ] ] },{ "type": "MultiPolygon", "properties": { "name": 4 }, "coordinates": [ [ [ [ -94.273501437679187, 43.169316876555747 ], [ -94.27357004019963, 43.172085374368471 ], [ -94.267533018401792, 43.171851891446664 ], [ -94.267350078347306, 43.169350232697944 ], [ -94.273501437679187, 43.169316876555747 ] ] ] ] }]}'''
envi_geojson_to_roi_task.inputs.input_geojson = envi_geojson
tasks += [envi_geojson_to_roi_task]

# Determine Stats from ROI file
envi_roi_stats = gbdx.Task("ENVI_ROIStatistics")
envi_roi_stats.inputs.input_raster = order_data_loc
envi_roi_stats.inputs.input_raster_band_grouping = 'multispectral'
envi_roi_stats.inputs.input_roi = envi_geojson_to_roi_task.outputs.output_roi_uri.value
tasks += [envi_roi_stats]

workflow = gbdx.Workflow(tasks)
workflow.savedata(envi_geojson_to_roi_task.outputs.output_roi_uri, location=os.path.join(output_location, 'roi'))
workflow.savedata(envi_roi_stats.outputs.task_meta_data, location=output_location)
workflow.savedata(envi_roi_stats.outputs.roi_names, location=output_location)
workflow.savedata(envi_roi_stats.outputs.min, location=output_location)
workflow.savedata(envi_roi_stats.outputs.max, location=output_location)
workflow.savedata(envi_roi_stats.outputs.covariance, location=output_location)
workflow.savedata(envi_roi_stats.outputs.stddev, location=output_location)
workflow.savedata(envi_roi_stats.outputs.roi_pixel_count, location=output_location)
workflow.savedata(envi_roi_stats.outputs.mean, location=output_location)

workflow.execute()

Inputs

The following table lists all ENVI_ROIStatistics inputs.
Mandatory (optional) settings are listed as Required = True (Required = False).

Name Required Default Valid Values Description
file_types False N/A string GBDX Option. Comma seperated list of permitted file type extensions. Use this to filter input files -- Value Type: STRING[*]
input_raster True N/A See ENVIRASTER input type Specify a raster from which to generate ROI statistics. -- Value Type: ENVIRASTER
input_raster_format False N/A See ENVIRASTER input type Provide the format of the image, for example: landsat-8. -- Value Type: STRING
input_raster_band_grouping False N/A See ENVIRASTER input type Provide the name of the band grouping to be used in the task, ie - panchromatic. -- Value Type: STRING
input_raster_filename False N/A See ENVIRASTER input type Provide the explicit relative raster filename that ENVI will open. This overrides any file lookup in the task runner. -- Value Type: STRING
input_roi True N/A See ENVIROIARRAY input type Specify an array of one or more ENVIROIs. -- Value Type: ENVIROIARRAY

Outputs

The following table lists all ENVI_ROIStatistics outputs.
Mandatory (optional) settings are listed as Required = True (Required = False).

Name Required Default Valid Values Description
task_meta_data False N/A directory GBDX Option. Output location for task meta data such as execution log and output JSON
min True N/A string This is the minimum data value, returned as an array [number of bands, number of ROIs]. -- Value Type: DOUBLEARRAY
max True N/A string This is the maximum data value, returned as an array [number of bands, number of ROIs]. -- Value Type: DOUBLEARRAY
roi_names True N/A string This is an array of ROI names as defined by the input ENVIROIs. -- Value Type: STRINGARRAY
covariance True N/A string This is the covariance matrix, returned an array [number of bands, number of bands, number of ROIs]. -- Value Type: DOUBLEARRAY
roi_colors True N/A string This is an array of RGB triplets representing the ROI colors as defined by the ENVIROIs. -- Value Type: BYTEARRAY
stddev True N/A string This is the standard deviation, returned as an array [number of bands, number of ROIs]. -- Value Type: DOUBLEARRAY
roi_pixel_count True N/A string This is the number of pixels for each ROI, returned as an array [number of ROIs]. -- Value Type: LONGARRAY
mean True N/A string This is the mean data value, returned as an array [number of bands, number of ROIs]. -- Value Type: DOUBLEARRAY

Output structure

The output files will be written to the specified S3 Customer Account Location.

Background

For additional background information on this task please refer to the Harris Geospatial ENVI documentation and
ENVI® ROIStatistics.

Contact

If you have any questions or issues with this task, please contact gbdx-support@digitalglobe.com.