File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -227,13 +227,20 @@ def update_connectivity(
227227 if start_index != 0 :
228228 column_values = column_values + start_index
229229
230+ dtype = connectivity .encoding .get ('dtype' , connectivity .dtype )
231+
232+ if dtype .kind == 'i' :
233+ # Ensure the fill value fits within the representable integers
234+ max_representable = np .iinfo (dtype ).max
235+ if max_representable < fill_value :
236+ fill_value = max_representable
237+
230238 # We need to preseve the integer dtype,
231239 # while also accounting for masked values.
232240 # xarray does not make this easy.
233241 # By constructing the array using new_fill_value where needed,
234242 # setting the dtype explicitly, and adding the _FillValue attribute,
235243 # xarray will cooperate.
236- dtype = connectivity .encoding .get ('dtype' , connectivity .dtype )
237244 include_row = ~ np .ma .getmask (row_indices )
238245 raw_values = np .array ([
239246 [
You can’t perform that action at this time.
0 commit comments