Commit 70caf5d5 authored by luroth's avatar luroth
Browse files

fix: NA if NA in canopy model

parent 7c03aa56
......@@ -196,6 +196,7 @@ def create_elevation_diff_GeoTiff(file_path_DTM, file_path_DSM, path_output_file
# Read DTM
dtm_ds = gdal.Open(file_path_DTM)
dtm_band1 = dtm_ds.GetRasterBand(1)
dtm_nodata_val = dtm_band1.GetNoDataValue()
dtm_arr = dtm_band1.ReadAsArray()
dtm_transform = dtm_ds.GetGeoTransform()
......@@ -242,6 +243,7 @@ def create_elevation_diff_GeoTiff(file_path_DTM, file_path_DSM, path_output_file
ph_arr = np.array(ph_arr, dtype=np.float32)
# set to nadata if no value in height model
ph_arr[np.where(dsm_arr == nondata_val)] = nondata_val
ph_arr[np.where(dtm_arr == dtm_nodata_val)] = nondata_val
# write geoTIFF
driver = gdal.GetDriverByName('GTiff')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment