pybob.coreg_tools¶
pybob.coreg_tools provides a toolset for coregistering DEMs, based on the method presented by Nuth and Kääb (2011).
-
pybob.coreg_tools.RMSE(indata)[source]¶ Return root mean square of indata.
Parameters: indata (array-like) – differences to calculate root mean square of Returns myrmse: RMSE of indata.
-
pybob.coreg_tools.create_stable_mask(img, mask1, mask2)[source]¶ Create mask representing stable terrain, given exclusion (i.e., glacier) and inclusion (i.e., land) masks.
Parameters: - img (pybob.GeoImg) – GeoImg to pull extents from
- mask1 (str) – filename for shapefile representing pixels to exclude from stable terrain (i.e., glaciers)
- mask2 (str) – filename for shapefile representing pixels to include in stable terrain (i.e., land)
Returns stable_mask: boolean array representing stable terrain
-
pybob.coreg_tools.dem_coregistration(masterDEM, slaveDEM, glaciermask=None, landmask=None, outdir='.', pts=False, full_ext=False, return_var=True, alg='Horn', magnlimit=2)[source]¶ Iteratively co-register elevation data.
Parameters: - masterDEM (str, pybob.GeoImg) – Path to filename or GeoImg dataset representing “master” DEM.
- slaveDEM (str, pybob.GeoImg) – Path to filename or GeoImg dataset representing “slave” DEM.
- glaciermask (str) – Path to shapefile representing points to exclude from co-registration consideration (i.e., glaciers).
- landmask (str) – Path to shapefile representing points to include in co-registration consideration (i.e., stable ground/land).
- outdir (str) – Location to save co-registration outputs.
- pts (bool) – If True, program assumes that masterDEM represents point data (i.e., ICESat), as opposed to raster data. Slope/aspect are then calculated from slaveDEM. masterDEM should be a string representing an HDF5 file continaing ICESat data.
- full_ext (bool) – If True, program writes full extents of input DEMs. If False, program writes input DEMs cropped to their common extent. Default is False.
- return_var (bool) – return variables representing co-registered DEMs and offsets (default).
- alg (str) – Algorithm for calculating Slope, Aspect. One of ‘ZevenbergenThorne’ or ‘Horn’. Default is ‘Horn’.
- magnlimit (float) – Magnitude threshold for determining termination of co-registration algorithm, calculated as sum in quadrature of dx, dy, dz shifts. Default is 2 m.
Returns masterDEM, outslave, out_offs: if return_var=True, returns master DEM, co-registered slave DEM, and x,y,z shifts removed from slave DEM.
If co-registration fails (i.e., there are too few acceptable points to perform co-registration), then returns original master and slave DEMs, with offsets set to -1.
-
pybob.coreg_tools.get_aspect(geoimg, alg='Horn')[source]¶ Wrapper function to calculate DEM aspect using gdal.DEMProcessing.
Parameters: - geoimg (pybob.GeoImg) – GeoImg object of DEM to calculate aspect
- alg (str) – Algorithm for calculating Aspect. One of ‘ZevenbergenThorne’ or ‘Horn’. Default is ‘Horn’.
Returns geo_aspect: new GeoImg object with aspect raster
-
pybob.coreg_tools.get_slope(geoimg, alg='Horn')[source]¶ Wrapper function to calculate DEM slope using gdal.DEMProcessing.
Parameters: - geoimg (pybob.GeoImg) – GeoImg object of DEM to calculate slope
- alg (str) – Algorithm for calculating Slope. One of ‘ZevenbergenThorne’ or ‘Horn’. Default is ‘Horn’.
Returns geo_slope: new GeoImg object with slope raster