# pyresample package

## Subpackages

- pyresample.bilinear package
  - Submodules
    - pyresample.bilinear.xarr module
      - `XArrayBilinearResampler`
      - `XArrayResamplerBilinear`
  - Module contents
- pyresample.boundary package
  - Submodules
    - pyresample.boundary.legacy_boundary module
      - `AreaBoundary`
      - `AreaDefBoundary`
      - `Boundary`
      - `SimpleBoundary`
  - Module contents
- pyresample.bucket package
  - Module contents
    - `BucketResampler`
      - `BucketResampler.__init__()`
      - `BucketResampler.get_abs_max()`
      - `BucketResampler.get_average()`
      - `BucketResampler.get_count()`
      - `BucketResampler.get_fractions()`
      - `BucketResampler.get_max()`
      - `BucketResampler.get_min()`
      - `BucketResampler.get_sum()`
    - `round_to_resolution()`
- pyresample.ewa package
  - Submodules
    - pyresample.ewa.dask_ewa module
      - `DaskEWAResampler`
    - pyresample.ewa.ewa module
      - `fornav()`
      - `ll2cr()`
  - Module contents
    - ll2cr
    - fornav
- pyresample.future package
  - Subpackages
    - pyresample.future.geometry package
      - Submodules
      - Module contents
    - pyresample.future.resamplers package
      - Submodules
      - Module contents
    - pyresample.future.spherical package
      - Submodules
      - Module contents
  - Module contents
- pyresample.gradient package
  - Module contents
    - `GradientSearchResampler()`
    - `ResampleBlocksGradientSearchResampler`
      - `ResampleBlocksGradientSearchResampler.__init__()`
      - `ResampleBlocksGradientSearchResampler.compute()`
      - `ResampleBlocksGradientSearchResampler.precompute()`
    - `block_bilinear_interpolator()`
    - `block_nn_interpolator()`
    - `create_gradient_search_resampler()`
    - `ensure_3d_data()`
    - `ensure_data_array()`
    - `gradient_resampler()`
    - `gradient_resampler_indices()`
    - `gradient_resampler_indices_block()`
    - `is_area_to_area()`
    - `is_area_to_swath()`
    - `is_swath_to_area()`
    - `parallel_gradient_search()`
- pyresample.static package
  - Subpackages
    - pyresample.static.css package
      - Module contents
    - pyresample.static.html package
      - Module contents
  - Module contents
- pyresample.test package
  - Submodules
    - pyresample.test.conftest module
      - `area_class()`
      - `area_def_lcc_conus_1km()`
      - `area_def_lonlat_pm180_target()`
      - `area_def_stere_source()`
      - `area_def_stere_target()`
      - `coord_def_2d_float32_dask()`
      - `create_test_area()`
      - `create_test_swath()`
      - `data_1d_float32_xarray_dask()`
      - `data_2d_float32_dask()`
      - `data_2d_float32_numpy()`
      - `data_2d_float32_xarray_dask()`
      - `data_2d_float32_xarray_numpy()`
      - `data_3d_float32_xarray_dask()`
      - `reset_pyresample_config()`
      - `swath_class()`
      - `swath_def_1d_xarray_dask()`
      - `swath_def_2d_dask()`
      - `swath_def_2d_numpy()`
      - `swath_def_2d_numpy_antimeridian()`
      - `swath_def_2d_xarray_dask()`
      - `swath_def_2d_xarray_dask_antimeridian()`
      - `swath_def_2d_xarray_numpy()`
    - pyresample.test.utils module
      - `CustomScheduler`
      - `assert_future_geometry()`
      - `assert_maximum_dask_computes()`
      - `assert_warnings_contain()`
      - `catch_warnings`
      - `create_test_latitude()`
      - `create_test_longitude()`
      - `friendly_crs_equal()`
      - `treat_deprecations_as_exceptions()`
  - Module contents
