SlideShare a Scribd company logo
Threp
A Lightweight Remap Framework
for the Earth System Model


吴竑 (Xunzhang) xunzhangthu@gmail.com
2013/03/09
Background

Data management between components in the Earth System Model(coupler)

Data exchange between grids in each Models(atmosphere, land, ocean, ice, ...)

Grids have become diverse(triple pole, hexagon, unstructured)

Interpolation algorithms have become complex(mixed/coupled, special handling)
Motivation

Current popular universal remapping libraries:




                                                 ESMF-Regridding
Motivation

Current popular universal remapping libraries:




 Inflexible data structure(latitude bin, local traverse)    3D Cartesian coordinates
          Tooold(SCRIP1.4 released at 2001)                Unstructured grid supported
                         Serial                                      Parallel

                                                               ESMF-Regridding
Motivation

Current popular universal remapping libraries:




 Inflexible data structure(latitude bin, local traverse)     Appeared as a app, no interface supplied
                                                                           3D Coords
          Tooold(SCRIP1.4 released at 2001)                Complicated hierarchy, really hard to improve
                                                                  Unstructured grid supported
                         Serial                                      Thoughtless readability
                                                                             Parallel

                                                                        ESMF-Regridding
Motivation

More versatility, flexible data structure

Remapping programming model in the Earth System Model(throw details to Threp)

Readable, lightweight, efficient remapping framework
Goal of Threp

Universal(Earth System Model)

Users develop just like building blocks

More grids(regular, rectilinear, curvilinear, unstructured) supported

Mask supported(source, destination)

Extrapolation supported(e.g., border of land and sea)

Parallel and Scalable
Encapsulation

Abstract…

Abstract…

Abstract…
Outline

Remapping on a sphere

Design of Threp

Implementation

Bilinear in action

Demo

Future work
Two Stage


Stage 1: Weights Generation                               Stage 2: Regridding Data



                                                                            𝑘
                                      𝑤11 𝑤12 … 𝑤1𝑘
                                      𝑤21 𝑤22 … 𝑤2𝑘           𝑑𝑎𝑡𝑎 𝐴 𝑗 =         𝑤 𝑖 ∙ 𝑑𝑎𝑡𝑎(𝑃𝑖 )
                                   A=          …                           𝑖=1
                                       𝑤 𝑗1 𝑤 𝑗2 … 𝑤 𝑗𝑘
                                               …

                                                          𝑑𝑎𝑡𝑎 𝑑𝑠𝑡_𝑖𝑛𝑑𝑥 = 𝐴 ∙ 𝑑𝑎𝑡𝑎[𝑠𝑟𝑐_𝑖𝑛𝑑𝑥]
           𝐴 𝑗 (on dst grid)
     𝑃1 , 𝑃2 … 𝑃 𝑘 (on src grid)
          𝑤1, 𝑤2 … 𝑤 𝑘 (wgts)
Search Neighbors

IDW: nearest k points

Bilinear: nearest quadrangle

Bicubic: nearest quadrangle or nearest 16 points   find nearest k + select

Patch: nearest patch

Least Square Method: nearest k points
Matrix-Vector Multiply


                       𝑤11 𝑤12 … 𝑤1𝑘
                       𝑤21 𝑤22 … 𝑤2𝑘
                                                          𝑘 × 𝑛𝑢𝑚 𝑑𝑠𝑡
 Sparse matrix A =            …       , sparsity =                       .
                                                        𝑛𝑢𝑚 𝑠𝑟𝑐 ×𝑛𝑢𝑚 𝑑𝑠𝑡
                        𝑤𝑗1 𝑤𝑗2 … 𝑤𝑗𝑘
                              …        𝑛𝑢𝑚 𝑠𝑟𝑐 ×𝑛𝑢𝑚 𝑑𝑠𝑡



                                                                𝑇
 dst_𝑖𝑛𝑑𝑥 = 1 1 … 1 2 2 … 2 … … 𝑛𝑢𝑚 𝑑𝑠𝑡 𝑛𝑢𝑚 𝑑𝑠𝑡 … 𝑛𝑢𝑚 𝑑𝑠𝑡
