mt-metadata 0.3.7__py2.py3-none-any.whl → 0.3.8__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of mt-metadata might be problematic. Click here for more details.

mt_metadata/__init__.py CHANGED
@@ -39,7 +39,7 @@ you should only have to changes these dictionaries.
39
39
 
40
40
  __author__ = """Jared Peacock"""
41
41
  __email__ = "jpeacock@usgs.gov"
42
- __version__ = "0.3.7"
42
+ __version__ = "0.3.8"
43
43
 
44
44
  # =============================================================================
45
45
  # Imports
@@ -274,7 +274,7 @@ class TF:
274
274
  )
275
275
  self.logger.error(msg)
276
276
  raise TypeError(msg)
277
- return run_metadata.copy()
277
+ return run_metadata
278
278
 
279
279
  def _validate_station_metadata(self, station_metadata):
280
280
  """
@@ -298,7 +298,7 @@ class TF:
298
298
  )
299
299
  self.logger.error(msg)
300
300
  raise TypeError(msg)
301
- return station_metadata.copy()
301
+ return station_metadata
302
302
 
303
303
  def _validate_survey_metadata(self, survey_metadata):
304
304
  """
@@ -328,7 +328,7 @@ class TF:
328
328
  )
329
329
  self.logger.error(msg)
330
330
  raise TypeError(msg)
331
- return survey_metadata.copy()
331
+ return survey_metadata
332
332
 
333
333
  ### Properties ------------------------------------------------------------
334
334
  @property
@@ -1475,9 +1475,8 @@ class TF:
1475
1475
  """
1476
1476
  self.station_metadata.id = validate_name(station_name)
1477
1477
  if self.station_metadata.runs[0].id is None:
1478
- r = self.station_metadata.runs[0].copy()
1478
+ r = self.station_metadata.runs.pop(None)
1479
1479
  r.id = f"{self.station_metadata.id}a"
1480
- self.station_metadata.runs.remove(None)
1481
1480
  self.station_metadata.runs.append(r)
1482
1481
 
1483
1482
  @property
@@ -2164,9 +2163,9 @@ class TF:
2164
2163
  """
2165
2164
  zmm_kwargs = {}
2166
2165
  zmm_kwargs["channel_nomenclature"] = self.channel_nomenclature
2167
- zmm_kwargs[
2168
- "inverse_channel_nomenclature"
2169
- ] = self.inverse_channel_nomenclature
2166
+ zmm_kwargs["inverse_channel_nomenclature"] = (
2167
+ self.inverse_channel_nomenclature
2168
+ )
2170
2169
  if hasattr(self, "decimation_dict"):
2171
2170
  zmm_kwargs["decimation_dict"] = self.decimation_dict
2172
2171
  zmm_obj = ZMM(**zmm_kwargs)
@@ -252,6 +252,22 @@ class EDI(object):
252
252
  return 1.0 / self.frequency
253
253
  return None
254
254
 
255
+ def _assert_descending_frequency(self):
256
+ """
257
+ Assert that the transfer function is ordered from high frequency to low
258
+ frequency.
259
+
260
+ """
261
+ if self.frequency[0] < self.frequency[1]:
262
+ self.logger.debug(
263
+ "Ordered arrays to be arranged from high to low frequency"
264
+ )
265
+ self.frequency = self.frequency[::-1]
266
+ self.z = self.z[::-1]
267
+ self.z_err = self.z_err[::-1]
268
+ self.t = self.t[::-1]
269
+ self.t_err = self.t_err[::-1]
270
+
255
271
  def read(self, fn=None, get_elevation=False):
256
272
  """
257
273
  Read in an edi file and fill attributes of each section's classes.
@@ -456,13 +472,8 @@ class EDI(object):
456
472
  except KeyError as error:
457
473
  self.logger.debug(error)
458
474
  # check for order of frequency, we want high togit low
459
- if self.frequency[0] < self.frequency[1]:
460
- self.logger.debug(
461
- "Ordered arrays to be arranged from high to low frequency"
462
- )
463
- self.frequency = self.frequency[::-1]
464
- self.z = self.z[::-1]
465
- self.z_err = self.z_err[::-1]
475
+ self._assert_descending_frequency()
476
+
466
477
  try:
467
478
  self.rotation_angle = np.array(data_dict["zrot"])
468
479
  except KeyError:
@@ -31,7 +31,7 @@ attr_dict.add_dict(get_schema("estimator", SCHEMA_FN_PATHS), "estimator")
31
31
  # =============================================================================
32
32
 
33
33
 
34
- def df_from_bands(band_list):
34
+ def df_from_bands(band_list: list) -> pd.DataFrame:
35
35
  """
36
36
  Utility function that transforms a list of bands into a dataframe
37
37
 
@@ -70,13 +70,13 @@ def df_from_bands(band_list):
70
70
  out_df.reset_index(inplace=True, drop=True)
