SozaD Automatic Shifts Components Det

Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

AU TOMATIC S HIFT C OMPONENTS DETERMINATION FOR C ORREC TIONS

BETW EEN TW O DEMS . 20 21 February.

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.

In the original tutorial published in June 20 18, Berthier describes tw o methods of


DEM adjustments. In that document, He expresses “… the details of the methods
1
can be found in the referred papers, either in this inter-comparison performed in
the framew ork of the project G lacier C C I (Paul et al., 20 15)”. The author suggests
some advice:

• Advice 1: read the full tutorial before starting


• Advice 2: keep an untouched version of all files (IDL, EX C EL, etc… ) so that
you can come back to them if you need to.

2. Find the shift by using Berthier code.

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.

Originally the tutorial w as w ritten to handle tw o AS TER DEMs from C erro


Aconcagua and their surrounding glaciers, but this version w as adapted to adjust
a Master DEM generated from historical air photos orthorectification (using
Hycon 1955 mission flight) to a reference AW orld 3d-30 DEM, both DEMs in the
debris-covered G ran C achapoal glacier located in the southern Andes C ordillera.

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”.

The assumptions are:

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.

Open the file “Adjust_0 1_550 224 on0 0 _AW 3Dv21.txt”

#Line C omponent vector convention magnitude in meters


10 X d_E/W positive eastw ard 4 .85
11 Y d_N/S positive northw ard -5.90
25 Z d_Z positive upw ard -17.22

The required processing steps needed to create the files that w ill be processed
by the IDL program are:

2.2. W orkDir configuration


The first step is to define and configure the w ork Dir folder (follow ing “w d”). In
this example, the route is “H:\DEM\PAIR1_5584 \”. In w in10 x6 4 and using the
Explorer, create this structure:

• “0 1_base”, for placing the original DEM datasets


• “0 2_mask”, for holding the vectors, including masks.
• “0 3_input”, to store the DEM for code running.
• “0 4 _output”, to save the results.

2.2.1. Prepare the DEM for code compilation


In ArcC atalog, connect the w orking directory (w orkdir) folder. C opy the
shifted reference DEM file obtained from the first adjustment. (here
3
“0 1_550 224 _DEM_shifted_H_V_on_0 0 _AW 3Dv21_DEM.tif”) located in the
output folder, and paste it to the “H:/DEM/PAIR1_5584 /0 1_base” folder;
rename it as “0 1_550 224 .tif”. From now on, the master or reference DEM is
DEM1, and the slave DEM is DEM2.

2.3. In ArcG is

2.3.1. Building the Data mask.


The DEMs to be corrected using the shift estimations, covering the 1955-
20 19 period. The first pair is the 1955-1984 period. Both DEMs w ere created
from aerial historical air photos rectification. In this particular case, the
1984 DEM2 covers less area than the 1955 DEM1.

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\”.

2.3.2. Building the comparison mask.


At this stage the DirW ork= “H:\DEM\PAIR1_5584 \0 2_mask\”. W hen any DEM
does not cover the same area of the other one or an irregular polygon
represents the data for any DEM, the smallest DEM must be clipped using a
rectangular mask w hich also covers the greatest DEM data. This mask
named “data_clip.shp” has to be completed contained by the DEM2 mask,
to ensure a common comparison area for the DEM pair. U sing the « Draw
Tool » a rectangular area w as placed then converted using the “C onvert

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.3.3. C lipping the DEMs using the C omparison mask.


At this stage the DirW ork= “H:\DEM\PAIR1_5584 \0 2_mask\”. U sing the
#Tool= « S patial Analyst Tools/Extraction/Extract by Mask/ », both DEMs
w ere clipped using the “data_clip.shp” as a feature mask, then stored in
“H:\DEM\PAIR1_5584 \0 3_input\0 30 _1stv_to_export\” folder. The output
files w ere named as “0 1_550 224 .tif” for DEM1, and “0 2_84 0 20 4 .tif”.

2.3.4 . Non-S table area mask creation.