Outline

Remap model in the Earth System Model

Design of Threp

Implementation

Bilinear in action

Demo

Future work
2d Tree Construction
Nearest neighbor search in a 2d tree demo




                               Average: 𝑙𝑜𝑔𝑁
                               Worse: 𝑁
Remap on a sphere

             Periodic Boundary

                                               Construct left ghost boundary:

                                                           (lon, 0.5) -> (lon, -0.5)

                                               Construct right ghost boundary:

                                                         (lon, 359.5) -> (lon, 360.5)

                                               Index recovery map/table:

                                                index of (lon, ghost_lat) ->index of (lon, lat)

Left ghost                       right ghost
boundary                         boundary
Remap on a sphere

     Pole Singularities

                          if highest lat(dst grid)> highest lat(src grid):

                               use north pole region interp pnts

                               continue

                          if lowest lat(dst grid)< lowest lat(src grid):

                               use south pole region interp pnts

                               continue

                          normal case…
A Map-Reduce application

Map: Stage1

Reduce: Stage 2
Outline

Remap model in the Earth System Model

Design of Threp

Implementation

Bilinear in action

Demo

Future work
Architecture


               bilinear     idw         patch   conserve
                               interp
           search         solver    prediction geometry
                                   io
                               NetCDF
                 MPI/TCP-IP                Pydoop
                              clusters
Embrace Python

User friendly(geoscience user)                       Recursive efficiency:

Easy to code, easy to read                                    loop version of kd-tree

More integrated libraries(no more repeated wheels)   Auto type checking:
Embrace Python



  < 4000 LOC! (so far)

  12th day, available!
Grid File

 SCRIP Grid Format

 2D lat/lon coords(degrees/radians units supported)

 Atmosphere grid with mask or no mask
Nearest k + Select

 Heuristic
Solver
                                      -solve weights for each dst grid pnt


Class                                 +__init__()
                                      +solve_quadratics()
                                      +select_legal_root()




               Idw_Solver                        Bilinear_Solver                      Bilinear_Solver
        -solve idw weights                   -solve bilinear weights              -solve bilinear weights
        +__init__()
        +solve()
                                             +__init__()
                                             +solve()
                                                                                  +__init__()
                                                                                  +solve()
                                                                                                            Solver


                                                                                          Bilinear
                       Interp                                                     -Bilinear remapping
    -Interpolation management class                                               class
                                                                                  +__init__()
    +__init__()                                                                   +local_functions()
    +interp()                                                                     +interp()
    +remap()                                                                      +remap()
    +check_wgt()
    +check_wgtsum()
    +check_all_masks()
    +dst_distribute()
                                                                                                            Interp
    +dst_merge()                                                                               Idw
    +indx_recovery()                                                              -Idw remapping class
    +compact_remap_matrix()                                                       +__init__()
    +learn()                                                                      +local_functions()
    +deliver()                                                                    +interp()
                                                                                  +remap()




                      Predictor                                              Bilinear_Predictor
    -Preditor class                                                -Bilinear predictor class                Predictor
    +__init__()                                                    +__init__()
    +predict()                                                     +predict()
MPI

Python MPI library: mpi4py

Linear speedup(stage1)

          4min->2min->1min->30sec->…(not complete)

Very fast for serial stage2, <0.2sec.

          necessary to parallelize?

          callback of MPI_Reduce interface?
MapReduce

Not finished!
Outline

Remap model in the Earth System Model

Design of Threp

Implementation

Bilinear in action

Demo

