SlideShare a Scribd company logo
Open source tools
mquartulli@vicomtech.org
1
Contents
• An introduction to cluster computing architectures
• The Python data analysis library stack
• The Apache Spark cluster computing framework
• Conclusions
Prerequisite material
We generally try to build on the
JPL-Caltech Virtual Summer School
Big Data Analytics
September 2-12 2014
available on Coursera. For this specific presentation, please go through
Ashish Mahabal
California Institute of Technology
"Best Programming Practices"
for an introduction to best practices in programming and for an introduction to Python and R.
Part 1: introduction 

to cluster computing architectures
• Divide and conquer…
• …except for causal/logical/probabilistic dependencies
motivating example: thematic mapping 

from remote sensing data classification
motivation: global scale near real–time analysis
• interactive data exploration 

(e.g. iteratively supervised thematic mapping)
• advanced algorithms for end–user “apps”
• e.g.
• astronomy “catalogues”
• geo analysis tools a la Google EarthEngine
motivation: global scale near real–time analysis
• growing remote sensing archive size - volume, variety, velocity
• e.g. the Copernicus Sentinels
• growing competence palette needed
• e.g. forestry, remote sensing, statistics, 

computer science, visualisation, operations
thematic mapping by supervised classification:
a distributed processing minimal example
parallelize
extract content descriptors
classify
trained
classifier
collect
Training is distributed to processing nodes,
thematic classes are predicted in parallel
no scheduler: first 100 tiles as per natural data storage organisation
thematic mapping by supervised classification:
a distributed processing minimal example
distributed processing

minimal architecture
random scheduler: first 100 random tiles
distributed processing

minimal architecture
geographic space filling curve-based scheduler: 

first 100 tiles “happen” around tile of interest (e.g. central tile)
remote sensing data processing architectures
Job Queue
Analysis Workers
Data
Catalogue
Processing Workers
Auto Scaling
Ingestion
Data
Catalogue
Exploitation
Annotations
Catalogue
User Application Servers
Load
Balancer
User
Source Products
Domain
Expert
Configuration
Admin
Domain
Expert
direct data import
Data Processing / Data Intelligence
Servers
13/34
batch processing architectures
parallel “batch mode” processing
Input
Batched
Data
Collector
Processing Job
Processing Job
Processing Job
…
Queries
Bakshi, K. (2012, March). Considerations for big data: Architecture and approach. In Aerospace Conference, 2012
IEEE (pp. 1-7). IEEE.
the lambda architecture
Nathan März “How to beat the CAP theorem”, Oct 2011
two separate lanes:

* batch for large, slow “frozen” 

* streaming for smaller, fast “live” data
merged at the end
Input
Batched
Data
Collector
Multiple Batch
Processing Jobs
Queries
Multiple Stream
Processing Jobs
RealTime
Streamed Data
trade–off considerations
• advantages: adaptability

“best of both worlds” –

mixing systems designed with different trade–offs
• limits: costs — code maintenance in particular

manifestations of polyglot processing
the kappa architecture
Jay Kreps “Questioning the Lambda Architecture”, Jul 2014
concept: use stream processing for everything
Collector
Multiple Stream
Processing Jobs
Queries
Multiple Stream
Processing Jobs
RealTime
Streamed Data
Historical Data
Stream
Input
Batched
Data
scheduled stream processing
intelligence in smart schedulers

for optimally iterating historical batch elements

presenting them as a stream
Collector
Multiple Stream
Processing Jobs
Queries
Multiple Stream
Processing Jobs
RealTime
Streamed Data
Scheduled
Historical Data
Stream
Input
Batched
Data
Smart
Schedulers
scheduling by space–filling curves:

ensure that all points are considered
Source: Haverkort, Walderveen “Locality and Bounding-Box Quality of Two-Dimensional Space-Filling Curves” 

2008 arXiv:0806.4787v2
E.G.: hilbert scheduling
• hilbert curve scheduling applications
• declustering

Berchtold et al. “Fast parallel similarity 

search in multi-media databases” 1997
• visualization

eg. B. Irwin et al. “High level 

internet scale traffic visualization 

using hilbert curve mapping”

2008
• parallel process scheduling

M. Drozdowski “Scheduling for parallel processing” 2010