71
71
  return out_df
72
72
 
73
- def get_fft_harmonics(samples_per_window, sample_rate):
73
+ def get_fft_harmonics(samples_per_window: int, sample_rate: float) -> np.ndarray:
74
74
  """
75
75
  Works for odd and even number of points.
76
76
 
77
- Could be midified with kwargs to support one_sided, two_sided, ignore_dc
78
- ignore_nyquist, and etc. Could actally take FrequencyBands as an argument
79
- if we wanted as well.
77
+ Development notes:
78
+ Could be modified with kwargs to support one_sided, two_sided, ignore_dc
79
+ ignore_nyquist, and etc. Consider taking FrequencyBands as an argument.
80
80
 
81
81
  Parameters
82
82
  ----------
@@ -44,18 +44,14 @@ class ListDict:
44
44
 
45
45
  def _get_key_from_index(self, index):
46
46
  try:
47
- return next(
48
- key for ii, key in enumerate(self._home) if ii == index
49
- )
47
+ return next(key for ii, key in enumerate(self._home) if ii == index)
50
48
 
51
49
  except StopIteration:
52
50
  raise KeyError(f"Could not find {index}")
53
51
 
54
52
  def _get_index_from_key(self, key):
55
53
  try:
56
- return next(
57
- index for index, k in enumerate(self._home) if k == key
58
- )
54
+ return next(index for index, k in enumerate(self._home) if k == key)
59
55
 
60
56
  except StopIteration:
61
57
  raise KeyError(f"Could not find {key}")
@@ -75,9 +71,7 @@ class ListDict:
75
71
  elif hasattr(obj, "component"):
76
72
  return obj.component
77
73
  else:
78
- raise TypeError(
79
- "could not identify an appropriate key from object"
80
- )
74
+ raise TypeError("could not identify an appropriate key from object")
81
75
 
82
76
  def __deepcopy__(self, memodict={}):
83
77
  """
@@ -230,9 +224,7 @@ class ListDict:
230
224
  raise (KeyError("Could not find None in keys."))
231
225
 
232
226
  else:
233
- raise TypeError(
234
- "could not identify an appropriate key from object"
235
- )
227
+ raise TypeError("could not identify an appropriate key from object")
236
228
 
237
229
  def extend(self, other, skip_keys=[]):
