Skip to content

Commit

Permalink
Make return of decomp_and_color easier to read
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlesGaydon committed Jun 26, 2023
1 parent 9ad6cc8 commit 50ab635
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pdaltools/color.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,15 @@ def decomp_and_color(
pipeline |= pdal.Filter.colorization(raster=veget_index_file, dimensions="Deviation:1:256.0")
writer_extra_dims = ["Deviation=ushort"]

tmp_ortho = None
if color_rvb_enabled:
tmp_ortho = tempfile.NamedTemporaryFile().name
download_image_from_geoportail_retrying(
proj, "ORTHOIMAGERY.ORTHOPHOTOS", minx, miny, maxx, maxy, pixel_per_meter, tmp_ortho, timeout_second
)
pipeline |= pdal.Filter.colorization(raster=tmp_ortho, dimensions="Red:1:256.0, Green:2:256.0, Blue:3:256.0")

color_ir_enabled = None
if color_ir_enabled:
tmp_ortho_irc = tempfile.NamedTemporaryFile().name
download_image_from_geoportail_retrying(
Expand All @@ -176,7 +178,7 @@ def decomp_and_color(

# The files are deleted only when their reference are lost.
# See: https://docs.python.org/2/library/tempfile.html#tempfile.TemporaryFile
return tmp_ortho if color_rvb_enabled else None, tmp_ortho_irc if color_ir_enabled else None
return tmp_ortho, tmp_ortho_irc


# https://gis.stackexchange.com/questions/413191/python-pdal-error-reading-format-1-4-las-file-readers-las-error-global-enco
Expand Down

0 comments on commit 50ab635

Please sign in to comment.