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

Merged
merged 13 commits into from
Nov 27, 2024
26 changes: 26 additions & 0 deletions pyorbital/geoloc_instrument_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,3 +548,29 @@ def ascat(scan_nb, scan_points=None):
[np.int32(scan_nb), 1]) + np.expand_dims(offset, 1))

return ScanGeometry(inst, times)


def slstr_nadir(scans_nb, scan_points=None):
"""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 scan_points is None:
scan_len = 3000 # samples per scan
scan_points = np.arange(scan_len)
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])

return ScanGeometry(inst, times)
16 changes: 15 additions & 1 deletion pyorbital/tests/test_geoloc.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@

"""Test the geoloc module."""


from datetime import datetime

import numpy as np

adybbroe marked this conversation as resolved.
Show resolved Hide resolved
from pyorbital.geoloc import ScanGeometry, geodetic_lat, qrotate, subpoint
from pyorbital.geoloc_instrument_definitions import amsua, ascat, atms, avhrr, hirs4, mhs, viirs
from pyorbital.geoloc_instrument_definitions import amsua, ascat, atms, avhrr, hirs4, mhs, slstr_nadir, viirs


class TestQuaternion:
Expand Down Expand Up @@ -291,3 +292,16 @@ def test_ascat(self):
geom = ascat(1, np.array([0, -1]))
np.testing.assert_allclose(
geom.fovs, expected_fovs, rtol=1e-2, atol=1e-2)

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

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)
np.testing.assert_allclose(geom.fovs, expected_fovs, rtol=1e-2, atol=1e-2)

geom = slstr_nadir(1, None)

np.testing.assert_equal(geom.fovs.size, 6000)
Loading