Skip to content
This repository was archived by the owner on Jun 14, 2021. It is now read-only.

Start date out of rangeΒ #9

@mark-boer

Description

@mark-boer

Hi everyone, really enjoy the project, very useful!

There seems to be a bug in the default argument of the start_date in the sentinel2 search function:

To reproduce:

>>> from aws_sat_api.search import sentinel2
>>> utm = 16
>>> lat = 'S'
>>> grid = 'DF'
>>> full_search = False
>>> level = 'l1c'
>>> s2_meta = sentinel2(utm, lat, grid, full_search, level)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\users\mark.boer\documents\git\aws-sat-api-py\aws_sat_api\search.py", line 183, in sentinel2
    raise ValueError(f"Start date out of range {start_date.year} < 2015.")
ValueError: Start date out of range 2014 < 2015.

Probable solution:

I live in the Netherlands, I think this problem lies in the fact that live in a timezone with a positive timezone offset.

I think this issue can be solved by adding a tzinfo=timezone.utc to search.py line 172

 start_date = start_date or datetime(2015, 1, 1, tzinfo=timezone.utc)

I'll create a PR later today :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions