File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
src/power_grid_model_io/converters Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 2121from power_grid_model_io .data_types import ExtraInfo , StructuredData
2222from power_grid_model_io .utils .dict import merge_dicts
2323
24+ _NAN_FUNC = {
25+ np .dtype ("f8" ): lambda x : np .all (np .isnan (x )),
26+ np .dtype ("i4" ): lambda x : np .all (x == np .iinfo (np .dtype ("i4" )).min ),
27+ np .dtype ("i1" ): lambda x : np .all (x == np .iinfo (np .dtype ("i1" )).min ),
28+ }
29+
2430
2531class PgmJsonConverter (BaseConverter [StructuredData ]):
2632 """
@@ -306,9 +312,4 @@ def _is_nan(data: np.ndarray) -> bool:
306312 True when all the data points are invalid
307313 False otherwise
308314 """
309- nan_func = {
310- np .dtype ("f8" ): lambda x : np .all (np .isnan (x )),
311- np .dtype ("i4" ): lambda x : np .all (x == np .iinfo (np .dtype ("i4" )).min ),
312- np .dtype ("i1" ): lambda x : np .all (x == np .iinfo (np .dtype ("i1" )).min ),
313- }
314- return bool (nan_func [data .dtype ](data ))
315+ return bool (_NAN_FUNC [data .dtype ](data ))
You can’t perform that action at this time.
0 commit comments