CNES / MAJA

Level-2A processor used for atmospheric correction and cloud-detection. The active repository is the one below, this one is kept to leave access to the older issues.
https://gitlab.orfeo-toolbox.org/maja/maja
Apache License 2.0
137 stars 25 forks source link

Cannot find SWBD files - Problem DTM creation #50

Closed coffeebread42 closed 4 years ago

coffeebread42 commented 4 years ago

Hello, I have a problem when I run the DTMcreation.py script. The error messages reads: Cannot find SWBD files! I believe I added correctly the address of the directory containing SRTM water body data, yet this error persist! I also tried unpacking the data into the directory and also just leaving the zip filed, but in both cases I got the same error. Attached is the full error message i2mj

petket-5 commented 4 years ago

Hi,

There is an updated version of the same script (with slightly different parameters, check readme for exemplary cmdline): https://github.com/CNES/Start-MAJA/tree/reprog-rc1/prepare_mnt

Can you please try with that instead?

Kind regards, Peter

coffeebread42 commented 4 years ago

Thank You Peter, I will try this out and let you know how it goes

coffeebread42 commented 4 years ago

Hello Peter When I try to run the script I get an error No module named 'Chain'. I tried looking and installing this module, but I couldn't find it. I did find a possible explanation for this error could be due to the lack of an init.py file, but in my case I do have an empty init.py file in the directory where the DTMCreation.py is located Could this be a problem with my python installation that I need to look out for? ier3

intiluna commented 4 years ago

Dear Coffeebread42,

The chain module is in the files (https://github.com/CNES/Start-MAJA/tree/reprog-rc1/Chain). You have to download all the branch: https://github.com/CNES/Start-MAJA/tree/reprog-rc1

Later you unzip, run the terminal from new recently downloaded folder "prepare_mnt" and there try python >>DTMCreation.py -h You will get a different set of commands compared to the previous version: "https://github.com/CNES/Start-MAJA/blob/master/prepare_dtm/Readme.md"

The info you would read is: usage: DTMCreation.py [-h] -p PRODUCT [-o OUT_DIR] [-d DEM_DIR] [-w WATER_DIR] [-t TEMP_DIR] [--type_dem TYPE_DEM] [-c COARSE_RES] [-v]

optional arguments: -h, --help show this help message and exit -p PRODUCT, --product PRODUCT The path to a Landsat-8, Venus or Sentinel-2 L1C/L2A product folder. -o OUT_DIR, --out_dir OUT_DIR Output directory. Default is the current directory. -d DEM_DIR, --dem_dir DEM_DIR The path to the folder containing the SRTM zip- archives.If not existing, an attempt will be made to download them. -w WATER_DIR, --water_dir WATER_DIR The path to the folder containing the GSW occurence .tif-files.If not existing, an attempt will be made to download them. -t TEMP_DIR, --temp_dir TEMP_DIR The path to temp the folder.If not existing, it is set to a /tmp/ location --type_dem TYPE_DEM DEM type. Default is 'SRTM'. -c COARSE_RES, --coarse_res COARSE_RES Coarse resolution in meters. Default is 240 -v, --version show program's version number and exit

Besides that, I have not try to create the dtm this way. I will try today and post here how it goes. Thank you Peter,

Cheers

intiluna commented 4 years ago

Dear Coffeebread42 and Peter,

I tried:

  1. Download water bodies information from: https://global-surface-water.appspot.com/download
  2. Set folders (temp files) and the rest (as described in the help description).
  3. Run the command: python DTMCreation.py -p /media/ernesto/cuatrot/peps_download/s2_dtmsample/S2A_MSIL1C_20190810T160911_N0208_R140_T16PDU_20190810T212513.SAFE/ -d /media/ernesto/cuatrot/maja_procesos/dtm/SRTM/ -w /media/ernesto/cuatrot/maja_procesos/dtm/GSW/ -t /media/ernesto/cuatrot/maja_procesos/dtm/tmp -o /media/ernesto/cuatrot/maja_procesos/dtm/DTM/

As a result it sends a message that it works but with some errors. Here is a screenshot:

screenshot_terminal_mntprep

I checked the temp folder and there is an occurrence.tif but nothing in the output folder. I also checked that is installed gdal_merge.py What could be the problem?

Thanks for your help,

petket-5 commented 4 years ago

Hi,

@coffeebread42 : As mention by @ILunaA , this is a module found directly inside the Start_maja directory. Did you check whether you cloned the whole Start_maja project?

@ILunaA Your gdal install is corrupted, this is not an error of DTMCreation. If you run the command gdal_merge.py -o /media/ernesto/cuatrot/maja_procesos/dtm/tmp... listed at the end of the error, you should be able to recreate it and thus be able to isolate it to an error related to gdal. If you installed gdal via pip/conda, it can be sufficient to just reinstall it.

Kind regards, Peter

intiluna commented 4 years ago

Dear Peter, Thank you for your comments. I managed to solve the gdal problem and now it works fine. It creates the 2 files: image

King regards,

coffeebread42 commented 4 years ago

Dear @petket-5 and @ILunaA Thank you very much for your help I managed to solve the problem