SatPy provides multiple resampling algorithms for resampling geolocated
data to uniform projected grids. The easiest way to perform resampling in
SatPy is through the
resample() method. Additional utility functions are
also available to assist in resampling data. Below is more information on
resampling with SatPy as well as links to the relevant API documentation for
available keyword arguments.
|ewa||Elliptical Weighted Averaging||
The resampling algorithm used can be specified with the
argument and defaults to
>>> scn = Scene(...) >>> euro_scn = global_scene.resample('euro4', resampler='nearest')
Some resampling algorithms expect certain forms of data. For example, the EWA resampling expects polar-orbiting swath data and prefers if the data can be broken in to “scan lines”. See the API documentation for a specific algorithm for more information.
Resampling for comparison and composites¶
While all the resamplers can be used to put datasets of different resolutions on to a common area, the ‘native’ resampler is designed to match datasets to one resolution in the dataset’s original projection. This is extremely useful when generating composites between bands of different resolutions.
>>> new_scn = scn.resample(resampler='native')
By default this resamples to the
highest resolution area (smallest footprint per
pixel) shared between the loaded datasets. You can easily specify the lower
>>> new_scn = scn.resample(scn.min_area(), resampler='native')
Providing an area that is neither the minimum or maximum resolution area may work, but behavior is currently undefined.
Caching for geostationary data¶
SatPy will do its best to reuse calculations performed to resample datasets,
but it can only do this for the current processing and will lose this
information when the process/script ends. Some resampling algorithms, like
bilinear, can benefit by caching intermediate data on disk in the directory
specified by cache_dir and using it next time. This is most beneficial with
geostationary satellite data where the locations of the source data and the
target pixels don’t change over time.
>>> new_scn = scn.resample('euro4', cache_dir='/path/to/cache_dir')
See the documentation for specific algorithms to see availability and limitations of caching for that algorithm.
Create custom area definition¶
pyresample.geometry.AreaDefinition for information on creating
areas that can be passed to the resample method:
>>> from pyresample.geometry import AreaDefinition >>> my_area = AreaDefinition(...) >>> local_scene = global_scene.resample(my_area)
Create dynamic area definition¶
pyresample.geometry.DynamicAreaDefinition for more information.
Examples coming soon…
Store area definitions¶
Area definitions can be added to a custom YAML file (see pyresample’s documentation for more information) and loaded using pyresample’s utility methods:
>>> from pyresample.utils import parse_area_file >>> my_area = parse_area_file('my_areas.yaml', 'my_area')
Examples coming soon…