From 5226b4f62ba9702b854ba6995d756ddc156b5e13 Mon Sep 17 00:00:00 2001 From: Bogdan Popescu <68062990+bopopescu@users.noreply.github.com> Date: Thu, 23 Jul 2020 20:25:30 +0300 Subject: [PATCH] Removal of master-slave phrasing --- pycor_dem2dem_standalone_addmessage.py | 42 ++++++++++++------------ pycor_dem2dem_toolbox_addmessage.py | 42 ++++++++++++------------ pycor_dem2point_standalone_addmessage.py | 14 ++++---- pycor_dem2point_toolbox_addmessage.py | 12 +++---- 4 files changed, 55 insertions(+), 55 deletions(-) diff --git a/pycor_dem2dem_standalone_addmessage.py b/pycor_dem2dem_standalone_addmessage.py index 962647d..c633b3a 100644 --- a/pycor_dem2dem_standalone_addmessage.py +++ b/pycor_dem2dem_standalone_addmessage.py @@ -1,12 +1,12 @@ ''' pycor_dem2dem.py -Description: Coregister slave DEM to master DEM using Nuth-Kaeaeb algorithm. +Description: Coregister subordinate DEM to main DEM using Nuth-Kaeaeb algorithm. Reference: Nuth, C. and Kaeaeb, A. (2011): http://doi.org/10.5194/tc-5-271-2011 Inputs: -(1) master DEM -(2) slave DEM +(1) main DEM +(2) subordinate DEM (3) polygon shapefile of stable terrain Outputs: @@ -52,19 +52,19 @@ shutil.rmtree(dirOutputs) os.makedirs(dirOutputs) -# master DEM -DEM_master = "DEM_master.tif" +# main DEM +DEM_main = "DEM_main.tif" -# slave DEM -DEM_slave = "DEM_slave1.tif" +# subordinate DEM +DEM_subordinate = "DEM_subordinate1.tif" # stable terrain OffGlacier = "OffGlacier.shp" # Initializations iteration = 0 -DEM_slave_before = DEM_slave -DEM_slave_after = DEM_slave +DEM_subordinate_before = DEM_subordinate +DEM_subordinate_after = DEM_subordinate result_mean = [0] result_std = [0] ShiftX = [0] @@ -72,7 +72,7 @@ file_shiftVec = os.path.join(dirOutputs, "shiftVec" + ".csv") # delete unused variables -del DEM_slave +del DEM_subordinate # Define CosineFitting function def CosineFitting(x, a, b, c): @@ -84,13 +84,13 @@ def CosineFitting(x, a, b, c): arcpy.AddMessage("Iteration {0} is running!".format(iteration)) # DEM difference [m] - dh = Raster(DEM_master) - Raster(DEM_slave_after) + dh = Raster(DEM_main) - Raster(DEM_subordinate_after) - # slope of the slave DEM [degree] - slp = Slope(DEM_slave_after, "DEGREE", "1") + # slope of the subordinate DEM [degree] + slp = Slope(DEM_subordinate_after, "DEGREE", "1") - # aspect of the slave DEM [degree] - asp = Aspect(DEM_slave_after) + # aspect of the subordinate DEM [degree] + asp = Aspect(DEM_subordinate_after) # Mask 'dh' using statale terrain polygon dh_mask = ExtractByMask(dh, OffGlacier) @@ -184,7 +184,7 @@ def CosineFitting(x, a, b, c): logic4 = logic2 and logic3 if logic1 or logic4: - DEM_slave_final = "DEM_shift" + str(iteration-1) # just string + DEM_subordinate_final = "DEM_shift" + str(iteration-1) # just string sum_ShiftX = np.sum(ShiftX) sum_ShiftY = np.sum(ShiftY) @@ -194,16 +194,16 @@ def CosineFitting(x, a, b, c): arcpy.AddMessage("********************Final Result********************") arcpy.AddMessage("Note: results are saved in {0}".format(dirOutputs)) - arcpy.AddMessage("The final shifted DEM: {0}".format(DEM_slave_final)) + arcpy.AddMessage("The final shifted DEM: {0}".format(DEM_subordinate_final)) arcpy.AddMessage("The final shift X: {0:.1f}".format(sum_ShiftX)) arcpy.AddMessage("The final shift Y: {0:.1f}".format(sum_ShiftY)) break - # Shift the slave DEM - DEM_slave_after = "DEM_shift" + str(iteration) - arcpy.Shift_management(DEM_slave_before, DEM_slave_after, str(ShiftX1), str(ShiftY1)) - DEM_slave_before = DEM_slave_after + # Shift the subordinate DEM + DEM_subordinate_after = "DEM_shift" + str(iteration) + arcpy.Shift_management(DEM_subordinate_before, DEM_subordinate_after, str(ShiftX1), str(ShiftY1)) + DEM_subordinate_before = DEM_subordinate_after for i in range(iteration-1): diff --git a/pycor_dem2dem_toolbox_addmessage.py b/pycor_dem2dem_toolbox_addmessage.py index 53de72c..ee881fb 100644 --- a/pycor_dem2dem_toolbox_addmessage.py +++ b/pycor_dem2dem_toolbox_addmessage.py @@ -1,12 +1,12 @@ ''' pycor_dem2dem.py -Description: Coregister slave DEM to master DEM using Nuth-Kaeaeb algorithm. +Description: Coregister subordinate DEM to main DEM using Nuth-Kaeaeb algorithm. Reference: Nuth, C. and Kaeaeb, A. (2011): http://doi.org/10.5194/tc-5-271-2011 Inputs: -(1) master DEM -(2) slave DEM +(1) main DEM +(2) subordinate DEM (3) polygon shapefile of stable terrain Outputs: @@ -52,19 +52,19 @@ shutil.rmtree(dirOutputs) os.makedirs(dirOutputs) -# master DEM -DEM_master = arcpy.GetParameterAsText(1) +# main DEM +DEM_main = arcpy.GetParameterAsText(1) -# slave DEM -DEM_slave = arcpy.GetParameterAsText(2) +# subordinate DEM +DEM_subordinate = arcpy.GetParameterAsText(2) # stable terrain OffGlacier = arcpy.GetParameterAsText(3) # Initializations iteration = 0 -DEM_slave_before = DEM_slave -DEM_slave_after = DEM_slave +DEM_subordinate_before = DEM_subordinate +DEM_subordinate_after = DEM_subordinate result_mean = [0] result_std = [0] ShiftX = [0] @@ -72,7 +72,7 @@ file_shiftVec = os.path.join(dirOutputs, "shiftVec" + ".csv") # delete unused variables -del DEM_slave +del DEM_subordinate # Define CosineFitting function def CosineFitting(x, a, b, c): @@ -84,13 +84,13 @@ def CosineFitting(x, a, b, c): arcpy.AddMessage("Iteration {0} is running!".format(iteration)) # DEM difference [m] - dh = Raster(DEM_master) - Raster(DEM_slave_after) + dh = Raster(DEM_main) - Raster(DEM_subordinate_after) - # slope of the slave DEM [degree] - slp = Slope(DEM_slave_after, "DEGREE", "1") + # slope of the subordinate DEM [degree] + slp = Slope(DEM_subordinate_after, "DEGREE", "1") - # aspect of the slave DEM [degree] - asp = Aspect(DEM_slave_after) + # aspect of the subordinate DEM [degree] + asp = Aspect(DEM_subordinate_after) # Mask 'dh' using statale terrain polygon dh_mask = ExtractByMask(dh, OffGlacier) @@ -184,7 +184,7 @@ def CosineFitting(x, a, b, c): logic4 = logic2 and logic3 if logic1 or logic4: - DEM_slave_final = "DEM_shift" + str(iteration-1) # just string + DEM_subordinate_final = "DEM_shift" + str(iteration-1) # just string sum_ShiftX = np.sum(ShiftX) sum_ShiftY = np.sum(ShiftY) @@ -194,16 +194,16 @@ def CosineFitting(x, a, b, c): arcpy.AddMessage("********************Final Result********************") arcpy.AddMessage("Note: results are saved in {0}".format(dirOutputs)) - arcpy.AddMessage("The final shifted DEM: {0}".format(DEM_slave_final)) + arcpy.AddMessage("The final shifted DEM: {0}".format(DEM_subordinate_final)) arcpy.AddMessage("The final shift X: {0:.1f}".format(sum_ShiftX)) arcpy.AddMessage("The final shift Y: {0:.1f}".format(sum_ShiftY)) break - # Shift the slave DEM - DEM_slave_after = "DEM_shift" + str(iteration) - arcpy.Shift_management(DEM_slave_before, DEM_slave_after, str(ShiftX1), str(ShiftY1)) - DEM_slave_before = DEM_slave_after + # Shift the subordinate DEM + DEM_subordinate_after = "DEM_shift" + str(iteration) + arcpy.Shift_management(DEM_subordinate_before, DEM_subordinate_after, str(ShiftX1), str(ShiftY1)) + DEM_subordinate_before = DEM_subordinate_after for i in range(iteration-1): diff --git a/pycor_dem2point_standalone_addmessage.py b/pycor_dem2point_standalone_addmessage.py index aa8a70d..586d02e 100644 --- a/pycor_dem2point_standalone_addmessage.py +++ b/pycor_dem2point_standalone_addmessage.py @@ -1,12 +1,12 @@ ''' pycor_dem2point.py -Description: Coregister slave DEM to master DEM using Nuth-Kaeaeb algorithm. +Description: Coregister subordinate DEM to main DEM using Nuth-Kaeaeb algorithm. Reference: Nuth, C. and Kaeaeb, A. (2011): http://doi.org/10.5194/tc-5-271-2011 Inputs: -(1) master elevation points -(2) slave DEM +(1) main elevation points +(2) subordinate DEM (3) polygon shapefile of stable terrain Outputs: @@ -60,8 +60,8 @@ # the elevation field in point shapefile elev_point_fieldName = "z" -# slave DEM -DEM = "DEM_slave1.tif" +# subordinate DEM +DEM = "DEM_subordinate1.tif" # stable terrain OffGlacier = "OffGlacier.shp" @@ -92,10 +92,10 @@ def CosineFitting(x, a, b, c): arcpy.AddMessage("--------------------------------------------------------------") arcpy.AddMessage("Iteration {0} is running!".format(iteration)) - # Get the slope of the slave DEM [degree] + # Get the slope of the subordinate DEM [degree] slp = Slope(DEM_after, "DEGREE", "1") - # Get the aspect of the slave DEM [degree] + # Get the aspect of the subordinate DEM [degree] asp = Aspect(DEM_after) # Extract raster values using point shapefile diff --git a/pycor_dem2point_toolbox_addmessage.py b/pycor_dem2point_toolbox_addmessage.py index ec18892..81de947 100644 --- a/pycor_dem2point_toolbox_addmessage.py +++ b/pycor_dem2point_toolbox_addmessage.py @@ -1,12 +1,12 @@ ''' pycor_dem2point.py -Description: Coregister slave DEM to master DEM using Nuth-Kaeaeb algorithm. +Description: Coregister subordinate DEM to main DEM using Nuth-Kaeaeb algorithm. Reference: Nuth, C. and Kaeaeb, A. (2011): http://doi.org/10.5194/tc-5-271-2011 Inputs: -(1) master elevation points -(2) slave DEM +(1) main elevation points +(2) subordinate DEM (3) polygon shapefile of stable terrain Outputs: @@ -57,7 +57,7 @@ # point shapefile shp_points = arcpy.GetParameterAsText(1) -# slave DEM +# subordinate DEM DEM = arcpy.GetParameterAsText(2) # stable terrain @@ -92,10 +92,10 @@ def CosineFitting(x, a, b, c): arcpy.AddMessage("--------------------------------------------------------------") arcpy.AddMessage("Iteration {0} is running!".format(iteration)) - # Get the slope of the slave DEM [degree] + # Get the slope of the subordinate DEM [degree] slp = Slope(DEM_after, "DEGREE", "1") - # Get the aspect of the slave DEM [degree] + # Get the aspect of the subordinate DEM [degree] asp = Aspect(DEM_after) # Extract raster values using point shapefile