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

Spatial subset and not use DEM for the coastal areas #75

Open hanamthang opened 3 years ago

hanamthang commented 3 years ago

Dear Colleges,

Could you please guide me the options in startmaja program to subset a small regions for quick processing. My computer is not strong enough to process entire scene of Sentinel - 2. I checked the options in startmaja but found no solutions.

In addition, can we turn off the functions of creating and using DEM during the process? Since my regions are the coastal areas, all the land will be masked after the atmospheric correction, therefore the DEM will not be necessary to me.

Recently, I processed a Sentinel - 2 scene but got the following error with DEM:

./startmaja -f /home/metal/Downloads/maja/MAJA-4.2.1/folder/folder.txt -t 60HVD
2020-10-23 14:51:49,572 [INFO ] =============This is Start_Maja v4.2.0==============
2020-10-23 14:51:49,793 [INFO ] Detecting input products...
2020-10-23 14:51:49,854 [INFO ] 1 L1C product(s) detected for tile 60HVD in /home/metal/Downloads/maja/MAJA-4.2.1/folder/work/S2-L1C/60HVD
2020-10-23 14:51:49,855 [WARNI] No L2A products detected for tile 60HVD in /home/metal/Downloads/maja/MAJA-4.2.1/folder/work/S2-L2A/60HVD
2020-10-23 14:51:49,920 [INFO ] Skipping CAMS file detection.
2020-10-23 14:51:49,920 [INFO ] Checking GIPP files
2020-10-23 14:51:49,920 [INFO ] Setting up GIPP folder: /home/metal/Downloads/maja/MAJA-4.2.1/folder/gipp
2020-10-23 14:51:49,934 [INFO ] Cannot find GIPP for SENTINEL2_NATIF. Will attempt to download it.
2020-10-23 14:51:49,935 [INFO ] Searching for DTM
2020-10-23 14:51:49,937 [INFO ] Cannot find DTM. Will attempt to download it for type 'any'
2020-10-23 14:51:49,937 [INFO ] Attempting to download DTM...
No input files selected.
Usage: gdal_merge.py [-o out_filename] [-of out_format] [-co NAME=VALUE]*
                     [-ps pixelsize_x pixelsize_y] [-tap] [-separate] [-q] [-v] [-pct]
                     [-ul_lr ulx uly lrx lry] [-init "value [value...]"]
                     [-n nodata_value] [-a_nodata output_nodata_value]
                     [-ot datatype] [-createonly] input_files
                     [--help-general]

2020-10-23 14:52:17,055 [ERROR] Command 'gdal_merge.py  -n -32767 -a_nodata 0 -q -o /tmp/raw_dem_lt1fwc75/eudem_10m.tif' returned non-zero exit status 1.
/home/metal/Downloads/maja/MAJA-4.2.1/lib/python/StartMaja/prepare_mnt/mnt/MNTBase.py:114: RuntimeWarning: divide by zero encountered in true_divide
  aspect = np.where(dz_dc > 0, np.arccos(dz_dl / norme), 2 * np.pi - np.arccos(dz_dl / norme))
/home/metal/Downloads/maja/MAJA-4.2.1/lib/python/StartMaja/prepare_mnt/mnt/MNTBase.py:114: RuntimeWarning: invalid value encountered in true_divide
  aspect = np.where(dz_dc > 0, np.arccos(dz_dl / norme), 2 * np.pi - np.arccos(dz_dl / norme))
/home/metal/Downloads/maja/MAJA-4.2.1/lib/python/StartMaja/prepare_mnt/mnt/MNTBase.py:114: RuntimeWarning: invalid value encountered in arccos
  aspect = np.where(dz_dc > 0, np.arccos(dz_dl / norme), 2 * np.pi - np.arccos(dz_dl / norme))
Killed

Thank you for all supports! Thang

olivierhagolle commented 3 years ago

Dear Thang,

I will let @petket-5 or @jerome-colin answer for your issue with DEM generation (it looks as if your computer was not able to download the input DTMs), but regarding the first question, we don't have implemented yet the possibility to run MAJA on a subset of Sentinel-2 images. There is however another possibility, which is to use PEPS on demand processing facility for MAJA :

https://github.com/olivierhagolle/maja_peps Best regards, Olivier

hanamthang commented 3 years ago

Dear Olivier,

Many thanks to your quick response. I successfully processed a Sentinel - 2 from L1C to L2A. It's quite costly using my computer (need 4 cores, 8 Gb RAM, and at least 50-60 Gb disk space free) but finally done.

In the meanwhile, I will try to process entire scene while waiting for the subset functions from MAJA.

Cheers, Thang