-
Notifications
You must be signed in to change notification settings - Fork 77
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
base: main
Are you sure you want to change the base?
Add slstr #98
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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): | ||||||
"""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) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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]) | ||||||
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. W293 blank line contains whitespace |
||||||
return ScanGeometry(inst, times) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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): | ||
|
@@ -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]) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
There was a problem hiding this comment.
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
?