@@ -299,6 +299,7 @@ def get_geo_out(legacy=True, has_gdal=True):
299299 "clip_cell_res" : int ,
300300 "clip_cell_addresses" : str ,
301301 "clip_region_files" : str ,
302+ "clip_cell_densification" : int ,
302303 "clipper_scale_factor" : float ,
303304 "input_address_type" : DggsInputAddressTypeT ,
304305 "input_hier_ndx_form" : DggsInputHierNdxFormT ,
@@ -555,8 +556,14 @@ class Dggs:
555556 # Add more aliases as needed
556557 }, init = False , repr = False )
557558
558- def _resolve_key (self , key : str ) -> str :
559+ def _resolve_key (self , key : str , strict : bool = False ) -> str | None :
559560 # If key is an alias, return canonical; else if it's a canonical, return as is
561+ if strict :
562+ if key in self ._aliases :
563+ return self ._aliases [key ]
564+ elif key in self .__dataclass_fields__ :
565+ return key
566+ return None
560567 return self ._aliases .get (key , key )
561568
562569 def set_par (self , par_key : str , par_value : DggridMetaConfigParameterT ):
@@ -589,12 +596,16 @@ def to_dict(self) -> dict[str, DggridMetaConfigParameterT]:
589596 def metafile (self ) -> DggridMetafileT :
590597 return copy .copy (dg_grid_meta (self ))
591598
592- def update (self , ** kwargs ):
599+ def update (self , strict = False , ** kwargs ):
593600 """
594601 Back propagate keyword parameters if they can be mapped to an attribute handled by this class.
602+
603+ :param strict:
604+ If True, only keys that match existing attributes will be set.
605+ If False, unknown keys will be set with provided name.
595606 """
596607 for key , value in kwargs .items ():
597- found = self ._resolve_key (key )
608+ found = self ._resolve_key (key , strict = strict )
598609 if found :
599610 self .set_par (found , value )
600611
@@ -1275,6 +1286,7 @@ def grid_cell_polygons_for_extent(
12751286 tmp_id = uuid .uuid4 ()
12761287 tmp_dir = self .working_dir
12771288 dggs = dgselect (dggs_type = dggs_type , res = resolution , mixed_aperture_level = mixed_aperture_level )
1289+ dggs .update (** conf_extra , strict = True )
12781290
12791291 subset_conf : DggridMetaConfigT = { 'update_frequency' : 100000 , 'clip_subset_type' : 'WHOLE_EARTH' }
12801292
@@ -1372,6 +1384,7 @@ def grid_cell_centroids_for_extent(
13721384 tmp_id = uuid .uuid4 ()
13731385 tmp_dir = self .working_dir
13741386 dggs = dgselect (dggs_type = dggs_type , res = resolution , mixed_aperture_level = mixed_aperture_level )
1387+ dggs .update (** conf_extra , strict = True )
13751388
13761389 subset_conf : DggridMetaConfigT = { 'update_frequency' : 100000 , 'clip_subset_type' : 'WHOLE_EARTH' }
13771390
@@ -1470,6 +1483,7 @@ def grid_cell_polygons_from_cellids(
14701483 tmp_id = uuid .uuid4 ()
14711484 tmp_dir = self .working_dir
14721485 dggs = dgselect (dggs_type = dggs_type , res = resolution , mixed_aperture_level = mixed_aperture_level )
1486+ dggs .update (** conf_extra , strict = True )
14731487
14741488 subset_conf : DggridMetaConfigT = { 'update_frequency' : 100000 , 'clip_subset_type' : clip_subset_type }
14751489 seq_df = None
@@ -1506,6 +1520,12 @@ def grid_cell_polygons_from_cellids(
15061520 'clip_cell_addresses' : " " .join ([str (address ) for address in cell_id_list ])
15071521 }
15081522 )
1523+ if "clip_cell_densification" in conf_extra :
1524+ subset_conf .update (
1525+ {
1526+ 'clip_cell_densification' : conf_extra ['clip_cell_densification' ]
1527+ }
1528+ )
15091529
15101530 subset_conf .update (specify_resolution (** conf_extra ))
15111531 subset_conf .update (specify_orient_type_args (** conf_extra ))
@@ -1610,6 +1630,7 @@ def grid_cell_centroids_from_cellids(
16101630 tmp_id = uuid .uuid4 ()
16111631 tmp_dir = self .working_dir
16121632 dggs = dgselect (dggs_type = dggs_type , res = resolution , mixed_aperture_level = mixed_aperture_level )
1633+ dggs .update (** conf_extra , strict = True )
16131634
16141635 subset_conf : DggridMetaConfigT = { 'update_frequency' : 100000 , 'clip_subset_type' : clip_subset_type }
16151636 seq_df = None
@@ -1737,6 +1758,7 @@ def grid_cellids_for_extent(
17371758 tmp_id = uuid .uuid4 ()
17381759 tmp_dir = self .working_dir
17391760 dggs = dgselect (dggs_type = dggs_type , res = resolution , mixed_aperture_level = mixed_aperture_level )
1761+ dggs .update (** conf_extra , strict = True )
17401762
17411763 subset_conf = { 'update_frequency' : 100000 , 'clip_subset_type' : 'WHOLE_EARTH' }
17421764
@@ -1821,6 +1843,7 @@ def cells_for_geo_points(
18211843 tmp_id = uuid .uuid4 ()
18221844 tmp_dir = self .working_dir
18231845 dggs = dgselect (dggs_type = dggs_type , res = resolution , mixed_aperture_level = mixed_aperture_level )
1846+ dggs .update (** conf_extra , strict = True )
18241847
18251848 cols = set (geodf_points_wgs84 .columns .tolist ())
18261849 cols = cols - set ('geometry' )
@@ -1917,6 +1940,7 @@ def address_transform(
19171940 tmp_id = uuid .uuid4 ()
19181941 tmp_dir = self .working_dir
19191942 dggs = dgselect (dggs_type = dggs_type , res = resolution , mixed_aperture_level = mixed_aperture_level )
1943+ dggs .update (** conf_extra , strict = True )
19201944
19211945 if cell_id_list is None or len (cell_id_list ) <= 0 :
19221946 raise ValueError ("Expecting cell_id_list to transform." )
0 commit comments