Future work
Bilinear Algorithm


            𝑓 𝑥, 𝑦 = 𝑎 + 𝑏𝑥 + 𝑐𝑦 + 𝑑𝑥𝑦

            𝑓 𝑥 𝑘 , 𝑦 𝑘 = 𝑓 0,0 1 − 𝑥 𝑘 (1 − 𝑦 𝑘 ) + 𝑓 1,0 𝑥 𝑘 (1 − 𝑦 𝑘 ) + 𝑓 0,1 𝑦 𝑘 1 − 𝑥 𝑘 + 𝑓 1,1 𝑥 𝑘 𝑦 𝑘

            𝑓 𝑥 𝑘 , 𝑦 𝑘 = 𝑓 0,0 𝑤1 + 𝑓 1,0 𝑤2 + 𝑓 0,1 𝑤3 + 𝑓 1,1 𝑤4

           For irregular bilinear box, a similar way to calculate𝑤1, 𝑤2, 𝑤3, 𝑤4 (2011/8, wuhong)
Extrapolation Case

  Source grid masked

           atm2ocn & ocn2atm

  Destination grid masked

           ignore

  Coupled bilinear




Can extrapolation as accurate as interpolation?

Yes, a property that…
Still Two Stage

𝑓 𝑥1, 𝑦1 = 𝑎 + 𝑏𝑥1 + 𝑐𝑦1 + 𝑑𝑥1 𝑦1                          𝑓 = 𝑓 𝑥1, 𝑦1          𝑓 𝑥1, 𝑦1 𝑓 𝑥1, 𝑦1 𝑓 𝑥1, 𝑦1   𝑇

𝑓 𝑥2, 𝑦2 = 𝑎 + 𝑏𝑥2 + 𝑐𝑦2 + 𝑑𝑥2 𝑦2
                                           𝑓 = 𝐶𝑦             1      𝑥1   𝑦1   𝑥1 𝑦1
𝑓 𝑥3, 𝑦3 = 𝑎 + 𝑏𝑥3 + 𝑐𝑦3 + 𝑑𝑥3 𝑦3
                                                              1      𝑥2   𝑦2   𝑥2 𝑦2                      𝑇
𝑓 𝑥4, 𝑦4 = 𝑎 + 𝑏𝑥4 + 𝑐𝑦4 + 𝑑𝑥4 𝑦4                          𝐶=                                𝑦= 𝑎 𝑏 𝑐 𝑑
                                                              1      𝑥3   𝑦3   𝑥3 𝑦3
                                                              1      𝑥4   𝑦4   𝑥4 𝑦4   4×4


                                                                   Solving inversion of a 4×4
                                                                            Matrix C
𝑓 𝑥 𝑘 , 𝑦 𝑘 = 𝑎 + 𝑏𝑥 𝑘 + 𝑐𝑦 𝑘 + 𝑑𝑥 𝑘 𝑦 𝑘   𝑓 𝑘 = 𝑧𝑦
                                           𝑓 𝑘 = 𝑧𝐶 −1 𝑓   𝑧 = [1 𝑥 𝑘 𝑦 𝑘 𝑥 𝑘 𝑦 𝑘 ]
                                           𝑓 𝑘 = 𝑤𝑓        𝑤 = 𝑧𝐶−1
Piece of Results


 T42 -> POP43:

         are: 8.74e-5

         mre: 0.00596
                         Better than idw!
 POP43->T42:             Better than idw mixed bilinear!

         are: 0.000238

         mre: 0.0829
Outline

Remap model in the Earth System Model

Design of Threp

Implementation

Bilinear in action

Demo

Future work
Discussion

 Unstructured grid source

 Periodic boundary problem of unstructured grid

 Specificity conservative remapping

 High dimensional remapping

 Restart Threp
Outline

Remap model in the Earth System Model

Design of Threp

Implementation

Bilinear in action

Demo

Future work
Roadmap

Performance:                           More sub modules in Threp:

          PyPy interpreter                      derivation

          C extension of kernel code            integral

          mapreduce version of Threp   More algorithms:

More grids:                                     patch


          triple poles                          bicubic

          unstructured                          conservative(first & second)

