Skip to content
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

Add option to choose EGM for external DEM in pyroSAR.snap.util.geocode #166

Open
peterfriedl opened this issue Oct 13, 2021 · 3 comments
Open

Comments

@peterfriedl
Copy link

With the newest version 0.14, the general support of EGM2008 for geoid correction of DEMs has been added. However, in the function pyroSAR.snap.util.geocode, the EGM that is applyied to an external DEM if externalDEMApplyEGM=True, is hardcoded to EGM96:

if dempar['externalDEMApplyEGM']:
get_egm_lookup(geoid='EGM96', software='SNAP')

It would be nice if in a future version an option is added to pyroSAR.snap.util.geocode, in wich the user can choose which EGM will be applied to the external DEM (EGM96 or EGM 2008), just like this is now the case for pyroSAR.auxdata.dem_create.

@johntruckenbrodt
Copy link
Owner

Hi @peterfriedl. You're right. However, I am not quite sure whether SNAP is able to apply the EGM2008 model. There is no option to select different geoid models in nodes like Terrain-Correction. The function get_egm_lookup only downloads the file (so SNAP does not run into an infinite loop when sitting behind a proxy), to my knowledge there is no such file for EGM2008 yet.

See these links for further details:
https://senbox.atlassian.net/browse/SITBX-849
https://forum.step.esa.int/t/terrain-correction-with-copernicus-dem/29025

According to this response, they are just applying EGM96 to the Copernicus DEM auto-download options as well.

Perhaps this option will be added in the next SNAP release, until then there is not much point adding it to snap.geocode.

@peterfriedl
Copy link
Author

peterfriedl commented Oct 13, 2021

Hi @johntruckenbrodt,
Ok, so e.g. changing

if dempar['externalDEMApplyEGM']:
  get_egm_lookup(geoid='EGM96', software='SNAP')

to

if dempar['externalDEMApplyEGM']:
  get_egm_lookup(geoid='EGM2008', software='PROJ')

has no effect on pyroSAR.snap.util.geocode and still the EGM96 will be applied, right?
So what is your recommended way to use an external DEM and apply EGM2008 in pyroSAR? Is it to correct for the geoid outside of pyroSAR and to use the corrected DEM as external DEM with setting externalDEMApplyEGM=False in pyroSAR.snap.util.geocode? Or can the EGM2008 be applied to an external DEM in GeoTIFF-format via pyroSAR.auxdata.dem_create and the resulting output be used as input to pyroSAR.snap.util.geocode (with externalDEMApplyEGM=False)?

@johntruckenbrodt
Copy link
Owner

The function pyrosar.auxdata.get_egm_lookup only downloads the file, but the actual correction is done by SNAP. Downloading the EGM2008 PROJ file will have no effect, because it cannot be used by SNAP.

Basically there are two ways of applying the correction: either with SNAP or with GDAL/PROJ.

You can use the function pyroSAR.auxdata.dem_create for preparing the external DEM including EGM2008 correction using GDAL. This function also calls get_egm_lookup internally (with software='PROJ') and then calls gdalwarp for the height conversion. GDAL internally uses PROJ for everything related to spatial reference systems (which itself needs dedicated files that are not part of the installation by default).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants