SlideShare a Scribd company logo
1 of 47
Download to read offline
March 8–11, 2016 | Palm Springs, CA
Esri Developer Summit
Writing Image Processing Algorithms
using the Python Raster Function
Gregory Brunner Jamie Drisdelle Feroz Abdul Kadar
Agenda
· Introduction
· Anatomy of a raster function
· Building raster models
· Additional considerations
· Q&A
Introduction
Raster Functions
What’s a Raster Function?
• Mapping of one raster to another.
• Loosely,
• On-demand. Transient.
• Different from a geoprocessing tool.
… a transformation of one raster into another.
The Fundamentals
Chaining Raster Functions
Raster Model
Function Raster Dataset
Mosaic Dataset Item
Image Service
Mosaic Dataset
A raster model encapsulates your algorithm as a tree of functions.
Chaining Raster Functions
An example: Landsat 8 Pansharpened
Demo
Apply a raster functions to image layers in ArcMap
Browsing raster models on an image service in ArcGIS.com
Python Raster Functions
What’s a Python Raster Function?
· Transforming rasters—image processing and analytic algorithms—in Python.
· Implement a raster function from the comfort of your Python module.
· Architecture: Module loaded by an adapter—Python-aware and a first-class participant in the
function chain.
Your Python module—assisted by ArcGIS—is a raster function.
The Extended Model
What’s a Python Raster Function?
The Extended Model
Function Raster Dataset
Mosaic Dataset Item
Image Service
Mosaic Dataset
Motivation
· Extend ArcGIS—participate in a raster model.
· Primary pipeline for image data in ArcGIS—processing, analyzing, and visualizing.
· On-the-fly at display resolution, or in batch at full resolution.
· Portable. Reusable. Dynamic. Fast. Scalable.
· Why Python?
· Friendly & easy to learn. “readability first”. “batteries included”.
· Huge collection of libraries. Vibrant community of Pythonistas and Pythoneers.
· “…de facto superglue language for modern scientific computing.”
· “…tools for almost every aspect of scientific computing are readily available in Python.”
Why Raster Functions in Python?
The API
• How does ArcGIS Desktop or Server interact with my raster function?
• Get started—step-by-step guide
• Real-world or reference implementations—excellent springboard
• Well-documented API reference
• What additional libraries are needed? How complicated is it?
• Lightweight design—no external dependencies outside of NumPy to begin with.
• ArcGIS’ adapter provides assistance—opt out to take control of specific aspects.
Create a new raster function using simple and familiar Pythonesque constructs.
How do I create Raster Function in Python?
Hello, World!
The API
· customize our function object—a specific
instance of our class—as soon as it's created.
· Define raster function name & description.
__init__
The API
· Define all input parameters to the function.
· For each parameter, define:
· Name (Identifier)
· Display Name
· Long Description
· Data Type
· Default Value
· Required vs Optional
· …
getParameterInfo()
The API
· How are input rasters read—Padding, Mask, …?
· How’s the output raster constructed—inherit NoData, Metadata, …?
· Given: scalar (non-raster) values.
· Returns: dictionary containing configuration attribute values.
getConfiguration()
The API
• Define a subset of input rasters.
• Pixels read from selected rasters.
• Given: properties of the requested
pixel block, all scalar parameter values.
• Returns: names of selected rasters.
selectRasters()
The API
• Defines the output raster.
• Invoked each time a dataset containing the Python raster function is initialized.
• Given: Raster info associated with all input rasters.
• Returns: Raster Info of the output raster.
updateRasterInfo()
The API
• Workhorse of the raster function. Process Pixels.
• Given:
• Expected pixel-block size+location
• output raster properties (map space)
• pixels+mask of selected input rasters
• Returns: Pixels+mask of requested pixel block.
updatePixels()
The API
• Create or update dataset- or band-level metadata.
• Given:
• property names
• band index
• current key metadata values
• Returns: updated values of given properties
updateKeyMetadata()
The API
• Given:
• info on parent product,
• context of execution.
• Returns:
• OK to Run (Boolean)—Licensed to execute or not?
• Expected product level and extension.
isLicensed()
Compound
Topographic
Index
Compound Topographic Index (CTI)
A steady state wetness index, a.k.a. Topographic Wetness index (TWI)
T.R. Matthews et al. 2015
· There’s a need in the agricultural and natural resources community
· To explore Python Raster Functions
· To understand the limits of a Python Raster Function
· Can I use SciPy?
· Does it make sense to use for loops?
· How does a Python raster function chain with other raster functions?
Motivation
Compound Topographic Index (CTI)
Calculations
Compound Topographic Index
𝑪𝑪𝑪𝑪𝑪𝑪 = 𝐥𝐥 𝐥𝐥 𝒇𝒇𝒇𝒇𝒇𝒇 𝒘𝒘𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂 𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂 𝒂𝒂 + 𝟏𝟏 ∗
𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄
𝐭𝐭𝐭𝐭 𝐭𝐭 𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔
Calculations
Compound Topographic Index
Slope FunctionDEM
Flow Accumulation
CTI
CTI Function
CTI: Code
Site
Suitability
Analysis
Site Suitability Analysis
Weather Variables Remap Table
Bad
Very bad
Average
Good
Very good
Output Function Raster
Site Suitability Analysis
Operational thresholdCell statistics
function
Remap functionsWeather
rasters
Site Suitability Analysis
Building Raster Models
Templatized chains of raster functions
What’s a Raster Model?
A templatized raster model replaces one or more inputs with place-holder Variables.
The basic concept
Template
Input
Raster
Variables
Input
Scalar
Variables
Output Raster
Raster Model
· Create new function templates
· Via Raster Function Template Editor
· Layer > Symbology > Export As Raster Function Template
· Function Raster Dataset > Functions > Save as
· Raster Layer in a Map
• Image Analysis Window
• Raster Functions Pane in Pro
• Layer > Properties > Functions tab
A raster function template makes your processing or analysis portable.
Basic workflows with “function template”
Raster Model
· On a Mosaic Dataset
· Populating a mosaic using the Add Rasters tool
· Mosaic dataset items
- Batch Edit Raster Functions or
- Edit Raster Function Geoprocessing Tool.
· As Processing Templates
· On an Image Service—for server-side processing
Learn more at https://github.com/Esri/raster-functions#raster-function-templates.
Advanced workflows with function templates
Raster Model
· Name & Description
· Type: Item, Group, or Mosaic.
· Definition Query
· Fields that control grouping.
Properties of a function template
Demo
Apply CTI raster model to image layers on map using ArcGIS Pro
Demo
Apply suitability raster model to a mosaic dataset using ArcMap
Browse processing templates of the mosaic layer
Additional Considerations
Performance
· Vectorize.
· Use NumPy and SciPy.
· Use Cython: For production-grade performance.
· Bridge to C/C++ implementations via ctypes or Boost.Python.
Leverage well-known options to optimize time-critical parts of your raster function.
Publishing & Deployment
· Python version
• Desktop vs. Pro: Python 2.7 vs. 3.4
• Desktop vs. Server: 32- vs. 64-bit Python 2.7
· Package dependencies
· Binary deployment
• CPython bytecode. Cython compiled binary.
• isLicensed method to restrict usage.
GitHub
· https://github.com/Esri/raster-functions
· Curated collection of raster functions and templates.
· Go ahead:
· Browse samples to learn more.
· Fork the repo. Experiment.
· Log defects or enhancement requests as issues.
· Send pull requests to contribute code.
GitHub enables collaboration.
Where do functions and templates live?
Wiki
· https://github.com/Esri/raster-functions/wiki
· Details of interaction between ArcGIS and your
Python raster function.
· Recommendations and techniques for writing
effective raster functions
Where do I find the story?
In Closing
· Powerful pipeline for processing, analysis, and visualization.
· Raster models built using raster functions for on-demand processing.
· Fast. Scalable. Integrated. Extensible.
· Build dynamically derived information products.
· Manage redundancy, provenance/authenticity, reproducibility.
· Using simple constructs in Python: participate and exploit.
· Code and docs are on GitHub.
· We’ll help you along the way—@gbrunner, @jdrisdelle, and @akferoz.
Questions?
Rate This Session
Use the Esri Events mobile app
Sessions on related topics:
Change Detection using the Python Raster Function—Tuesday at 1:00
Getting Started with the JS API for Multidimensional Image Services—Tuesday at 1:00
Automating Image Management and Dissemination using Python—Wednesday at 10:30
Developing Applications which use Oblique Imagery in ArcGIS—Wednesday at 4:00
Getting Started with Imagery using the Web AppBuilder for ArcGIS—Wednesday at 4:35
http://www.esri.com/events/devsummit/agenda/detailed-agenda
dev_int_96

More Related Content

What's hot

Continuous Evaluation of Deployed Models in Production Many high-tech industr...
Continuous Evaluation of Deployed Models in Production Many high-tech industr...Continuous Evaluation of Deployed Models in Production Many high-tech industr...
Continuous Evaluation of Deployed Models in Production Many high-tech industr...Databricks
 
Dynamic Community Detection for Large-scale e-Commerce data with Spark Stream...
Dynamic Community Detection for Large-scale e-Commerce data with Spark Stream...Dynamic Community Detection for Large-scale e-Commerce data with Spark Stream...
Dynamic Community Detection for Large-scale e-Commerce data with Spark Stream...Spark Summit
 
Generalized Linear Models in Spark MLlib and SparkR
Generalized Linear Models in Spark MLlib and SparkRGeneralized Linear Models in Spark MLlib and SparkR
Generalized Linear Models in Spark MLlib and SparkRDatabricks
 
Spark Summit EU talk by Javier Aguedes
Spark Summit EU talk by Javier AguedesSpark Summit EU talk by Javier Aguedes
Spark Summit EU talk by Javier AguedesSpark Summit
 
Garbage collection 介紹
Garbage collection 介紹Garbage collection 介紹
Garbage collection 介紹kao kuo-tung
 
Data Agility—A Journey to Advanced Analytics and Machine Learning at Scale
Data Agility—A Journey to Advanced Analytics and Machine Learning at ScaleData Agility—A Journey to Advanced Analytics and Machine Learning at Scale
Data Agility—A Journey to Advanced Analytics and Machine Learning at ScaleDatabricks
 
