Skip to content
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 CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Changes in 0.2.8 (under development)
## Changes in 0.2.8 (from 2026-05-08)

- Fix package discovery in `pyproject.toml` to ensure only `xarray_eopf`
(and its subpackages) is included in the PyPI wheel.
Expand Down
239 changes: 123 additions & 116 deletions docs/examples/sentinel_1_analysis.ipynb

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions docs/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ Additional parameters specific to each Sentinel mission are described below.

##### Sentinel-1

> Note: Support for Sentinel-1 GRD products in analysis mode is available.
> Support for SLC products is planned for a future release.
> Note: Support for Sentinel-1 GRD products in analysis mode is
> currently experimental and undergoing validation. Support for SLC products is
> planned for a future release.

Sentinel-1 GRD data is provided in radar geometry, defined by the coordinates
(`azimuth_time`, `ground_range`). To transform this data into an
Expand Down
3,930 changes: 0 additions & 3,930 deletions examples/sentinel_1_analysis.ipynb

This file was deleted.

4 changes: 2 additions & 2 deletions integration/test_sen1_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def test_open_dataset_sen1_grd(self):
)
self.assertTrue(result.time_delta < allowed_open_time)

self.assertIn("vv", ds)
self.assertIn("vh", ds)
self.assertIn("gamma0_vv", ds)
self.assertIn("gamma0_vh", ds)

assert_dataset_is_chunked(self, ds, verbose=show_chunking)
for var_name in ds.data_vars:
Expand Down
67 changes: 47 additions & 20 deletions tests/amodes/test_sentinel1.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def test_convert_datatree(self):

self.assertIs(out, expected)
args, kwargs = mocked.call_args
self.assertEqual(["vv"], list(args[0].data_vars))
self.assertEqual(["beta0_vv"], list(args[0].data_vars))
self.assertIs(args[3], self.dem)
self.assertEqual("bilinear", kwargs["interp_method"])
self.assertTrue(kwargs["apply_rtc"])
Expand Down Expand Up @@ -254,7 +254,6 @@ def test_get_dem_bbox_passthrough_and_crop_branch(self):
).chunk(dict(y=2, x=2))

