SozaD Automatic Shifts Components Det
SozaD Automatic Shifts Components Det
SozaD Automatic Shifts Components Det
Based on Etienne Berthier’s tutorial (20 18) w ith contributions from C hristopher
Nuth, Oslo U niversity. In red, the textual Berthier’s w ords. In blue Diego S oza
comments.
S ummary
1. Introduction. ........................................................................................................................................................ 1
2. Find the shift by using Berthier code. .................................................................................................. 2
2.1. Testing the code to create a master DEM ................................................................................ 3
2.2. W orkDir configuration ......................................................................................................................... 3
2.2.1. Prepare the DEM for code compilation .............................................................................. 3
2.3. In ArcG is ...................................................................................................................................................... 4
2.3.1. Building the Data mask. .............................................................................................................. 4
2.3.2. Building the comparison mask. .............................................................................................. 4
2.3.3. C lipping the DEMs using the C omparison mask. .......................................................... 5
2.3.4 . Non-S table area mask creation. ............................................................................................ 5
2.3.5. S table area mask creation. ...................................................................................................... 6
2.4 . In ENVI .......................................................................................................................................................... 6
2.4 .1. S lope, aspect and curvature surfaces. ............................................................................... 6
2.4 .2. ROI generation from un-stable mask. ................................................................................. 8
2.4 .3. Building mask from stable mask. ........................................................................................... 9
2.5. In ArcG is (again) ..................................................................................................................................... 9
2.6 . In Explorer .................................................................................................................................................. 11
2.7. In Envi (again) .......................................................................................................................................... 11
2.8. In the IDL w orkbench .......................................................................................................................... 12
2.9. Analyzing the results ........................................................................................................................... 13
3. Find the shift by using the Nuth & Kääb (20 11) algorithm ....................................................... 13
4 . Apply the shift to the original image/DEM ....................................................................................... 19
5. References ...................................................................................................................................................... 20
1. Introduction.
The comparison of digital elevation models (DEMs) is getting more and more
commonly used to measure glacier elevation changes and, w ith a proper
assumption on the density of the material gained/loss, to estimate the glacier-
w ide or region-w ide mass balance. How ever, the DEMs (tw o or more) needs first
to be adjusted to account for horizontal/vertical shift betw een them. The vertical
shift w ill bias the mass balance. Maybe this is less obvious for the horizontal shift.
The elevation difference is large and related to the aspect (azimuth of the main
slope) of the terrain (Nuth and Kääb, 20 11). G iven that glaciers generally have a
preferred orientation, their elevation changes w ould be severely biases if
extracted readily from those shifted DEMs. DEMs need to be adjusted horizontally
and vertically first.
The method described here is the one used in Berthier et. al. (20 0 7) inspired by
Rodríguez et. al. (20 0 6 ), and w e could probably track it back to earlier papers.
This method compiled the efforts to find the shift by minimizing the standard
deviation of elevation difference off- glacier. A horizontal shift betw een the DEMs
w ill severely increase the standard deviation of their elevation difference but not
necessarily influence the mean. The idea is to iteratively shift horizontally a slave
DEM by increment until a minimum of the standard deviation of the difference is
reached. The procedure is w ritten using IDL, the programming language that
comes along w ith ENVI, so if you have ENVI on your machine you also have IDL
ready to use. The Berthier’s programming is very simple and probably not 10 0 %
computer efficient but it w orks.
The code w as tested in ENVI 5.3 and IDL 8.5 versions. S ome vectors and rasters
w ere obtained using ArcG is 10 .5 and their S patialAnalyst extension, and
ETG eoW izard tools.
After this first shift correction, nineteen slave DEMs w ere corrected to the 1955
Hycon DEM. In Berthier’s w ords “check that you can modify and run it yourself, I
suggest that you test it on a different pair of DEMs”.
A/ The reference or master DEM is the oldest one. The slave DEM is the new est
from the DEM pair.
B/ Both DEMs cover the same extension and have the same pixel resolution
(or G S D) in meters.
C/ The DEM sets should have the same horizontal reference (ideal the U TM
projection), thus the same height reference (geoidal or ellipsoidal
geodetical frame). In our case, w e use epsg: 32719 and ITRF96 .
2
2.1. Testing the code to create a master DEM
Previously the DEM1 w as shifted, as seen in Figure 1.
Figure 1. Left, the original 1955 DEM; center, the horizontal and vertical shifted DEM; right,
at the front the blacked polygons are the un-stable areas, in the background the dh in
meters betw een original and shifted DEM.
The required processing steps needed to create the files that w ill be processed
by the IDL program are:
2.3. In ArcG is
A “data mask” for DEM2 (w here elevation values exist) w as obtained using
the next sequence:
#ArcG IS
#G oal= build a data mask for any DEM
#Tool= S patial Analyst Tool/Map Algebra/Raster_C alculator/
mask1= "slave_DEM.tif" * 0 #its a S QL expression
output_raster= “DirW ork\mask_data_DEM2_v1.tif "
#Tool= S patial Analyst Tool/Reclass/Reclassify
Input raster= “DirW ork\ mask_data_DEM2_v1.tif "
Reclass_field= Value:0 :1;Value :NoData:NoData. #its a S QL expression
output_raster= “DirW ork\mask_data_DEM2_v2.tif"
#Tool= C onversion Tool/From Raster/Raster to Polygon
Input raster= “DirW ork\mask_data_DEM2_v2.tif"
Field= Value
Output polygon features= “DirW ork\mask_data_DEM2.shp".
,w here DirW ork= “H:\DEM\PAIR1_5584 \0 2_mask\”.
4
G raphics to Features”. The results of 2.3.1 and 2.3.2 procedures w ere
resumed in Figure 2.
Figure 2. The black line show s the boundary of the 1984 shaded-relief DEM; the
magenta rectangle represents the clip vector. In the background, the 1955 DEM
elevation.
2.4 . In ENVI
Note that all generated files must be exported in G eotiff format. My
suggestion is to open any (raster) DEM file, then save it as a Tiff file using
the option “file/save as/ tiff/G eoTIFF”; the option place automatically the
“.tif” extension in the output name.
C/ But, there’s a “file extension conflict”. As you can see in the follow ing Figure
captured from ArcC atalog, the tiff raster format steel continues as ENVI
raster format.
6
To correct it, w ith the mouse right button w e select “Export > Raster to
Different Format”. You can observe from the next figure the export
configuration. The output raster file w as w ritten at
“H:\DEM\PAIR1_5584 \0 3_input\2ndv_to_run_code\”.
7
2.4 .2. ROI generation from the un-stable mask.
A/ At this stage the DirW ork=
“H:\DEM\PAIR1_5584 \0 3_input\0 30 _1stv_to_export”.
B/ Drag and drop from the Explorer to ENVI the DEM1 tiff file.
C/ Open the unstable area vector mask file: “mask_1_on_U NS TABLE.shp”.
D/ C reate an ROI, importing a vector file (the .shp unstable mask). Follow the
sequence (1 to 4 ) in the next Figure.
8
2.4 .3. Building mask from the stable mask.
A/ G enerate the file “mask_1_on_S TABLE.tif” again w ith the same number of
columns/lines as the Reference DEM (Basic Tools > Masking > Build Mask>
Option > Import ROI & selected area off). Follow the sequence (1 to 4 ) in
the next Figure.
9
B/ To correct it, w ith the mouse right button w e select “Export > Raster to
Different Format”. You can observe from the next figure the export
configuration. The output raster file w as w ritten at
“H:\DEM\PAIR1_5584 \0 3_input\0 31_2ndv_to_run_code\”.
2.6 . In Explorer
A/ At this stage the DirW ork=
“H:\DEM\PAIR1_5584 \0 3_input\2ndv_to_run_code\”.
B/ U sing W inExplorer, copy and paste all the files from DirW ork to the folder
“H:\DEM\”.
11
It should see like this…
12
B/ C ompile. Run the program.
B/ The IDL program also outputs the shifted secondary DEM and a map of
elevation difference betw een the tw o DEMs show ing (S EC -REF). The
associated plot (in PostS cript format) illustrates the successive steps in the
minimization. You can open it w ith Adobe Acrobat Pro or other print layout
softw are reconstruction.
3. Find the shift by using the Nuth & Kääb (20 11) algorithm
13
The algorithm is based on the relationship betw een the elevation difference and
aspect. This method w orks independently from the 1/ described above. A typical
procedure w ith ENVI/IDL/EX C EL is as follow :
B/ U sing band 1 of the stacked file computes the slope and aspect using
Topographic Modelling (kernel = 3). Output = “PAIR1_DEM_S tacked
_after0 iter _topo”.
14
C/ G enerate the file “mask_1_out_G LA_on_DEM_after0 iter” also w ith the same
number of columns/lines as in the stacked file (mask > from vector file >
selected area ON, if the stacked file is open, ENVI w ill automatically the
good number of column/line). The mask w ill be generated from the
shapefile “ADT9_20 19_rock.shp”, file vector estimated erasing from
“ADT9.shp” file (the DEM1 and DEM2 data in PAIR1) the
“20 19_ice_snow _cw ater.shp” vector file (a vector that represents the snow
and ice maximum extents covering during the period).
15
The procedure is C /1 to make a ROI from the stable area, open the ROI
Tool>File>Import Vector, then select the .shp file, and follow the screen
captures.
16
Once the ROI w as created, then you can build a stable zone mask.
17
D/ Run the IDL program “Extract_RandomS ample_dh_for_Excel.pro” w here
20 0 0 0 randomly selected points w ill be extracted from the above
generated (dh, slope, aspect) matrices. A range of slopes can be selected
and points are extracted outside glaciers. W hen running this program w ith
IDL, you need first to launch “ENVI” at the prompt.
In the IDL, DO NOT FORG ET TO U PDATE the field name= '_after_0 _iter' for
each iteration
F/ Apply the “X , Y, Z” shift to the original slave DEM. This is done by opening
the DEM in ENVI and using Edit ENVI Header > Map Info and changing the
coordinates of the Easting, Northing. New coordinates can be found in the
Excel file in the spreadsheet “S hift”. They are found by subtracting the
value of the shift from the initial coordinates. Then using “ENVI/Basic
Tools/Band Math” and type the “b1-dh” expression, to correct the vertical
shift, w here “b1” is the original height values from reference DEM. The
output is saved as a geotiff file (example AS T14 DMO_20 0 5-0 2-
0 2_DEM_shifted_after_1_iter.tif or ENVI file if you prefer) and can be used
in a new loop starting w ith its stacking to the master DEM.
18
G/ The method needs several steps to converge so the above procedure step
1 to step 6 has to be run 3-4 times to converge
Results (show ing that convergence has been reached after 3 “loops”
If w e take the example of the shift found in section 1, the new coordinates of the
upper left pixels of the slave DEM w ill be:
3934 26 .6 - 4 8.6 = 393378.0
6 4 4 3511.9 - (-26 .6 ) = 6 4 4 3538.5
ENVI > Basic Tools> Band Math, b20 0 5-(-20 .8) can be used to correct the vertical
shift of the slave DEM.
If you w ant to match the Aster ortho-image (V3N) w ith shifted DEM you also have
to apply the E/W and N/S shift to its upper left coordinates.
The figure below compares the map of elevation differences, draw n w ith the
same color scale before/after applying the shifts
19
Figure 4 . Map of elevation difference obtained by subtracting the 2 February
20 0 5 and the 13 January 20 0 1 AS TER DEMs before (Left) and after (Right)
adjustment.
5. References
• Berthier, E., Arnaud, Y., Kumar, R., Ahmad, S ., W agnon, P. and C hevallier, P.:
Remote sensing estimates of glacier mass balances in the Himachal
Pradesh (W estern Himalaya, India), Remote S ens. Environ., 10 8(3), 327–338,
doi:10 .10 16 /j.rse.20 0 6 .11.0 17, 20 0 7.
• Nuth, C . and Kääb, A.: C o-registration and bias corrections of satellite
elevation data sets for quantifying glacier thickness change, C ryosph., 5(1),
271–290 , doi:10 .5194 /tc-5-271-20 11, 20 11.
• Paul, F., Bolch, T., Kääb, A., Nagler, T., Nuth, C ., S charrer, K., S hepherd, A.,
S trozzi, T., Ticconi, F., Bhambri, R., Berthier, E., Bevan, S ., G ourmelen, N., Heid,
T., Jeong, S ., Kunz, M., Lauknes, T. R., Luckman, A., Merryman Boncori, J. P.,
Moholdt, G ., Muir, A., Neelmeijer, J., Rankl, M., VanLooy, J. and Van Niel, T.:
The glaciers climate change initiative: Methods for creating glacier area,
elevation change and velocity products, Remote S ens. Environ., 16 2, 4 0 8–
4 26 , doi:10 .10 16 /j.rse.20 13.0 7.0 4 3, 20 15.
• Rodríguez, E., Morris, C . S . and Belz, J. E.: A global assessment of the S RTM
performance, Photogramm. Eng. Remote S ensing, 72(3), 24 9–26 0 ,
doi:10 .14 358/PERS .72.3.24 9, 20 0 6 .
20