Skip to content

Commit

Permalink
Merge pull request #178 from kujaku11/patches
Browse files Browse the repository at this point in the history
Patches
  • Loading branch information
kujaku11 authored Nov 9, 2023
2 parents ce718df + cb23198 commit 1c4068d
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.3.2
current_version = 0.3.3
files = setup.py mt_metadata/__init__.py README.md tests/tf/io/edi/test_no_error_edi.py
commit = True
tag = True
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# mt_metadata version 0.3.2
# mt_metadata version 0.3.3
Standard MT metadata

[![PyPi version](https://img.shields.io/pypi/v/mt_metadata.svg)](https://pypi.python.org/pypi/mt-metadata)
Expand Down Expand Up @@ -28,7 +28,7 @@ MT Metadata is a project led by [IRIS-PASSCAL MT Software working group](https:/

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.

* **Version**: 0.3.2
* **Version**: 0.3.3
* **Free software**: MIT license
* **Documentation**: https://mt-metadata.readthedocs.io.
* **Examples**: Click the `Binder` badge above and Jupyter Notebook examples are in **mt_metadata/examples/notebooks** and **docs/source/notebooks**
Expand Down
2 changes: 1 addition & 1 deletion mt_metadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

__author__ = """Jared Peacock"""
__email__ = "[email protected]"
__version__ = "0.3.2"
__version__ = "0.3.3"

# =============================================================================
# Imports
Expand Down
11 changes: 6 additions & 5 deletions mt_metadata/transfer_functions/processing/aurora/stations.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@author: jpeacock
"""
import pandas as pd
# =============================================================================
# Imports
# =============================================================================
Expand Down Expand Up @@ -126,14 +127,14 @@ def to_dataset_dataframe(self):
"""

local_df = self.local.to_dataset_dataframe()

df = self.local.to_dataset_dataframe()
for rr in self.remote:
local_df = local_df.append(rr.to_dataset_dataframe())
remote_df = rr.to_dataset_dataframe()
df = pd.concat([df, remote_df]) #, axis=1, ignore_index=True)

local_df = local_df.reset_index()
df.reset_index(inplace=True, drop=True)

return local_df
return df

def get_station(self, station_id):
"""
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
test_suite="tests",
tests_require=test_requirements,
url="https://github.com/kujaku11/mt_metadata",
version="0.3.2",
version="0.3.3",
zip_safe=False,
package_data={
"": [
Expand Down
2 changes: 1 addition & 1 deletion tests/tf/io/edi/test_no_error_edi.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_header(self):
("longitude", 0.0),
("progdate", "2013-07-03"),
("progname", "mt_metadata"),
("progvers", "0.3.2"),
("progvers", "0.3.3"),
("stdvers", "SEG 1.0"),
("units", "millivolts_per_kilometer_per_nanotesla"),
]
Expand Down
84 changes: 84 additions & 0 deletions tests/tf/processing/aurora/test_processing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 25 11:46:46 2022
@author: jpeacock
"""

# =============================================================================
# Imports
# =============================================================================
import pandas as pd
import unittest

from mt_metadata.transfer_functions.processing.aurora import Processing

# =============================================================================


class TestProcessing(unittest.TestCase):

@classmethod
def setUpClass(self):
starts = ["2020-01-01T00:00:00", "2020-02-02T00:00:00"]
ends = ["2020-01-31T12:00:00", "2020-02-28T12:00:00"]

data_list = []
for ii in range(3):
for start, end in zip(starts, ends):
entry = {
"station_id": "mt01",
"run_id": f"{ii:03}",
"start": start,
"end": end,
"mth5_path": r"/home/mth5_path.h5",
"sample_rate": 10,
"input_channels": ["hx", "hy"],
"output_channels": ["hz", "ex", "ey"],
"remote": False
}

data_list.append(entry)

rr_entry_01 = {
"station_id": "rr01",
"run_id": f"{ii:03}",
"start": start,
"end": end,
"mth5_path": r"/home/mth5_path.h5",
"sample_rate": 10,
"input_channels": ["hx", "hy"],
"output_channels": ["hz", "ex", "ey"],
"remote": True
}
data_list.append(rr_entry_01)

rr_entry_02 = {
"station_id": "rr02",
"run_id": f"{ii:03}",
"start": start,
"end": end,
"mth5_path": r"/home/mth5_path.h5",
"sample_rate": 10,
"input_channels": ["hx", "hy"],
"output_channels": ["hz", "ex", "ey"],
"remote": True
}
data_list.append(rr_entry_02)
data_list = data_list
df = pd.DataFrame(data_list)
df.start = pd.to_datetime(df.start)
df.end = pd.to_datetime(df.end)
self.df = df


def test_stations_to_dataframe(self):
""" This could be moved under test_statons.py"""
p = Processing()
p.stations.from_dataset_dataframe(self.df)
df = p.stations.to_dataset_dataframe()
assert len(df) == len(self.df)


if __name__ == "__main__":
unittest.main()

0 comments on commit 1c4068d

Please sign in to comment.