Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions pyresample/geometry.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010-2023 Pyresample developers
# Copyright (C) 2010-2025 Pyresample developers
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
Expand Down Expand Up @@ -143,7 +140,13 @@ def update_hash(self, existing_hash: Optional[hashlib._Hash] = None) -> hashlib.
return existing_hash

def __eq__(self, other):
"""Test for approximate equality."""
"""Test for approximate equality.

Equality considers only the projection coordinates, not metadata such
as description or projection ID. In other words, areas are considered
equal if they produce approximately the same output when used for
resampling, within floating point tolerances.
"""
if self is other:
return True
if not isinstance(other, BaseDefinition):
Expand Down Expand Up @@ -186,7 +189,7 @@ def _extract_lonlat_subarrays(
return lons, lats

def __ne__(self, other):
"""Test for approximate equality."""
"""Test for approximate inequality."""
return not self.__eq__(other)

def get_area_extent_for_subset(self, row_LR, col_LR, row_UL, col_UL):
Expand Down Expand Up @@ -2109,7 +2112,12 @@ def create_areas_def_legacy(self):
return area_def_str

def __eq__(self, other):
"""Test for equality."""
"""Test for equality.

Equality considers only the projection coordinates, not metadata such
as description or projection ID. In other words, areas are considered
equal if they produce the same output when used for resampling.
"""
try:
return ((np.allclose(self.area_extent, other.area_extent)) and
(self.crs == other.crs) and
Expand All @@ -2118,7 +2126,7 @@ def __eq__(self, other):
return super().__eq__(other)

def __ne__(self, other):
"""Test for equality."""
"""Test for inequality."""
return not self.__eq__(other)

def update_hash(self, existing_hash: Optional[hashlib._Hash] = None) -> hashlib._Hash:
Expand Down
Loading