Skip to content

Commit

Permalink
Code style
Browse files Browse the repository at this point in the history
  • Loading branch information
alexamici committed Jan 17, 2024
1 parent 13aa0a8 commit 619f8c8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion sarsen/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2016-2022 B-Open Solutions srl
# Copyright 2016, B-Open Solutions srl.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
5 changes: 2 additions & 3 deletions sarsen/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def simulate_acquisition(
include_variables: Container[str] = (),
) -> xr.Dataset:
"""Compute the image coordinates of the DEM given the satellite orbit."""

orbit_interpolator = orbit.OrbitPolyfitIterpolator.from_position(position_ecef)
position_ecef = orbit_interpolator.position()
velocity_ecef = orbit_interpolator.velocity()
Expand All @@ -40,12 +39,12 @@ def simulate_acquisition(

for data_var_name in acquisition.data_vars:
if include_variables and data_var_name not in include_variables:
acquisition = acquisition.drop_vars(data_var_name)
acquisition = acquisition.drop_vars(data_var_name) # type: ignore

# drop coordinates that are not associated with any data variable
for coord_name in acquisition.coords:
if all(coord_name not in dv.coords for dv in acquisition.data_vars.values()):
acquisition = acquisition.drop_vars(coord_name)
acquisition = acquisition.drop_vars(coord_name) # type: ignore

return acquisition

Expand Down
5 changes: 4 additions & 1 deletion sarsen/geocoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ def backward_geocode(

# NOTE: dem_distance has the associated azimuth_time as a coordinate already
_, _, _, (dem_distance, satellite_direction) = secant_method(
zero_doppler, t_prev, t_curr, diff_ufunc # type: ignore
zero_doppler,
t_prev,
t_curr,
diff_ufunc,
)
acquisition = xr.Dataset(
data_vars={
Expand Down
7 changes: 4 additions & 3 deletions tests/test_10_chunking.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import Callable

import numpy as np
import xarray as xr

Expand Down Expand Up @@ -62,6 +60,9 @@ def test_compute_chunks() -> None:

def test_map_ovelap() -> None:
arr = xr.DataArray(np.arange(22 * 31).reshape((22, 31)), dims=("x", "y"))
function: Callable[[xr.DataArray], xr.DataArray] = lambda x: x

def function(x: xr.DataArray) -> xr.DataArray:
return x

res = chunking.map_ovelap(function=function, obj=arr, chunks=10, bound=2)
assert res.equals(arr)

0 comments on commit 619f8c8

Please sign in to comment.