Error Processing Landsat-8

Post Reply
asim1212
Posts: 7
Joined: Mon Jul 29, 2019 10:51 am
company / institution: UiT, Norway
Location: Tromso

Error Processing Landsat-8

Post by asim1212 »

Hi,

I am running Polymer on OLI-8, it gives the following error.


/Data/mas108/ResearchData/IFT/EarthObservation/ArvenEtterNansen/workspace/muhammad/L8_S2_L1_2019/Data_2018/LC81790082018202LGN00
LC81790082018202LGN00
/Data/mas108/ResearchData/IFT/EarthObservation/ArvenEtterNansen/workspace/muhammad/L8_S2_L1_2019/Data_2018/Polymer_OLI/LC81790082018202LGN00
Reading coordinates from /Data/mas108/ResearchData/IFT/EarthObservation/ArvenEtterNansen/workspace/muhammad/L8_S2_L1_2019/Data_2018/LC81790082018202LGN00/LC08_L1TP_179008_20180721_20180731_01_T1_B1.TIF
Image size is 8961x8981
Traceback (most recent call last):
File "/Data/mas108/ResearchData/IFT/EarthObservation/ArvenEtterNansen/workspace/muhammad/Polymer/polymer-v4.13/Run_Polymer.py", line 69, in <module>
run_atm_corr(Level1_OLI(filename,
File "/Data/mas108/ResearchData/IFT/EarthObservation/ArvenEtterNansen/workspace/muhammad/Polymer/polymer-v4.13/polymer/level1_landsat8.py", line 147, in __init__
self.init_geometry()
File "/Data/mas108/ResearchData/IFT/EarthObservation/ArvenEtterNansen/workspace/muhammad/Polymer/polymer-v4.13/polymer/level1_landsat8.py", line 214, in init_geometry
assert len(filenames_sensor) == 1, 'Error, sensor angles file missing ({})'.format(str(filenames_sensor))
AssertionError: Error, sensor angles file missing ([])

Please advise.
User avatar
fsteinmetz
Site Admin
Posts: 306
Joined: Fri Sep 07, 2018 1:34 pm
company / institution: Hygeos
Location: Lille, France
Contact:

Re: Error Processing Landsat-8

Post by fsteinmetz »

Hello,
Indeed you need to generate the angles file. The documentation in level1_landsat8.py is a bit succinct, so here it is with some more details :

The command to run to generate the angles file is : l8_angles LC08_..._ANG.txt BOTH 1 -b 1

l8_angles is available at:
https://www.usgs.gov/land-resources/nli ... ient-files

It can be compiled with the following commands:

Code: Select all

wget https://landsat.usgs.gov/sites/default/files/documents/L8_ANGLES_2_7_0.tgz
tar xzf L8_ANGLES_2_7_0.tgz
rm -fv L8_ANGLES_2_7_0.tgz
cd l8_angles
make
cd ..
Cheers,
François
sydney.baratta
Posts: 11
Joined: Tue Aug 08, 2023 6:40 pm
company / institution: University of Maine
Location: Orono

Re: Error Processing Landsat-8

Post by sydney.baratta »

Hi François,

I ran into the same issue and tried your suggested steps (compiling l8_angles and then running l8_angles LC08_..._ANG.txt BOTH 1 -b 1') on v4.16. I think I might be making an error in that command, when I just called in the ANG.txt I received the error again. I receive the error:

(polymer) [sbaratta@katahdin polymer-v4.16]$ ./polymer_cli.py LC08_L1TP_001017_20230618_20230623_02_T1_ANG.txt BOTH 1 -b 1 testoutput.nc
usage: polymer_cli.py [-h] [-fmt {hdf4,netcdf4,autodetect}] input_file output_file
polymer_cli.py: error: unrecognized arguments: 1 -b 1 testoutput.nc\

Am I making an error in notation, or do you know why I am receiving this error?

Sydney
User avatar
fsteinmetz
Site Admin
Posts: 306
Joined: Fri Sep 07, 2018 1:34 pm
company / institution: Hygeos
Location: Lille, France
Contact:

Re: Error Processing Landsat-8

Post by fsteinmetz »

Hi Sydney,
It is the "l8_angles" command that should be used in the first place to generate the angles files, not polymer_cli.py.
polymer_cli.py should be run afterwards, once the angles file is present.
Cheers,
François
sydney.baratta
Posts: 11
Joined: Tue Aug 08, 2023 6:40 pm
company / institution: University of Maine
Location: Orono

Re: Error Processing Landsat-8

Post by sydney.baratta »

Hi François,
Thank you! I generated the (4) angle files now, but where am I supposed to put those files (ex/ keep them in l8_angles, move to polymer folder, or the LC08 folder)? I tried putting them in the same directory as the imagery (LC08...) but that didn't seem to be the right answer.

I am receiving this error, which looks like polymer can't find the angle files.

(polymer) [sbaratta@katahdin polymer-v4.16]$ ./polymer_cli.py LC08_L1TP_001017_20230618_20230623_02_T1/ output.nc

Traceback (most recent call last):
File "./polymer_cli.py", line 34, in <module>
run_atm_corr(Level1(args.input_file),
File "/home/sbaratta/Downloads/polymer-v4.16/polymer/level1.py", line 36, in __init__
self.autodetect()
File "/home/sbaratta/Downloads/polymer-v4.16/polymer/level1.py", line 64, in autodetect
raise Exception('Unable to detect sensor for file "{}"'.format(b))
Exception: Unable to detect sensor for file ""
lanzhiqishi
Posts: 44
Joined: Fri May 22, 2020 7:00 pm
company / institution: university of maine
Location: maine

Re: Error Processing Landsat-8

Post by lanzhiqishi »

Dear Sydney and François,


you should run command line as follows, i tried it works. then It will generate 4 files “sensor_B01”,“solar_B01”. finally, you copy 4 files to your LANDSAT8 directory, then run python . If we run lots of Landsat-8 by POLYMER4.16, also generate one by one, it would take lots of steps. Do you have any suggustions? thanks François


command line
cd /YOUR POLYMER DIR/

wget https://landsat.usgs.gov/sites/default/ ... _2_7_0.tgz
tar xzf L8_ANGLES_2_7_0.tgz
rm -fv L8_ANGLES_2_7_0.tgz
cd l8_angles
make
./l8_angles /public3/home/sc73004/software-sc73004/polymer-v4.16.1.tar/polymer-v4.16.1/LC08_L1TP_003017_20230616_20230623_02_T1/LC08_L1TP_003017_20230616_20230623_02_T1_ANG.txt BOTH 1 -b 1


Best,Binbin
lanzhiqishi
Posts: 44
Joined: Fri May 22, 2020 7:00 pm
company / institution: university of maine
Location: maine

Re: Error Processing Landsat-8

Post by lanzhiqishi »

Dear François,

i try Polymer v4.17beta2 for Landsat8 data, it errors. But i already make the landsat8 angles like this,viewtopic.php?f=7&t=136 . The angle file had genate in l8_angles.


Best,Binbin


(polymer) [sc73004@ln32%bscc-a2 polymer-v4.16.1]$ python runlandsat8Polymer.pyReading coordinates from /public3/home/sc73004/greenland/landsat8/LC08_L1TP_007013_20190617_20200828_02_T1/LC08_L1TP_007013_20190617_20200828_02_T1_B1.TIF
/public3/home/sc73004/.conda/envs/polymer/lib/python3.8/site-packages/osgeo/gdal.py:287: FutureWarning: Neither gdal.UseExceptions() nor gdal.DontUseExceptions() has been explicitly called. In GDAL 4.0, exceptions will be enabled by default.
warnings.warn(
Image size is 8361x8411
Traceback (most recent call last):
File "runlandsat8Polymer.py", line 19, in <module>
Level1_OLI('/public3/home/sc73004/greenland/landsat8/LC08_L1TP_007013_20190617_20200828_02_T1'),
File "/public3/home/sc73004/software-sc73004/polymer-v4.16.1.tar/polymer-v4.16.1/polymer-v4.16.1/polymer/level1_landsat8.py", line 159, in __init__
self.init_geometry()
File "/public3/home/sc73004/software-sc73004/polymer-v4.16.1.tar/polymer-v4.16.1/polymer-v4.16.1/polymer/level1_landsat8.py", line 242, in init_geometry
assert len(filenames_sensor) == 1, 'Error, sensor angles file missing ({})'.format(str(filenames_sensor))
AssertionError: Error, sensor angles file missing ([])
lanzhiqishi
Posts: 44
Joined: Fri May 22, 2020 7:00 pm
company / institution: university of maine
Location: maine

Re: Error Processing Landsat-8

Post by lanzhiqishi »

Dear all,

now it works, just copy these genrate files to the orginal Landsat8 directory.


Best,Binbin
Post Reply