Coverage for C:\src\imod-python\imod\util\__init__.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.5.1, created at 2024-05-08 14:15 +0200

1""" 

2Miscellaneous Utilities. 

3 

4The utilies imported in this file are public API, and previously placed in 

5imod/util.py. Therefore these should be available under the imod.util namespace. 

6""" 

7 

8import warnings 

9 

10from imod.util.context import cd, ignore_warnings 

11from imod.util.path import temporary_directory 

12from imod.util.spatial import ( 

13 coord_reference, 

14 empty_2d, 

15 empty_2d_transient, 

16 empty_3d, 

17 empty_3d_transient, 

18 from_mdal_compliant_ugrid2d, 

19 mdal_compliant_ugrid2d, 

20 spatial_reference, 

21 to_ugrid2d, 

22 transform, 

23 ugrid2d_data, 

24) 

25from imod.util.structured import replace, values_within_range, where 

26from imod.util.time import to_datetime 

27 

28 

29def round_extent(extent, cellsize): 

30 """ 

31 This function is to preserve the imod.util.round_extent() namespace. Please 

32 refer to the new location in the future: imod.prepare.spatial.roundextent. 

33 """ 

34 # Import locally to avoid circular imports 

35 from imod.prepare.spatial import round_extent 

36 

37 warnings.warn( 

38 "Use of `imod.util.round_extent` is deprecated, please use the new " 

39 "location `imod.prepare.spatial.round_extent`", 

40 DeprecationWarning, 

41 ) 

42 return round_extent(extent, cellsize)