@@ -68,11 +68,11 @@ class Centroids():
68
68
def __init__ (
69
69
self ,
70
70
* ,
71
- lat : Union [np .ndarray , list ],
72
- lon : Union [np .ndarray , list ],
71
+ lat : Union [np .ndarray , list [ float ] ],
72
+ lon : Union [np .ndarray , list [ float ] ],
73
73
crs : str = DEF_CRS ,
74
- region_id : Union [str ( ' country' ) , None , np .ndarray , list ] = None ,
75
- on_land : Union [str ( ' natural_earth' ) , None , np .ndarray , list ] = None ,
74
+ region_id : Union [Literal [ " country" ] , None , np .ndarray , list [ float ] ] = None ,
75
+ on_land : Union [Literal [ " natural_earth" ] , None , np .ndarray , list [ float ] ] = None ,
76
76
):
77
77
"""Initialization
78
78
@@ -90,12 +90,13 @@ def __init__(
90
90
on land (True) and on sea (False) of size size. Defaults to None array
91
91
"""
92
92
93
- attr_dict = {
94
- 'geometry' : gpd .points_from_xy (lon , lat , crs = crs ),
95
- 'region_id' : region_id ,
96
- 'on_land' : on_land
97
- }
98
- self .gdf = gpd .GeoDataFrame (data = attr_dict )
93
+ self .gdf = gpd .GeoDataFrame (
94
+ data = {
95
+ 'geometry' : gpd .points_from_xy (lon , lat , crs = crs ),
96
+ 'region_id' : region_id ,
97
+ 'on_land' : on_land ,
98
+ }
99
+ )
99
100
100
101
if isinstance (region_id , str ):
101
102
LOGGER .info (f'Setting region id to { region_id } level.' )
@@ -140,7 +141,7 @@ def crs(self):
140
141
141
142
@property
142
143
def size (self ):
143
- """Get size (number of lat/lon paris )"""
144
+ """Get size (number of lat/lon pairs )"""
144
145
return self .gdf .shape [0 ]
145
146
146
147
@property
0 commit comments