Graduate!!
Conclusion

Threp abstract remapping model in the Earth System Model

Threp is a parallel remapping framework, supports masked/unstructured grid

Threp is lightweight, easy to start

A extrapolation coupled bilinear algorithm implemented in Threp, better accuracy

High performance scalability

Embrace Threp!!
Open Source

https://github.com/xunzhang/Threp
Acknowledge

Google.com

Stackoverflow.com

Lanning Wang< wangln@bnu.edu.cn >

Shunqiang Song< pinewall@gmail.com >

Li Liu< liuli03@mails.tsinghua.edu.cn >

Yushu Chen<>
Thank you!   Questions?
Singularity(backup)
Ill-condition(backup)

More Related Content

PPT
CS 354 Acceleration Structures
RTF
Image compression
PDF
Sparse autoencoder
PPTX
Anomaly detection using deep one class classifier
PPTX
M Gumbel - SCABIO: a framework for bioinformatics algorithms in Scala
PDF
Lecture 06 marco aurelio ranzato - deep learning
PDF
Extreme dxt compression
PPTX
The world of loss function
CS 354 Acceleration Structures
Image compression
Sparse autoencoder
Anomaly detection using deep one class classifier
M Gumbel - SCABIO: a framework for bioinformatics algorithms in Scala
Lecture 06 marco aurelio ranzato - deep learning
Extreme dxt compression
The world of loss function

What's hot (20)

PPTX
Show, Attend and Tell: Neural Image Caption Generation with Visual Attention
PPT
Anatomy of a Texture Fetch
PDF
MLIP - Chapter 6 - Generation, Super-Resolution, Style transfer
PPTX
Image transforms
PPTX
Detailed Description on Cross Entropy Loss Function
PPT
Ch2 Liang
PDF
Backpropagation in Convolutional Neural Network
PPT
CS 354 Typography
PPTX
Getting started with image processing using Matlab
PDF
VAE-type Deep Generative Models
PDF
MLIP - Chapter 5 - Detection, Segmentation, Captioning
PDF
ICML2012読み会 Scaling Up Coordinate Descent Algorithms for Large L1 regularizat...
PDF
MLIP - Chapter 3 - Introduction to deep learning
PDF
Lecture 02 internet video search
PDF
"Deep Learning" Chap.6 Convolutional Neural Net
PPTX
ARCHITECTURAL CONDITIONING FOR DISENTANGLEMENT OF OBJECT IDENTITY AND POSTURE...
PDF
Topological Inference via Meshing
PPTX
PPT
Fast Forward To Scala
PPT
Stockage, manipulation et analyse de données matricielles avec PostGIS Raster
Show, Attend and Tell: Neural Image Caption Generation with Visual Attention
Anatomy of a Texture Fetch
MLIP - Chapter 6 - Generation, Super-Resolution, Style transfer
Image transforms
Detailed Description on Cross Entropy Loss Function
Ch2 Liang
Backpropagation in Convolutional Neural Network
CS 354 Typography
Getting started with image processing using Matlab
VAE-type Deep Generative Models
MLIP - Chapter 5 - Detection, Segmentation, Captioning
ICML2012読み会 Scaling Up Coordinate Descent Algorithms for Large L1 regularizat...
MLIP - Chapter 3 - Introduction to deep learning
Lecture 02 internet video search
"Deep Learning" Chap.6 Convolutional Neural Net
ARCHITECTURAL CONDITIONING FOR DISENTANGLEMENT OF OBJECT IDENTITY AND POSTURE...
Topological Inference via Meshing
Fast Forward To Scala
Stockage, manipulation et analyse de données matricielles avec PostGIS Raster
Ad

Viewers also liked (19)

