@@ -104,7 +104,9 @@ def drop_condition(
104104 _diff = _before - _after
105105 if _diff :
106106 log_method = (
107- LOGGER .info if (_diff / float (_before )) < warning_threshold else LOGGER .warn
107+ LOGGER .info
108+ if (_diff / float (_before )) < warning_threshold
109+ else LOGGER .warning
108110 )
109111 log_method (f"Dropped { _diff } rows ({ _diff / float (_before )* 100 :.2f} %)" )
110112 return df
@@ -179,25 +181,23 @@ def polyfill(
179181) -> None :
180182 """
181183 Reads a geoparquet, performs polyfilling (for Polygon),
182- linetracing (for LineString), and writes out to parquet.
184+ linetracing (for LineString), or indexing (for Point),
185+ and writes out to parquet.
183186 """
184187 df = gpd .read_parquet (pq_in ).reset_index ().drop (columns = [spatial_sort_col ])
185188 if len (df .index ) == 0 :
186- # Input is empty, nothing to polyfill
189+ # Input is empty, nothing to convert
187190 return None
188191
189- # DGGS specific polyfill
192+ # DGGS specific conversion
190193 df = dggsfunc (df , resolution )
191194
192195 if len (df .index ) == 0 :
193- # Polyfill resulted in empty output (e.g. large cell, small feature)
196+ # Conversion resulted in empty output (e.g. large cell, small feature)
194197 return None
195198
196199 df .index .rename (f"{ dggs } _{ resolution :02} " , inplace = True )
197200 parent_res : int = get_parent_res (dggs , parent_res , resolution )
198- # print(parent_res)
199- # print(df.index)
200- # print(df.columns)
201201
202202 # Secondary (parent) index, used later for partitioning
203203 df = secondary_index_func (df , parent_res )
@@ -233,7 +233,7 @@ def index(
233233 overwrite : bool = False ,
234234) -> Path :
235235 """
236- Performs multi-threaded polyfilling on (multi)polygons .
236+ Performs multi-threaded DGGS indexing on geometries (including multipart and collections) .
237237 """
238238
239239 if table and con :
@@ -291,7 +291,8 @@ def index(
291291 "index" : lambda frame : frame [
292292 (frame .geometry .geom_type != "Polygon" )
293293 & (frame .geometry .geom_type != "LineString" )
294- ], # NB currently points and other types are lost; in principle, these could be indexed
294+ & (frame .geometry .geom_type != "Point" )
295+ ],
295296 "message" : "Considering unsupported geometries" ,
296297 },
297298 ]
@@ -314,9 +315,9 @@ def index(
314315
315316 filepaths = list (map (lambda f : f .absolute (), Path (tmpdir ).glob ("*" )))
316317
317- # Multithreaded polyfilling
318+ # Multithreaded DGGS indexing
318319 LOGGER .debug (
319- "Indexing on spatial partitions by polyfill with resolution: %d" ,
320+ "DGGS indexing by spatial partitions with resolution: %d" ,
320321 resolution ,
321322 )
322323 with tempfile .TemporaryDirectory (suffix = ".parquet" ) as tmpdir2 :
@@ -344,7 +345,7 @@ def index(
344345
345346 parent_partitioning (
346347 dggs ,
347- tmpdir2 ,
348+ Path ( tmpdir2 ) ,
348349 output_directory ,
349350 resolution ,
350351 parent_res ,
0 commit comments