@@ -107,6 +107,7 @@ def assemble_kwargs(
107107
108108 return kwargs
109109
110+
110111def zero_padding (dggs : str ) -> int :
111112 max_res_lookup = {
112113 "h3" : const .MAX_H3 ,
@@ -120,6 +121,7 @@ def zero_padding(dggs: str) -> int:
120121 raise ValueError (f"Unknown DGGS type: { dggs } " )
121122 return len (str (max_res ))
122123
124+
123125def get_parent_res (dggs : str , parent_res : Union [None , int ], resolution : int ) -> int :
124126 """
125127 Uses a parent resolution,
@@ -128,20 +130,17 @@ def get_parent_res(dggs: str, parent_res: Union[None, int], resolution: int) ->
128130
129131 Used for intermediate re-partioning.
130132 """
131- default_dggs_parent_res = {
132- "h3" : max (const .MIN_H3 , (resolution - const .DEFAULT_PARENT_OFFSET )),
133- "rhp" : max (const .MIN_RHP , (resolution - const .DEFAULT_PARENT_OFFSET )),
134- "geohash" : max (const .MIN_GEOHASH , (resolution - const .DEFAULT_PARENT_OFFSET )),
135- "maidenhead" : const .MIN_MAIDENHEAD ,
136- "s2" : max (const .MIN_S2 , (resolution - const .DEFAULT_PARENT_OFFSET )),
137- }
138- if not dggs in default_dggs_parent_res :
133+ if not dggs in const .DEFAULT_DGGS_PARENT_RES .keys ():
139134 raise RuntimeError (
140135 "Unknown dggs {dggs}) - must be one of [ {options} ]" .format (
141- dggs = dggs , options = ", " .join (default_dggs_parent_res .keys ())
136+ dggs = dggs , options = ", " .join (const . DEFAULT_DGGS_PARENT_RES .keys ())
142137 )
143138 )
144- return parent_res if parent_res is not None else default_dggs_parent_res [dggs ]
139+ return (
140+ int (parent_res )
141+ if parent_res is not None
142+ else const .DEFAULT_DGGS_PARENT_RES [dggs ]
143+ )
145144
146145
147146def address_boundary_issues (
@@ -166,8 +165,6 @@ def address_boundary_issues(
166165 of the original (i.e. window-based) partitioning. Using the nested structure of the DGGS is an useful property
167166 to address this problem.
168167 """
169- parent_res = get_parent_res (dggs , parent_res , resolution )
170-
171168 LOGGER .debug (
172169 f"Reading Stage 1 output ({ pq_input } ) and setting index for parent-based partitioning"
173170 )
0 commit comments