stream processing with smart schedulers 

for remote sensing catalogue analytics
idea: exploit user interest locality in
• geographic space
• multi–resolution space
• possibly semantics?
source: geowave
for large datasets:
divide and conquer
yet:
1. dependencies need to be modelled (e.g. segmentation)
2. if NOT ALL TILES HAVE EQUAL VALUE

and analysis cost (e.g. TIME) ENTERS THE PICTURE…
motivating example: thematic mapping 

from remote sensing data classification
Part 2: the PyData stack
➤ pydata — data analytics http://pydata.org/downloads/
➤ rasterio — OO GDAL https://github.com/mapbox/rasterio
➤ fiona — OO OGR http://toblerity.org/fiona/manual.html
➤ skimage — image processing http://scikit-image.org/
➤ sklearn — machine learning http://scikit-learn.org/stable/
➤ pandas — data analysis http://pandas.pydata.org/
➤ PIL — imaging http://www.pythonware.com/products/pil/
➤ Scipy — scientific computing library http://scipy.org/
numpy.array: array data types
What it does:
ND array data types allow operations
to be described in terms of matrices
and vectors.
This is good because:
It makes code both cleaner and more
efficient, since it translates to fewer
lower-level calls to compiled routines,
avoiding `for` loops.
matplotlib.pylab: plotting in 2D and 3D
What it does:
It allows producing visual
representations of the data.
This is good because:
It can help generate insights,
communicate results, 

