Skip to content

Commit 2d81ae1

Browse files
committed
Removes some errors messages from documentation build (see details)
Several attributes of Centroids became properties and were doctringed twice, I removed the attribute docstring and improved the properties ones.
1 parent fb7cd37 commit 2d81ae1

File tree

1 file changed

+12
-26
lines changed

1 file changed

+12
-26
lines changed

climada/hazard/centroids/centr.py

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import logging
2424
import warnings
2525
from pathlib import Path
26-
from typing import Any, Literal, Union
26+
from typing import Any, Literal, Optional, Union
2727

2828
import cartopy
2929
import cartopy.crs as ccrs
@@ -52,21 +52,7 @@
5252

5353

5454
class Centroids:
55-
"""Contains vector centroids as a GeoDataFrame
56-
57-
Attributes
58-
----------
59-
lat : np.array
60-
Latitudinal coordinates in the specified CRS (can be any unit).
61-
lon : np.array
62-
Longitudinal coordinates in the specified CRS (can be any unit).
63-
crs : pyproj.CRS
64-
Coordinate reference system. Default: EPSG:4326 (WGS84)
65-
region_id : np.array, optional
66-
Numeric country (or region) codes. Default: None
67-
on_land : np.array, optional
68-
Boolean array indicating on land (True) or off shore (False). Default: None
69-
"""
55+
"""Contains vector centroids as a GeoDataFrame"""
7056

7157
def __init__(
7258
self,
@@ -116,13 +102,13 @@ def __init__(
116102
self.set_on_land(source=on_land, overwrite=True)
117103

118104
@property
119-
def lat(self):
120-
"""Return latitudes"""
105+
def lat(self) -> np.array:
106+
"""Latitudinal coordinates in the specified CRS (can be any unit)."""
121107
return self.gdf.geometry.y.values
122108

123109
@property
124-
def lon(self):
125-
"""Return longitudes"""
110+
def lon(self) -> np.array:
111+
"""Longitudinal coordinates in the specified CRS (can be any unit)."""
126112
return self.gdf.geometry.x.values
127113

128114
@property
@@ -131,26 +117,26 @@ def geometry(self):
131117
return self.gdf["geometry"]
132118

133119
@property
134-
def on_land(self):
135-
"""Get the on_land property"""
120+
def on_land(self) -> Optional[np.array]:
121+
"""Boolean array indicating on land (True) or off shore (False). Default: None"""
136122
if "on_land" not in self.gdf:
137123
return None
138124
if self.gdf["on_land"].isna().all():
139125
return None
140126
return self.gdf["on_land"].values
141127

142128
@property
143-
def region_id(self):
144-
"""Get the assigned region_id"""
129+
def region_id(self) -> Optional[np.array]:
130+
"""Numeric country (or region) codes. Default: None"""
145131
if "region_id" not in self.gdf:
146132
return None
147133
if self.gdf["region_id"].isna().all():
148134
return None
149135
return self.gdf["region_id"].values
150136

151137
@property
152-
def crs(self):
153-
"""Get the crs"""
138+
def crs(self) -> CRS:
139+
"""Coordinate reference system. Default: EPSG:4326 (WGS84)"""
154140
return self.gdf.crs
155141

156142
@property

0 commit comments

Comments
 (0)