Install & Compatibility
Where this runs
tested against v1.31.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
build_error
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 5.2s · import 0.710s · 172MB
174MB installed
● package 174MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
AreaDefinition
✓ from pyresample import AreaDefinition
✗ from pyresample.area_config import AreaDefinition
AreaDefinition is importable directly from pyresample since v1.10.0; old path still works but is deprecated.
SwathDefinition
✓ from pyresample import SwathDefinition
resample_nearest
✓ from pyresample.kd_tree import resample_nearest
✗ from pyresample import resample_nearest
Resampling functions are in submodules like kd_tree, bilinear, etc. Direct import from pyresample may work in some versions but is not guaranteed.
load_area
✓ from pyresample.area_config import load_area
Basic swath-to-area resampling with nearest neighbor method.
import numpy as np
from pyresample import AreaDefinition, SwathDefinition
from pyresample.kd_tree import resample_nearest
# Define source swath (e.g., satellite granule)
lon = np.array([[-10, -9], [-10, -9]])
lat = np.array([[40, 40], [41, 41]])
swath_def = SwathDefinition(lons=lon, lats=lat)
# Define target area (regular grid)
area_def = AreaDefinition(
area_id='test',
description='Test area',
proj_id='test',
projection='+proj=eqc +lon_0=0 +lat_0=0',
width=100,
height=100,
area_extent=[-20, 30, 10, 50]
)
# Source data (same shape as swath)
data = np.random.rand(2, 2)
# Resample using nearest neighbor
result = resample_nearest(swath_def, data, area_def, radius_of_influence=50000)
print(result.shape) # (100, 100)
Errors
Common errors & fixes
AttributeError: module 'pyresample' has no attribute 'resample_nearest'
Attempting to import resampling functions from the top-level pyresample module instead of the correct submodule.
fixUse: from pyresample.kd_tree import resample_nearest
KeyError: 'area_id'
Missing required keyword when creating AreaDefinition; area_id is mandatory.
fixInclude area_id='my_area' in AreaDefinition constructor.
ValueError: radius_of_influence must be defined for kd_tree based resampling
In pyresample >=1.20.0, radius_of_influence is not set by default and must be provided.
fixAdd radius_of_influence=50000 (or appropriate value) to the call.
TypeError: 'NoneType' object is not callable
Using deprecated import path for area functions (e.g., from pyresample.area_config import load_area) after internal refactoring.
fixUse: from pyresample.area_config import load_area (still works in 1.35) but prefer: from pyresample import parse_area_file
Upgrade
Version history
1.35.0latest on PyPI · released Dec 2, 2025
Audit
Dependencies
numpyrequiredCore dependency for array operations
pyprojrequiredGeodetic projections and coordinate transformations
daskoptionalOptional but recommended for large dataset resampling
xarrayoptionalOften used with pyresample for labeled arrays