Skip to content

Commit 4930532

Browse files
committed
ruff isort
1 parent ccfd594 commit 4930532

14 files changed

Lines changed: 36 additions & 35 deletions

File tree

tests/sampledata.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,13 +528,14 @@ def create_cci_lccs_class_var(flag_values_as_list=False):
528528
var.attrs["flag_values"] = list(map(int, flag_values.split(", ")))
529529
return var
530530

531+
531532
def create_nx8x6_dataset_with_regular_coords(days: int):
532533
ds = create_8x6_dataset_with_regular_coords()
533534
refl_base = ds.refl.values.copy()
534535
ndvi_base = ds.ndvi.values.copy()
535536
nlat, nlon = refl_base.shape
536537
day_range = np.arange(0, days + 1)
537-
amplitude = np.arange(-days/2, days/2)
538+
amplitude = np.arange(-days / 2, days / 2)
538539
time = pd.date_range("2025-08-01", periods=days)
539540

540541
refl_array_3d = np.zeros((days, nlat, nlon), dtype=float)
@@ -547,8 +548,10 @@ def create_nx8x6_dataset_with_regular_coords(days: int):
547548
ndvi_array_3d[d] = ndvi_base + a
548549

549550
ds_3d = xr.Dataset(
550-
data_vars=dict(refl=(("time", "lat", "lon"), refl_array_3d),
551-
ndvi=(("time", "lat", "lon"), ndvi_array_3d)),
551+
data_vars=dict(
552+
refl=(("time", "lat", "lon"), refl_array_3d),
553+
ndvi=(("time", "lat", "lon"), ndvi_array_3d),
554+
),
552555
coords=dict(time=time, lat=ds.lat, lon=ds.lon),
553556
)
554557

tests/test_rectify.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def test_rectify_2x2_to_default(self):
5050
source_ds,
5151
target_gm=target_gm,
5252
interp_methods=0,
53-
output_indices_names=("indices_lon", "indices_lat")
53+
output_indices_names=("indices_lon", "indices_lat"),
5454
)
5555

5656
np.testing.assert_almost_equal(
@@ -71,9 +71,8 @@ def test_rectify_2x2_to_default(self):
7171
[
7272
[nan, nan, nan, nan],
7373
[nan, 0.26086957, 0.60869565, nan],
74-
[0., 0.42857143, 0.85714286, nan],
75-
[nan, 1., nan,nan],
76-
74+
[0.0, 0.42857143, 0.85714286, nan],
75+
[nan, 1.0, nan, nan],
7776
],
7877
dtype=target_ds.indices_lon.dtype,
7978
),

tests/test_temporal.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727

2828
from tests.sampledata import create_nx8x6_dataset_with_regular_coords
2929
from xcube_resampling.temporal import (
30-
resample_in_time,
31-
_guess_resampling_operation,
3230
_get_agg_method_kwargs,
33-
_get_temporal_interp_method,
3431
_get_temporal_agg_method,
32+
_get_temporal_interp_method,
33+
_guess_resampling_operation,
34+
resample_in_time,
3535
)
3636

3737

tests/test_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@
1313

1414
# noinspection PyProtectedMember
1515
from xcube_resampling.utils import (
16-
_get_spatial_agg_method,
1716
_get_fill_value,
1817
_get_grid_mapping_name,
19-
_get_spatial_interp_method,
2018
_get_prevent_nan_propagation,
19+
_get_spatial_agg_method,
20+
_get_spatial_interp_method,
2121
_prep_spatial_interp_methods_downscale,
2222
_select_variables,
2323
bbox_overlap,
2424
clip_dataset_by_bbox,
25-
resolution_meters_to_degrees,
2625
get_spatial_coords,
2726
reproject_bbox,
27+
resolution_meters_to_degrees,
2828
)
2929

3030

xcube_resampling/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
"affine_transform_dataset",
3333
"rectify_dataset",
3434
"reproject_dataset",
35-
"resample_in_time"
35+
"resample_in_time",
3636
]

xcube_resampling/affine.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@
3030
from .constants import (
3131
AffineTransformMatrix,
3232
AggFunction,
33-
SpatialAggMethods,
3433
FillValues,
3534
FloatInt,
35+
PreventNaNPropagations,
36+
SpatialAggMethods,
3637
SpatialInterpMethodInt,
3738
SpatialInterpMethods,
38-
PreventNaNPropagations,
3939
)
4040
from .gridmapping import GridMapping
4141
from .utils import (
4242
_can_apply_affine_transform,
43-
_get_spatial_agg_method,
4443
_get_fill_value,
45-
_get_spatial_interp_method_int,
4644
_get_prevent_nan_propagation,
45+
_get_spatial_agg_method,
46+
_get_spatial_interp_method_int,
4747
_select_variables,
4848
normalize_grid_mapping,
4949
)

xcube_resampling/constants.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,12 @@
2222

2323
import logging
2424
from collections.abc import Callable, Hashable, Mapping
25-
from typing import Literal, TypeAlias, Sequence, Annotated
25+
from typing import Annotated, Literal, Sequence, TypeAlias
2626

2727
import numpy as np
2828

2929
from .coarsen import center, first, last, mean, median, mode, std, var
3030

31-
3231
__all__ = [
3332
"FloatInt",
3433
"AffineTransformMatrix",

xcube_resampling/gridmapping/base.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@
2020
# DEALINGS IN THE SOFTWARE.
2121

2222
import abc
23-
from collections.abc import Sequence
2423
import copy
2524
import math
2625
import threading
27-
from collections.abc import Callable, Mapping
26+
from collections.abc import Callable, Mapping, Sequence
2827
from typing import Any
2928

3029
import dask.array as da

xcube_resampling/gridmapping/regular.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
import pyproj
2727
import xarray as xr
2828

29+
from xcube_resampling.constants import FloatInt
30+
2931
from .assertions import assert_true
3032
from .base import GridMapping
3133
from .helpers import (
@@ -36,7 +38,6 @@
3638
_normalize_number_pair,
3739
_to_int_or_float,
3840
)
39-
from xcube_resampling.constants import FloatInt
4041

4142

4243
class RegularGridMapping(GridMapping):

xcube_resampling/rectify.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@
3232
LOG,
3333
SCALE_LIMIT,
3434
UV_DELTA,
35-
SpatialAggMethods,
3635
FillValues,
3736
FloatInt,
37+
PreventNaNPropagations,
38+
SpatialAggMethods,
3839
SpatialInterpMethods,
3940
SpatialInterpMethodStr,
40-
PreventNaNPropagations,
4141
)
4242
from .dask import compute_array_from_func
4343
from .gridmapping import GridMapping

0 commit comments

Comments
 (0)