From 29f6fd1e5c66764bbb083b1dadb23f3db2cec7ec Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Fri, 24 Dec 2021 14:35:00 -0600 Subject: [PATCH] Mark features added in #144 as new (#328) --- torchgeo/datasets/geo.py | 12 ++++++++++++ torchgeo/datasets/utils.py | 16 ++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/torchgeo/datasets/geo.py b/torchgeo/datasets/geo.py index 5c09a2d8930..fc7935419bc 100644 --- a/torchgeo/datasets/geo.py +++ b/torchgeo/datasets/geo.py @@ -134,6 +134,8 @@ def __and__(self, other: "GeoDataset") -> "IntersectionDataset": Raises: ValueError: if other is not a :class:`GeoDataset` + + .. versionadded: 0.2 """ return IntersectionDataset(self, other) @@ -148,6 +150,8 @@ def __or__(self, other: "GeoDataset") -> "UnionDataset": Raises: ValueError: if other is not a :class:`GeoDataset` + + .. versionadded: 0.2 """ return UnionDataset(self, other) @@ -222,6 +226,8 @@ def crs(self) -> CRS: Returns: the :term:`coordinate reference system (CRS)` + + .. versionadded: 0.2 """ return self._crs @@ -233,6 +239,8 @@ def crs(self, new_crs: CRS) -> None: Args: new_crs: new :term:`coordinate reference system (CRS)` + + .. versionadded: 0.2 """ if new_crs == self._crs: return @@ -810,6 +818,8 @@ class IntersectionDataset(GeoDataset): .. code-block:: python dataset = landsat & cdl + + .. versionadded: 0.2 """ def __init__( @@ -920,6 +930,8 @@ class UnionDataset(GeoDataset): .. code-block:: python dataset = landsat7 | landsat8 + + .. versionadded: 0.2 """ def __init__( diff --git a/torchgeo/datasets/utils.py b/torchgeo/datasets/utils.py index 9a68be30ca3..341a94989f9 100644 --- a/torchgeo/datasets/utils.py +++ b/torchgeo/datasets/utils.py @@ -221,6 +221,8 @@ def __post_init__(self) -> None: Raises: ValueError: if bounding box is invalid (minx > maxx, miny > maxy, or mint > maxt) + + .. versionadded: 0.2 """ if self.minx > self.maxx: raise ValueError( @@ -274,6 +276,8 @@ def __contains__(self, other: "BoundingBox") -> bool: Returns: True if other is within this bounding box, else False + + .. versionadded: 0.2 """ return ( (self.minx <= other.minx <= self.maxx) @@ -292,6 +296,8 @@ def __or__(self, other: "BoundingBox") -> "BoundingBox": Returns: the minimum bounding box that contains both self and other + + .. versionadded: 0.2 """ return BoundingBox( min(self.minx, other.minx), @@ -313,6 +319,8 @@ def __and__(self, other: "BoundingBox") -> "BoundingBox": Raises: ValueError: if self and other do not intersect + + .. versionadded: 0.2 """ try: return BoundingBox( @@ -429,6 +437,8 @@ def _list_dict_to_dict_list(samples: Iterable[Dict[Any, Any]]) -> Dict[Any, List Returns: a dictionary of lists + + .. versionadded: 0.2 """ collated = collections.defaultdict(list) for sample in samples: @@ -448,6 +458,8 @@ def stack_samples(samples: Iterable[Dict[Any, Any]]) -> Dict[Any, Any]: Returns: a single sample + + .. versionadded: 0.2 """ collated: Dict[Any, Any] = _list_dict_to_dict_list(samples) for key, value in collated.items(): @@ -466,6 +478,8 @@ def concat_samples(samples: Iterable[Dict[Any, Any]]) -> Dict[Any, Any]: Returns: a single sample + + .. versionadded: 0.2 """ collated: Dict[Any, Any] = _list_dict_to_dict_list(samples) for key, value in collated.items(): @@ -486,6 +500,8 @@ def merge_samples(samples: Iterable[Dict[Any, Any]]) -> Dict[Any, Any]: Returns: a single sample + + .. versionadded: 0.2 """ collated: Dict[Any, Any] = {} for sample in samples: