Skip to content
Snippets Groups Projects
Commit 201ba448 authored by Narayanarao Bhogapurapu's avatar Narayanarao Bhogapurapu
Browse files

0.5.1

parent 00f5d49a
No related branches found
No related tags found
No related merge requests found
description: Estimates canopy height from InSAR coherence and LiDAR data description: Estimates canopy height from InSAR coherence and LiDAR data
algo_name: ich algo_name: ich
version: 0.5 version: 0.5.1
environment: ubuntu environment: ubuntu
repository_url: https://repo.maap-project.org/bnarayanarao/insar_forest_height.git repository_url: https://repo.maap-project.org/bnarayanarao/insar_forest_height.git
docker_url: mas.maap-project.org/root/maap-workspaces/base_images/python:v4.1.0 docker_url: mas.maap-project.org/root/maap-workspaces/base_images/python:v4.1.0
......
...@@ -20,6 +20,8 @@ options=() ...@@ -20,6 +20,8 @@ options=()
[[ "${2:-}" != "-" ]] && options+=("--upper_limit" "${2}") [[ "${2:-}" != "-" ]] && options+=("--upper_limit" "${2}")
[[ "${3:-}" != "-" ]] && options+=("--window" "${3}") [[ "${3:-}" != "-" ]] && options+=("--window" "${3}")
[[ "${4:-}" != "-" ]] && options+=("--validation" "${4}") [[ "${4:-}" != "-" ]] && options+=("--validation" "${4}")
[[ "${5:-}" != "-" ]] && options+=("--algorithm" "${5}")
[[ "${6:-}" != "-" ]] && options+=("--overlap" "${6}")
# Run the Python script with the determined options # Run the Python script with the determined options
${ich_py} --correlationFile "${correlationFile}" --cal_ht "${cal_ht}" "${options[@]}" ${ich_py} --correlationFile "${correlationFile}" --cal_ht "${cal_ht}" "${options[@]}"
\ No newline at end of file
...@@ -37,14 +37,13 @@ parser = argparse.ArgumentParser() ...@@ -37,14 +37,13 @@ parser = argparse.ArgumentParser()
parser.add_argument("-c", "--correlationFile", dest = "corFile", help="correlation file [0,1]") parser.add_argument("-c", "--correlationFile", dest = "corFile", help="correlation file [0,1]")
parser.add_argument("-l", "--cal_ht", dest = "lidarFile", help="Calibration height file e.g. LiDAR heights in (m)") parser.add_argument("-l", "--cal_ht", dest = "lidarFile", help="Calibration height file e.g. LiDAR heights in (m)")
parser.add_argument("-ll", "--lower_limit",dest ="htl", default = 0 ,help="lower limit of canopy height (m)", type=int) parser.add_argument("-ll", "--lower_limit",dest ="htl", default = None ,help="lower limit of canopy height (m)", type=int)
parser.add_argument("-ul", "--upper_limit",dest = "htg", default = 40,help="upper limit of canopy height (m)", type=int) parser.add_argument("-ul", "--upper_limit",dest = "htg", default = None,help="upper limit of canopy height (m)", type=int)
parser.add_argument("-w", "--window",dest = "window_size", default = 10, help="Size", type=int) parser.add_argument("-w", "--window",dest = "window_size", default = 10, help="Size", type=int)
parser.add_argument("-val", "--validation",dest = "validation", default = 0, help="fraction to split cross validation", type=float) parser.add_argument("-val", "--validation",dest = "validation", default = 0, help="fraction to split cross validation", type=float)
parser.add_argument("-al", "--algorithm",dest = "algo", default = 1, help="Algorithm Type", type=int) parser.add_argument("-al", "--algorithm",dest = "algo", default = 1, help="Algorithm Type", type=int)
parser.add_argument("-ol", "--overlap",dest = "window_overlap", default = 0, help="window overlap fraction", type=float) parser.add_argument("-ol", "--overlap",dest = "window_overlap", default = 0, help="window overlap fraction", type=float)
args = parser.parse_args() args = parser.parse_args()
......
...@@ -75,6 +75,14 @@ def rvog_inverse(args): ...@@ -75,6 +75,14 @@ def rvog_inverse(args):
lidar_ht[lidar_ht==0] = np.nan lidar_ht[lidar_ht==0] = np.nan
if args.htl==None and args.htg==None:
""" Calculating the upper limit of the heights to be estimated from the LiDAR data
Ceiling the upper limit to the closest multiple of 5 for the height at 99.9 percentile """
args.htl=0
pp99 = np.nanpercentile(lidar_ht,99.9)
args.htg = int( 5 * np.ceil( pp99 / 5. ))
lidar_ht[lidar_ht<args.htl] = np.nan lidar_ht[lidar_ht<args.htl] = np.nan
lidar_ht[lidar_ht>args.htg] = np.nan lidar_ht[lidar_ht>args.htg] = np.nan
cor[cor<0.1]=np.nan cor[cor<0.1]=np.nan
...@@ -113,7 +121,8 @@ def rvog_inverse(args): ...@@ -113,7 +121,8 @@ def rvog_inverse(args):
if not os.path.exists(outDir): if not os.path.exists(outDir):
os.mkdir(outDir) os.mkdir(outDir)
_postfix_str = '_w'+str(args.window_size)+'o'+"%02d" %(args.window_overlap*10)+"_"+str(args.htl)+str(args.htg) # _postfix_str = '_w'+str(args.window_size)+'o'+"%02d" %(args.window_overlap*10)+"_"+str(args.htl)+str(args.htg)
_postfix_str = f"_w{args.window_size}_{args.htl}_{args.htg}"
outcFile = os.path.join(outDir,os.path.basename(corFile).split('.tif')[0]+_postfix_str+'_c.tif') outcFile = os.path.join(outDir,os.path.basename(corFile).split('.tif')[0]+_postfix_str+'_c.tif')
outsFile = os.path.join(outDir,os.path.basename(corFile).split('.tif')[0]+_postfix_str+'_s.tif') outsFile = os.path.join(outDir,os.path.basename(corFile).split('.tif')[0]+_postfix_str+'_s.tif')
...@@ -410,9 +419,6 @@ def rvog_inverse(args): ...@@ -410,9 +419,6 @@ def rvog_inverse(args):
s = s*temp_mask s = s*temp_mask
c = c*temp_mask c = c*temp_mask
# c = np.nanmean([sw,c20,c50]) # c = np.nanmean([sw,c20,c50])
else: else:
raise ValueError('Invalid algorithm type!') raise ValueError('Invalid algorithm type!')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment