pyresample.slicer module
Area and Swath Slicers.
- class pyresample.slicer.AreaSlicer(area_to_crop, area_to_contain)
Bases:
SlicerA Slicer for cropping AreaDefinitions.
Set up the Slicer.
- __init__(area_to_crop, area_to_contain)
Set up the Slicer.
- get_polygon_to_contain()
Get the shapely Polygon corresponding to area_to_contain in projection coordinates of area_to_crop.
- get_slices_from_polygon(poly_to_contain)
Get the slices based on the polygon.
- class pyresample.slicer.Slicer(area_to_crop, area_to_contain, work_crs)
Bases:
ABCAbstract Slicer.
Provided an Area-to-crop and an Area-to-contain, a Slicer provides methods to find slices that enclose area-to-contain inside area-to-crop.
Example
For slicing a full-disk MSG area using a polar-stereographic area over Germany:
>>> from pyresample import slicer >>> from satpy.resample import get_area_def >>> msg_area = get_area_def("msg_seviri_fes_3km") >>> germ_area = get_area_def("germ") >>> slc = slicer.create_slicer(msg_area, germ_area) >>> slc.get_slices() (slice(1900, 2242, None), slice(233, 423, None))
Set up the Slicer.
- __init__(area_to_crop, area_to_contain, work_crs)
Set up the Slicer.
- abstractmethod get_polygon_to_contain()
Get the shapely Polygon corresponding to area_to_contain.
- get_slices()
Get the slices to crop area_to_crop enclosing area_to_contain.
- abstractmethod get_slices_from_polygon(poly)
Get the slices based on the polygon.
- class pyresample.slicer.SwathSlicer(area_to_crop, area_to_contain, work_crs=None)
Bases:
SlicerA Slicer for cropping SwathDefinitions.
Set up the Slicer.
- __init__(area_to_crop, area_to_contain, work_crs=None)
Set up the Slicer.
- get_polygon_to_contain()
Get the shapely Polygon corresponding to area_to_contain in lon/lat coordinates.
- get_slices_from_polygon(poly)
Get the slices based on the polygon.
- pyresample.slicer.create_slicer(area_to_crop, area_to_contain)
Create a slicer for cropping area_to_crop based on area_to_contain.
Return an AreaSlicer or a SwathSlicer based on the first area type.
- pyresample.slicer.expand_slice(small_slice)
Expand slice by one.