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

13 statements  

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

1# -*- coding: utf-8 -*- 

2""" 

3================== 

4metadata 

5================== 

6 

7This module deals with metadata as defined by the MT metadata standards. 

8 

9There are multiple containers for each type of metadata, named appropriately. 

10 

11Each container will be able to read and write: 

12 * dictionary 

13 * json 

14 * xml 

15 * csv? 

16 * pandas.Series 

17 * anything else? 

18 

19 

20Each container has an attribute called _attr_dict which dictates if the 

21attribute is included in output objects, the data type, whether it is a 

22required parameter, and the style of output. This should help down the road 

23with validation and keeping the data types consistent. And if things change 

24you should only have to changes these dictionaries. 

25 

26:copyright: 

27 Jared Peacock (jpeacock@usgs.gov) 

28 

29:license: 

30 MIT 

31 

32 

33""" 

34 

35# ============================================================================= 

36# Package details 

37# ============================================================================= 

38 

39 

40__author__ = """Jared Peacock""" 

41__email__ = "jpeacock@usgs.gov" 

42__version__ = "0.4.0" 

43 

44# ============================================================================= 

45# Imports 

46# ============================================================================= 

47import sys 

48from pathlib import Path 

49 

50from loguru import logger 

51 

52# ============================================================================= 

53# Global Variables 

54# ============================================================================= 

55 

56 

57ACCEPTED_STYLES = [ 

58 "name", 

59 "url", 

60 "email", 

61 "number", 

62 "date", 

63 "free form", 

64 "time", 

65 "date time", 

66 "name list", 

67 "number list", 

68 "controlled vocabulary", 

69 "alpha numeric", 

70] 

71 

72REQUIRED_KEYS = [ 

73 "attribute", 

74 "type", 

75 "required", 

76 "units", 

77 "style", 

78 "description", 

79 "options", 

80 "alias", 

81 "example", 

82 "default", 

83] 

84 

85DEFAULT_CHANNEL_NOMENCLATURE = { 

86 "hx": "hx", 

87 "hy": "hy", 

88 "hz": "hz", 

89 "ex": "ex", 

90 "ey": "ey", 

91} 

92 

93NULL_VALUES = [ 

94 None, 

95 "", 

96 "null", 

97 "None", 

98 "NONE", 

99 "NULL", 

100 "Null", 

101 "none", 

102 "1980-01-01T00:00:00", 

103 "1980-01-01T00:00:00+00:00", 

104] 

105 

106# ============================================================================= 

107# Initiate loggers 

108# ============================================================================= 

109config = { 

110 "handlers": [ 

111 { 

112 "sink": sys.stdout, 

113 "level": "INFO", 

114 "colorize": True, 

115 "format": "<level>{time} | {level: <3} | {name} | {function} | line: {line} | {message}</level>", 

116 }, 

117 ], 

118 "extra": {"user": "someone"}, 

119} 

120logger.configure(**config) 

121# logger.disable("mt_metadata") 

122 

123 

124from mt_metadata.data import *