Skip to content

Commit

Permalink
Merge pull request #24 from IGNF/dev
Browse files Browse the repository at this point in the history
dev dans master v1.3.1
  • Loading branch information
leavauchier authored Sep 13, 2023
2 parents 462efee + bf997a7 commit d6d5504
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# dev

# 1.3.1
- fix color: ensure that tmp orthoimages are deleted after use by using the namedTemporaryFile properly.

# 1.3.0
- color: support colorization for <0.2m clouds (including height=0/width=0)
- color: ceil width/height to have a bbox that contains all points
Expand Down
2 changes: 1 addition & 1 deletion pdaltools/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "1.3.0"
__version__ = "1.3.1"


if __name__ == "__main__":
Expand Down
14 changes: 8 additions & 6 deletions pdaltools/color.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,17 @@ def color(

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

tmp_ortho_irc = None
if color_ir_enabled:
tmp_ortho_irc = tempfile.NamedTemporaryFile().name
tmp_ortho_irc = tempfile.NamedTemporaryFile()
download_image_from_geoportail_retrying(
proj,
"ORTHOIMAGERY.ORTHOPHOTOS.IRC",
Expand All @@ -168,10 +170,10 @@ def color(
maxx,
maxy,
pixel_per_meter,
tmp_ortho_irc,
tmp_ortho_irc.name,
timeout_second,
)
pipeline |= pdal.Filter.colorization(raster=tmp_ortho_irc, dimensions="Infrared:1:256.0")
pipeline |= pdal.Filter.colorization(raster=tmp_ortho_irc.name, dimensions="Infrared:1:256.0")

pipeline |= pdal.Writer.las(
filename=output_file, extra_dims=writer_extra_dims, minor_version="4", dataformat_id="8"
Expand Down
4 changes: 2 additions & 2 deletions test/test_color.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ def test_epsg_fail():

def test_color_and_keeping_orthoimages():
tmp_ortho, tmp_ortho_irc = color.color(INPUT_PATH, OUTPUT_FILE, epsg)
assert Path(tmp_ortho).exists()
assert Path(tmp_ortho_irc).exists()
assert Path(tmp_ortho.name).exists()
assert Path(tmp_ortho_irc.name).exists()


def test_color_narrow_cloud():
Expand Down

0 comments on commit d6d5504

Please sign in to comment.