Coverage for C:\src\imod-python\imod\mf6\out\common.py: 92%

13 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2024-04-08 13:27 +0200

1import pathlib 

2from typing import BinaryIO, Union 

3 

4import numpy as np 

5 

6# Type annotations 

7IntArray = np.ndarray 

8FloatArray = np.ndarray 

9FilePath = Union[str, pathlib.Path] 

10 

11 

12def _grb_text(f: BinaryIO, lentxt: int = 50) -> str: 

13 return f.read(lentxt).decode("utf-8").strip().lower() 

14 

15 

16def _to_nan(a: FloatArray, dry_nan: bool) -> FloatArray: 

17 # TODO: this could really use a docstring? 

18 a[a == 1e30] = np.nan 

19 if dry_nan: 

20 a[a == -1e30] = np.nan 

21 return a