238
230
  """
@@ -282,3 +274,18 @@ class ListDict:
282
274
  )
283
275
 
284
276
  self._home.update(other)
277
+
278
+ def pop(self, key):
279
+ """
280
+ pop item off of dictionary. The key must be verbatim
281
+
282
+ :param key: key of item to be popped off of dictionary
283
+ :type key: string
284
+ :return: item popped
285
+
286
+ """
287
+
288
+ if key in self.keys():
289
+ return dict([self._home.popitem(key)])
290
+ else:
291
+ raise KeyError(f"{key} is not in ListDict keys.")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mt-metadata
3
- Version: 0.3.7
3
+ Version: 0.3.8
4
4
  Summary: Metadata for magnetotelluric data
5
5
  Home-page: https://github.com/kujaku11/mt_metadata
6
6
  Author: Jared Peacock
@@ -28,7 +28,7 @@ Requires-Dist: matplotlib
28
28
  Requires-Dist: xarray
29
29
  Requires-Dist: loguru
30
30
 
31
- # mt_metadata version 0.3.7
31
+ # mt_metadata version 0.3.8
32
32
  Standard MT metadata
33
33
 
34
34
  [![PyPi version](https://img.shields.io/pypi/v/mt_metadata.svg)](https://pypi.python.org/pypi/mt-metadata)
@@ -58,7 +58,7 @@ MT Metadata is a project led by [IRIS-PASSCAL MT Software working group](https:/
58
58
 
59
59
  Most people will be using the transfer functions, but a lot of that metadata comes from the time series metadata. This module supports both and has tried to make them more or less seamless to reduce complication.
60
60
 
61
- * **Version**: 0.3.7
61
+ * **Version**: 0.3.8
62
62
  * **Free software**: MIT license
63
63
  * **Documentation**: https://mt-metadata.readthedocs.io.
64
64
  * **Examples**: Click the `Binder` badge above and Jupyter Notebook examples are in **mt_metadata/examples/notebooks** and **docs/source/notebooks**
@@ -426,3 +426,11 @@ History
426
426
  * Patches by @kkappler in https://github.com/kujaku11/mt_metadata/pull/221
427
427
  * Patches by @kkappler in https://github.com/kujaku11/mt_metadata/pull/223
428
428
  * Bump version: 0.3.6 → 0.3.7 by @kujaku11 in https://github.com/kujaku11/mt_metadata/pull/225
429
+
430
+ 0.3.8 (2024-09-30)
431
+ ----------------------
432
+
433
+ * Add pop to ListDict by @kujaku11 in https://github.com/kujaku11/mt_metadata/pull/226
434
+ * Fix EDI Tipper flip by @kujaku11 in https://github.com/kujaku11/mt_metadata/pull/228
435
+ * Patches by @kujaku11 in https://github.com/kujaku11/mt_metadata/pull/227
436
+ * Bump version: 0.3.7 → 0.3.8 by @kujaku11 in https://github.com/kujaku11/mt_metadata/pull/229
@@ -1,4 +1,4 @@
1
- mt_metadata/__init__.py,sha256=Ij-OA6uOFAAYRMgD-lPkuf74v6_J326Orxlg2fKQVbM,5588
1
+ mt_metadata/__init__.py,sha256=5I6-LAuYEnG5odhwSnzJQmi38FjQCSeUoBpwML7C6BI,5588
2
2
  mt_metadata/base/__init__.py,sha256=bylCGBoJkeytxeQgMnuqivqFAvbyNE5htvP-3yu1GEY,184
3
3
  mt_metadata/base/helpers.py,sha256=_SbJC8zDFmjQrmGbb6jBkqkWtaItNHyb8PREdPm5nl8,19798
4
4
  mt_metadata/base/metadata.py,sha256=obOFdU6FPf2o-SbdxOxZ60LvzbI6Cp-bbRXw8KdkBao,27145
@@ -131,11 +131,11 @@ mt_metadata/timeseries/stationxml/xml_station_mt_station.py,sha256=pelvkiQios4gz
131
131
  mt_metadata/timeseries/tools/__init__.py,sha256=loPgjYnajbOX2rQTlLBh79cG2eaUNpI3KaCjp7SB4ik,78
132
132
  mt_metadata/timeseries/tools/from_many_mt_files.py,sha256=rtx5NAPBUmOgrMXUT-YJxznqfI1qdRkS4B2SWjrU_1c,14405
133
133
  mt_metadata/transfer_functions/__init__.py,sha256=7F_9sev0KlRfswx_H0j8-1PJs-ZTpD04qwjYh1jst8w,1288
134
- mt_metadata/transfer_functions/core.py,sha256=AmWmH2-k-2W2uGTsaozZkq6p3KURWWgfMHCbEMZiTU8,80641
134
+ mt_metadata/transfer_functions/core.py,sha256=9fl-9-9x0vUMIv9MdiR-cp90ImJsS5E9NYTdkjvRaos,80569
135
135
  mt_metadata/transfer_functions/io/__init__.py,sha256=8DKEQZrpF0RK_MTjR0_w0UQfgVf9VwuJrzy7eann1N8,215
136
136
  mt_metadata/transfer_functions/io/tools.py,sha256=xatyc0RN8-KKS1PmpjATDAOHln9HIEP-iNAN0Njjyv4,6024
137
137
  mt_metadata/transfer_functions/io/edi/__init__.py,sha256=5pgyFFwRezvlxxcsSQsvCmeShJe97TdY6F37T7FiNWA,61
138
- mt_metadata/transfer_functions/io/edi/edi.py,sha256=mFUahyjiIZnh45masDsue4pJkU4FifnZOi4I8rlvXh0,53798
138
+ mt_metadata/transfer_functions/io/edi/edi.py,sha256=BQdiZNiXRdQ9-95HhhWDNK4zHyUTSFRcHXSJr4h6Q8I,54099
139
139
  mt_metadata/transfer_functions/io/edi/metadata/__init__.py,sha256=ndXcOh7eN4adnXS7fAtvZg6i4K_gY3VT7zbNzeGjsaM,395
140
140
  mt_metadata/transfer_functions/io/edi/metadata/data_section.py,sha256=RhelbBN83LhRvItlVrBKuQoFLBaPonENp0KyIkW79X0,7751
141
141
  mt_metadata/transfer_functions/io/edi/metadata/define_measurement.py,sha256=AQfJQSTVs-iOuEyiCnBFjMwqgowD0dkL2Bp5mSAhQ8s,16318
@@ -280,7 +280,7 @@ mt_metadata/transfer_functions/processing/aurora/band.py,sha256=mNDkpJQbf7F7aF-F
280
280
  mt_metadata/transfer_functions/processing/aurora/channel.py,sha256=TZHfy-XgrijdNVd4Sjbq3tjORFsJNZIzwa4_J7tDOHM,773
281
281
  mt_metadata/transfer_functions/processing/aurora/channel_nomenclature.py,sha256=Y7rQTH3YsTB8KFIMk6vQZWFrRKQWlnwoQNZOZjZImbk,3038
282
282
  mt_metadata/transfer_functions/processing/aurora/decimation.py,sha256=AF7vdU-Q7W4yfnJoPDbhDqgxJTtHiLCLEUDLBEzfmFM,785
283
- mt_metadata/transfer_functions/processing/aurora/decimation_level.py,sha256=cZhV9BPM7kj3qSDg7HCM2vyV7VW1-jWOTE7ISASKRsA,10657
283
+ mt_metadata/transfer_functions/processing/aurora/decimation_level.py,sha256=-DgKDCypO1qoqYsck-FNGrduF41can3xqRLsKeIVYeA,10700
284
284
  mt_metadata/transfer_functions/processing/aurora/estimator.py,sha256=9I2Rs3guO7sc9HEpLbYI8nYZfQ7IayosKvsrE6etBac,781
285
285
  mt_metadata/transfer_functions/processing/aurora/processing.py,sha256=BCKXGu_iVValVyE0EbsR9_gYkwv0I4GxS61AqXUtc8s,10320
286
286
  mt_metadata/transfer_functions/processing/aurora/regression.py,sha256=NIgivJx11-ZVsVfQgdIODfsPeyMPmhRXA6bSNiarA8c,783
@@ -325,14 +325,14 @@ mt_metadata/transfer_functions/tf/standards/survey.json,sha256=4AX3-n8j8QwLkXF7G
325
325
  mt_metadata/transfer_functions/tf/standards/transfer_function.json,sha256=yTPACcTk9JcxmTwIiRPUdoPf3riRGJZ-XxrNfHU5Otw,3220
326
326
  mt_metadata/utils/__init__.py,sha256=5TWhar2ujJY_pYkwDdggX8jU9CFXcxc9jX1yXc8TqJs,35
327
327
  mt_metadata/utils/exceptions.py,sha256=PKWdjKfR95NJ-Rgx3rzu9Qmdj0thVHjcmEvHoC9HuBE,462
328
- mt_metadata/utils/list_dict.py,sha256=BguxnQuNPf8aOMwULaaam22L4RUQ3SNzIkLqVh_gUQs,7668
328
+ mt_metadata/utils/list_dict.py,sha256=sazYtq8spfN9l6iGrqsfKCdUFAMXq6iV8cq3m8UlS-Q,7945
329
329
  mt_metadata/utils/mttime.py,sha256=v71TCPjtoY_0GTsJ39WCD8kwIZDNzE679m96a3QGgPE,18725
330
330
  mt_metadata/utils/summarize.py,sha256=KisJt2PWz1-_FOBH8NQtidgxjdWPAbIDwPzEB197uhs,4109
331
331
  mt_metadata/utils/units.py,sha256=OdALLmytoPvjJ8rYf7QsGq1b8nrNt85A8wUhjqRyTOo,6405
332
332
  mt_metadata/utils/validators.py,sha256=jQf0VBtfT5GMXlEUI5Hg1zILqSir9Ra4Moi4dL54KeM,16380
333
- mt_metadata-0.3.7.dist-info/AUTHORS.rst,sha256=3RKy4std2XZQLNF6xYIiA8S5A0bBPqNO7ypJsuEhiN8,706
334
- mt_metadata-0.3.7.dist-info/LICENSE,sha256=P33RkFPriIBxsgZtVzSn9KxYa2K7Am42OwMV0h_m5e0,1080
335
- mt_metadata-0.3.7.dist-info/METADATA,sha256=dCuqaycFVp396z1u2LdlwnYTOI36qMNpu5i8sfk8_vI,20438
336
- mt_metadata-0.3.7.dist-info/WHEEL,sha256=DZajD4pwLWue70CAfc7YaxT1wLUciNBvN_TTcvXpltE,110
337
- mt_metadata-0.3.7.dist-info/top_level.txt,sha256=fxe_q_GEd9h6iR3050ZnrhSfxUSO5pR8u65souS4RWM,12
338
- mt_metadata-0.3.7.dist-info/RECORD,,
333
+ mt_metadata-0.3.8.dist-info/AUTHORS.rst,sha256=3RKy4std2XZQLNF6xYIiA8S5A0bBPqNO7ypJsuEhiN8,706
334
+ mt_metadata-0.3.8.dist-info/LICENSE,sha256=P33RkFPriIBxsgZtVzSn9KxYa2K7Am42OwMV0h_m5e0,1080
335
+ mt_metadata-0.3.8.dist-info/METADATA,sha256=n5-YN8vl3N_p8nBp_EUFXxSC97d-rXWmHwGa5BaIolM,20842
336
+ mt_metadata-0.3.8.dist-info/WHEEL,sha256=DZajD4pwLWue70CAfc7YaxT1wLUciNBvN_TTcvXpltE,110
337
+ mt_metadata-0.3.8.dist-info/top_level.txt,sha256=fxe_q_GEd9h6iR3050ZnrhSfxUSO5pR8u65souS4RWM,12
338
+ mt_metadata-0.3.8.dist-info/RECORD,,