Coverage for C: \ Users \ peaco \ OneDrive \ Documents \ GitHub \ mt_metadata \ mt_metadata \ timeseries \ magnetic.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-01-10 00:11 -0800

1# ===================================================== 

2# Imports 

3# ===================================================== 

4from typing import Annotated 

5 

6from pydantic import Field, PrivateAttr 

7 

8from mt_metadata.common import StartEndRange 

9from mt_metadata.timeseries import Channel 

10 

11 

12# ===================================================== 

13class Magnetic(Channel): 

14 _channel_type: str = PrivateAttr("magnetic") 

15 component: Annotated[ 

16 str, 

17 Field( 

18 default="h_default", 

19 description="Component of the magnetic field.", 

20 alias=None, 

21 pattern=r"^[hHbBrR][a-zA-Z0-9_]*$", 

22 json_schema_extra={ 

23 "units": None, 

24 "required": True, 

25 "examples": ["hx"], 

26 }, 

27 ), 

28 ] 

29 

30 h_field_min: Annotated[ 

31 StartEndRange, 

32 Field( 

33 default_factory=StartEndRange, 

34 description="minimum of field strength at the beginning and end", 

35 alias=None, 

36 json_schema_extra={ 

37 "units": "nanotesla", 

38 "required": True, 

39 "examples": ["StartEndRange(start=0.01, end=0.02)"], 

40 }, 

41 ), 

42 ] 

43 

44 h_field_max: Annotated[ 

45 StartEndRange, 

46 Field( 

47 default_factory=StartEndRange, 

48 description="maximum of field strength at the beginning and end", 

49 alias=None, 

50 json_schema_extra={ 

51 "units": "nanotesla", 

52 "required": True, 

53 "examples": ["StartEndRange(start=0.1, end=2.0)"], 

54 }, 

55 ), 

56 ] 

57 

58 type: Annotated[ 

59 str, 

60 Field( 

61 default="magnetic", 

62 description="Data type for the channel, should be a descriptive word that a user can understand.", 

63 alias=None, 

64 json_schema_extra={ 

65 "units": None, 

66 "required": True, 

67 "examples": ["magnetic"], 

68 }, 

69 ), 

70 ]