- pyresample.utils package
  - Submodules
    - pyresample.utils.cartopy module
      - `Projection`
    - pyresample.utils.cf module
      - `load_cf_area()`
    - pyresample.utils.errors module
      - `PerformanceWarning`
    - pyresample.utils.proj4 module
      - `DaskFriendlyTransformer`
      - `convert_proj_floats()`
      - `get_geodetic_crs_with_no_datum_shift()`
      - `get_geostationary_height()`
      - `ignore_pyproj_proj_warnings()`
      - `proj4_dict_to_str()`
      - `proj4_radius_parameters()`
      - `proj4_str_to_dict()`
    - pyresample.utils.rasterio module
      - `get_area_def_from_raster()`
    - pyresample.utils.row_appendable_array module
      - `RowAppendableArray`
  - Module contents
    - `check_and_wrap()`
    - `check_slice_orientation()`
    - `convert_def_to_yaml()`
    - `create_area_def()`
    - `fwhm2sigma()`
    - `generate_nearest_neighbour_linesample_arrays()`
    - `generate_quick_linesample_arrays()`
    - `get_area_def()`
    - `load_area()`
    - `parse_area_file()`
    - `recursive_dict_update()`
    - `wrap_longitudes()`

## Submodules

- pyresample.area_config module
  - `AreaNotFound`
  - `convert_def_to_yaml()`
  - `create_area_def()`
  - `generate_area_def_rst_list()`
  - `get_area_def()`
  - `load_area()`
  - `load_area_from_string()`
  - `parse_area_file()`
- pyresample.data_reduce module
  - `get_valid_index_from_cartesian_grid()`
  - `get_valid_index_from_lonlat_boundaries()`
  - `get_valid_index_from_lonlat_grid()`
  - `swath_from_cartesian_grid()`
  - `swath_from_lonlat_boundaries()`
  - `swath_from_lonlat_grid()`
- pyresample.geo_filter module
  - `GridFilter`
    - `GridFilter.__init__()`
    - `GridFilter.filter()`
    - `GridFilter.get_valid_index()`