DOCX
Encuesta
PPTX
Wix rosa
DOC
เทคโนโลยีสารสนเทศ
PPT
นวัตกรรม เรื่อง ส่วนประกอบคอมพิวเตอร์
DOC
07. проектодоговор оп1
PPTX
ID Slide Presentation
PDF
คู่มือ Wordpress
DOC
05. указания
PDF
Wearing your heart on your sleeve: a wearable computing primer (of sorts)
PPT
บทที่ 1 ความเป็นมาของเทคโนโลยีสารสนเทศ
PDF
ระบบประสาท
DOCX
ระบบประสาท
PDF
Pgt botany
DOC
06. технически спецификации
PPTX
Transmedia presentation
PPTX
A manager's guide to performance appraisals
PPT
Open house
PPTX
A manager's guide to performance appraisals
PDF
นวัตกรรม เรื่อง ส่วนประกอบคอมพิวเตอร์
Encuesta
Wix rosa
เทคโนโลยีสารสนเทศ
นวัตกรรม เรื่อง ส่วนประกอบคอมพิวเตอร์
07. проектодоговор оп1
ID Slide Presentation
คู่มือ Wordpress
05. указания
Wearing your heart on your sleeve: a wearable computing primer (of sorts)
บทที่ 1 ความเป็นมาของเทคโนโลยีสารสนเทศ
ระบบประสาท
ระบบประสาท
Pgt botany
06. технически спецификации
Transmedia presentation
A manager's guide to performance appraisals
Open house
A manager's guide to performance appraisals
นวัตกรรม เรื่อง ส่วนประกอบคอมพิวเตอร์
Ad

Similar to Intro to threp (20)

PDF
Sketch sort sugiyamalab-20101026 - public
PDF
Grid generation and adaptive refinement
PPT
A Tutorial on Computational Geometry
PDF
Algorithm To Build A Routing Project
PDF
CSMR06a.ppt
PDF
Morphing Image
PDF
Summary of My Research
PDF
Numba: Array-oriented Python Compiler for NumPy
PDF
Hadoop Summit 2010 Multiple Sequence Alignment Using Hadoop
PPTX
Advanced geoprocessing with Python
PDF
Orthogonal Range Searching
PDF
Highs and Lows: A Resel-based Approach to the Analysis of Data from Geophysic...
PDF
Reading and writing spatial data for the non-spatial programmer
PDF
Project2
PDF
A multithreaded method for network alignment
PDF
Machine Vision made easy with Ruby - ShRUG June 2010
PDF
Image Smoothing for Structure Extraction
PPTX
Oxford 05-oct-2012
PPTX
Big Practical Recommendations with Alternating Least Squares
PDF
Matlab assignment
Sketch sort sugiyamalab-20101026 - public
Grid generation and adaptive refinement
A Tutorial on Computational Geometry
Algorithm To Build A Routing Project
CSMR06a.ppt
Morphing Image
Summary of My Research
Numba: Array-oriented Python Compiler for NumPy
Hadoop Summit 2010 Multiple Sequence Alignment Using Hadoop
Advanced geoprocessing with Python
Orthogonal Range Searching
Highs and Lows: A Resel-based Approach to the Analysis of Data from Geophysic...
Reading and writing spatial data for the non-spatial programmer
Project2
A multithreaded method for network alignment
Machine Vision made easy with Ruby - ShRUG June 2010
Image Smoothing for Structure Extraction
Oxford 05-oct-2012
Big Practical Recommendations with Alternating Least Squares
Matlab assignment

Recently uploaded (20)

PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
Encapsulation theory and applications.pdf
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
Web App vs Mobile App What Should You Build First.pdf
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PDF
Hybrid model detection and classification of lung cancer
PDF
A comparative analysis of optical character recognition models for extracting...
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
1 - Historical Antecedents, Social Consideration.pdf
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
Mushroom cultivation and it's methods.pdf
PPTX
Chapter 5: Probability Theory and Statistics
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
project resource management chapter-09.pdf
Univ-Connecticut-ChatGPT-Presentaion.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Encapsulation theory and applications.pdf
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
Web App vs Mobile App What Should You Build First.pdf
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Heart disease approach using modified random forest and particle swarm optimi...
Hybrid model detection and classification of lung cancer
A comparative analysis of optical character recognition models for extracting...
OMC Textile Division Presentation 2021.pptx
1 - Historical Antecedents, Social Consideration.pdf
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
Mushroom cultivation and it's methods.pdf
Chapter 5: Probability Theory and Statistics
SOPHOS-XG Firewall Administrator PPT.pptx
gpt5_lecture_notes_comprehensive_20250812015547.pdf
project resource management chapter-09.pdf

