8000 Updates to correctly check for vertical datums, improve mosaicking, options to select surveys to process by ShashankBice · Pull Request #9 · uw-cryo/lidar_tools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Updates to correctly check for vertical datums, improve mosaicking, options to select surveys to process #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
May 16, 2025

Conversation

ShashankBice
Copy link
Member

This PR implements the following updates:

  • Compares the 3DEP DSM with COP30 EGM2008 DSM over ESA worldcover v2.0 "bare and spare vegetation" surfaces and determines if a geoid to ellipsoid correction is required or not, and performs the corresponding datum correction.
  • Updates the pixi environment to allow for timely compiling, tested on both linux and mac arm machines.
  • Remove ASP dependency for mosaicking tiles
  • Use target-aligned-pixel tiling and mosaicking scheme using gdal tools for efficient mosaicking without the need for reprojection of tiles on the fly.
  • Ensures final mosaicked rasters are COG, with in-built Gaussian overviews
  • Introduces flexibility to select which 3DEP survey to process for a given tile
    • Default is first intersecting survey
    • Can select a specific survey to be processed by passing the name of the 3DEP survey required
    • Can select all surveys which intersect with the aoi tile (useful for large extent processing when the full aoi is covered by multiple 3DEP surveys acquired over several days/months/years)

@ShashankBice ShashankBice requested a review from scottyhq May 13, 2025 15:05



return readers, pointcloud_input_crs, extents, original_extents
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI is failing (https://github.com/uw-cryo/lidar_tools/actions/runs/15000341829/job/42145345525?pr=9) because this function now returns more things. Would be good to update the docstring for this function to clarify it now also returns extents and original extents. Feel free to change the test here to check for these new outputs:

readers, crslist = lidar_tools.dsm_functions.return_readers(input_aoi,

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docstring updated in: 1f9ca8c

Tried to update test here: 41fb7d5


Parameters
----------
input_aoi : shapely.geometry.Polygon
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not critical, but just noting you can move these type hints into the function definition, which has the advantage of given more feedback in code editors:

def return_reader_inclusive(input_aoi: shapely.geometry.Polygon,
                   src_crs: pyproj.CRS,
                   pointcloud_resolution: int=1):

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All functions have been now updated to include typehints in the function definition via: 1f9ca8c

"""
ds = gdal.Open(raster_fn, 1)
gdal.SetConfigOption('COMPRESS_OVERVIEW', 'DEFLATE')
ds.BuildOverviews("GAUSS",[2,4,8,16,32,64,128,256,512,1024,2048,4096],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a lot of overviews! Is it necessary to go beyond 64?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okies, updated here: 4416695

8000
srcSRS=src_srs, xRes=res, yRes=res,
dstSRS=dst_srs, errorThreshold=tolerance,
targetAlignedPixels=True,
creationOptions=['COMPRESS=LZW','TILED=YES','COPY_SRC_OVERVIEWS=YES'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
creationOptions=['COMPRESS=LZW','TILED=YES','COPY_SRC_OVERVIEWS=YES'],
format='COG'

I haven't used GDAL python bindings very much, but I wonder if that wouldn't be simpler? Would also automatically add overviews

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, COG is better option, as long as we can specify gauss resampling option to create overviews

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point Scott, COG would be better.
As per David's note, I checked the available overview resampling methods for the COG driver (https://gdal.org/en/latest/drivers/raster/cog.html), and Gaussian resampling is not available. I am leaving this as is, and added a note to revisit this in the future!

Copy link
Member
@scottyhq scottyhq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great @ShashankBice ! Thanks for all the hard work on this. Excited to start running some more tests and integration with coincident searches. I added a couple comments, but feel free to merge whenever and we can iterate on full up changes.

@ShashankBice
Copy link
Member Author

Thank you Scott and David for the feedback and ideas! The tests still fail, need to learn that from you, Scott 😊
Merging the PR for now!

@ShashankBice ShashankBice merged commit 2169b0f into main May 16, 2025
1 check failed
@scottyhq
Copy link
Member

The tests still fail

All good, I'd suggest changing to this when you get a chance. Eventually we should add tests for all these functions for two main reasons: 1. ensure outputs are correct, and 2. ensure future changes don't change existing workflows. Generally it's hard to guard against everything, but it's surprising how many issues even a few simple checks like the one below help catch issues in advance!

    assert len(readers) == 4
    assert {'type','filename','resolution', 'polygon'} == set(readers[0].keys())
    assert isinstance(crslist[0], pyproj.CRS)
    assert buff_reader_extent_list[0] == (-11863800.0, 4687040.0, -11856370.0, 4691980.0)
    assert original_dem_tile_grid_extent_list[0] == [-11863790.0, 4687050.0, -11856380.0, 4691970.0]

@ShashankBice ShashankBice deleted the datum_implement branch May 19, 2025 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0