- pyresample.geometry module
  - `AreaDefinition`
    - `AreaDefinition.area_id`
    - `AreaDefinition.description`
    - `AreaDefinition.proj_id`
    - `AreaDefinition.projection`
    - `AreaDefinition.width`
    - `AreaDefinition.height`
    - `AreaDefinition.size`
    - `AreaDefinition.area_extent_ll`
    - `AreaDefinition.pixel_size_x`
    - `AreaDefinition.pixel_size_y`
    - `AreaDefinition.upper_left_extent`
    - `AreaDefinition.pixel_upper_left`
    - `AreaDefinition.pixel_offset_x`
    - `AreaDefinition.pixel_offset_y`
    - `AreaDefinition.crs`
    - `AreaDefinition.crs_wkt`
    - `AreaDefinition.cartesian_coords`
    - `AreaDefinition.__init__()`
    - `AreaDefinition.aggregate()`
    - `AreaDefinition.area_extent`
    - `AreaDefinition.colrow2lonlat()`
    - `AreaDefinition.copy()`
    - `AreaDefinition.create_areas_def()`
    - `AreaDefinition.create_areas_def_legacy()`
    - `AreaDefinition.crop_around()`
    - `AreaDefinition.dump()`
    - `AreaDefinition.from_area_of_interest()`
    - `AreaDefinition.from_cf()`
    - `AreaDefinition.from_circle()`
    - `AreaDefinition.from_epsg()`
    - `AreaDefinition.from_extent()`
    - `AreaDefinition.from_ul_corner()`
    - `AreaDefinition.geocentric_resolution()`
    - `AreaDefinition.get_area_slices()`
    - `AreaDefinition.get_array_coordinates_from_lonlat()`
    - `AreaDefinition.get_array_coordinates_from_projection_coordinates()`
    - `AreaDefinition.get_array_indices_from_lonlat()`
    - `AreaDefinition.get_array_indices_from_projection_coordinates()`
    - `AreaDefinition.get_edge_bbox_in_projection_coordinates()`
    - `AreaDefinition.get_lonlat()`
    - `AreaDefinition.get_lonlat_from_array_coordinates()`
    - `AreaDefinition.get_lonlat_from_projection_coordinates()`
    - `AreaDefinition.get_lonlats()`
    - `AreaDefinition.get_lonlats_dask()`
    - `AreaDefinition.get_proj_coords()`
    - `AreaDefinition.get_proj_coords_dask()`
    - `AreaDefinition.get_proj_vectors()`
    - `AreaDefinition.get_proj_vectors_dask()`
    - `AreaDefinition.get_projection_coordinates_from_array_coordinates()`
    - `AreaDefinition.get_projection_coordinates_from_lonlat()`
    - `AreaDefinition.get_xy_from_lonlat()`
    - `AreaDefinition.get_xy_from_proj_coords()`
    - `AreaDefinition.is_geostationary`
    - `AreaDefinition.lonlat2colrow()`
    - `AreaDefinition.name`
    - `AreaDefinition.outer_boundary_corners`
    - `AreaDefinition.proj4_string`
    - `AreaDefinition.proj_str`
    - `AreaDefinition.projection_x_coords`
    - `AreaDefinition.projection_y_coords`
    - `AreaDefinition.resolution`
    - `AreaDefinition.to_cartopy_crs()`
    - `AreaDefinition.to_odc_geobox()`
    - `AreaDefinition.update_hash()`
  - `BaseDefinition`
    - `BaseDefinition.__init__()`
    - `BaseDefinition.boundary()`
    - `BaseDefinition.corners`
    - `BaseDefinition.get_area()`
    - `BaseDefinition.get_area_extent_for_subset()`
    - `BaseDefinition.get_area_slices()`
    - `BaseDefinition.get_bbox_lonlats()`
    - `BaseDefinition.get_boundary_lonlats()`
    - `BaseDefinition.get_cartesian_coords()`
    - `BaseDefinition.get_edge_lonlats()`
    - `BaseDefinition.get_lonlat()`
    - `BaseDefinition.get_lonlats()`
    - `BaseDefinition.get_lonlats_dask()`
    - `BaseDefinition.intersection()`
    - `BaseDefinition.is_geostationary`
    - `BaseDefinition.overlap_rate()`
    - `BaseDefinition.overlaps()`
    - `BaseDefinition.update_hash()`
  - `CoordinateDefinition`
    - `CoordinateDefinition.__init__()`
    - `CoordinateDefinition.append()`
    - `CoordinateDefinition.concatenate()`
    - `CoordinateDefinition.geocentric_resolution()`
  - `DimensionError`
  - `DynamicAreaDefinition`
    - `DynamicAreaDefinition.area_id`
    - `DynamicAreaDefinition.description`
    - `DynamicAreaDefinition.projection`
    - `DynamicAreaDefinition.width`
    - `DynamicAreaDefinition.height`
    - `DynamicAreaDefinition.shape`
    - `DynamicAreaDefinition.area_extent`
    - `DynamicAreaDefinition.resolution`
    - `DynamicAreaDefinition.optimize_projection`
    - `DynamicAreaDefinition.__init__()`
    - `DynamicAreaDefinition.compute_domain()`
    - `DynamicAreaDefinition.freeze()`
    - `DynamicAreaDefinition.pixel_size_x`
    - `DynamicAreaDefinition.pixel_size_y`
  - `GridDefinition`
    - `GridDefinition.shape`
    - `GridDefinition.size`
    - `GridDefinition.lons`
    - `GridDefinition.lats`
    - `GridDefinition.cartesian_coords`
    - `GridDefinition.__init__()`
  - `IncompatibleAreas`
  - `InvalidArea`
  - `StackedAreaDefinition`
    - `StackedAreaDefinition.__init__()`
    - `StackedAreaDefinition.append()`
    - `StackedAreaDefinition.get_lonlats()`
    - `StackedAreaDefinition.get_lonlats_dask()`
    - `StackedAreaDefinition.height`
    - `StackedAreaDefinition.proj4_string`
    - `StackedAreaDefinition.proj_str`
    - `StackedAreaDefinition.squeeze()`
    - `StackedAreaDefinition.update_hash()`
    - `StackedAreaDefinition.width`
  - `SwathDefinition`
    - `SwathDefinition.shape`
    - `SwathDefinition.size`
    - `SwathDefinition.ndims`
    - `SwathDefinition.lons`
    - `SwathDefinition.lats`
    - `SwathDefinition.cartesian_coords`
    - `SwathDefinition.__init__()`
    - `SwathDefinition.aggregate()`
    - `SwathDefinition.compute_bb_proj_params()`
    - `SwathDefinition.compute_optimal_bb_area()`
    - `SwathDefinition.copy()`
  - `combine_area_extents_vertical()`
  - `concatenate_area_defs()`
  - `daskify_2in_2out()`
  - `enclose_areas()`
  - `get_array_hashable()`
  - `get_full_geostationary_bounding_box_in_proj_coords()`
  - `get_geostationary_angle_extent()`
  - `get_geostationary_bounding_box()`
  - `get_geostationary_bounding_box_in_lonlats()`
  - `get_geostationary_bounding_box_in_proj_coords()`
  - `masked_ints()`
  - `ordered_dump()`
  - `preserve_scalars()`
