Skip to content

CRS hard coded in Geoid conversion #19

@brentwilder

Description

@brentwilder

Issue:

  • CRS is hard coded in the geoid conversion (for the reference, snow-free DEM).
  • And also, Ames Stereo Pipeline was not automatically saving the ellipsoid CRS, causing the need for knowing the ellipsoid equivalent CRS after the transformation.

Solution:

Honestly, we should just move this whole piece out of the main pipeline and just keep it as a helper / utility function. If someone needs to transform their vertical datum of the reference DEM to match their lidar, we can just have a separate python file to do this.

Even for our use case, we have not used this once! And it's because we have been using the same ellipsoid DEM for all runs.

    if dem_is_geoid is True:
        # ASP needs NAVD88 conversion to be in NAD83 (not WGS84)
        nad83_dem = join(result_dir, 'demNAD_tmp.tif')
        gdal_func = join(asp_dir, 'gdalwarp')
        cl_call(f'{gdal_func} -t_srs EPSG:26911 {in_dem} {nad83_dem}', log)
        # Use ASP to convert from geoid to ellipsoid
        ellisoid_dem = join(result_dir, 'dem_wgs')
        geoid_func = join(asp_dir, 'dem_geoid')
        cl_call(f'{geoid_func} --nodata_value -9999 {nad83_dem} \
                --geoid NAVD88 --reverse-adjustment -o {ellisoid_dem}', log)
        # Set it back to WGS84
        ref_dem = join(result_dir, 'ellipsoid_DEM.tif')
        cl_call(f'{gdal_func} -t_srs EPSG:32611 {ellisoid_dem}-adj.tif {ref_dem}', log)

        # check for success
        if not exists(ref_dem):
            raise Exception('Conversion to ellipsoid failed')

        log.info('Merged DEM converted to ellipsoid per user input')

    else:
        # cl_call('cp '+ in_dem +' '+ ref_dem, log)
        ref_dem = in_dem
        log.info('Merged DEM was kept in original ellipsoid form...')

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions