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

Support old MTL format #13

Closed gillins closed 7 years ago

gillins commented 7 years ago

Original report by Xavier Corredor Llano (Bitbucket: XavierCLL, GitHub: XavierCLL).


Hi,

Python-fmask cannot process old MTL format such as LT50120541987003XXX10

Key error when try parse file:

#!bash
... ".../fmask/landsatangles.py", line 236, in sunAnglesForExtent

dateStr = mtlInfo['DATE_ACQUIRED']
KeyError: 'DATE_ACQUIRED'

Regards

Xavier

gillins commented 7 years ago

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


Hi Xavier,

thanks. I thought we had caught all those, but apparently not. I will look into it and make sure that works.

Thanks for letting us know. Neil

gillins commented 7 years ago

Original comment by Xavier Corredor Llano (Bitbucket: XavierCLL, GitHub: XavierCLL).


yeah, I understand

gillins commented 7 years ago

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


Hi Xavier,

I have pushed some changes which should take care of this oldest MTL format. Seems to work for me, but could you test and confirm, before I make a versioned release? Let me know what happens.

thanks

Neil

gillins commented 7 years ago

Original comment by Xavier Corredor Llano (Bitbucket: XavierCLL, GitHub: XavierCLL).


Thanks Neil!

Let me test it and I'll tell you how it's going....

gillins commented 7 years ago

Original comment by Xavier Corredor Llano (Bitbucket: XavierCLL, GitHub: XavierCLL).


Perfect! thanks Neil

gillins commented 7 years ago

Original comment by Xavier Corredor Llano (Bitbucket: XavierCLL, GitHub: XavierCLL).


Hi Neil!

This fixed for old MTL but introduce new bug for the new MTL using Landsat 8:

#!bash
... fmask/config.py", line 742, in readMTLFile
dict['DATE_ACQUIRED'] = dict['ACQUISITION_DATE']
KeyError: 'ACQUISITION_DATE'

relate commit 9d93bb0

gillins commented 7 years ago

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


Hi Xavier,

sorry, stupid of me. Those two extra lines were supposed to be conditional. I have fixed this, and it seems to load new files properly again.

I think it is OK now. Sorry not to have tested properly.

cheers

Neil

gillins commented 7 years ago

Original comment by Xavier Corredor Llano (Bitbucket: XavierCLL, GitHub: XavierCLL).


Thanks Neil for quick fix! I have tested with all version of Landsat and all works fine