rapidly validate procedures
scikit-image
• A library of standard image
processing methods.
• It operates on `numpy` arrays.
sklearn: machine learning
• A library for clustering,
classification, regression, e.g. for
basic thematic mapping.
• Plus: data transformation, ML
performance evaluation...
• See the ML lessons in the `JPL-
Caltech Virtual Summer School`
material.
RASTERIO: RASTER LOADING
➤ high-level interfaces to GDAL
fn = “~/Data/all_donosti_croped_16_wgs4326_b.ers”
import rasterio, numpy
with rasterio.drivers(CPL_DEBUG=True):
with rasterio.open(os.path.expanduser(fn)) as src:
bands = map(src.read_band, (1, 2, 3))
data = numpy.dstack(bands)
print(type(data))
print(src.bounds)
print(src.count, src.shape)
print(src.driver)
print(str(src.crs))
bounds = src.bounds[::2] + src.bounds[1::2]
import skimage.color
import matplotlib.pylab as plt
data_hsv = skimage.color.rgb2xyz(data)
fig = plt.figure(figsize=(8, 8))
ax = plt.imshow(data_hsv, extent=bounds)
plt.show()
FIONA: VECTOR MASKING
➤ Binary masking by Shapefiles
import shapefile, os.path
from PIL import Image, ImageDraw
sf = shapefile.Reader(os.path.expanduser(“~/masking_shapes.shp"))
shapes, src_bbox = sf.shapes(), [ bounds[i] for i in [0, 2, 1, 3] ]
# Geographic x & y image sizes
xdist, ydist = src_bbox[2] - src_bbox[0], src_bbox[3] - src_bbox[1]
# Image width & height
iwidth, iheight = feats.shape[1], feats.shape[0]
xratio, yratio = iwidth/xdist, iheight/ydist
# Masking
mask = Image.new("RGB", (iwidth, iheight), "black")
draw = ImageDraw.Draw(mask)
pixels = { label:[] for label in labels }
for i_shape, shape in enumerate(sf.shapes()):
draw.polygon([ p[:2] for p in pixels[label] ],
outline="rgb(1, 1, 1)",
fill="rgb(1, 1, 1)”)
import scipy.misc
fig = plt.figure(figsize=(8, 8))
ax = plt.imshow(scipy.misc.fromimage(mask)*data, extent=bounds)
pandas: data management and analysis
• Adds labels to `numpy` arrays.
• Mimicks R's DataFrame type,
integrates plotting and data
analysis.
Jupyter: an interactive development 

and documentation environment
• Write and maintain documents
that include text, diagrams and
code.
• Documents are rendered as
HTML by GitHub.
Jupiter interactive widgets
Part 3: Cluster computing
• Idea: “Decompose data, move instructions to data chunks”
• Big win for easily decomposable problems
• Issues in managing dependencies in data analysis
Spark cluster computing
Hitesh Dharmdasani, “Python and Bigdata - An Introduction to Spark (PySpark)”
pyspark
https://pbs.twimg.com/media/CAfBmDQU8AAL6gf.png
pyspark example: context
The Spark context represents the cluster.
It can be used to distribute elements to the nodes.
Examples:
- a library module
- a query description in a search system.
pyspark example: hdfs
Distributes and manages for redundancy very large data files on the
cluster disks.
Achille's heel: managing very large numbers of small files.
pyspark example: telemetry
The central element
for optimising
the analysis system.
“If it moves we track it” —>
Design Of Experiments
pyspark example: spark.mllib
Machine learning tools for cluster computing contexts 

is a central application of cluster computing frameworks.

At times, still not up to par with single machine configurations.
pyspark.streaming
Data stream analysis (e.g. from a network connection) an important
use case.
Standard cluster computing concepts apply.
It is done in chunks whose size is not controlled directly.
pyspark @ AWS
The Spark distribution includes tools
to instantiate a cluster on the
Amazon Web Services
infrastructure.
Costs tend to be extremely low…

if you DO NOT publish your
credentials.
Ongoing trends
• Data standardisation: Apache Arrow
• A simplification of infrastructure management tools: Hashi Terraform
apache arrow
import feather
path = 'my_data.feather'
feather.write_dataframe(df, path)
df = feather.read_dataframe(path)
OpenStack, Ansible, Vagrant, Terraform...
• Infrastructure management tools 

allow more complex setups to be easily managed
Conclusions
• Extending an analytics pipeline to computing clusters 

can be done with limited resources

More Related Content

PDF
07 data structures_and_representations
PPTX
HPC-ABDS High Performance Computing Enhanced Apache Big Data Stack (with a ...
PDF
HPC-ABDS: The Case for an Integrating Apache Big Data Stack with HPC
PPTX
Cloud Services for Big Data Analytics
PPTX
Next Generation Grid: Integrating Parallel and Distributed Computing Runtimes...
PPTX
Classification of Big Data Use Cases by different Facets
PPTX
Matching Data Intensive Applications and Hardware/Software Architectures
PPTX
51 Use Cases and implications for HPC & Apache Big Data Stack
07 data structures_and_representations
HPC-ABDS High Performance Computing Enhanced Apache Big Data Stack (with a ...
HPC-ABDS: The Case for an Integrating Apache Big Data Stack with HPC
Cloud Services for Big Data Analytics
Next Generation Grid: Integrating Parallel and Distributed Computing Runtimes...
Classification of Big Data Use Cases by different Facets
Matching Data Intensive Applications and Hardware/Software Architectures
51 Use Cases and implications for HPC & Apache Big Data Stack

What's hot (20)

PPTX
What is the "Big Data" version of the Linpack Benchmark? ; What is “Big Data...
PPTX
Comparing Big Data and Simulation Applications and Implications for Software ...
PDF
Scientific Application Development and Early results on Summit
PPTX
Matching Data Intensive Applications and Hardware/Software Architectures
PPTX
High Performance Data Analytics with Java on Large Multicore HPC Clusters
PPTX
Materials Data Facility: Streamlined and automated data sharing, discovery, ...
PDF
Share and analyze geonomic data at scale by Andy Petrella and Xavier Tordoir
PPTX
Data Automation at Light Sources
PPTX
Learning Systems for Science
PDF
Large Infrastructure Monitoring At CERN by Matthias Braeger at Big Data Spain...
PDF
Parallel Sequence Generator
PDF
Asd 2015
PPT
Computing Outside The Box June 2009
PPTX
Visualizing and Clustering Life Science Applications in Parallel 
PDF
High Performance Data Analytics and a Java Grande Run Time
PDF
ISNCC 2017
PDF
parallel OLAP
PDF
Astronomical Data Processing on the LSST Scale with Apache Spark
PDF
Don't Be Scared. Data Don't Bite. Introduction to Big Data.
PPTX
Computing Just What You Need: Online Data Analysis and Reduction at Extreme ...
What is the "Big Data" version of the Linpack Benchmark? ; What is “Big Data...
Comparing Big Data and Simulation Applications and Implications for Software ...
Scientific Application Development and Early results on Summit
Matching Data Intensive Applications and Hardware/Software Architectures
High Performance Data Analytics with Java on Large Multicore HPC Clusters
Materials Data Facility: Streamlined and automated data sharing, discovery, ...
Share and analyze geonomic data at scale by Andy Petrella and Xavier Tordoir
Data Automation at Light Sources
Learning Systems for Science
Large Infrastructure Monitoring At CERN by Matthias Braeger at Big Data Spain...
Parallel Sequence Generator
Asd 2015
Computing Outside The Box June 2009
Visualizing and Clustering Life Science Applications in Parallel 
High Performance Data Analytics and a Java Grande Run Time
ISNCC 2017
parallel OLAP
Astronomical Data Processing on the LSST Scale with Apache Spark
Don't Be Scared. Data Don't Bite. Introduction to Big Data.
Computing Just What You Need: Online Data Analysis and Reduction at Extreme ...
Ad

Viewers also liked (10)

PDF
08 visualisation seminar ver0.2
PDF
07 dimensionality reduction
PDF
06 ashish mahabal bse2
PDF
08 distributed optimization
PDF
06 ashish mahabal bse1
PDF
05 sensor signal_models_feature_extraction
PDF
07 big skyearth_dlr_7_april_2016
PDF
05 astrostat feigelson
PDF
06 ashish mahabal bse3
PDF
04 bigdata and_cloud_computing
08 visualisation seminar ver0.2
07 dimensionality reduction
06 ashish mahabal bse2
08 distributed optimization
06 ashish mahabal bse1
05 sensor signal_models_feature_extraction
07 big skyearth_dlr_7_april_2016
05 astrostat feigelson
06 ashish mahabal bse3
04 bigdata and_cloud_computing
Ad

Similar to 04 open source_tools (20)

PDF
Apache Spark and the Emerging Technology Landscape for Big Data
PDF
Build Deep Learning Applications for Big Data Platforms (CVPR 2018 tutorial)
PDF
Software tools for high-throughput materials data generation and data mining
PPTX
Azure Databricks for Data Scientists
PDF
Azure 機器學習 - 使用Python, R, Spark, CNTK 深度學習
PDF
A Maturing Role of Workflows in the Presence of Heterogenous Computing Archit...
PDF
Microservices, containers, and machine learning
PDF
Big data berlin
PPSX
Open Source Lambda Architecture for deep learning
PPTX
Apache Spark sql
PPTX
Large-Scale Data Science in Apache Spark 2.0
PDF
Apache Spark Presentation good for big data
PPTX
Machine Learning and Hadoop
PPTX
What’s New in the Berkeley Data Analytics Stack
PPTX
Pyspark presentationsfspfsjfspfjsfpsjfspfjsfpsjfsfsf
PPTX
Big Data_Architecture.pptx
PPTX
Role of python in hpc
PDF
Automated Data Exploration: Building efficient analysis pipelines with Dask
PPTX
A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...
PDF
Scalable Preservation Workflows
Apache Spark and the Emerging Technology Landscape for Big Data
Build Deep Learning Applications for Big Data Platforms (CVPR 2018 tutorial)
Software tools for high-throughput materials data generation and data mining
Azure Databricks for Data Scientists
Azure 機器學習 - 使用Python, R, Spark, CNTK 深度學習
A Maturing Role of Workflows in the Presence of Heterogenous Computing Archit...
Microservices, containers, and machine learning
Big data berlin
Open Source Lambda Architecture for deep learning
Apache Spark sql
Large-Scale Data Science in Apache Spark 2.0
Apache Spark Presentation good for big data
Machine Learning and Hadoop
What’s New in the Berkeley Data Analytics Stack
Pyspark presentationsfspfsjfspfjsfpsjfspfjsfpsjfsfsf
Big Data_Architecture.pptx
Role of python in hpc
Automated Data Exploration: Building efficient analysis pipelines with Dask
A full Machine learning pipeline in Scikit-learn vs in scala-Spark: pros and ...
Scalable Preservation Workflows

Recently uploaded (20)

PPTX
ognitive-behavioral therapy, mindfulness-based approaches, coping skills trai...
PDF
The scientific heritage No 166 (166) (2025)
PPTX
famous lake in india and its disturibution and importance
PDF
Phytochemical Investigation of Miliusa longipes.pdf
PDF
Assessment of environmental effects of quarrying in Kitengela subcountyof Kaj...
PPTX
neck nodes and dissection types and lymph nodes levels
PPTX
Protein & Amino Acid Structures Levels of protein structure (primary, seconda...
PPTX
cpcsea ppt.pptxssssssssssssssjjdjdndndddd
PDF
Warm, water-depleted rocky exoplanets with surfaceionic liquids: A proposed c...
PDF
Cosmic Outliers: Low-spin Halos Explain the Abundance, Compactness, and Redsh...
PPTX
EPIDURAL ANESTHESIA ANATOMY AND PHYSIOLOGY.pptx
PPTX
7. General Toxicologyfor clinical phrmacy.pptx
PPTX
INTRODUCTION TO EVS | Concept of sustainability
PDF
Placing the Near-Earth Object Impact Probability in Context
PPTX
ECG_Course_Presentation د.محمد صقران ppt
PPTX
ANEMIA WITH LEUKOPENIA MDS 07_25.pptx htggtftgt fredrctvg
PPTX
TOTAL hIP ARTHROPLASTY Presentation.pptx
PDF
lecture 2026 of Sjogren's syndrome l .pdf
PDF
CHAPTER 3 Cell Structures and Their Functions Lecture Outline.pdf
PPTX
Introduction to Cardiovascular system_structure and functions-1
ognitive-behavioral therapy, mindfulness-based approaches, coping skills trai...
The scientific heritage No 166 (166) (2025)
famous lake in india and its disturibution and importance
Phytochemical Investigation of Miliusa longipes.pdf
Assessment of environmental effects of quarrying in Kitengela subcountyof Kaj...
neck nodes and dissection types and lymph nodes levels
Protein & Amino Acid Structures Levels of protein structure (primary, seconda...
cpcsea ppt.pptxssssssssssssssjjdjdndndddd
Warm, water-depleted rocky exoplanets with surfaceionic liquids: A proposed c...
Cosmic Outliers: Low-spin Halos Explain the Abundance, Compactness, and Redsh...
EPIDURAL ANESTHESIA ANATOMY AND PHYSIOLOGY.pptx
7. General Toxicologyfor clinical phrmacy.pptx
INTRODUCTION TO EVS | Concept of sustainability
Placing the Near-Earth Object Impact Probability in Context
ECG_Course_Presentation د.محمد صقران ppt
ANEMIA WITH LEUKOPENIA MDS 07_25.pptx htggtftgt fredrctvg
TOTAL hIP ARTHROPLASTY Presentation.pptx
lecture 2026 of Sjogren's syndrome l .pdf
CHAPTER 3 Cell Structures and Their Functions Lecture Outline.pdf
Introduction to Cardiovascular system_structure and functions-1

04 open source_tools

  • 2. Contents • An introduction to cluster computing architectures • The Python data analysis library stack • The Apache Spark cluster computing framework • Conclusions
  • 3. Prerequisite material We generally try to build on the JPL-Caltech Virtual Summer School Big Data Analytics September 2-12 2014 available on Coursera. For this specific presentation, please go through Ashish Mahabal California Institute of Technology "Best Programming Practices" for an introduction to best practices in programming and for an introduction to Python and R.
  • 4. Part 1: introduction 
 to cluster computing architectures • Divide and conquer… • …except for causal/logical/probabilistic dependencies
  • 5. motivating example: thematic mapping 
 from remote sensing data classification
  • 6. motivation: global scale near real–time analysis • interactive data exploration 
 (e.g. iteratively supervised thematic mapping) • advanced algorithms for end–user “apps” • e.g. • astronomy “catalogues” • geo analysis tools a la Google EarthEngine
  • 7. motivation: global scale near real–time analysis • growing remote sensing archive size - volume, variety, velocity • e.g. the Copernicus Sentinels • growing competence palette needed • e.g. forestry, remote sensing, statistics, 
 computer science, visualisation, operations
  • 8. thematic mapping by supervised classification: a distributed processing minimal example parallelize extract content descriptors classify trained classifier collect Training is distributed to processing nodes, thematic classes are predicted in parallel
  • 9. no scheduler: first 100 tiles as per natural data storage organisation thematic mapping by supervised classification: a distributed processing minimal example
  • 10. distributed processing
 minimal architecture random scheduler: first 100 random tiles
  • 11. distributed processing
 minimal architecture geographic space filling curve-based scheduler: 
 first 100 tiles “happen” around tile of interest (e.g. central tile)
  • 12. remote sensing data processing architectures Job Queue Analysis Workers Data Catalogue Processing Workers Auto Scaling Ingestion Data Catalogue Exploitation Annotations Catalogue User Application Servers Load Balancer User Source Products Domain Expert Configuration Admin Domain Expert direct data import Data Processing / Data Intelligence Servers 13/34
  • 13. batch processing architectures parallel “batch mode” processing Input Batched Data Collector Processing Job Processing Job Processing Job … Queries Bakshi, K. (2012, March). Considerations for big data: Architecture and approach. In Aerospace Conference, 2012 IEEE (pp. 1-7). IEEE.
  • 14. the lambda architecture Nathan März “How to beat the CAP theorem”, Oct 2011 two separate lanes:
 * batch for large, slow “frozen” 
 * streaming for smaller, fast “live” data merged at the end Input Batched Data Collector Multiple Batch Processing Jobs Queries Multiple Stream Processing Jobs RealTime Streamed Data
  • 15. trade–off considerations • advantages: adaptability
 “best of both worlds” –
 mixing systems designed with different trade–offs • limits: costs — code maintenance in particular
 manifestations of polyglot processing
  • 16. the kappa architecture Jay Kreps “Questioning the Lambda Architecture”, Jul 2014 concept: use stream processing for everything Collector Multiple Stream Processing Jobs Queries Multiple Stream Processing Jobs RealTime Streamed Data Historical Data Stream Input Batched Data
  • 17. scheduled stream processing intelligence in smart schedulers
 for optimally iterating historical batch elements
 presenting them as a stream Collector Multiple Stream Processing Jobs Queries Multiple Stream Processing Jobs RealTime Streamed Data Scheduled Historical Data Stream Input Batched Data Smart Schedulers
  • 18. scheduling by space–filling curves:
 ensure that all points are considered Source: Haverkort, Walderveen “Locality and Bounding-Box Quality of Two-Dimensional Space-Filling Curves” 
 2008 arXiv:0806.4787v2
  • 19. E.G.: hilbert scheduling • hilbert curve scheduling applications • declustering
 Berchtold et al. “Fast parallel similarity 
 search in multi-media databases” 1997 • visualization
 eg. B. Irwin et al. “High level 
 internet scale traffic visualization 
 using hilbert curve mapping”
 2008 • parallel process scheduling
 M. Drozdowski “Scheduling for parallel processing” 2010

  • 20. stream processing with smart schedulers 
 for remote sensing catalogue analytics idea: exploit user interest locality in • geographic space • multi–resolution space • possibly semantics? source: geowave
  • 21. for large datasets: divide and conquer yet: 1. dependencies need to be modelled (e.g. segmentation) 2. if NOT ALL TILES HAVE EQUAL VALUE
 and analysis cost (e.g. TIME) ENTERS THE PICTURE… motivating example: thematic mapping 
 from remote sensing data classification
  • 22. Part 2: the PyData stack ➤ pydata — data analytics http://pydata.org/downloads/ ➤ rasterio — OO GDAL https://github.com/mapbox/rasterio ➤ fiona — OO OGR http://toblerity.org/fiona/manual.html ➤ skimage — image processing http://scikit-image.org/ ➤ sklearn — machine learning http://scikit-learn.org/stable/ ➤ pandas — data analysis http://pandas.pydata.org/ ➤ PIL — imaging http://www.pythonware.com/products/pil/ ➤ Scipy — scientific computing library http://scipy.org/
  • 23. numpy.array: array data types What it does: ND array data types allow operations to be described in terms of matrices and vectors. This is good because: It makes code both cleaner and more efficient, since it translates to fewer lower-level calls to compiled routines, avoiding `for` loops.
  • 24. matplotlib.pylab: plotting in 2D and 3D What it does: It allows producing visual representations of the data. This is good because: It can help generate insights, communicate results, 
 rapidly validate procedures
  • 25. scikit-image • A library of standard image processing methods. • It operates on `numpy` arrays.
  • 26. sklearn: machine learning • A library for clustering, classification, regression, e.g. for basic thematic mapping. • Plus: data transformation, ML performance evaluation... • See the ML lessons in the `JPL- Caltech Virtual Summer School` material.
  • 27. RASTERIO: RASTER LOADING ➤ high-level interfaces to GDAL fn = “~/Data/all_donosti_croped_16_wgs4326_b.ers” import rasterio, numpy with rasterio.drivers(CPL_DEBUG=True): with rasterio.open(os.path.expanduser(fn)) as src: bands = map(src.read_band, (1, 2, 3)) data = numpy.dstack(bands) print(type(data)) print(src.bounds) print(src.count, src.shape) print(src.driver) print(str(src.crs)) bounds = src.bounds[::2] + src.bounds[1::2] import skimage.color import matplotlib.pylab as plt data_hsv = skimage.color.rgb2xyz(data) fig = plt.figure(figsize=(8, 8)) ax = plt.imshow(data_hsv, extent=bounds) plt.show()
  • 28. FIONA: VECTOR MASKING ➤ Binary masking by Shapefiles import shapefile, os.path from PIL import Image, ImageDraw sf = shapefile.Reader(os.path.expanduser(“~/masking_shapes.shp")) shapes, src_bbox = sf.shapes(), [ bounds[i] for i in [0, 2, 1, 3] ] # Geographic x & y image sizes xdist, ydist = src_bbox[2] - src_bbox[0], src_bbox[3] - src_bbox[1] # Image width & height iwidth, iheight = feats.shape[1], feats.shape[0] xratio, yratio = iwidth/xdist, iheight/ydist # Masking mask = Image.new("RGB", (iwidth, iheight), "black") draw = ImageDraw.Draw(mask) pixels = { label:[] for label in labels } for i_shape, shape in enumerate(sf.shapes()): draw.polygon([ p[:2] for p in pixels[label] ], outline="rgb(1, 1, 1)", fill="rgb(1, 1, 1)”) import scipy.misc fig = plt.figure(figsize=(8, 8)) ax = plt.imshow(scipy.misc.fromimage(mask)*data, extent=bounds)
  • 29. pandas: data management and analysis • Adds labels to `numpy` arrays. • Mimicks R's DataFrame type, integrates plotting and data analysis.
  • 30. Jupyter: an interactive development 
 and documentation environment • Write and maintain documents that include text, diagrams and code. • Documents are rendered as HTML by GitHub.
  • 32. Part 3: Cluster computing • Idea: “Decompose data, move instructions to data chunks” • Big win for easily decomposable problems • Issues in managing dependencies in data analysis
  • 33. Spark cluster computing Hitesh Dharmdasani, “Python and Bigdata - An Introduction to Spark (PySpark)”
  • 35. pyspark example: context The Spark context represents the cluster. It can be used to distribute elements to the nodes. Examples: - a library module - a query description in a search system.
  • 36. pyspark example: hdfs Distributes and manages for redundancy very large data files on the cluster disks. Achille's heel: managing very large numbers of small files.
  • 37. pyspark example: telemetry The central element for optimising the analysis system. “If it moves we track it” —> Design Of Experiments
  • 38. pyspark example: spark.mllib Machine learning tools for cluster computing contexts 
 is a central application of cluster computing frameworks.
 At times, still not up to par with single machine configurations.
  • 39. pyspark.streaming Data stream analysis (e.g. from a network connection) an important use case. Standard cluster computing concepts apply. It is done in chunks whose size is not controlled directly.
  • 40. pyspark @ AWS The Spark distribution includes tools to instantiate a cluster on the Amazon Web Services infrastructure. Costs tend to be extremely low…
 if you DO NOT publish your credentials.
  • 41. Ongoing trends • Data standardisation: Apache Arrow • A simplification of infrastructure management tools: Hashi Terraform
  • 42. apache arrow import feather path = 'my_data.feather' feather.write_dataframe(df, path) df = feather.read_dataframe(path)
  • 43. OpenStack, Ansible, Vagrant, Terraform... • Infrastructure management tools 
 allow more complex setups to be easily managed
  • 44. Conclusions • Extending an analytics pipeline to computing clusters 
 can be done with limited resources