Data science on big data. Pragmatic approach
Data science on big data. Pragmatic approachData science on big data. Pragmatic approach
Data science on big data. Pragmatic approachPavel Mezentsev
 
Large-Scale Machine Learning with Apache Spark
Large-Scale Machine Learning with Apache SparkLarge-Scale Machine Learning with Apache Spark
Large-Scale Machine Learning with Apache SparkDB Tsai
 
Time-evolving Graph Processing on Commodity Clusters: Spark Summit East talk ...
Time-evolving Graph Processing on Commodity Clusters: Spark Summit East talk ...Time-evolving Graph Processing on Commodity Clusters: Spark Summit East talk ...
Time-evolving Graph Processing on Commodity Clusters: Spark Summit East talk ...Spark Summit
 
Make your PySpark Data Fly with Arrow!
Make your PySpark Data Fly with Arrow!Make your PySpark Data Fly with Arrow!
Make your PySpark Data Fly with Arrow!Databricks
 
Practical Distributed Machine Learning Pipelines on Hadoop
Practical Distributed Machine Learning Pipelines on HadoopPractical Distributed Machine Learning Pipelines on Hadoop
Practical Distributed Machine Learning Pipelines on HadoopDataWorks Summit
 
Multinomial Logistic Regression with Apache Spark
Multinomial Logistic Regression with Apache SparkMultinomial Logistic Regression with Apache Spark
Multinomial Logistic Regression with Apache SparkDB Tsai
 
2011.10.14 Apache Giraph - Hortonworks
2011.10.14 Apache Giraph - Hortonworks2011.10.14 Apache Giraph - Hortonworks
2011.10.14 Apache Giraph - HortonworksAvery Ching
 
Apache Spark Machine Learning
Apache Spark Machine LearningApache Spark Machine Learning
Apache Spark Machine LearningCarol McDonald
 
Accelerated Machine Learning with RAPIDS and MLflow, Nvidia/RAPIDS
Accelerated Machine Learning with RAPIDS and MLflow, Nvidia/RAPIDSAccelerated Machine Learning with RAPIDS and MLflow, Nvidia/RAPIDS
Accelerated Machine Learning with RAPIDS and MLflow, Nvidia/RAPIDSDatabricks
 
Apache Lens at Hadoop meetup
Apache Lens at Hadoop meetupApache Lens at Hadoop meetup
Apache Lens at Hadoop meetupamarsri
 
Machine Learning With Spark
Machine Learning With SparkMachine Learning With Spark
Machine Learning With SparkShivaji Dutta
 
Scaling out logistic regression with Spark
Scaling out logistic regression with SparkScaling out logistic regression with Spark
Scaling out logistic regression with SparkBarak Gitsis
 

What's hot (20)

Continuous Evaluation of Deployed Models in Production Many high-tech industr...
Continuous Evaluation of Deployed Models in Production Many high-tech industr...Continuous Evaluation of Deployed Models in Production Many high-tech industr...
Continuous Evaluation of Deployed Models in Production Many high-tech industr...
 
