landsatxplore icon indicating copy to clipboard operation
landsatxplore copied to clipboard

Landsat 4 partly supported?

Open anikaweinmann opened this issue 3 years ago • 3 comments

I try to get Lansat 5 data and get an error: landsatxplore.errors.LandsatxploreError: Failed to guess dataset from identifier.

import landsatxplore.api
from landsatxplore.earthexplorer import EarthExplorer

bb=('-0.49799280', '5.48261312', '0.67396018', '6.03887914')

scenes = landsat_api.search(dataset='landsat_tm_c2_l2', bbox=bb,start_date='1990-10-01', end_date='1991-01-31', max_cloud_cover='15', max_results=50)
# scenes are: [{'cloud_cover': 15.0, 'entity_id': 'LT41930561990359XXX03', ...]

ee.download(identifier="LT41930561990359XXX03",  output_dir=outdir, timeout=int(options["timeout"]))
*** landsatxplore.errors.LandsatxploreError: Failed to guess dataset from identifier.

It seems that with landsat_tm_c2_l2 I get scenes from landsat 4 and 5 (https://github.com/yannforget/landsatxplore/blob/2a97d286e00b8eb2e765c27b85bbfeea7065aa8a/landsatxplore/util.py#L80), but 4 is not yet supported https://github.com/yannforget/landsatxplore/blob/2a97d286e00b8eb2e765c27b85bbfeea7065aa8a/landsatxplore/util.py#L90.

Is my assumption correct, or does the error come from somewhere else? And is it possible to integrate landsat 4 completely?

anikaweinmann avatar Mar 02 '21 10:03 anikaweinmann

Hi,

Yes your assumption is correct! I did not plan to support Landsat 4.

You could try with the following change?

def landsat_dataset(satellite, collection="c1", level="l1"):
    """Get landsat dataset name."""
    if satellite == 4 or satellite == 5:
        sensor = "tm"

yannforget avatar Mar 02 '21 11:03 yannforget

@yannforget Thank you this is working well. Is it okay to add this Landsat 4 support or better to remove it completely?

anikaweinmann avatar Mar 02 '21 12:03 anikaweinmann

@yannforget I tried to remove the Landsat 4 scene: https://github.com/yannforget/landsatxplore/pull/37

anikaweinmann avatar Mar 02 '21 13:03 anikaweinmann