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

Bugfix - slstr not yet properly supported #92

Merged
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
7 changes: 5 additions & 2 deletions trollsched/boundary.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Copyright (c) 2014-2019 PyTroll community
# Copyright (c) 2014-2024 PyTroll community

# Author(s):

Expand Down Expand Up @@ -38,6 +38,9 @@
"avhrr-3": "avhrr",
"mwhs-2": "mwhs2"}

class InstrumentNotSupported(Exception):
"""Exception to capture cases when instrument are (yet) not supported."""


class SwathBoundary(Boundary):
"""Boundaries for satellite overpasses."""
Expand Down Expand Up @@ -79,7 +82,7 @@ def get_instrument_and_angle(self, overpass):
scan_angle = 55.4
instrument = "avhrr"
elif instrument.startswith("slstr"):
instrument = "slstr"
raise InstrumentNotSupported("SLSTR is a conical scanner, and currently not supported!")
elif overpass.satellite.name.startswith("aws"):
scan_angle = 55.25
instrument = "avhrr"
Expand Down
28 changes: 18 additions & 10 deletions trollsched/tests/test_satpass.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# Copyright (c) 2018 - 2021 Pytroll-schedule developers
# Copyright (c) 2018 - 2021, 2024 Pytroll-schedule developers

# Author(s):

Expand Down Expand Up @@ -31,6 +31,7 @@
from pyresample.geometry import AreaDefinition, create_area_def

from trollsched.boundary import SwathBoundary
from trollsched.boundary import InstrumentNotSupported
from trollsched.satpass import Pass

LONS1 = np.array([-122.29913729160562, -131.54385362589042, -155.788034272281,
Expand Down Expand Up @@ -342,6 +343,22 @@ def test_swath_coverage_metop(self):
cov = mypass.area_coverage(self.euron1)
assert cov == pytest.approx(0.357324, 1e-5)

def test_swath_coverage_slstr_not_supported(self):
"""Test Sentinel-3 SLSTR swath coverage - SLSTR is currently not supported!"""
# Sentinel 3A slstr
tstart = datetime(2022, 6, 6, 19, 58, 0)
tend = tstart + timedelta(seconds=60)

tle1 = "1 41335U 16011A 22156.83983125 .00000043 00000-0 35700-4 0 9996"
tle2 = "2 41335 98.6228 224.3150 0001264 95.7697 264.3627 14.26738650328113"
mypass = Pass('SENTINEL 3A', tstart, tend, instrument='slstr', tle1=tle1, tle2=tle2)

with pytest.raises(InstrumentNotSupported) as exec_info:
cov = mypass.area_coverage(self.euron1)

assert str(exec_info.value) == "SLSTR is a conical scanner, and currently not supported!"


def test_swath_coverage_fy3(self):
"""Test FY3 coverages."""
tstart = datetime.strptime("2019-01-05T01:01:45", "%Y-%m-%dT%H:%M:%S")
Expand All @@ -358,15 +375,6 @@ def test_swath_coverage_fy3(self):
cov = mypass.area_coverage(self.euron1)
assert cov == pytest.approx(0.786836, 1e-5)

# Sentinel 3A slstr
tstart = datetime(2022, 6, 6, 19, 58, 0)
tend = tstart + timedelta(seconds=60)

tle1 = "1 41335U 16011A 22156.83983125 .00000043 00000-0 35700-4 0 9996"
tle2 = "2 41335 98.6228 224.3150 0001264 95.7697 264.3627 14.26738650328113"
mypass = Pass('SENTINEL 3A', tstart, tend, instrument='slstr', tle1=tle1, tle2=tle2)
cov = mypass.area_coverage(self.euron1)
self.assertAlmostEqual(cov, 0.05305641490480109, 6)

def test_arctic_is_not_antarctic(self):
"""Test that artic and antarctic are not mixed up."""
Expand Down