Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix orbit padding #36

Merged
merged 4 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10"]
include:
- os: windows-latest
python-version: "3.10"
Expand Down
26 changes: 20 additions & 6 deletions eof/scihubclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@ class ValidityError(ValueError):


def lastval_cover(
t0: datetime.datetime, t1: datetime.datetime, data: Sequence[SentinelOrbit]
t0: datetime.datetime,
t1: datetime.datetime,
data: Sequence[SentinelOrbit],
margin: datetime.timedelta = datetime.timedelta(minutes=5),
) -> str:
candidates = [
item for item in data if item.start_time <= t0 and item.stop_time >= t1
item
for item in data
if item.start_time <= (t0 - margin) and item.stop_time >= (t1 + margin)
]
if not candidates:
raise ValidityError(
Expand All @@ -45,8 +50,13 @@ class ScihubGnssClient:
T0 = datetime.timedelta(days=1)
T1 = datetime.timedelta(days=1)

def __init__(self, user: str = "gnssguest", password: str = "gnssguest",
api_url: str = "https://scihub.copernicus.eu/gnss/", **kwargs):
def __init__(
self,
user: str = "gnssguest",
password: str = "gnssguest",
api_url: str = "https://scihub.copernicus.eu/gnss/",
**kwargs
):
self._api = SentinelAPI(user=user, password=password, api_url=api_url, **kwargs)

def query_orbit(self, t0, t1, satellite_id: str, product_type: str = "AUX_POEORB"):
Expand Down Expand Up @@ -129,7 +139,9 @@ def query_orbit_by_dt(
product_type="AUX_POEORB",
)
try:
result = self._select_orbit(products, dt, dt + datetime.timedelta(minutes=1))
result = self._select_orbit(
products, dt, dt + datetime.timedelta(minutes=1)
)
except ValidityError:
result = None
else:
Expand Down Expand Up @@ -210,7 +222,9 @@ def get_full_eof_list(self, orbit_type="precise", max_dt=None):
max_saved = max([e.start_time for e in eof_list])
if max_saved < max_dt:
logger.warning("Clearing cached {} EOF list:".format(orbit_type))
logger.warning("{} is older than requested {}".format(max_saved, max_dt))
logger.warning(
"{} is older than requested {}".format(max_saved, max_dt)
)
self._clear_cache(orbit_type)
else:
logger.info("Using cached EOF list")
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="sentineleof",
version="0.6.5",
version="0.7.0",
author="Scott Staniewicz",
author_email="scott.stanie@gmail.com",
description="Download precise orbit files for Sentinel 1 products",
Expand Down
Loading