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

Unable to read metadata (l3a,l3b) #28

Open
smfcrts opened this issue Nov 9, 2019 · 49 comments
Open

Unable to read metadata (l3a,l3b) #28

smfcrts opened this issue Nov 9, 2019 · 49 comments

Comments

@smfcrts
Copy link

smfcrts commented Nov 9, 2019

Hello,
I run L3A composite through command line:
/usr/bin/composite_processing.py --syntdate 20190901 --input "/mnt/archive/maccs_def/morocco/l2a/S2A_MSIL2A_20190813T112121_N0208_R037_T29SMS_20190813T114617.SAFE/S2A_OPER_SSC_L2VALD_29SMS____20190813.HDR " "/mnt/archive/maccs_def/morocco/l2a/S2B_MSIL2A_20190818T112119_N0208_R037_T29SMS_20190818T122949.SAFE/S2B_OPER_SSC_L2VALD_29SMS____20190818.HDR" "/mnt/archive/maccs_def/morocco/l2a/S2A_MSIL2A_20190823T112121_N0208_R037_T29SMS_20190823T114631.SAFE/S2A_OPER_SSC_L2VALD_29SMS____20190823.HDR" "/mnt/archive/maccs_def/morocco/l2a/S2A_MSIL2A_20190902T112111_N0208_R037_T29SMS_20190902T132637.SAFE/S2A_OPER_SSC_L2VALD_29SMS____20190902.HDR" "/mnt/archive/maccs_def/morocco/l2a/S2A_MSIL2A_20190912T112111_N0208_R037_T29SMS_20190912T114646.SAFE/S2A_OPER_SSC_L2VALD_29SMS____20190912.HDR" "/mnt/archive/maccs_def/morocco/l2a/S2B_MSIL2A_20190917T112119_N0208_R037_T29SMS_20190917T132014.SAFE/S2B_OPER_SSC_L2VALD_29SMS____20190917.HDR" "/mnt/archive/maccs_def/morocco/l2a/S2A_MSIL2A_20190922T112111_N0208_R037_T29SMS_20190922T114652.SAFE/S2A_OPER_SSC_L2VALD_29SMS____20190922.HDR" --res 10 --outdir "/mnt/archive/temp/20190901/29SMS/" --bands /usr/share/sen2agri/bands_mapping_s2_L8.txt --scatteringcoe /usr/share/sen2agri/scattering_coeffs_10m.txt --synthalf 25
It gave this error:
The following error occurred during application execution : /home/cudroiu/sen2agri/sen2agri-processors/ProductReaders/MetadataHelpers/src/MetadataHelperFactory.cpp:43:
itk::ERROR: MetadataHelperFactory(0x16a8810): Unable to read metadata from /mnt/archive/maccs_def/morocco/l2a/S2A_MSIL2A_20190813T112121_N0208_R037_T29SMS_20190813T114617.SAFE/S2A_OPER_SSC_L2VALD_29SMS____20190813.HDR
OTB app finished in: 0:00:04.178794
OTB application error

Please how can i overcome this issue

@smfcrts
Copy link
Author

smfcrts commented Nov 13, 2019

@lnicola please could you give a solution to this issue

@lnicola
Copy link
Contributor

lnicola commented Nov 15, 2019

@smfcrts sorry for the late reply. Can you tell us what version of the system you are running and maybe attach a copy of that HDR file?

@smfcrts
Copy link
Author

smfcrts commented Nov 15, 2019