Dynamic Community Detection for Large-scale e-Commerce data with Spark Stream...
Dynamic Community Detection for Large-scale e-Commerce data with Spark Stream...Dynamic Community Detection for Large-scale e-Commerce data with Spark Stream...
Dynamic Community Detection for Large-scale e-Commerce data with Spark Stream...
 
Generalized Linear Models in Spark MLlib and SparkR
Generalized Linear Models in Spark MLlib and SparkRGeneralized Linear Models in Spark MLlib and SparkR
Generalized Linear Models in Spark MLlib and SparkR
 
Spark Summit EU talk by Javier Aguedes
Spark Summit EU talk by Javier AguedesSpark Summit EU talk by Javier Aguedes
Spark Summit EU talk by Javier Aguedes
 
Garbage collection 介紹
Garbage collection 介紹Garbage collection 介紹
Garbage collection 介紹
 
Data Agility—A Journey to Advanced Analytics and Machine Learning at Scale
Data Agility—A Journey to Advanced Analytics and Machine Learning at ScaleData Agility—A Journey to Advanced Analytics and Machine Learning at Scale
Data Agility—A Journey to Advanced Analytics and Machine Learning at Scale
 
Data science on big data. Pragmatic approach
Data science on big data. Pragmatic approachData science on big data. Pragmatic approach
Data science on big data. Pragmatic approach
 
Large-Scale Machine Learning with Apache Spark
Large-Scale Machine Learning with Apache SparkLarge-Scale Machine Learning with Apache Spark
Large-Scale Machine Learning with Apache Spark
 
Time-evolving Graph Processing on Commodity Clusters: Spark Summit East talk ...
Time-evolving Graph Processing on Commodity Clusters: Spark Summit East talk ...Time-evolving Graph Processing on Commodity Clusters: Spark Summit East talk ...
Time-evolving Graph Processing on Commodity Clusters: Spark Summit East talk ...
 
Make your PySpark Data Fly with Arrow!
Make your PySpark Data Fly with Arrow!Make your PySpark Data Fly with Arrow!
Make your PySpark Data Fly with Arrow!
 
Practical Distributed Machine Learning Pipelines on Hadoop
Practical Distributed Machine Learning Pipelines on HadoopPractical Distributed Machine Learning Pipelines on Hadoop
Practical Distributed Machine Learning Pipelines on Hadoop
 
Multinomial Logistic Regression with Apache Spark
Multinomial Logistic Regression with Apache SparkMultinomial Logistic Regression with Apache Spark
Multinomial Logistic Regression with Apache Spark
 
2011.10.14 Apache Giraph - Hortonworks
2011.10.14 Apache Giraph - Hortonworks2011.10.14 Apache Giraph - Hortonworks
2011.10.14 Apache Giraph - Hortonworks
 
Apache Spark Machine Learning
Apache Spark Machine LearningApache Spark Machine Learning
Apache Spark Machine Learning
 
Accelerated Machine Learning with RAPIDS and MLflow, Nvidia/RAPIDS
Accelerated Machine Learning with RAPIDS and MLflow, Nvidia/RAPIDSAccelerated Machine Learning with RAPIDS and MLflow, Nvidia/RAPIDS
Accelerated Machine Learning with RAPIDS and MLflow, Nvidia/RAPIDS
 
Apache Lens at Hadoop meetup
Apache Lens at Hadoop meetupApache Lens at Hadoop meetup
Apache Lens at Hadoop meetup
 
Apache Giraph
Apache GiraphApache Giraph
Apache Giraph
 
Machine Learning With Spark
Machine Learning With SparkMachine Learning With Spark
Machine Learning With Spark
 
The Evolution of Apache Kylin
The Evolution of Apache KylinThe Evolution of Apache Kylin
The Evolution of Apache Kylin
 
Scaling out logistic regression with Spark
Scaling out logistic regression with SparkScaling out logistic regression with Spark
Scaling out logistic regression with Spark
 

Viewers also liked

PyconPH 2014 - Image Analysis in Python
PyconPH 2014 - Image Analysis in PythonPyconPH 2014 - Image Analysis in Python
PyconPH 2014 - Image Analysis in PythonCharmyne Mamador
 
Introduction to digital image processing
Introduction to digital image processingIntroduction to digital image processing
Introduction to digital image processingHossain Md Shakhawat
 
Image Processing Basics
Image Processing BasicsImage Processing Basics
Image Processing BasicsNam Le
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image ProcessingSahil Biswas
 

Viewers also liked (6)