Intro to threp

  • 1. Threp A Lightweight Remap Framework for the Earth System Model 吴竑 (Xunzhang) xunzhangthu@gmail.com 2013/03/09
  • 2. Background Data management between components in the Earth System Model(coupler) Data exchange between grids in each Models(atmosphere, land, ocean, ice, ...) Grids have become diverse(triple pole, hexagon, unstructured) Interpolation algorithms have become complex(mixed/coupled, special handling)
  • 3. Motivation Current popular universal remapping libraries: ESMF-Regridding
  • 4. Motivation Current popular universal remapping libraries: Inflexible data structure(latitude bin, local traverse) 3D Cartesian coordinates Tooold(SCRIP1.4 released at 2001) Unstructured grid supported Serial Parallel ESMF-Regridding
  • 5. Motivation Current popular universal remapping libraries: Inflexible data structure(latitude bin, local traverse) Appeared as a app, no interface supplied 3D Coords Tooold(SCRIP1.4 released at 2001) Complicated hierarchy, really hard to improve Unstructured grid supported Serial Thoughtless readability Parallel ESMF-Regridding
  • 6. Motivation More versatility, flexible data structure Remapping programming model in the Earth System Model(throw details to Threp) Readable, lightweight, efficient remapping framework
  • 7. Goal of Threp Universal(Earth System Model) Users develop just like building blocks More grids(regular, rectilinear, curvilinear, unstructured) supported Mask supported(source, destination) Extrapolation supported(e.g., border of land and sea) Parallel and Scalable
  • 9. Outline Remapping on a sphere Design of Threp Implementation Bilinear in action Demo Future work
  • 10. Two Stage Stage 1: Weights Generation Stage 2: Regridding Data 𝑘 𝑤11 𝑤12 … 𝑤1𝑘 𝑤21 𝑤22 … 𝑤2𝑘 𝑑𝑎𝑡𝑎 𝐴 𝑗 = 𝑤 𝑖 ∙ 𝑑𝑎𝑡𝑎(𝑃𝑖 ) A= … 𝑖=1 𝑤 𝑗1 𝑤 𝑗2 … 𝑤 𝑗𝑘 … 𝑑𝑎𝑡𝑎 𝑑𝑠𝑡_𝑖𝑛𝑑𝑥 = 𝐴 ∙ 𝑑𝑎𝑡𝑎[𝑠𝑟𝑐_𝑖𝑛𝑑𝑥] 𝐴 𝑗 (on dst grid) 𝑃1 , 𝑃2 … 𝑃 𝑘 (on src grid) 𝑤1, 𝑤2 … 𝑤 𝑘 (wgts)
  • 11. Search Neighbors IDW: nearest k points Bilinear: nearest quadrangle Bicubic: nearest quadrangle or nearest 16 points find nearest k + select Patch: nearest patch Least Square Method: nearest k points
  • 12. Matrix-Vector Multiply 𝑤11 𝑤12 … 𝑤1𝑘 𝑤21 𝑤22 … 𝑤2𝑘 𝑘 × 𝑛𝑢𝑚 𝑑𝑠𝑡 Sparse matrix A = … , sparsity = . 𝑛𝑢𝑚 𝑠𝑟𝑐 ×𝑛𝑢𝑚 𝑑𝑠𝑡 𝑤𝑗1 𝑤𝑗2 … 𝑤𝑗𝑘 … 𝑛𝑢𝑚 𝑠𝑟𝑐 ×𝑛𝑢𝑚 𝑑𝑠𝑡 𝑇 dst_𝑖𝑛𝑑𝑥 = 1 1 … 1 2 2 … 2 … … 𝑛𝑢𝑚 𝑑𝑠𝑡 𝑛𝑢𝑚 𝑑𝑠𝑡 … 𝑛𝑢𝑚 𝑑𝑠𝑡
  • 13. Outline Remap model in the Earth System Model Design of Threp Implementation Bilinear in action Demo Future work
  • 15. Nearest neighbor search in a 2d tree demo Average: 𝑙𝑜𝑔𝑁 Worse: 𝑁
  • 16. Remap on a sphere Periodic Boundary Construct left ghost boundary: (lon, 0.5) -> (lon, -0.5) Construct right ghost boundary: (lon, 359.5) -> (lon, 360.5) Index recovery map/table: index of (lon, ghost_lat) ->index of (lon, lat) Left ghost right ghost boundary boundary
  • 17. Remap on a sphere Pole Singularities if highest lat(dst grid)> highest lat(src grid): use north pole region interp pnts continue if lowest lat(dst grid)< lowest lat(src grid): use south pole region interp pnts continue normal case…
  • 18. A Map-Reduce application Map: Stage1 Reduce: Stage 2
  • 19. Outline Remap model in the Earth System Model Design of Threp Implementation Bilinear in action Demo Future work
  • 20. Architecture bilinear idw patch conserve interp search solver prediction geometry io NetCDF MPI/TCP-IP Pydoop clusters
  • 21. Embrace Python User friendly(geoscience user) Recursive efficiency: Easy to code, easy to read loop version of kd-tree More integrated libraries(no more repeated wheels) Auto type checking:
  • 22. Embrace Python < 4000 LOC! (so far) 12th day, available!
  • 23. Grid File SCRIP Grid Format 2D lat/lon coords(degrees/radians units supported) Atmosphere grid with mask or no mask
  • 24. Nearest k + Select Heuristic
  • 25. Solver -solve weights for each dst grid pnt Class +__init__() +solve_quadratics() +select_legal_root() Idw_Solver Bilinear_Solver Bilinear_Solver -solve idw weights -solve bilinear weights -solve bilinear weights +__init__() +solve() +__init__() +solve() +__init__() +solve() Solver Bilinear Interp -Bilinear remapping -Interpolation management class class +__init__() +__init__() +local_functions() +interp() +interp() +remap() +remap() +check_wgt() +check_wgtsum() +check_all_masks() +dst_distribute() Interp +dst_merge() Idw +indx_recovery() -Idw remapping class +compact_remap_matrix() +__init__() +learn() +local_functions() +deliver() +interp() +remap() Predictor Bilinear_Predictor -Preditor class -Bilinear predictor class Predictor +__init__() +__init__() +predict() +predict()
  • 26. MPI Python MPI library: mpi4py Linear speedup(stage1) 4min->2min->1min->30sec->…(not complete) Very fast for serial stage2, <0.2sec. necessary to parallelize? callback of MPI_Reduce interface?
  • 28. Outline Remap model in the Earth System Model Design of Threp Implementation Bilinear in action Demo Future work
  • 29. Bilinear Algorithm 𝑓 𝑥, 𝑦 = 𝑎 + 𝑏𝑥 + 𝑐𝑦 + 𝑑𝑥𝑦 𝑓 𝑥 𝑘 , 𝑦 𝑘 = 𝑓 0,0 1 − 𝑥 𝑘 (1 − 𝑦 𝑘 ) + 𝑓 1,0 𝑥 𝑘 (1 − 𝑦 𝑘 ) + 𝑓 0,1 𝑦 𝑘 1 − 𝑥 𝑘 + 𝑓 1,1 𝑥 𝑘 𝑦 𝑘 𝑓 𝑥 𝑘 , 𝑦 𝑘 = 𝑓 0,0 𝑤1 + 𝑓 1,0 𝑤2 + 𝑓 0,1 𝑤3 + 𝑓 1,1 𝑤4 For irregular bilinear box, a similar way to calculate𝑤1, 𝑤2, 𝑤3, 𝑤4 (2011/8, wuhong)
  • 30. Extrapolation Case Source grid masked atm2ocn & ocn2atm Destination grid masked ignore Coupled bilinear Can extrapolation as accurate as interpolation? Yes, a property that…
  • 31. Still Two Stage 𝑓 𝑥1, 𝑦1 = 𝑎 + 𝑏𝑥1 + 𝑐𝑦1 + 𝑑𝑥1 𝑦1 𝑓 = 𝑓 𝑥1, 𝑦1 𝑓 𝑥1, 𝑦1 𝑓 𝑥1, 𝑦1 𝑓 𝑥1, 𝑦1 𝑇 𝑓 𝑥2, 𝑦2 = 𝑎 + 𝑏𝑥2 + 𝑐𝑦2 + 𝑑𝑥2 𝑦2 𝑓 = 𝐶𝑦 1 𝑥1 𝑦1 𝑥1 𝑦1 𝑓 𝑥3, 𝑦3 = 𝑎 + 𝑏𝑥3 + 𝑐𝑦3 + 𝑑𝑥3 𝑦3 1 𝑥2 𝑦2 𝑥2 𝑦2 𝑇 𝑓 𝑥4, 𝑦4 = 𝑎 + 𝑏𝑥4 + 𝑐𝑦4 + 𝑑𝑥4 𝑦4 𝐶= 𝑦= 𝑎 𝑏 𝑐 𝑑 1 𝑥3 𝑦3 𝑥3 𝑦3 1 𝑥4 𝑦4 𝑥4 𝑦4 4×4 Solving inversion of a 4×4 Matrix C 𝑓 𝑥 𝑘 , 𝑦 𝑘 = 𝑎 + 𝑏𝑥 𝑘 + 𝑐𝑦 𝑘 + 𝑑𝑥 𝑘 𝑦 𝑘 𝑓 𝑘 = 𝑧𝑦 𝑓 𝑘 = 𝑧𝐶 −1 𝑓 𝑧 = [1 𝑥 𝑘 𝑦 𝑘 𝑥 𝑘 𝑦 𝑘 ] 𝑓 𝑘 = 𝑤𝑓 𝑤 = 𝑧𝐶−1
  • 32. Piece of Results T42 -> POP43: are: 8.74e-5 mre: 0.00596 Better than idw! POP43->T42: Better than idw mixed bilinear! are: 0.000238 mre: 0.0829
  • 33. Outline Remap model in the Earth System Model Design of Threp Implementation Bilinear in action Demo Future work
  • 34. Discussion Unstructured grid source Periodic boundary problem of unstructured grid Specificity conservative remapping High dimensional remapping Restart Threp
  • 35. Outline Remap model in the Earth System Model Design of Threp Implementation Bilinear in action Demo Future work
  • 36. Roadmap Performance: More sub modules in Threp: PyPy interpreter derivation C extension of kernel code integral mapreduce version of Threp More algorithms: More grids: patch triple poles bicubic unstructured conservative(first & second) Graduate!!
  • 37. Conclusion Threp abstract remapping model in the Earth System Model Threp is a parallel remapping framework, supports masked/unstructured grid Threp is lightweight, easy to start A extrapolation coupled bilinear algorithm implemented in Threp, better accuracy High performance scalability Embrace Threp!!
  • 39. Acknowledge Google.com Stackoverflow.com Lanning Wang< wangln@bnu.edu.cn > Shunqiang Song< pinewall@gmail.com > Li Liu< liuli03@mails.tsinghua.edu.cn > Yushu Chen<>
  • 40. Thank you! Questions?