At this stage the DirW ork= “H:\DEM\PAIR1_5584 \0 2_mask\”. Assuming that
the maximum frontal regrading and minimal area extension should occur
in the final 20 19 year, a snow cover, w ater bodies, and ice-free and ice
debris-covered inventories w ere delivered using a combination of S entinel
2a, Planet and G eoEye normalized indexes, and manual delineation assisted
from the shaded-relief interpretation, alw ays supported from commonly
used glacier inventories (as RG I, “Inventario Publico de glaciares” DG A
office, 20 14 ). The output is a shapefile named “mask_1_on_U NS TABLE.shp”.
5
2.3.5. S table area mask creation.
At this stage the DirW ork= “H:\DEM\PAIR1_5584 \0 2_mask\”. Before any
raster operation, there is a need to get and time-stable (dh/dt) vector mask.
The literature evidence indicates that zone w as characterized as the
surrounding out-glacier area, normally ice, snow , permafrost, and/or
w ater-free, w ith a slope <12° grade, usually cover by rock extrusions. This
stable mask w as generated erasing from the “data_clip.shp” features the
“mask_1_on_U NS TABLE.shp” vector file. The output file w as named
“mask_1_on_S TABLE.shp”.

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.

2.4 .1. S lope, aspect, and curvature surfaces.


A/ At this stage the DirW ork=
“H:\DEM\PAIR1_5584 \0 3_input\0 30 _1stv_to_export\”.
B/ From DEM1 data, compute the slope, aspect, Maximum curvature surfaces,
using ENVI> Topographic>Topographic Modelling (kernel = 3). The three-
band raster result is stored in DirW ork and then the output file is
“0 1_550 224 _DEM_TOPO.tif” (see Figure below ).

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.

2.5. In ArcG is (again)


A/ There’s a “file extension conflict”. As you can see in the follow ing Figure
captured from ArcC atalog, the .tiff mask steel continues as ENVI raster
format.

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\”.

C/ At this stage the DirW ork=


“H:\DEM\PAIR1_5584 \0 3_input\0 30 _1stv_to_export\”. S elect DEM1 and
DEM2 tif files, then C opy.
10
… and paste them in “H:\DEM\PAIR1_5584 \0 3_input\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\”.

2.7. In Envi (again)


A/ At this level the DirW ork= “H:\DEM\”.
B/ As show n in the next image, select, drag and drop from the Explorer to ENVI
the DEM1, DEM2, DEM1_TOPO, and MAS K tiff files.

11
It should see like this…

2.8. In the IDL w orkbench


A/ Open “C oregistration_2dems.pro”. C heck the routes, the min/max
parameters for altitude and slope. C heck the input names.

12
B/ C ompile. Run the program.

2.9. Analyzing the results


A/ The output from the IDL program. Open the file
“Adjust_0 2_84 0 20 4 on0 1_550 224 .txt”

#Line_source C omponent vector convention magnitude in


meters
positive
10 X d_E/W -128.36
eastw ard
positive
11 Y d_N/S -32.33
northw ard
25 Z d_Z positive upw ard -238.4 6

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 :

A/ S tacked the DEMs in a common projection. G enerate file


“PAIR1_DEM_S tacked _after0 iter”. Make sure that the 20 0 1 reference DEM
is in Band 1 of the stacked file! The stacking needs to be “Exclusive” (= only
the overlapping area of the DEM is of interest) and I suggest a “C ubic
C onvolution” for resampling (Bilinear should also w ork, one could test the
sensitivity to this choice if he has time).

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

E/ Import the output “dh_slope_aspect_after0 iter.txt” in Excel and C opy and


paste the result in the spreadsheet “C o-Registration Tool_1iter” of the file
“Nuth_C o-Registration_Aconcagua_20 0 0 0 pts.xls”. W hen importing the
“.txt” file in excel, remember to select the “delimited” option and choose
“spaced” as delimitator. This file is courtesy of C . Nuth. You need the EX C EL
S OLVER to be installed! Read carefully the “Instructions for use” before
w orking w ith this file.

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”

After_1_iter After_2_iter After_3_iter After_4 _iter Total S hift


dE 4 4 .9 6 .5 -1.4 0 .0 4 9.9
dN -24 .3 -4 -0 .3 0 .0 -28.6
dh -25.8 7.7 -2.1 0 .4 -19.8

4. Apply the shift to the original image/DEM

S ee how to do it in step 6 in section 2 above.

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

You might also like