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:
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
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…
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:
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?
Extrapolation Case
Source grid masked
atm2ocn & ocn2atm
Destination grid masked
ignore
Coupled bilinear
Can extrapolation as accurate as interpolation?
Yes, a property that…
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!!