Registry / data / pyresample

pyresample

JSON →
library1.35.0pypypi✓ verified 86d ago

Pyresample is a Python library for geospatial image resampling, supporting both area-to-area and swath-to-area resampling. It is part of the PyTroll ecosystem. Current version is 1.35.0, with regular releases approximately every 2-3 months.

pip install pyresample
INSTALL
IMPORT
SIG · PYRESAMPLE
P
pyresample
datapythonv1.35.0
Install
5.2s avg
Import
710ms
Disk
174MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
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
musl
py 3.103.95 runs
build_error
glibc
py 3.103.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)
Debug
Known issues
breakingIn pyresample v1.20.0, the function `resample_nearest` and others changed their `radius_of_influence` default from 5000 to None. You must specify it explicitly to avoid errors.
fix
Always provide `radius_of_influence` in meters.
affects: >=1.20.0
deprecatedThe module `pyresample.area_config` is partially deprecated. Direct usage of `load_area` and `get_area_def` from `pyresample.area_config` is being replaced by `pyresample.parse_area_file` and similar functions in `pyresample.geometry`.
fix
Use `from pyresample import parse_area_file` instead of `load_area`.
affects: >=1.30.0
gotchaSwathDefinition's `lons` and `lats` must be 2D arrays (even for single scan lines). Using 1D arrays will cause cryptic errors.
fix
Ensure lon/lat arrays have shape (n_scans, n_pixels) for swath data.
affects: all
gotchaAreaDefinition's `area_extent` expects (xmin, ymin, xmax, ymax) in the projection's coordinate system, not geographic lon/lat. Common mistake: passing lon/lat directly.
fix
Transform your geographic extent to the projection coordinates using pyproj before defining AreaDefinition.
affects: all
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.
fix
Use: from pyresample.kd_tree import resample_nearest
KeyError: 'area_id'
Missing required keyword when creating AreaDefinition; area_id is mandatory.
fix
Include 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.
fix
Add 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.
fix
Use: 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
Agent activity
14 hits · last 30 days
node
12
Resources
pyresample — pip install pyresample · libregistry