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

Add slstr #98

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
30 changes: 30 additions & 0 deletions pyorbital/geoloc_instrument_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,3 +553,33 @@ def ascat(scan_nb, scan_points=None):
[np.int32(scan_nb), 1]) + np.expand_dims(offset, 1))

return ScanGeometry(inst, times)


def slstr(scans_nb, scan_points=None, is_nadir=True):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be called eg slstr_nadir?

"""Definition of the SLSTR instrument Nadir swath.

Source: Sentinel-3 SLSTR Coverage
https://sentinel.esa.int/web/sentinel/user-guides/Sentinel-3-slstr/coverage
"""

if not is_nadir:
raise NotImplementedError("SLSTR is only implemented for Nadir view.")

if scan_points is None:
scan_len = 3000 # samples per scan
scan_points = np.arange(3000)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
scan_points = np.arange(3000)
scan_points = np.arange(scan_len)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be tested also.

else:
scan_len = len(scan_points)
scan_angle_west = 46.5 # swath, degrees
scan_angle_east = -22.1 # swath, degrees

# build the slstr instrument scan line angles
scanline_angles = np.linspace(np.deg2rad(scan_angle_west),
np.deg2rad(scan_angle_east), scan_len)
inst = np.vstack((scanline_angles, np.zeros(scan_len,)))

inst = np.tile(inst[:, np.newaxis, :], [1, np.int32(scans_nb), 1])

times = np.tile(np.zeros_like(scanline_angles), [np.int32(scans_nb), 1])

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

W293 blank line contains whitespace

return ScanGeometry(inst, times)
15 changes: 14 additions & 1 deletion pyorbital/tests/test_geoloc.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import numpy as np

from pyorbital.geoloc import ScanGeometry, geodetic_lat, qrotate, subpoint
from pyorbital.geoloc_instrument_definitions import avhrr, viirs, amsua, mhs, hirs4, atms, ascat
from pyorbital.geoloc_instrument_definitions import avhrr, viirs, amsua, mhs, hirs4, atms, ascat, slstr


class TestQuaternion(unittest.TestCase):
Expand Down Expand Up @@ -287,6 +287,19 @@ def test_ascat(self):
self.assertTrue(np.allclose(
geom.fovs, expected_fovs, rtol=1e-2, atol=1e-2))

def test_slstr(self):
"""Test the definition of the slstr instrument flying on Sentinel-3
"""
geom = slstr(1, [0, 1])

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

W293 blank line contains whitespace

expected_fovs = np.array([
np.tile(np.array([[0.8115781, -0.38571776]]), [1, 1]),
np.tile(np.array([[0., 0.]]), [1, 1])], dtype=np.float64)
self.assertTrue(np.allclose(geom.fovs,
expected_fovs, rtol=1e-2, atol=1e-2))

with self.assertRaises(NotImplementedError):
slstr(1, [0, 1], is_nadir=False)

def suite():
"""The suite for test_geoloc
Expand Down