PyconPH 2014 - Image Analysis in Python
PyconPH 2014 - Image Analysis in PythonPyconPH 2014 - Image Analysis in Python
PyconPH 2014 - Image Analysis in Python
 
Fun with Python
Fun with PythonFun with Python
Fun with Python
 
Introduction to digital image processing
Introduction to digital image processingIntroduction to digital image processing
Introduction to digital image processing
 
Image Processing Basics
Image Processing BasicsImage Processing Basics
Image Processing Basics
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image Processing
 
Image processing ppt
Image processing pptImage processing ppt
Image processing ppt
 

Similar to dev_int_96

Python Raster Function - Esri Developer Conference - 2015
Python Raster Function - Esri Developer Conference - 2015Python Raster Function - Esri Developer Conference - 2015
Python Raster Function - Esri Developer Conference - 2015akferoz07
 
Presto query optimizer: pursuit of performance
Presto query optimizer: pursuit of performancePresto query optimizer: pursuit of performance
Presto query optimizer: pursuit of performanceDataWorks Summit
 
Lambda Architecture with Spark
Lambda Architecture with SparkLambda Architecture with Spark
Lambda Architecture with SparkKnoldus Inc.
 
FOSDEM 2019: M3, Prometheus and Graphite with metrics and monitoring in an in...
FOSDEM 2019: M3, Prometheus and Graphite with metrics and monitoring in an in...FOSDEM 2019: M3, Prometheus and Graphite with metrics and monitoring in an in...
FOSDEM 2019: M3, Prometheus and Graphite with metrics and monitoring in an in...Rob Skillington
 
Seattle Spark Meetup Mobius CSharp API
Seattle Spark Meetup Mobius CSharp APISeattle Spark Meetup Mobius CSharp API
Seattle Spark Meetup Mobius CSharp APIshareddatamsft
 
(ATS6-PLAT03) What's behind Discngine collections
(ATS6-PLAT03) What's behind Discngine collections(ATS6-PLAT03) What's behind Discngine collections
(ATS6-PLAT03) What's behind Discngine collectionsBIOVIA
 
Microservices, containers, and machine learning
Microservices, containers, and machine learningMicroservices, containers, and machine learning
Microservices, containers, and machine learningPaco Nathan
 
Nebula Graph nMeetup in Shanghai - Meet with Graph Technology Enthusiasts
Nebula Graph nMeetup in Shanghai - Meet with Graph Technology EnthusiastsNebula Graph nMeetup in Shanghai - Meet with Graph Technology Enthusiasts
Nebula Graph nMeetup in Shanghai - Meet with Graph Technology EnthusiastsNebula Graph
 
ACM Sunnyvale Meetup.pdf
ACM Sunnyvale Meetup.pdfACM Sunnyvale Meetup.pdf
ACM Sunnyvale Meetup.pdfAnyscale
 
GraphFrames: DataFrame-based graphs for Apache® Spark™
GraphFrames: DataFrame-based graphs for Apache® Spark™GraphFrames: DataFrame-based graphs for Apache® Spark™
GraphFrames: DataFrame-based graphs for Apache® Spark™Databricks
 
The Nitty Gritty of Advanced Analytics Using Apache Spark in Python
The Nitty Gritty of Advanced Analytics Using Apache Spark in PythonThe Nitty Gritty of Advanced Analytics Using Apache Spark in Python
The Nitty Gritty of Advanced Analytics Using Apache Spark in PythonMiklos Christine
 
DataMass Summit - Machine Learning for Big Data in SQL Server
DataMass Summit - Machine Learning for Big Data  in SQL ServerDataMass Summit - Machine Learning for Big Data  in SQL Server
DataMass Summit - Machine Learning for Big Data in SQL ServerŁukasz Grala
 
Using Cloud Automation Technologies to Deliver an Enterprise Data Fabric
Using Cloud Automation Technologies to Deliver an Enterprise Data FabricUsing Cloud Automation Technologies to Deliver an Enterprise Data Fabric
Using Cloud Automation Technologies to Deliver an Enterprise Data FabricCambridge Semantics
 
Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...
Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...
Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...Citus Data
 
APPLICATION OF PYTHON IN GEOSCIENCE
APPLICATION OF  PYTHON IN GEOSCIENCEAPPLICATION OF  PYTHON IN GEOSCIENCE
APPLICATION OF PYTHON IN GEOSCIENCEAhasanHabibSajeeb
 