- pyresample.grid module
  - `get_image_from_linesample()`
  - `get_image_from_lonlats()`
  - `get_linesample()`
  - `get_resampled_image()`
- pyresample.image module
  - `ImageContainer`
    - `ImageContainer.image_data`
    - `ImageContainer.geo_def`
    - `ImageContainer.fill_value`
    - `ImageContainer.nprocs`
    - `ImageContainer.__init__()`
    - `ImageContainer.get_array_from_linesample()`
    - `ImageContainer.get_array_from_neighbour_info()`
    - `ImageContainer.resample()`
  - `ImageContainerBilinear`
    - `ImageContainerBilinear.image_data`
    - `ImageContainerBilinear.geo_def`
    - `ImageContainerBilinear.radius_of_influence`
    - `ImageContainerBilinear.epsilon`
    - `ImageContainerBilinear.fill_value`
    - `ImageContainerBilinear.reduce_data`
    - `ImageContainerBilinear.nprocs`
    - `ImageContainerBilinear.segments`
    - `ImageContainerBilinear.__init__()`
    - `ImageContainerBilinear.resample()`
  - `ImageContainerNearest`
    - `ImageContainerNearest.image_data`
    - `ImageContainerNearest.geo_def`
    - `ImageContainerNearest.radius_of_influence`
    - `ImageContainerNearest.epsilon`
    - `ImageContainerNearest.fill_value`
    - `ImageContainerNearest.reduce_data`
    - `ImageContainerNearest.nprocs`
    - `ImageContainerNearest.segments`
    - `ImageContainerNearest.__init__()`
    - `ImageContainerNearest.resample()`
  - `ImageContainerQuick`
    - `ImageContainerQuick.image_data`
    - `ImageContainerQuick.geo_def`
    - `ImageContainerQuick.fill_value`
    - `ImageContainerQuick.nprocs`
    - `ImageContainerQuick.segments`
    - `ImageContainerQuick.__init__()`
    - `ImageContainerQuick.resample()`
- pyresample.kd_tree module
  - `EmptyResult`
  - `XArrayResamplerNN`
    - `XArrayResamplerNN.__init__()`
    - `XArrayResamplerNN.get_neighbour_info()`
    - `XArrayResamplerNN.get_sample_from_neighbour_info()`
    - `XArrayResamplerNN.query_resample_kdtree()`
  - `get_neighbour_info()`
  - `get_sample_from_neighbour_info()`
  - `resample_custom()`
  - `resample_gauss()`
  - `resample_nearest()`
- pyresample.plot module
  - `area_def2basemap()`
  - `ellps2axis()`
  - `save_quicklook()`
  - `show_quicklook()`
- pyresample.resampler module
  - `BaseResampler`
    - `BaseResampler.__init__()`
    - `BaseResampler.compute()`
    - `BaseResampler.get_hash()`
    - `BaseResampler.precompute()`
    - `BaseResampler.resample()`
  - `crop_data_around_area()`
  - `crop_source_area()`
  - `resample_blocks()`