Hello,
The version of the system is 2.0.1, and find below example of the HDR file(I changed here
S2A_OPER_SSC_L2VALD_29SMS____20190813.txt
the extension to .txt because i can't upload HDR file):
Uploading S2A_OPER_SSC_L2VALD_29SMS____20190813.txt…

@smfcrts
Copy link
Author

smfcrts commented Nov 18, 2019

@lnicola I sent a copy of attached HDR file,please have a look on it

@lnicola
Copy link
Contributor

lnicola commented Nov 18, 2019

I'll think about it when I find some time, but I didn't see anything obviously wrong there.

@smfcrts
Copy link
Author

smfcrts commented Nov 18, 2019

Thank you @lnicola

@smfcrts
Copy link
Author

smfcrts commented Jan 9, 2020

@lnicola Hi, did you have a look on the HDR file, because i still have the same problem even if the L2A products are well generated.

@lnicola
Copy link
Contributor

lnicola commented Jan 10, 2020

I couldn't see anything obviously wrong with the file. Can you upload the whole product somewhere (e.g. https://send.firefox.com) so I can pass it to my colleague who knows more about the L3A?

In the meanwhile, can you test with fewer input products in that command line? Even a single one, if it allows you. Also, what happens if you remove the first product from that list? Do you get an error on the second one as well?

@smfcrts
Copy link
Author

smfcrts commented Jan 10, 2020

I tested with only one product and it give the same error, and even if i remove the first one it give error on the second one. So which product should i upload?

@lnicola
Copy link
Contributor

lnicola commented Jan 10, 2020

Either of them, I suppose.

@smfcrts
Copy link
Author

smfcrts commented Jan 10, 2020

Do you think it could be a problem of permission?

@lnicola
Copy link
Contributor

lnicola commented Jan 10, 2020

It might be. Does cat /mnt/archive/maccs_def/morocco/l2a/S2A_MSIL2A_20190813T112121_N0208_R037_T29SMS_20190813T114617.SAFE/S2A_OPER_SSC_L2VALD_29SMS____20190813.HDR work from the account you're using to run the processor?

@smfcrts
Copy link
Author

smfcrts commented Jan 10, 2020

ok i'll try, what does cat do?

@lnicola
Copy link
Contributor

lnicola commented Jan 10, 2020

It should display the contents of that file (it's an XML) to the console/screen. If you get a "Permission denied" error, it means it's not working.

@smfcrts
Copy link
Author

smfcrts commented Jan 10, 2020

yes it works.

@lnicola
Copy link
Contributor

lnicola commented Jan 10, 2020

Can you also try this?

$ sudo yum -y install strace
$ strace -f /usr/bin/composite_processing.py --syntdate 20190901 --input [...] 2>&1 | tee log.txt # use the whole command line here

When it finishes, log.txt should contain the complete list of operating system calls done by the programs. If there's an OS error, it should show up in there.

PS: I just noticed that your original command line has this:

"/mnt/archive/maccs_def/morocco/l2a/S2A_MSIL2A_20190813T112121_N0208_R037_T29SMS_20190813T114617.SAFE/S2A_OPER_SSC_L2VALD_29SMS____20190813.HDR "

Note the extra space before the closing quote. Assuming the file doesn't have a space in its name, you'll get a file not found error on it.

On the other hand, you said you got the same error even after removing the first file, so...

@smfcrts
Copy link
Author

smfcrts commented Jan 10, 2020

the error mention that it couldn't read file, not the file doesn't exit.So I'll try right now what you suggest.

@lnicola
Copy link
Contributor

lnicola commented Jan 10, 2020

the error mention that it couldn't read file, not the file doesn't exit.So I'll try right now what you suggest.

I'm pretty sure it's the same thing (it can't read a file that doesn't exist).

@smfcrts
Copy link
Author

smfcrts commented Jan 10, 2020

I couldn't find the log file, it show information on terminal

@lnicola
Copy link
Contributor

lnicola commented Jan 10, 2020

There should be a log.txt file in the current directory (from the 2>&1 | tee log.txt part of the command.

@smfcrts
Copy link
Author

smfcrts commented Jan 10, 2020

PLease find attached the log file log.txt

@lnicola
Copy link
Contributor

lnicola commented Jan 10, 2020

The file you've attached is truncated:

"log.txt" 2394L, 182930C

It looks like you've opened the file with a text editor (vi?), then copied the screen contents and pasted it to this file. The original file had 2394 lines and 180 KB, while the one above has 38 lines.

@smfcrts
Copy link
Author

smfcrts commented Jan 10, 2020

ah yes you're right

@smfcrts
Copy link
Author

smfcrts commented Jan 10, 2020

because i run the command on sen2agri-service user, so how can i get the log file without using vim.

@smfcrts
Copy link
Author

smfcrts commented Jan 10, 2020

Here is the file but i run the command line with user log.txt

@lnicola
Copy link
Contributor

lnicola commented Jan 10, 2020

because i run the command on sen2agri-service user, so how can i get the log file without using vim.

You can copy it to your account with e.g. sudo cp ~sen2agri-service/log.txt ..

Here is the file but i run the command line with user log.txt

From the log: composite_processing.py: error: argument --synthalf is required

@smfcrts
Copy link
Author

smfcrts commented Jan 13, 2020

HI, I added synthalf to the command line.Please find attached the log.txt file
log.txt

@lnicola
Copy link
Contributor

lnicola commented Jan 13, 2020

error: argument --outdir is required

Can you test it beforehand (without strace) to make sure that the command works?

@smfcrts
Copy link
Author

smfcrts commented Jan 13, 2020

here is the log file without strace log.txt

@lnicola
Copy link
Contributor

lnicola commented Jan 13, 2020

All right, at least it's starting now. Can you try with strace? Maybe use strace -s256 -f composite_processing.py [...] this time, it will print the whole paths.

@smfcrts
Copy link
Author

smfcrts commented Jan 13, 2020

Here is the log file with strace -s256 -f log.txt

@lnicola
Copy link
Contributor

lnicola commented Jan 13, 2020

So it's not a missing file nor a permission issue. Can you make an archive of the product and upload it somewhere like https://send.firefox.com?

@smfcrts
Copy link
Author

smfcrts commented Jan 13, 2020

I was not able to upload the zip file through the link you sent

@lnicola
Copy link
Contributor

lnicola commented Jan 13, 2020

Is it larger than 1 GB? If so, you can make an account there, or try a different service.

@smfcrts
Copy link
Author

smfcrts commented Jan 13, 2020

I do, i created an account

@smfcrts
Copy link
Author

smfcrts commented Jan 13, 2020

@smfcrts
Copy link
Author

smfcrts commented Jan 16, 2020

HI @lnicola , please did you have a look on the link

@lnicola
Copy link
Contributor

lnicola commented Jan 16, 2020

I was able to reproduce the failure, and it seems to be related to the format of the product metadata. Specifically, we're now using a version of MAJA that outputs a different product format. If you look at https://logiciels.cnes.fr/fr/node/57?type=desc, you'll see two versions, "TM" and "noTM". We use the former, but you might have the other one.

Your product is similar to MACCS (the predecessor of MAJA) products and we can actually open it, but we reject it because of an over-eager validation. You can test it by opening the product HDR file and changing

        <Source>
            <System>MAJA</System>
            <Creator>MAJA_L2_NOMINAL_CHAIN</Creator>
            <Creator_Version>3.2.2</Creator_Version>
            <Creation_Date>UTC=2019-11-04T00:57:14</Creation_Date>
        </Source>

to

        <Source>
            <System>MACCS</System>
            <Creator>MAJA_L2_NOMINAL_CHAIN</Creator>
            <Creator_Version>3.2.2</Creator_Version>
            <Creation_Date>UTC=2019-11-04T00:57:14</Creation_Date>
        </Source>

After making the change the processing started, at least. I couldn't let it finish because of unrelated reasons.

We will probably fix the validation in a future version, but it might be easiest for you to just change the string in the HDR files. This can be done in an automated way. I can guide you through the process, if you want to take that route.

@smfcrts
Copy link
Author

smfcrts commented Jan 16, 2020 via email

@lnicola
Copy link
Contributor

lnicola commented Jan 16, 2020

Hi, what do you mean by the former one for maja output, it means you use
the version TM or noTM.

We use TM, I believe you have noTM.

So i have to change MAJA by MACCS? That 's it

Yes, in the System element. The Creator doesn't matter.

@smfcrts
Copy link
Author

smfcrts commented Jan 16, 2020 via email

@lnicola
Copy link
Contributor

lnicola commented Jan 16, 2020

It should, but you might as well replace that string in the HDR files to keep the L2A products that you already have.

@smfcrts
Copy link
Author

smfcrts commented Jan 16, 2020 via email

@lnicola
Copy link
Contributor

lnicola commented Jan 16, 2020

Not really tested, but something like:

$ sudo su -l sen2agri-service
$ find /mnt/archive/maccs_def/morocco/l2a/ -maxdepth 1 -name "*.HDR" -print0 | xargs -0 sed -i 's|<System>MAJA</System>|<System>MACCS</System>|'

You might need -maxdepth 2 instead of 1.

@smfcrts
Copy link
Author

smfcrts commented Jan 16, 2020 via email

@smfcrts
Copy link
Author

smfcrts commented Jan 17, 2020

I've got this error

cannot rename /mnt/archive/maccs_def/morocco/l2a/S2A_MSIL2A_20190614T112121_N0207_R037_T29SMS_20190614T114731.SAFE/sedI0PNHV: Permission denied

@lnicola
Copy link
Contributor

lnicola commented Jan 18, 2020

I'm not sure what that would happen. You ran it under the sen2agri-service system account, right? Does it not have permissions on that directory?

@smfcrts
Copy link
Author

smfcrts commented Jan 29, 2020

yes i ran under sen2agri-service system account and it have permission on that directory

@smfcrts
Copy link
Author

smfcrts commented Mar 3, 2020

@lnicola I overcome the problem, I replace in the HDR files to keep the L2A products that I already have. But when i installed Maja3.2.2 TM and i downloaded the appropriate gipp file it give's me error that gip CMN00 not found.

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

No branches or pull requests

2 participants