ubarsc / python-fmask

A set of command line utilities and Python modules that implement the ‘fmask’ algorithm
https://www.pythonfmask.org
GNU General Public License v3.0
75 stars 21 forks source link

sensingTimeStr = sensingTimeNode.text.strip() #18

Closed gillins closed 5 years ago

gillins commented 6 years ago

Original report by Anonymous.


Dear All,

I have this error when I try to run fmask_sentinel2makeAnglesImage.py:

Traceback (most recent call last): File "/home/userdata/python-fmask-0.4.5/bin/fmask_sentinel2makeAnglesImage.py", line 122, in mainRoutine() File "/home/userdata/python-fmask-0.4.5/bin/fmask_sentinel2makeAnglesImage.py", line 64, in mainRoutine info = sen2meta.Sen2TileMeta(filename=cmdargs.infile) File "/usr/local/lib/python2.7/dist-packages/fmask/sen2meta.py", line 37, in init sensingTimeStr = sensingTimeNode.text.strip() AttributeError: 'NoneType' object has no attribute 'text'

And I think the module is working,

fmask_sentinel2makeAnglesImage.py -h usage: fmask_sentinel2makeAnglesImage.py [-h] [-i INFILE] [-o OUTFILE]

optional arguments: -h, --help show this help message and exit -i INFILE, --infile INFILE Input sentinel-2 tile metafile -o OUTFILE, --outfile OUTFILE Output angles image file

Best regards,

gillins commented 6 years ago

Original comment by Neil Flood (Bitbucket: neilflood, GitHub: neilflood).


On the face of it, that looks like there is a problem with the XML metadata file you have given it. There should be a field called SENSING_TIME, which contains a date/time string. If there is not one of those, it would give a message like the one you have shown.

If you are unsure, you could attach the metadata file to this post and I could take a look.

You should also give us the command line you used to get this error, so we can see exactly what is happening.

Neil

gillins commented 6 years ago

Original comment by zgramos (Bitbucket: zgramos, GitHub: zgramos).


I have found the solution to my problem. I was giving as input to fmask_sentinel2makeAnglesImage.py the main S2 product 'MTD_MSIL1C.xml' file, which does not contain the information about 'SENSING_TIME'. The single S2 granule 'MTD_TL.xml' file should be used instead as input to fmask_sentinel2makeAnglesImage.py. A more clear specification about what xml file (S2 products contains many xml files) should be used as input may help the users. Thanks for support