- pyresample.slicer module
  - `AreaSlicer`
    - `AreaSlicer.__init__()`
    - `AreaSlicer.get_polygon_to_contain()`
    - `AreaSlicer.get_slices_from_polygon()`
  - `Slicer`
    - `Slicer.__init__()`
    - `Slicer.get_polygon_to_contain()`
    - `Slicer.get_slices()`
    - `Slicer.get_slices_from_polygon()`
  - `SwathSlicer`
    - `SwathSlicer.__init__()`
    - `SwathSlicer.get_polygon_to_contain()`
    - `SwathSlicer.get_slices_from_polygon()`
  - `create_slicer()`
  - `expand_slice()`
- pyresample.spherical module
  - `Arc`
    - `Arc.__init__()`
    - `Arc.angle()`
    - `Arc.get_next_intersection()`
    - `Arc.intersection()`
    - `Arc.intersections()`
    - `Arc.intersects()`
  - `CCoordinate`
    - `CCoordinate.__init__()`
    - `CCoordinate.cross()`
    - `CCoordinate.dot()`
    - `CCoordinate.norm()`
    - `CCoordinate.normalize()`
    - `CCoordinate.to_spherical()`
  - `SCoordinate`
    - `SCoordinate.__init__()`
    - `SCoordinate.cross2cart()`
    - `SCoordinate.distance()`
    - `SCoordinate.hdistance()`
    - `SCoordinate.plot()`
    - `SCoordinate.to_cart()`
    - `SCoordinate.vertices`
    - `SCoordinate.vertices_in_degrees`
  - `SphPolygon`
    - `SphPolygon.__init__()`
    - `SphPolygon.aedges()`
    - `SphPolygon.area()`
    - `SphPolygon.edges()`
    - `SphPolygon.intersection()`
    - `SphPolygon.inverse()`
    - `SphPolygon.invert()`
    - `SphPolygon.union()`
- pyresample.spherical_geometry module
  - `Arc`
    - `Arc.__init__()`
    - `Arc.angle()`
    - `Arc.center_angle()`
    - `Arc.intersection()`
    - `Arc.intersections()`
    - `Arc.intersects()`
  - `Coordinate`
    - `Coordinate.__init__()`
    - `Coordinate.cross()`
    - `Coordinate.cross2cart()`
    - `Coordinate.distance()`
    - `Coordinate.dot()`
    - `Coordinate.lat`
    - `Coordinate.lon`
    - `Coordinate.norm()`
    - `Coordinate.normalize()`
    - `Coordinate.x__`
    - `Coordinate.y__`
    - `Coordinate.z__`
  - `get_first_intersection()`
  - `get_intersections()`
  - `get_next_intersection()`
  - `get_polygon_area()`
  - `intersection_polygon()`
  - `modpi()`
  - `point_inside()`
- pyresample.spherical_utils module
  - `GetNonOverlapUnions`
    - `GetNonOverlapUnions.__init__()`
  - `GetNonOverlapUnionsBaseClass`
    - `GetNonOverlapUnionsBaseClass.__init__()`
    - `GetNonOverlapUnionsBaseClass.get_ids()`
    - `GetNonOverlapUnionsBaseClass.get_polygons()`
    - `GetNonOverlapUnionsBaseClass.merge()`
  - `check_if_two_polygons_overlap()`
  - `check_keys_int_or_tuple()`
  - `merge_tuples()`
- pyresample.version module
  - `get_versions()`

## Module contents

Pyresample package for geographic data resampling and related utilities.

pyresample.convert_def_to_yaml(def_area_file, yaml_area_file)

  Convert a legacy area def file to the yaml counter partself.

  yaml_area_file will be overwritten by the operation.

