Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clients #82

Merged
merged 58 commits into from
Mar 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
9d443b2
adding fdsn module
kujaku11 Feb 5, 2022
c13147d
updating documentation
kujaku11 Feb 15, 2022
f7831f2
updated make_mth5 to use FDSN class
kujaku11 Feb 16, 2022
16bec7a
updated version 0.1.0 tests
kujaku11 Feb 16, 2022
62029a4
updated tests
kujaku11 Feb 16, 2022
91b5891
added documentation to make_mth5
kujaku11 Feb 16, 2022
2b534bb
Merge branch 'master' of https://github.com/kujaku11/mth5 into clients
kujaku11 May 6, 2022
64da14b
updating tests
kujaku11 May 6, 2022
7a54c6f
Update fdsn.py
kujaku11 May 6, 2022
a162416
adding geomag client
kujaku11 Nov 15, 2022
f6d6451
Merge branch 'master' into clients
kujaku11 Nov 15, 2022
54a8cee
updated set sample period
kujaku11 Nov 15, 2022
2ec334e
added start and end time
kujaku11 Nov 15, 2022
3b63a9c
Update geomag.py
kujaku11 Nov 15, 2022
8f24ef3
updating geomag to request in chunks
kujaku11 Nov 15, 2022
767fce8
updated geomag client to output a runTS
kujaku11 Nov 15, 2022
6eba507
adding survey_metadata to run and channel
kujaku11 Nov 16, 2022
911d463
updating geomag client
kujaku11 Nov 18, 2022
61a4ebf
updating tests
kujaku11 Mar 20, 2023
311b69b
Update geomag.py
kujaku11 Mar 20, 2023
1171cb0
Merge branch 'master' into clients
kujaku11 Mar 21, 2023
60b4881
Update test_geomag.py
kujaku11 Mar 21, 2023
eff751e
Update geomag.py
kujaku11 Mar 21, 2023
cc2a447
adding tests for geomag
kujaku11 Mar 21, 2023
b91bf3a
added astype(float) to data
kujaku11 Mar 21, 2023
d46559e
added make_filename
kujaku11 Mar 21, 2023
c747abe
Update test_geomag.py
kujaku11 Mar 21, 2023
4c10944
adding h5 options to make_mth5
kujaku11 Mar 22, 2023
307e6e4
updating test for clients
kujaku11 Mar 22, 2023
cb4d8a0
Update __init__.py
kujaku11 Mar 22, 2023
314fc08
adding tests for make_mth5_from_geomag
kujaku11 Mar 22, 2023
287c1bc
tests pass locally
kujaku11 Mar 22, 2023
3fcf5ef
adding documentation, changing how runs are named
kujaku11 Mar 23, 2023
cf66da5
updated documentation
kujaku11 Mar 23, 2023
60d793f
updated get chunks
kujaku11 Mar 23, 2023
fcb3ff8
Update make_mth5.py
kujaku11 Mar 23, 2023
c5f0efa
added set to get_files
kujaku11 Mar 24, 2023
8608c98
added set for getting files
kujaku11 Mar 24, 2023
63b0a85
Update channel_ts.py
kujaku11 Mar 24, 2023
9135d3b
Update channel_ts.py
kujaku11 Mar 24, 2023
509765e
Update channel_ts.py
kujaku11 Mar 24, 2023
402b29c
updated __add__ for channels
kujaku11 Mar 24, 2023
69ae510
Update channel_ts.py
kujaku11 Mar 24, 2023
0f21e3f
Update channel_ts.py
kujaku11 Mar 24, 2023
81891dc
added interpolate_na to fill gaps
kujaku11 Mar 24, 2023
c593bde
added interpolate_na to __add__
kujaku11 Mar 24, 2023
964d9e9
added test for merge
kujaku11 Mar 24, 2023
f53a1c4
adding __add__, resample, merge to runts
kujaku11 Mar 24, 2023
e7cbcce
adding tests for add runs
kujaku11 Mar 26, 2023
12ada9e
updated run tests for __add__, merge; combined into one test
kujaku11 Mar 26, 2023
970deb8
Update run_ts_example.ipynb
kujaku11 Mar 26, 2023
7a85cbc
updated from trace and channel_type validation
kujaku11 Mar 26, 2023
3d762fc
from_obspy_trace not working
kujaku11 Mar 27, 2023
41bed0a
updating documentation and added copy method
kujaku11 Mar 27, 2023
c14576c
added copy and __eq_ to run
kujaku11 Mar 27, 2023
06f1691
added __neq__
kujaku11 Mar 27, 2023
c473461
Merge pull request #136 from kujaku11/ch_add
kujaku11 Mar 27, 2023
5a68fde
Create test_makemth5.py
kujaku11 Mar 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
270 changes: 234 additions & 36 deletions docs/examples/notebooks/channel_ts_example.ipynb

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions docs/examples/notebooks/fdsn_request.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
,network,station,location,channel,start,end
0,8P,CAS04,,LFE,2020-06-02T19:00:00,2020-07-13T19:00:00
1,8P,CAS04,,LFN,2020-06-02T19:00:00,2020-07-13T19:00:00
2,8P,CAS04,,LFZ,2020-06-02T19:00:00,2020-07-13T19:00:00
3,8P,CAS04,,LQE,2020-06-02T19:00:00,2020-07-13T19:00:00
4,8P,CAS04,,LQN,2020-06-02T19:00:00,2020-07-13T19:00:00
51 changes: 33 additions & 18 deletions docs/examples/notebooks/make_mth5_driver_v0.1.0.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
"source": [
"# Make MTH5 from IRIS Data Managment Center v0.1.0 \n",
"\n",
"This example demonstrates how to build an MTH5 from data archived at IRIS, it could work with any MT data stored at an FDSN data center (probably).\n",
"\n",
"We will use the `mth5.clients.FDSN` class to build the file. There is also second way using the more generic `mth5.clients.MakeMTH5` class, which will be highlighted below. \n",
"\n",
"**Note:** this example assumes that data availability (Network, Station, Channel, Start, End) are all previously known. If you do not know the data that you want to download use [IRIS tools](https://ds.iris.edu/ds/nodes/dmc/tools/##) to get data availability. "
]
},
Expand All @@ -18,7 +22,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"2022-09-12 17:00:41,562 [line 135] mth5.setup_logger - INFO: Logging file can be found C:\\Users\\jpeacock\\OneDrive - DOI\\Documents\\GitHub\\mth5\\logs\\mth5_debug.log\n"
"2023-03-23 14:32:18,703 [line 135] mth5.setup_logger - INFO: Logging file can be found C:\\Users\\jpeacock\\OneDrive - DOI\\Documents\\GitHub\\mth5\\logs\\mth5_debug.log\n"
]
}
],
Expand All @@ -28,7 +32,7 @@
"import numpy as np\n",
"import pandas as pd\n",
"from mth5.mth5 import MTH5\n",
"from mth5.clients.make_mth5 import MakeMTH5\n",
"from mth5.clients import FDSN\n",
"\n",
"from matplotlib import pyplot as plt\n",
"%matplotlib widget"
Expand Down Expand Up @@ -67,8 +71,8 @@
"metadata": {},
"outputs": [],
"source": [
"m = MakeMTH5(mth5_version='0.1.0')\n",
"m.client = \"IRIS\""
"fdsn_object = FDSN(mth5_version='0.1.0')\n",
"fdsn_object.client = \"IRIS\""
]
},
{
Expand All @@ -95,7 +99,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 6,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -186,7 +190,7 @@
"4 8P CAS04 LQN 2020-06-02T19:00:00 2020-07-13T19:00:00"
]
},
"execution_count": 4,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -203,7 +207,7 @@
" )\n",
"\n",
"# Turn list into dataframe\n",
"request_df = pd.DataFrame(request_list, columns=m.column_names) \n",
"request_df = pd.DataFrame(request_list, columns=fdsn_object.request_columns) \n",
"request_df"
]
},
Expand All @@ -218,7 +222,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -236,11 +240,11 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"inventory, data = m.get_inventory_from_df(request_df, data=False)"
"inventory, data = fdsn_object.get_inventory_from_df(request_df, data=False)"
]
},
{
Expand All @@ -252,13 +256,13 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Inventory created at 2022-09-13T00:00:42.935166Z\n",
"Inventory created at 2023-03-23T21:32:59.642492Z\n",
"\tCreated by: ObsPy 1.3.0\n",
"\t\t https://www.obspy.org\n",
"\tSending institution: MTH5\n",
Expand All @@ -267,12 +271,12 @@
"\t\t\t8P\n",
"\t\tStations (1):\n",
"\t\t\t8P.CAS04 (Corral Hollow, CA, USA)\n",
"\t\tChannels (8):\n",
"\t\t\t8P.CAS04..LFZ, 8P.CAS04..LFN, 8P.CAS04..LFE, 8P.CAS04..LQN (2x), \n",
"\t\t\t8P.CAS04..LQE (3x)"
"\t\tChannels (5):\n",
"\t\t\t8P.CAS04..LFZ, 8P.CAS04..LFN, 8P.CAS04..LFE, 8P.CAS04..LQN, \n",
"\t\t\t8P.CAS04..LQE"
]
},
"execution_count": 7,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -291,7 +295,18 @@
"\n",
"We are going to time it just to get an indication how long it might take. Should take about 4 minutes.\n",
"\n",
"**Note:** we are setting `interact=False`. If you want to just to keep the file open to interogat it set `interact=True`. "
"**Note:** we are setting `interact=False`. If you want to just to keep the file open to interogat it set `interact=True`. \n",
"\n",
"### Make an MTH5 using MakeMTH5\n",
"\n",
"Another way to make a file is using the `mth5.clients.MakeMTH5` class, which is more generic than FDSN, but doesn't have as many methods. The `MakeMTH5` class is meant to be a convienence method for the various clients.\n",
"\n",
"```\n",
"from mth5.clients import MakeMTH5\n",
"\n",
"make_mth5_object = MakeMTH5(mth5_version='0.1.0', interact=False)\n",
"mth5_filename = make_mth5_object.from_fdsn_client(request_df, client=\"IRIS\")\n",
"```"
]
},
{
Expand Down Expand Up @@ -352,7 +367,7 @@
"source": [
"%%time\n",
"\n",
"mth5_filename = m.make_mth5_from_fdsnclient(request_df, interact=False)\n",
"mth5_filename = fdsn_object.make_mth5_from_fdsn_client(request_df, interact=False)\n",
"\n",
"print(f\"Created {mth5_filename}\")"
]
Expand Down
31 changes: 23 additions & 8 deletions docs/examples/notebooks/make_mth5_driver_v0.2.0.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
"source": [
"# Make MTH5 from IRIS Data Managment Center v0.2.0 \n",
"\n",
"This example demonstrates how to build an MTH5 from data archived at IRIS, it could work with any MT data stored at an FDSN data center (probably).\n",
"\n",
"We will use the `mth5.clients.FDSN` class to build the file. There is also second way using the more generic `mth5.clients.MakeMTH5` class, which will be highlighted below. \n",
"\n",
"**Note:** this example assumes that data availability (Network, Station, Channel, Start, End) are all previously known. If you do not know the data that you want to download use [IRIS tools](https://ds.iris.edu/ds/nodes/dmc/tools/##) to get data availability. "
]
},
Expand All @@ -18,7 +22,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"2022-09-12 15:28:25,328 [line 135] mth5.setup_logger - INFO: Logging file can be found C:\\Users\\jpeacock\\OneDrive - DOI\\Documents\\GitHub\\mth5\\logs\\mth5_debug.log\n"
"2023-03-23 14:50:15,143 [line 135] mth5.setup_logger - INFO: Logging file can be found C:\\Users\\jpeacock\\OneDrive - DOI\\Documents\\GitHub\\mth5\\logs\\mth5_debug.log\n"
]
}
],
Expand All @@ -28,7 +32,7 @@
"import numpy as np\n",
"import pandas as pd\n",
"from mth5.mth5 import MTH5\n",
"from mth5.clients.make_mth5 import MakeMTH5\n",
"from mth5.clients.make_mth5 import FDSN\n",
"\n",
"from matplotlib import pyplot as plt\n",
"%matplotlib widget"
Expand Down Expand Up @@ -67,8 +71,8 @@
"metadata": {},
"outputs": [],
"source": [
"m = MakeMTH5(mth5_version='0.2.0')\n",
"m.client = \"IRIS\""
"fdsn_object = FDSN(mth5_version='0.2.0')\n",
"fdsn_object.client = \"IRIS\""
]
},
{
Expand Down Expand Up @@ -254,7 +258,7 @@
" )\n",
"\n",
"# Turn list into dataframe\n",
"request_df = pd.DataFrame(request_list, columns=m.column_names) \n",
"request_df = pd.DataFrame(request_list, columns=fdsn_object.request_columns) \n",
"request_df"
]
},
Expand Down Expand Up @@ -291,7 +295,7 @@
"metadata": {},
"outputs": [],
"source": [
"inventory, data = m.get_inventory_from_df(request_df, data=False)"
"inventory, data = fdsn_object.get_inventory_from_df(request_df, data=False)"
]
},
{
Expand Down Expand Up @@ -344,7 +348,18 @@
"\n",
"We are going to time it just to get an indication how long it might take. Should take about 4 minutes.\n",
"\n",
"**Note:** we are setting `interact=False`. If you want to just to keep the file open to interogat it set `interact=True`. "
"**Note:** we are setting `interact=False`. If you want to just to keep the file open to interogat it set `interact=True`. \n",
"\n",
"### Make an MTH5 using MakeMTH5\n",
"\n",
"Another way to make a file is using the `mth5.clients.MakeMTH5` class, which is more generic than FDSN, but doesn't have as many methods. The `MakeMTH5` class is meant to be a convienence method for the various clients.\n",
"\n",
"```\n",
"from mth5.clients import MakeMTH5\n",
"\n",
"make_mth5_object = MakeMTH5(mth5_version='0.2.0', interact=False)\n",
"mth5_filename = make_mth5_object.from_fdsn_client(request_df, client=\"IRIS\")\n",
"```"
]
},
{
Expand Down Expand Up @@ -428,7 +443,7 @@
"source": [
"%%time\n",
"\n",
"mth5_object = m.make_mth5_from_fdsnclient(request_df, interact=False)\n",
"mth5_object = fdsn_object.make_mth5_from_fdsn_client(request_df, interact=False)\n",
"\n",
"print(f\"Created {mth5_object}\")"
]
Expand Down