Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The...

60
Helping the World’s Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation

Transcript of Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The...

Page 1: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Helping the World’s Farmers Adapt to Climate Change

Strata Conference Oct 2012Siraj Khaliq, CTO, The Climate Corporation

Page 2: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Fritchton, IN – late summer, 2012

Page 3: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Louisville, IL

Page 4: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Wichita, KA

Page 5: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.
Page 6: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.
Page 7: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.
Page 8: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.
Page 9: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.
Page 10: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Click to edit Master title style

• Click to edit Master text styles– Second level

• Third level– Fourth level

» Fifth level 195620121988

Worst US Droughts in the Last Fifty Years

Page 11: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Click to edit Master title style

-16%2012 Estimated Corn Yield (USDA)

Page 12: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Click to edit Master title style

+6%World food prices month-on-month

change in July 2012 (UNFAO)

Page 13: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Large capital outlays at start of season (April)

Seed, equipment, pesticide, and land

Revenue comes in at harvest

1-2 years of revenue shortfall could be catastrophic

Futures help with price volatility, not weather

Farm Economics

Page 14: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Farmer Rich Vernon talks to NPR's David Schaper (audio)

A real-life example

Page 15: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.
Page 16: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.
Page 17: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

This is set to continue

Page 18: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Click to edit Master title style

Page 19: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.
Page 20: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Click to edit Master title style

To help all the world's people & businesses manage and

adapt to climate change

Our Mission

Page 21: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Evaluating Markets

Page 22: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Click to edit Master title style

$4.2 Trillion2012 Estimated Corn Yield (USDA)

Page 23: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Total Weather Insurance (TWI)

Page 24: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

TWI Demo

Page 25: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

HOW?

Page 26: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

OutcomeWeather DataPolicy

Page 27: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Modeled Outcomes

Weather Simulations

Structure

Page 28: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

StructureHow does weather impact crop yield?

Page 29: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Structure

Varies based on many inputs: Temperature Precipitation Soil type Topography Farming practices Crop varietal

Page 30: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Structure

Agronomically deduced candidates Model at large scale Every farm in the US (20M)

Page 31: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Structure

Page 32: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Modeled Outcomes

Weather Simulations

Structure

Page 33: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

What weather dowe expect?

Weather Simulations

Page 34: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Weather Simulations

1M locations (2.5mi x 2.5mi grid)10k scenarios/location

going 2 years out

2 measurements

60Tb of data per

simulation set

every couple of weeks

Page 35: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Weather Simulations

Page 36: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

2.5 x 2.5Square Miles

Page 37: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Weather Simulations

Expensive computation Parallelizing hard due to correlations

Would take 80+ years on one fast modern server-class machine

We need to generate these within days

Page 38: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Soil Moisture Modeling

What's the soil moisture at farm X?

Page 39: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Soil Moisture Modeling

soil type, weather, topography, crop

Page 40: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Evolution of Our Technology

Page 41: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Java frontend

PricingServer (Rserve)

MySQL

2007

400 stations All data in MySQLPricing servers (Rserve)Java-based webapp

Page 42: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Java frontend

PricingServer (Rserve)

MySQL

2008

2000 stations Weather data now on disk Versioning hard Java-R bridge messy

Disk

Page 43: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Java frontend

PricingServer (java)

SimulationService

Weather dataServiceSim gen (hadoop)

SimpleDB / S3 SimpleDB / S3

MySQL

2009-2010

22,000 locations Rserve replaced by java Simulations & S3/SimpleDB Model gen in Hadoop Moved fully to EC2

Page 44: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Rails frontend

PricingServer (java)

Marty (HBase)Geo data storeSim gen

(cascalog)

S3

MySQL

2011 – today

1,000,000 locations Own big geo-data store Many more hadoop jobs Eliminated SimpleDB

Soil moisture dataset gen (cascalog)

Structures gen (cascalog)

Other hadoop jobs

Page 45: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

MapReduce at TCC

Python (Hadoop streaming) Some native java Most are higher-level frameworks

Page 46: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Big Wins

Cascalog/Clojure EC2 Spot Instances “NoSQL”

Page 47: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Big Win #1 - Cascalog

(defn weather-map-q  "Creates a Cascalog query to extract individual measurement values of  ObservationSet data and produces tuples of [date JSON-encoded map], in  which each JSON-encoded map is keyed by station-id"  [stations interval measurement sources start end nostra]  (<- [?date ?json-aggregated-values] ; from hfs-textline    (stations ?station-id)    (fetch-obs-for-station [interval measurement sources start end nostra]                           ?station-id :> ?obs)    (extract-values-by-date ?obs :> ?date ?value)    (aggregate-values ?value :> ?aggregated-values)    (json/generate-string ?aggregated-values :> ?json-aggregated-values)))

Page 48: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Big Win #1 - Cascalog

Easily composable workflows Can unit test Hadoop flows Quick iteration

Page 49: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Big Win #2 – EC2 Spot Instances

Good fit to our compute approach Can be very cheap Good availability

Page 50: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

MapReduce at TCC

Page 51: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Big Win #3: NoSQL

Datasets must be: Repeatably Generated Versioned Indexed

Page 52: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Big Win #3 – NoSQL

Why not SQL? Time-series data, not relational Large size and ad hoc structure Specific query patterns 10s of Terabytes in size

Page 53: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

NoSQL at TCC - Marty

Own big geo-data store Built on HBase Billions of records

Page 54: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Learning #1 – Embrace Hadoop

Defines problem clearly Focus on problem more than architecture Great tools and community support

Page 55: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Learning #2 – Be Careful

Fail-fast code Test, test, test Run at small scale first

Page 56: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Learning #3 – Architecture Matters

Eliminate single points of failure Consider memory usage and I/O Write simple flows with checkpointing Monitoring is invaluable

Page 57: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

TCC Today

150 employees Half engineering 20 PhDs Reputation for hard science problems

… by standing on the shoulders of giants

Page 58: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Open Source at TCC

github.com/TheClimateCorporation

Lemur (EMR / Clojure) Repoman (coming soon) Marty (coming)

Page 59: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

??

Page 60: Helping the Worlds Farmers Adapt to Climate Change Strata Conference Oct 2012 Siraj Khaliq, CTO, The Climate Corporation.

Click to edit Master title style