Add DEM

Post Reply
maps
Posts: 2
Joined: Tue Jun 11, 2019 6:02 pm
company / institution: University of Valencia - Image Processing Laboratory
Location: Spain

Add DEM

Post by maps » Wed Jul 17, 2019 12:22 pm

Dear Francois,

I would like to add a DEM interface in Sentinel2 processing. According to the documentation, it would be:
altitude: surface altitude in m
* a float
* a DEM instance such as:
SRTM(cache_dir=...) # srtm.py
GLOBE(directory=...) # globe.py
SRTM(..., missing=GLOBE(...))

I have edited level1_msi.py and put in altitude:
altitude=SRTM(https=//github.com/tkrajina/srtm.py),
However, I have a syntaxis error, Is altitude edited correctly?

Thanks in advance
Marcela
User avatar
fsteinmetz
Site Admin
Posts: 50
Joined: Fri Sep 07, 2018 1:34 pm
company / institution: Hygeos
Location: Lille, France
Contact:

Re: Add DEM

Post by fsteinmetz » Thu Jul 18, 2019 8:37 am

Dear Marcela,

The SRTM implementation in Polymer (polymer/srtm.py) is not related to github.com/tkrajina/srtm.py.
I think the comment # srtm.py was misleading, I was meaning that the SRTM3 class (the class is actually SRTM3, and not SRTM, I will fix the doc) is implemented in srtm.py, and GLOBE in globe.py.
To use the SRTM DEM, you don't have to edit level1_msi.py. Just pass a SRTM3 instance to your Level1_MSI object, as follows :

Code: Select all

from polymer.srtm import SRTM3
Level1_MSI(dirname, altitude=SRTM3())
You can pass further (optional) arguments to SRTM3, like cache_dir, to specify where the tiles will be downloaded.

Kind regards,
François
maps
Posts: 2
Joined: Tue Jun 11, 2019 6:02 pm
company / institution: University of Valencia - Image Processing Laboratory
Location: Spain

Re: Add DEM

Post by maps » Sat Jul 20, 2019 6:00 pm

Dear François,

Excuse me but it is not clear to me how to pass a SRTM3 instance to my Level1_MSI object.
According to my understanding about it, I have edited polymer_cli.py (Is it correct?), added the code lines at the begining of it and added a new argument called altitude='SRTM3'.

However I have this warning:

from geoutils.misc import ListOnDisk
ModuleNotFoundError: No module named 'geoutils'

I don't have clear the procedure. Could you be more specific with it? I really appreciate your help.

Kind regards

Marcela.
User avatar
fsteinmetz
Site Admin
Posts: 50
Joined: Fri Sep 07, 2018 1:34 pm
company / institution: Hygeos
Location: Lille, France
Contact:

Re: Add DEM

Post by fsteinmetz » Mon Jul 22, 2019 2:52 pm

Dear Marcela,

polymer_cli.py is a very basic command line interface to Polymer. You may edit this file but the recommended way of doing is that you write your own python script, import all necessary modules from Polymer and run it directly. This script may contain the following :

Code: Select all

from polymer.main import run_atm_corr
from polymer.level1_msi import Level1_MSI
from polymer.level2_nc import Level2_NETCDF
from polymer.srtm import SRTM3

run_atm_corr(Level1_MSI('<s2-msi_product>', altitude=SRTM3()), Level2_NETCDF('output.nc'))
It seems that you have done thing correctly.
Now about the SRTM module, there is indeed a bug : from geoutils.misc import ListOnDisk refers to a module that is missing, but the class ListOnDisk is actually not even used. Please remove this line and try again :) (and I will fix this in further releases of Polymer).

Cheers,
François
Post Reply