Quadtree¶
The Quadtree
reduces the amount of displacement data by sub-sampling the InSAR displacement map. For efficient forward modelling it is important to have reasonably sized dataset.
The quadtree is made from hierarchically organized QuadNode
, a slice through of the tree’s nodes is then called leaves
.
Parameters defining the quadtree are:
epsilon
threshold controlling the leaves’ split, this is the displacement variance within a leave.nan_allowed
is the fraction of allowed NaN values before a leaf is dismissed.tile_size_max
andtile_size_min
define the maximum and minimum dimension of the tile in meter or degree
Kite realises the quadtree concept from Jónsson et al. (2002) 1.
Note
All nodes of the Quadtree
are built upon initialisation an instance.
Interactive quadtree parametrisation¶
The graphical user interface (GUI) spool
offers an interactive parametrisation of the quadtree. Start the program, click on tab Quadtree. Detailed instruction can be found in spool’s tutorial.
spool insar_displacement_scene.npz
Scripted quadtree parametrisation¶
The quadtree can also be parametrised by a python script. This example modifies the quadtree and saves the scene.
Tip
It is recommended to use the spool GUI for parametrisation of the quadtree and covariance.
import logging
from kite import Scene
logging.basicConfig(level=logging.DEBUG)
sc = Scene.import_data('test/data/20110214_20110401_ml4_sm.unw.geo_ig_dsc_ionnocorr.mat')
# For convenience we set an abbreviation to the quadtree
qt = sc.quadtree
# Parametrisation of the quadtree
qt.epsilon = 0.024 # Variance threshold
qt.nan_allowed = 0.9 # Percentage of NaN values allowed per tile/leave
# Be careful here, if you scene is referenced in degree use decimal values!
qt.tile_size_max = 12000 # Maximum leave edge length in [m] or [deg]
qt.tile_size_min = 250 # Minimum leave edge length in [m] or [deg]
print(qt.reduction_rms) # In units of [m] or [deg]
# >>> 0.234123152
for l in qt.leaves:
print l
# We save the scene in kite's format
sc.save('kite_scene')
# Or export the quadtree to CSV file
qt.export('/tmp/tree.csv')
Plotting the quadtree with matplotlib¶
We can also use Matplotlib to plot the Quadtree’s current leaves.
import numpy as num
import matplotlib.pyplot as plt
from matplotlib import cm, colors
from kite import Scene
sc = Scene.load('my_scene.yml')
qt = sc.quadtree
fig = plt.figure()
ax = fig.gca()
limit = num.abs(qt.leaf_medians).max()
color_map = cm.ScalarMappable(
norm=colors.Normalize(vmin=-limit, vmax=limit),
cmap=cm.get_cmap('RdBu'))
for rect, leaf in zip(qt.getMPLRectangles(), qt.leaves):
color = color_map.to_rgba(leaf.median)
rect.set_facecolor(color)
ax.add_artist(rect)
ax.set_xlim(qt.leaf_eastings.min(), qt.leaf_eastings.max())
ax.set_ylim(qt.leaf_northings.min(), qt.leaf_northings.max())
plt.show()
Footnotes
- 1
Jónsson, Sigurjón, Howard Zebker, Paul Segall, and Falk Amelung. 2002. “Fault Slip Distribution of the 1999 Mw 7.1 Hector Mine, California, Earthquake, Estimated from Satellite Radar and GPS Measurements.” Bulletin of the Seismological Society of America 92 (4): 1377–89. doi:10.1785/0120000922.