out = sen1.get_dem([0, 0, 2, 2])
self.assertEqual("dem", out.name)
self.assertIn("lat", out.dims)
self.assertIn("lon", out.dims)
self.assertEqual(3, out.sizes["lat"])
Expand Down Expand Up @@ -462,13 +461,20 @@ def test_simulate_acquisition_without_rtc(self):
dims=("axis", "lat", "lon"),
coords={"axis": ["x", "y", "z"], "lat": [0.0, 1.0], "lon": [0.0, 1.0]},
)
pos_coeff = xr.DataArray(
gm_dem = GridMapping.from_dataset(dem_ecef.to_dataset(name="dem"))
sat_position = xr.DataArray(
np.zeros((2, 3)),
dims=("degree", "axis"),
coords={"degree": [1, 0], "axis": ["x", "y", "z"]},
attrs={"epoch": np.datetime64("2024-01-01T00:00:00")},
dims=("azimuth_time", "axis"),
coords={
"azimuth_time": np.array(
[
np.datetime64("2024-01-01T00:00:00"),
np.datetime64("2024-01-01T00:00:01"),
]
),
"axis": ["x", "y", "z"],
},
)
vel_coeff = pos_coeff.copy()
dist = xr.DataArray(
np.ones((3, 2, 2), dtype="float64"),
dims=("axis", "lat", "lon"),
Expand All @@ -478,7 +484,7 @@ def test_simulate_acquisition_without_rtc(self):
t = xr.DataArray(np.zeros((2, 2), dtype="float64"), dims=("lat", "lon"))
with patch.object(sen1, "backward_geocode", return_value=(t, dist, vel)):
acq = sen1.simulate_acquisition(
dem_ecef, pos_coeff, vel_coeff, apply_rtc=False
dem_ecef, gm_dem, sat_position, apply_rtc=False
)
self.assertIn("slant_range_time", acq)
self.assertNotIn("gamma_area", acq)
Expand All @@ -489,13 +495,20 @@ def test_simulate_acquisition_with_rtc(self):
dims=("axis", "lat", "lon"),
coords={"axis": ["x", "y", "z"], "lat": [0.0, 1.0], "lon": [0.0, 1.0]},
)
pos_coeff = xr.DataArray(
gm_dem = GridMapping.from_dataset(dem_ecef.to_dataset(name="dem"))
sat_position = xr.DataArray(
np.zeros((2, 3)),
dims=("degree", "axis"),
coords={"degree": [1, 0], "axis": ["x", "y", "z"]},
attrs={"epoch": np.datetime64("2024-01-01T00:00:00")},
dims=("azimuth_time", "axis"),
coords={
"azimuth_time": np.array(
[
np.datetime64("2024-01-01T00:00:00"),
np.datetime64("2024-01-01T00:00:01"),
]
),
"axis": ["x", "y", "z"],
},
)
vel_coeff = pos_coeff.copy()
dist = xr.DataArray(
np.ones((3, 2, 2), dtype="float64"),
dims=("axis", "lat", "lon"),
Expand All @@ -509,28 +522,41 @@ def test_simulate_acquisition_with_rtc(self):
patch.object(sen1, "compute_gamma_area", return_value=gamma),
):
acq = sen1.simulate_acquisition(
dem_ecef, pos_coeff, vel_coeff, apply_rtc=True
dem_ecef, gm_dem, sat_position, apply_rtc=True
)
self.assertIn("gamma_area", acq)

def test_compute_gamma_area_clips_negative(self):
dem_ecef = xr.DataArray(
np.ones((3, 1, 2), dtype="float64"),
np.ones((3, 2, 2), dtype="float64"),
dims=("axis", "lat", "lon"),
coords={"axis": ["x", "y", "z"], "lat": [0.0], "lon": [0.0, 1.0]},
coords={"axis": ["x", "y", "z"], "lat": [0.0, 1.0], "lon": [0.0, 1.0]},
)
gm_dem = GridMapping.from_dataset(dem_ecef.to_dataset(name="dem"))
area = xr.DataArray(
np.array([[[1.0, -1.0]], [[0.0, 0.0]], [[0.0, 0.0]]]),
np.array(
[
[[1.0, -1.0], [1.0, -1.0]],
[[0.0, 0.0], [0.0, 0.0]],
[[0.0, 0.0], [0.0, 0.0]],
]
),
dims=("axis", "lat", "lon"),
coords=dem_ecef.coords,
)
direction = xr.DataArray(
np.array([[[-1.0, -1.0]], [[0.0, 0.0]], [[0.0, 0.0]]]),
np.array(
[
[[1.0, -1.0], [1.0, -1.0]],
[[0.0, 0.0], [0.0, 0.0]],
[[0.0, 0.0], [0.0, 0.0]],
]
),
dims=("axis", "lat", "lon"),
coords=dem_ecef.coords,
)
with patch.object(sen1, "compute_dem_area", return_value=area):
gamma = sen1.compute_gamma_area(dem_ecef, direction)
gamma = sen1.compute_gamma_area(dem_ecef, gm_dem, direction)
self.assertTrue(np.all(gamma.values >= 0))
self.assertEqual(0.0, float(gamma.values[0, 1]))

Expand All @@ -548,7 +574,8 @@ def test_compute_dem_area(self):
dims=("axis", "lat", "lon"),
coords={"axis": ["x", "y", "z"], "lat": lat, "lon": lon},
)
area = sen1.compute_dem_area(dem_ecef)
gm_dem = GridMapping.from_dataset(dem_ecef.to_dataset(name="dem"))
area = sen1.compute_dem_area(dem_ecef, gm_dem)
self.assertEqual(("axis", "lat", "lon"), area.dims)

def test_sum_weights_and_gamma_weight_helpers(self):
Expand Down
Loading
Loading