Skip to content

Commit

Permalink
Add passing ground_range to GRD directly
Browse files Browse the repository at this point in the history
  • Loading branch information
alexamici committed Feb 10, 2024
1 parent e2e0f82 commit 7653c5f
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions sarsen/datamodel.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import abc
from typing import Any, Dict, Tuple
from typing import Any, Dict, Optional, Tuple

import xarray as xr

Expand All @@ -26,8 +26,9 @@ def interp_sar(
self,
data: xr.DataArray,
azimuth_time: xr.DataArray,
slant_range_time: xr.DataArray,
slant_range_time: Optional[xr.DataArray] = None,
method: xr.core.types.InterpOptions = "nearest",
ground_range: Optional[xr.DataArray] = None,
) -> xr.DataArray:
...

Expand All @@ -51,12 +52,14 @@ def interp_sar(
self,
data: xr.DataArray,
azimuth_time: xr.DataArray,
slant_range_time: xr.DataArray,
slant_range_time: Optional[xr.DataArray] = None,
method: xr.core.types.InterpOptions = "nearest",
ground_range: Optional[xr.DataArray] = None,
) -> xr.DataArray:
ground_range = self.slant_range_time_to_ground_range(
azimuth_time, slant_range_time
)
if ground_range is not None:
ground_range = self.slant_range_time_to_ground_range(
azimuth_time, slant_range_time
)
interpolated = data.interp(
azimuth_time=azimuth_time, ground_range=ground_range, method=method
)
Expand All @@ -78,9 +81,11 @@ def interp_sar(
self,
data: xr.DataArray,
azimuth_time: xr.DataArray,
slant_range_time: xr.DataArray,
slant_range_time: Optional[xr.DataArray] = None,
method: xr.core.types.InterpOptions = "nearest",
ground_range: Optional[xr.DataArray] = None,
) -> xr.DataArray:
assert ground_range is None
interpolated = data.interp(
azimuth_time=azimuth_time, slant_range_time=slant_range_time, method=method
)
Expand Down

0 comments on commit 7653c5f

Please sign in to comment.