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

Can not detect L1C product in the folder #72

Open hanamthang opened 3 years ago

hanamthang commented 3 years ago

I start MAJA with the basic command: ./startmaja -f /home/metal/Downloads/maja/build-pkg/MAJA-4.2.1/folder/folder.txt -t 60HVD -d 20200405

but the following errors appear: Error 1: ValueError: Cannot find ^T?60HVD$ in /home/metal/Downloads/maja/build-pkg/MAJA-4.2.1/folder/repL1 if name of L1C file as: S2A_MSIL1C_20200405T221601_N0209_R129_T60HVD_20200405T233012.SAFE

Error 2: OSError: No L1C products detected for tile 60HVD in /home/metal/Downloads/maja/build-pkg/MAJA-4.2.1/folder/repL1/60HVD if I rename L1C file as 60HVD.

What would be wrong in this case? Is it just the name of L1C file?

Many thanks, Thang

olivierhagolle commented 3 years ago

Hi, I have had this issue too !

In MAJA 4.2 (and not in MAJA 3.x) the L1C products should be stored, in your case, in : /home/metal/Downloads/maja/build-pkg/MAJA-4.2.1/folder/repL1/60HVD (or T60HVD)

Hope it solves your problem. Olivier

hanamthang commented 3 years ago

Hi, thank you for your support. Actually, I tested both:

  1. Renamed L1C file to 60HVD or T60HVD but still got error: OSError: No L1C products detected for tile 60HVD in /home/metal/Downloads/maja/build-pkg/MAJA-4.2.1/folder/repL1/60HVD

  2. Copy the scene in the GRANULE folder of S2 L1C image and then renamed to 60HVD or T60HVD but still error: OSError: No L1C products detected for tile 60HVD in /home/metal/Downloads/maja/build-pkg/MAJA-4.2.1/folder/repL1/60HVD

Is it the code error or something with the python library? I used the prepacked binary, extracted and installed MAJA using the file ".RUN". Version of MAJA is 4.2.1.

Regards, Thang

petket-5 commented 3 years ago

Hi Thang,

You should not rename the L1C folder. Instead, you should follow this file structure:

/work/S2-L1C
├── 31TCJ
│   ├── S2A_MSIL1C_20180401T105031_N0206_R051_T31TCJ_20180401T144530.SAFE
...
├── 31TFJ
│   └── S2B_MSIL1C_20190717T104029_N0208_R008_T31TFJ_20190717T142616.SAFE
├── 31UFR
│   ├── S2A_MSIL1C_20190821T104031_N0208_R008_T31UFR_20190821T111838.SAFE
│   ├── S2A_MSIL1C_20190903T105031_N0208_R051_T31UFR_20190903T125049.SAFE
...
├── 34WDC
│   ├── S2A_MSIL1C_20200403T105621_N0209_R094_T34WDC_20200403T114509.SAFE
...

If you have that structure, you need to set inside the folders.txt the parameter repL1C=/work/S2-L1C. Any other path is also fine as long as you store your L1C products in that structure.

Kind regards, Peter

hanamthang commented 3 years ago

Hi Peter,

Many thanks for the solution that worked. The MAJA can detect L1C Sentinel 2 now.

And I think the section Prepare folder and input files should be updated for the path to L1C and L2A. For new comer like me, I did not know how to set the name of the folder.

[Maja_Inputs]
repWork=./work
repGipp=./gipp
repMNT=./dtm
repL1  =/path/to/L1C
repL2  =/path/to/L2A
exeMaja=/path/to/bin/maja
repCAMS=/path/to/CAMS

[DTM_Creation]
repRAW=./dtm/raw 
repGSW=./dtm/gsw 
repL1  =/path/to/L1C
repL2  =/path/to/L2A

should change to

repL1 = ./work/S2-L1C/31TCJ
repL2 =./work/S2-L2A

or something like that which then enable MAJA detect L1C.

cimbelli commented 3 years ago

Hi, I've a similar issue. This is my command:

./bin/startmaja -f folders.txt -t 33TWF -s 33TWF -d 20200601 -e 20200630

and this is my folders.txt file:

[Maja_Inputs] repWork=/media/alex/dati_linux/s2/temp repGipp=/media/alex/DATI/gipp repL1 =/media/alex/DATI/L1C repL2 =/media/alex/DATI/L2A repMNT =/media/alex/DATI/dtm/ exeMaja=/opt/maja/bin/maja repCAMS=/media/alex/DATI/netdbl

[DTM_Creation] repRAW =/media/alex/DATI/dtm/raw repGSW =/media/alex/DATI/dtm/gsw

I've many images in the L1C folder, like /media/alex/DATI/L1C/202006/33TWF/S2A_MSIL1C_20200601T095041_N0209_R079_T33TWF_20200601T110247.SAFE/

But I receive the error:

2020-11-29 03:46:58,220 [INFO ] =============This is Start_Maja v4.2.0============== 2020-11-29 03:46:58,954 [WARNI] 33TWF Traceback (most recent call last): File "/opt/maja/lib/python/StartMaja/Start_maja.py", line 557, in type_dem=args.type_dem, skip_errors=args.skip_errors) File "/opt/maja/lib/python/StartMaja/Start_maja.py", line 66, in init self.path_input_l1, self.path_input_l2, self.site_info = self.__set_input_paths() File "/opt/maja/lib/python/StartMaja/Start_maja.py", line 233, in set_input_paths path_input_l1 = FileSystem.find_single(r"^T?%s$" % self.tile, site_l1) File "/opt/maja/lib/python/StartMaja/Common/FileSystem.py", line 127, in find_single return find(pattern, path, case_sensitive=case_sensitive, depth=depth, ftype=ftype)[0] File "/opt/maja/lib/python/StartMaja/Common/FileSystem.py", line 111, in find raise ValueError("Cannot find %s in %s" % (pattern, path)) ValueError: Cannot find ^T?33TWF$ in /media/alex/DATI/L1C/202006/33TWF

It seems strange because with the previous version of Maja I didn't get the error.

Kind regards, Alessandro

tnmthai commented 1 year ago

Hi there,

If you used: ./bin/startmaja -f folders.txt -t 33TWF -s 33TWFA -d 20200601 -e 20200630

Your folder should be: /media/alex/DATI/L1C/33TWFA /33TWF/S2A_MSIL1C_20200601T095041_N0209_R079_T33TWF_20200601T110247.SAFE/

I added "A" after 33TWF to make a difference between the two names.

Kind regards Thai