RAPIDS cuGraph – Accelerating all your Graph needs
RAPIDS cuGraph – Accelerating all your Graph needsRAPIDS cuGraph – Accelerating all your Graph needs
RAPIDS cuGraph – Accelerating all your Graph needsConnected Data World
 
Overview of Modern Graph Analysis Tools
Overview of Modern Graph Analysis ToolsOverview of Modern Graph Analysis Tools
Overview of Modern Graph Analysis ToolsKeiichiro Ono
 
Graph Analytics in Spark
Graph Analytics in SparkGraph Analytics in Spark
Graph Analytics in SparkPaco Nathan
 

Similar to dev_int_96 (20)

Python Raster Function - Esri Developer Conference - 2015
Python Raster Function - Esri Developer Conference - 2015Python Raster Function - Esri Developer Conference - 2015
Python Raster Function - Esri Developer Conference - 2015
 
design_doc
design_docdesign_doc
design_doc
 
Presto query optimizer: pursuit of performance
Presto query optimizer: pursuit of performancePresto query optimizer: pursuit of performance
Presto query optimizer: pursuit of performance
 
Lambda Architecture with Spark
Lambda Architecture with SparkLambda Architecture with Spark
Lambda Architecture with Spark
 
FOSDEM 2019: M3, Prometheus and Graphite with metrics and monitoring in an in...
FOSDEM 2019: M3, Prometheus and Graphite with metrics and monitoring in an in...FOSDEM 2019: M3, Prometheus and Graphite with metrics and monitoring in an in...
FOSDEM 2019: M3, Prometheus and Graphite with metrics and monitoring in an in...
 
Seattle Spark Meetup Mobius CSharp API
Seattle Spark Meetup Mobius CSharp APISeattle Spark Meetup Mobius CSharp API
Seattle Spark Meetup Mobius CSharp API
 
(ATS6-PLAT03) What's behind Discngine collections
(ATS6-PLAT03) What's behind Discngine collections(ATS6-PLAT03) What's behind Discngine collections
(ATS6-PLAT03) What's behind Discngine collections
 
Microservices, containers, and machine learning
Microservices, containers, and machine learningMicroservices, containers, and machine learning
Microservices, containers, and machine learning
 
Nebula Graph nMeetup in Shanghai - Meet with Graph Technology Enthusiasts
Nebula Graph nMeetup in Shanghai - Meet with Graph Technology EnthusiastsNebula Graph nMeetup in Shanghai - Meet with Graph Technology Enthusiasts
Nebula Graph nMeetup in Shanghai - Meet with Graph Technology Enthusiasts
 
ACM Sunnyvale Meetup.pdf
ACM Sunnyvale Meetup.pdfACM Sunnyvale Meetup.pdf
ACM Sunnyvale Meetup.pdf
 
GraphFrames: DataFrame-based graphs for Apache® Spark™
GraphFrames: DataFrame-based graphs for Apache® Spark™GraphFrames: DataFrame-based graphs for Apache® Spark™
GraphFrames: DataFrame-based graphs for Apache® Spark™
 
The Nitty Gritty of Advanced Analytics Using Apache Spark in Python
The Nitty Gritty of Advanced Analytics Using Apache Spark in PythonThe Nitty Gritty of Advanced Analytics Using Apache Spark in Python
The Nitty Gritty of Advanced Analytics Using Apache Spark in Python
 
DataMass Summit - Machine Learning for Big Data in SQL Server
DataMass Summit - Machine Learning for Big Data  in SQL ServerDataMass Summit - Machine Learning for Big Data  in SQL Server
DataMass Summit - Machine Learning for Big Data in SQL Server
 
Using Cloud Automation Technologies to Deliver an Enterprise Data Fabric
Using Cloud Automation Technologies to Deliver an Enterprise Data FabricUsing Cloud Automation Technologies to Deliver an Enterprise Data Fabric
Using Cloud Automation Technologies to Deliver an Enterprise Data Fabric
 
Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...
Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...
Tutorial: Implementing your first Postgres extension | PGConf EU 2019 | Burak...
 
APPLICATION OF PYTHON IN GEOSCIENCE
APPLICATION OF  PYTHON IN GEOSCIENCEAPPLICATION OF  PYTHON IN GEOSCIENCE
APPLICATION OF PYTHON IN GEOSCIENCE
 
RAPIDS cuGraph – Accelerating all your Graph needs
RAPIDS cuGraph – Accelerating all your Graph needsRAPIDS cuGraph – Accelerating all your Graph needs
RAPIDS cuGraph – Accelerating all your Graph needs
 
