Skip to content

Refactor resampler module to submodules #3124

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

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
e873d3b
Refactor resampler module to submodules
lahtinep May 12, 2025
b65098a
Update resample imports
lahtinep May 12, 2025
f3712ab
Update and move resampling docstring
lahtinep May 12, 2025
0b59ca8
Fix DOS line-endings, fix get_area_def import
lahtinep May 13, 2025
9051519
Fix imports to use new resampler modules
lahtinep May 13, 2025
41f5ef0
Simplify prepare_resampler()
lahtinep May 13, 2025
43f4b33
Simplify add_xy_coords()
lahtinep May 13, 2025
80b16e1
Simplify BucketResamplerBase.resample()
lahtinep May 13, 2025
b16e834
Simplify KDTreeResampler.load_neighbour_info()
lahtinep May 13, 2025
d68afb5
Simplify NativeResampler.compute()
lahtinep May 13, 2025
ea5d24b
Simplify native._rechunk_if_nonfactor_chunks()
lahtinep May 13, 2025
c71f33d
Simplify _check_crs_units and add_xy_coords() more
lahtinep May 13, 2025
86a4def
Reduce cyclomatic complecity of NativeResampler._expand_reduce()
lahtinep May 13, 2025
44ee39b
Make base.hash_dict a private function
lahtinep May 13, 2025
e33ea4b
Make get_area_file and update_resampled_coords private functions
lahtinep May 16, 2025
412d848
Fix import
lahtinep May 16, 2025
d7e4e9e
Move get_area_def and get_area_file to a new module satpy.area_utils
lahtinep May 16, 2025
125e691
Create satpy.coords_utils module
lahtinep May 16, 2025
f24507f
Fix get_area_def patching
lahtinep May 16, 2025
28e02ca
Merge branch 'main' into refactor-resample
lahtinep May 16, 2025
9371f45
Fix bucket doc references, again
lahtinep May 16, 2025
5a73b6e
Merge branch 'main' into refactor-resample
pnuu May 28, 2025
e5a4db7
Use helper function instead of if/elif/else in satpy.resample imports
pnuu May 28, 2025
3fcbe6d
Fix resample imports and doc references
pnuu May 28, 2025
5fe8f06
Remove unnecessary pyproj<2.0 check
pnuu May 28, 2025
ea17ec0
Merge branch 'main' into refactor-resample
pnuu May 28, 2025
bfdb334
Fix resampling related invalid sphinx references
djhoese May 28, 2025
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
1,096 changes: 0 additions & 1,096 deletions satpy/resample.py

This file was deleted.

66 changes: 66 additions & 0 deletions satpy/resample/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Copyright (c) 2015-2025 Satpy developers
#
# This file is part of satpy.
#
# satpy is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# satpy is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# satpy. If not, see <http://www.gnu.org/licenses/>.
"""Writers subpackage."""
from __future__ import annotations

import warnings
from typing import Any


def __getattr__(name: str) -> Any:
if name in ("KDTreeResampler", "BilinearResampler"):
from . import kdtree

new_submod = "kdtree"
obj = getattr(kdtree, name)
elif name == "NativeResampler":
from .native import NativeResampler
new_submod = "native"
obj = NativeResampler
elif name in (
"BucketResamplerBase",
"BucketAvg",
"BucketSum",
"BucketCount",
"BucketFraction"
):
from . import bucket
new_submod = "bucket"
obj = getattr(bucket, name)
elif name in (
"hash_dict",
"get_area_file",
"get_area_def",
"add_xy_coords",
"add_crs_xy_coords",
"update_resampled_coords",
"resample",
"prepare_resampler",
"get_fill_value",
"resample_dataset"
):
from . import base
new_submod = "base"
obj = getattr(base, name)
else:
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")

warnings.warn(
f"'satpy.resample.{name}' has been moved to 'satpy.resample.{new_submod}.{name}'. "
f"Import from the new location instead (ex. 'from satpy.resample.{new_submod} import {name}').",
stacklevel=2,
)
return obj
Loading
Loading