pyresample.create_area_def(area_id, projection, width=None, height=None, area_extent=None, shape=None, upper_left_extent=None, center=None, resolution=None, radius=None, units=None, optimize_projection=False, **kwargs)

  Create AreaDefinition from whatever information is known.

  Parameters:

    - area_id (str) – ID of area

    - projection (pyproj CRS object, dict, str, int, tuple, object) – Projection parameters. This can be in any format understood by `pyproj.crs.CRS.from_user_input()`, such as a pyproj CRS object, proj4 dict, proj4 string, EPSG integer code, or others.

    - description (str, optional) – Description/name of area. Defaults to area_id

    - proj_id (str, optional) – ID of projection (deprecated)

    - units (str, optional) –

      Units that provided arguments should be interpreted as. This can be one of ‘deg’, ‘degrees’, ‘meters’, ‘metres’, and any parameter supported by the cs2cs -lu command. Units are determined in the following priority:

      1. units expressed with each variable through a DataArray’s attrs attribute.

      2. units passed to `units`

      3. units used in `projection`

      4. meters

    - width (str, optional) – Number of pixels in the x direction

    - height (str, optional) – Number of pixels in the y direction

    - area_extent (list, optional) – Area extent as a list (lower_left_x, lower_left_y, upper_right_x, upper_right_y)

    - shape (list, optional) – Number of pixels in the y and x direction (height, width)

    - upper_left_extent (list, optional) – Upper left corner of upper left pixel (x, y)

    - center (list, optional) – Center of projection (x, y)

    - resolution (list or float, optional) – Size of pixels: (dx, dy)

    - radius (list or float, optional) – Length from the center to the edges of the projection (dx, dy)

    - nprocs (int, optional) – Number of processor cores to be used

    - lons (numpy array, optional) – Grid lons

    - lats (numpy array, optional) – Grid lats

    - optimize_projection – Whether the projection parameters have to be optimized for a DynamicAreaDefinition.

  Returns:

    area – If shape and area_extent are found, an AreaDefinition object is returned. If only shape or area_extent can be found, a DynamicAreaDefinition object is returned

  Return type:

    pyresample.geometry.AreaDefinition or pyresample.geometry.DynamicAreaDefinition

  Raises:

    ValueError: – If neither shape nor area_extent could be found

  Notes

  - `resolution` and `radius` can be specified with one value if dx == dy

  - If `resolution` and `radius` are provided as angles, center must be given or findable. In such a case, they represent [projection x distance from center[0] to center[0]+dx, projection y distance from center[1] to center[1]+dy]

pyresample.get_area_def(area_id, area_name, proj_id, proj4_args, width, height, area_extent)

  Construct AreaDefinition object from arguments.

  Parameters:

    - area_id (str) – ID of area

    - area_name (str) – Description of area

    - proj_id (str) – ID of projection

    - proj4_args (dict, CRS, or str) – Projection information passed to pyproj’s CRS object

    - width (int) – Number of pixel in x dimension

    - height (int) – Number of pixel in y dimension

    - area_extent (list | tuple) – Area extent as a list of ints (LL_x, LL_y, UR_x, UR_y)

  Returns:

    area_def – AreaDefinition object

  Return type:

    object

pyresample.load_area(area_file_name, *regions)

  Load area(s) from area file.

  Parameters:

    - area_file_name (str, pathlib.Path, stream, or list thereof) – List of paths or streams. Any str or pathlib.Path will be interpreted as a path to a file. Any stream will be interpreted as containing a yaml definition file. To read directly from a string, use `load_area_from_string()`.

    - regions (str argument list) – Regions to parse. If no regions are specified all regions in the file are returned

  Returns:

    area_defs – If one area name is specified a single AreaDefinition object is returned. If several area names are specified a list of AreaDefinition objects is returned

  Return type:

    pyresample.geometry.AreaDefinition or list

  Raises:

    AreaNotFound: – If a specified area name is not found

pyresample.parse_area_file(area_file_name, *regions)

  Parse area information from area file.

  Parameters:

    - area_file_name (str or list) – One or more paths to area definition files

    - regions (str argument list) – Regions to parse. If no regions are specified all regions in the file are returned

  Returns:

    area_defs – List of AreaDefinition objects

  Return type:

    list

  Raises:

    AreaNotFound: – If a specified area is not found