Overview of Modern Graph Analysis Tools
Overview of Modern Graph Analysis ToolsOverview of Modern Graph Analysis Tools
Overview of Modern Graph Analysis Tools
 
PREDIcT
PREDIcTPREDIcT
PREDIcT
 
Graph Analytics in Spark
Graph Analytics in SparkGraph Analytics in Spark
Graph Analytics in Spark
 

dev_int_96

  • 1. March 8–11, 2016 | Palm Springs, CA Esri Developer Summit Writing Image Processing Algorithms using the Python Raster Function Gregory Brunner Jamie Drisdelle Feroz Abdul Kadar
  • 2. Agenda · Introduction · Anatomy of a raster function · Building raster models · Additional considerations · Q&A
  • 4. What’s a Raster Function? • Mapping of one raster to another. • Loosely, • On-demand. Transient. • Different from a geoprocessing tool. … a transformation of one raster into another. The Fundamentals
  • 5. Chaining Raster Functions Raster Model Function Raster Dataset Mosaic Dataset Item Image Service Mosaic Dataset A raster model encapsulates your algorithm as a tree of functions.
  • 6. Chaining Raster Functions An example: Landsat 8 Pansharpened
  • 7. Demo Apply a raster functions to image layers in ArcMap Browsing raster models on an image service in ArcGIS.com
  • 9. What’s a Python Raster Function? · Transforming rasters—image processing and analytic algorithms—in Python. · Implement a raster function from the comfort of your Python module. · Architecture: Module loaded by an adapter—Python-aware and a first-class participant in the function chain. Your Python module—assisted by ArcGIS—is a raster function. The Extended Model
  • 10. What’s a Python Raster Function? The Extended Model Function Raster Dataset Mosaic Dataset Item Image Service Mosaic Dataset
  • 11. Motivation · Extend ArcGIS—participate in a raster model. · Primary pipeline for image data in ArcGIS—processing, analyzing, and visualizing. · On-the-fly at display resolution, or in batch at full resolution. · Portable. Reusable. Dynamic. Fast. Scalable. · Why Python? · Friendly & easy to learn. “readability first”. “batteries included”. · Huge collection of libraries. Vibrant community of Pythonistas and Pythoneers. · “…de facto superglue language for modern scientific computing.” · “…tools for almost every aspect of scientific computing are readily available in Python.” Why Raster Functions in Python?
  • 12. The API • How does ArcGIS Desktop or Server interact with my raster function? • Get started—step-by-step guide • Real-world or reference implementations—excellent springboard • Well-documented API reference • What additional libraries are needed? How complicated is it? • Lightweight design—no external dependencies outside of NumPy to begin with. • ArcGIS’ adapter provides assistance—opt out to take control of specific aspects. Create a new raster function using simple and familiar Pythonesque constructs. How do I create Raster Function in Python?
  • 14. The API · customize our function object—a specific instance of our class—as soon as it's created. · Define raster function name & description. __init__
  • 15. The API · Define all input parameters to the function. · For each parameter, define: · Name (Identifier) · Display Name · Long Description · Data Type · Default Value · Required vs Optional · … getParameterInfo()
  • 16. The API · How are input rasters read—Padding, Mask, …? · How’s the output raster constructed—inherit NoData, Metadata, …? · Given: scalar (non-raster) values. · Returns: dictionary containing configuration attribute values. getConfiguration()
  • 17. The API • Define a subset of input rasters. • Pixels read from selected rasters. • Given: properties of the requested pixel block, all scalar parameter values. • Returns: names of selected rasters. selectRasters()
  • 18. The API • Defines the output raster. • Invoked each time a dataset containing the Python raster function is initialized. • Given: Raster info associated with all input rasters. • Returns: Raster Info of the output raster. updateRasterInfo()
  • 19. The API • Workhorse of the raster function. Process Pixels. • Given: • Expected pixel-block size+location • output raster properties (map space) • pixels+mask of selected input rasters • Returns: Pixels+mask of requested pixel block. updatePixels()
  • 20. The API • Create or update dataset- or band-level metadata. • Given: • property names • band index • current key metadata values • Returns: updated values of given properties updateKeyMetadata()
  • 21. The API • Given: • info on parent product, • context of execution. • Returns: • OK to Run (Boolean)—Licensed to execute or not? • Expected product level and extension. isLicensed()
  • 23. Compound Topographic Index (CTI) A steady state wetness index, a.k.a. Topographic Wetness index (TWI) T.R. Matthews et al. 2015
  • 24. · There’s a need in the agricultural and natural resources community · To explore Python Raster Functions · To understand the limits of a Python Raster Function · Can I use SciPy? · Does it make sense to use for loops? · How does a Python raster function chain with other raster functions? Motivation Compound Topographic Index (CTI)
  • 25. Calculations Compound Topographic Index 𝑪𝑪𝑪𝑪𝑪𝑪 = 𝐥𝐥 𝐥𝐥 𝒇𝒇𝒇𝒇𝒇𝒇 𝒘𝒘𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂 𝒂𝒂𝒂𝒂𝒂𝒂𝒂𝒂 𝒂𝒂 + 𝟏𝟏 ∗ 𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄𝒄 𝐭𝐭𝐭𝐭 𝐭𝐭 𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔𝒔
  • 26. Calculations Compound Topographic Index Slope FunctionDEM Flow Accumulation CTI CTI Function
  • 29. Site Suitability Analysis Weather Variables Remap Table Bad Very bad Average Good Very good Output Function Raster
  • 30. Site Suitability Analysis Operational thresholdCell statistics function Remap functionsWeather rasters
  • 32. Building Raster Models Templatized chains of raster functions
  • 33. What’s a Raster Model? A templatized raster model replaces one or more inputs with place-holder Variables. The basic concept Template Input Raster Variables Input Scalar Variables Output Raster
  • 34. Raster Model · Create new function templates · Via Raster Function Template Editor · Layer > Symbology > Export As Raster Function Template · Function Raster Dataset > Functions > Save as · Raster Layer in a Map • Image Analysis Window • Raster Functions Pane in Pro • Layer > Properties > Functions tab A raster function template makes your processing or analysis portable. Basic workflows with “function template”
  • 35. Raster Model · On a Mosaic Dataset · Populating a mosaic using the Add Rasters tool · Mosaic dataset items - Batch Edit Raster Functions or - Edit Raster Function Geoprocessing Tool. · As Processing Templates · On an Image Service—for server-side processing Learn more at https://github.com/Esri/raster-functions#raster-function-templates. Advanced workflows with function templates
  • 36. Raster Model · Name & Description · Type: Item, Group, or Mosaic. · Definition Query · Fields that control grouping. Properties of a function template
  • 37. Demo Apply CTI raster model to image layers on map using ArcGIS Pro
  • 38. Demo Apply suitability raster model to a mosaic dataset using ArcMap Browse processing templates of the mosaic layer
  • 40. Performance · Vectorize. · Use NumPy and SciPy. · Use Cython: For production-grade performance. · Bridge to C/C++ implementations via ctypes or Boost.Python. Leverage well-known options to optimize time-critical parts of your raster function.
  • 41. Publishing & Deployment · Python version • Desktop vs. Pro: Python 2.7 vs. 3.4 • Desktop vs. Server: 32- vs. 64-bit Python 2.7 · Package dependencies · Binary deployment • CPython bytecode. Cython compiled binary. • isLicensed method to restrict usage.
  • 42. GitHub · https://github.com/Esri/raster-functions · Curated collection of raster functions and templates. · Go ahead: · Browse samples to learn more. · Fork the repo. Experiment. · Log defects or enhancement requests as issues. · Send pull requests to contribute code. GitHub enables collaboration. Where do functions and templates live?
  • 43. Wiki · https://github.com/Esri/raster-functions/wiki · Details of interaction between ArcGIS and your Python raster function. · Recommendations and techniques for writing effective raster functions Where do I find the story?
  • 44. In Closing · Powerful pipeline for processing, analysis, and visualization. · Raster models built using raster functions for on-demand processing. · Fast. Scalable. Integrated. Extensible. · Build dynamically derived information products. · Manage redundancy, provenance/authenticity, reproducibility. · Using simple constructs in Python: participate and exploit. · Code and docs are on GitHub. · We’ll help you along the way—@gbrunner, @jdrisdelle, and @akferoz.
  • 46. Rate This Session Use the Esri Events mobile app Sessions on related topics: Change Detection using the Python Raster Function—Tuesday at 1:00 Getting Started with the JS API for Multidimensional Image Services—Tuesday at 1:00 Automating Image Management and Dissemination using Python—Wednesday at 10:30 Developing Applications which use Oblique Imagery in ArcGIS—Wednesday at 4:00 Getting Started with Imagery using the Web AppBuilder for ArcGIS—Wednesday at 4:35 http://www.esri.com/events/devsummit/agenda/detailed-agenda