### Example Channel Entry Source: https://github.com/seisman/hinetpy/blob/main/docs/appendix/channeltable.md An example of a single line entry in a channel table file, illustrating the format and data fields. ```default 6033 1 0 N.AAKH U 6 27 175.60 m/s 1.00 0.70 0 1.023e-07 36.3726 137.9203 483 0 0 Azuminoakashina ``` -------------------------------- ### Parameter File Example Source: https://github.com/seisman/hinetpy/blob/main/docs/appendix/win2sac.md An example of a parameter file used by win32 systems. The win2sac_32 tool specifically uses the 2nd line (channel table file) and 4th line (pick files path). ```plaintext . 0101_20100101.ch . . ``` -------------------------------- ### Example win2sac_32 Conversion Command Source: https://github.com/seisman/hinetpy/blob/main/docs/appendix/win2sac.md An example demonstrating how to use the win2sac_32 tool to convert a specific WIN32 file, extract channels, specify SAC output extension, and use big-endian format. ```bash win2sac_32 2000082404000101VM.cnt 4c55,4c65 SAC DATA -e > junk.log ``` -------------------------------- ### Install Developing Version of HinetPy Source: https://github.com/seisman/hinetpy/blob/main/docs/installation.md Install the latest development version of HinetPy by cloning the repository and installing from source. ```bash git clone https://github.com/seisman/HinetPy cd HinetPy python -m pip install . ``` -------------------------------- ### Start Python Interpreter Source: https://github.com/seisman/hinetpy/blob/main/docs/tutorial/get-started.md Begin by running the Python interpreter. Ensure you are using Python 3.8 or a later version. ```bash $ python Python 3.11.6 | packaged by conda-forge | (main, Oct 3 2023, 10:40:35) [GCC 12.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> ``` -------------------------------- ### Install Latest Stable HinetPy Source: https://github.com/seisman/hinetpy/blob/main/docs/installation.md Use this command to install the most recent stable release of the HinetPy library. ```bash python -m pip install HinetPy ``` -------------------------------- ### Example CSV Catalog Format Source: https://github.com/seisman/hinetpy/blob/main/docs/examples/example1.md This is an example of the CSV catalog file format used to specify events for waveform data retrieval. It includes event ID, time, location, magnitude, and other relevant details. ```csv #EventID | Time | Latitude | Longitude | Depth/km | Author | Catalog | Contributor | ContributorID | MagType | Magnitude | MagAuthor | EventLocationName 9993759|2017-01-22T04:30:22|-6.2145|155.1442|135.0|pt,us,at|NEIC PDE|us|us10007uph,pt17022050,at00ok5z6p|mww|7.9|us|SOLOMON ISLANDS 9993037|2017-01-19T23:04:21|-10.3433|161.318|36.0|pt,us,at|NEIC PDE|us|us10007u7n,at00ok1ura,pt17019050|mww|6.5|us|SOLOMON ISLANDS 9953968|2017-01-10T06:13:47|4.4634|122.575|612.71|at,us|NEIC PDE|us|us10007s9c,at00ojjvz0|Mww|7.3|us|CELEBES SEA 9951821|2017-01-03T21:52:30|-19.3542|176.058|12.0|at,us,pt|NEIC PDE|us|us10007pj6,at00oj84rf,pt17003051|Mww|6.9|us|SOUTH OF FIJI ISLANDS ``` -------------------------------- ### Download Arrival Time Catalog Source: https://github.com/seisman/hinetpy/blob/main/docs/tutorial/get-catalog.md Use the `get_arrivaltime` method to download the JMA arrival time catalog. Requires client authentication and a start date. ```python from HinetPy import Client from datetime import datetime client = Client("username", "password") startdate = datetime(2010, 1, 1) client.get_arrivaltime(startdate, 5) ``` -------------------------------- ### Get Continuous Waveform Data Source: https://github.com/seisman/hinetpy/blob/main/docs/api/HinetPy.client.md Download continuous waveform data from the Hi-net server. Specify the network code, start time, and span in minutes. Optional parameters allow for controlling maximum span, data filenames, output directory, and multithreading. ```python client.get_continuous_waveform(code='XX', starttime='2020-01-01T00:00:00', span=60, max_span=30, threads=5, cleanup=False) ``` -------------------------------- ### Get Network Information Source: https://github.com/seisman/hinetpy/blob/main/docs/tutorial/get-started.md Retrieve a list of available network codes and their descriptions using the info() method. You can also get detailed information for a specific network code. ```python client.info() ``` ```python client.info("0101") # get more information about NIED Hi-net (0101) ``` -------------------------------- ### Continuous Waveform Request with Different Time Formats Source: https://github.com/seisman/hinetpy/blob/main/docs/tutorial/get-continuous-waveform.md Demonstrates using alternative string formats for the start time in the `get_continuous_waveform()` function. This includes ISO 8601 format and a space-separated date and time. ```python >>> data, ctable = client.get_continuous_waveform("0101", "2010-01-01T00:00", 20) >>> data, ctable = client.get_continuous_waveform("0101", "2010-01-01 00:00", 20) ``` -------------------------------- ### Download Focal Mechanism Catalog Source: https://github.com/seisman/hinetpy/blob/main/docs/tutorial/get-catalog.md Use the `get_focalmechanism` method to download the JMA focal mechanism catalog. Requires client authentication and a start date. ```python from HinetPy import Client from datetime import datetime client = Client("username", "password") startdate = datetime(2010, 1, 1) client.get_focalmechanism(startdate, 5) ``` -------------------------------- ### Get Station List Source: https://github.com/seisman/hinetpy/blob/main/docs/tutorial/get-started.md Fetch a list of all stations for a given network code. The output includes the network code, station code, latitude, longitude, and elevation. ```python stations = client.get_station_list("0101") for station in stations: print(station) ``` -------------------------------- ### Requesting and Processing Hi-net Waveform Data Source: https://github.com/seisman/hinetpy/blob/main/paper/paper.md Demonstrates how to request continuous waveform data, convert it to SAC format, and extract SAC polezero files for instrumental responses. Requires a Hi-net account and prior installation of win32tools. ```python from HinetPy import Client, win32 # You need to register a Hi-net account first client = Client("username", "password") # Let's try to request 20-minute data of the Hi-net network (with an internal # network code of '0101') starting at 2010-01-01T00:00 (JST, GMT+0900) data, ctable = client.get_continuous_waveform("0101", "201001010000", 20) # The request and download process usually takes a few minutes. # Be patient... # Now you can see the data and channels table in your working directory # Waveform data (in win32 format) : 0101_201001010000_20.cnt # Channels table (plaintext file) : 0101_20100101.ch # Convert data from win32 format to SAC format win32.extract_sac(data, ctable) # Extract instrumental responses and save as SAC polezero files win32.extract_sacpz(ctable) # Now you can see several SAC and SAC_PZ files in your working directory. # # N.NGUH.E.SAC ... # N.NGUH.E.SAC_PZ ... ``` -------------------------------- ### Basic Continuous Waveform Request Source: https://github.com/seisman/hinetpy/blob/main/docs/tutorial/get-continuous-waveform.md Request 20 minutes of continuous waveform data since a specific time from the Hi-net network. This example demonstrates the default filename format for waveform and channel table files. ```python >>> from HinetPy import Client >>> client = Client("username", "password") >>> data, ctable = client.get_continuous_waveform("0101", "201001010000", 20) [2017-03-11 17:46:20] INFO: 2010-01-01 00:00 ~20 [2017-03-11 17:46:20] INFO: [1/4] => 2010-01-01 00:00 ~5 [2017-03-11 17:46:41] INFO: [2/4] => 2010-01-01 00:05 ~5 [2017-03-11 17:46:50] INFO: [3/4] => 2010-01-01 00:10 ~5 [2017-03-11 17:47:04] INFO: [4/4] => 2010-01-01 00:15 ~5 >>> ls 0101_201001010000_20.cnt 0101_20100101.ch ``` -------------------------------- ### Get Station List for Hi-net Source: https://github.com/seisman/hinetpy/blob/main/docs/api/HinetPy.client.md Retrieves a list of stations for the Hi-net network (code '0101'). Each station's information is printed to the console. ```python stations = client.get_station_list("0101") >>> for station in stations: ... print(station) 0101 N.WNNH 45.4883 141.885 -159.06 0101 N.SFNH 45.3346 142.1185 -81.6 ... ``` -------------------------------- ### Continuous Waveform Request with Datetime Object Source: https://github.com/seisman/hinetpy/blob/main/docs/tutorial/get-continuous-waveform.md Shows how to use a Python `datetime.datetime` object for the start time, providing more flexibility for time manipulation. Note that the datetime object is interpreted as JST time. ```python >>> from datetime import datetime >>> starttime = datetime(2010, 1, 1, 0, 0) # JST time >>> data, ctable = client.get_continuous_waveform("0101", starttime, 20) ``` -------------------------------- ### Perform System Checks with doctor() Source: https://github.com/seisman/hinetpy/blob/main/docs/tutorial/get-started.md Use the doctor() method to verify your HinetPy installation and check the status of the Hi-net web service and required tools like catwin32 and win2sac_32. ```python client.doctor() ``` -------------------------------- ### Channel Number File Format Source: https://github.com/seisman/hinetpy/blob/main/docs/appendix/win2sac.md Defines the format for a file containing channel numbers to be extracted. Lines starting with '#' are comments, blank lines are ignored, and numbers can be separated by spaces, tabs, or commas. ```plaintext 6034,6035 # 6036 # this line is ignored 6038 6039 ``` -------------------------------- ### HinetPy.utils.check_package_release Source: https://github.com/seisman/hinetpy/blob/main/docs/api.md Checks the release version of an installed package. ```APIDOC ## HinetPy.utils.check_package_release ### Description Checks the release version of an installed package. ### Method N/A (Python function) ### Endpoint N/A (Python function) ### Parameters N/A (Function signature not provided in source) ### Request Example N/A ### Response N/A ``` -------------------------------- ### HinetPy.win32.merge Source: https://github.com/seisman/hinetpy/blob/main/docs/api/HinetPy.win32.md Merges multiple win32 files into a single large win32 file using the `catwin32` command. It supports specifying files directly or via wildcard, and offers an option to force sorting by start time. ```APIDOC ## HinetPy.win32.merge ### Description Merges multiple win32 files into a single large win32 file. This function utilizes the `catwin32` command from the Hi-net win32tools package. ### Method Function Call ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **data** (*list* *or* *str*) – Win32 files to be merged. Can be a list of file names or a wildcard. * **total_data** (*str*) – Filename for the output win32 file. * **force_sort** (*bool*) – If True, sorts all win32 files by starttime before merging. Defaults to False. ### Request Example ```python # Example with sorted files data_files = sorted(glob.glob("20130404*.cnt")) HinetPy.win32.merge(data=data_files, total_data="merged_output.cnt") # Example forcing sort (use with caution due to performance) HinetPy.win32.merge(data="20130404*.cnt", total_data="merged_output.cnt", force_sort=True) ``` ### Response #### Success Response (No specific response details provided, implies successful execution of the merge operation) #### Response Example (No specific response example provided) ``` -------------------------------- ### Create Hi-netPy Client Source: https://github.com/seisman/hinetpy/blob/main/docs/tutorial/get-started.md Instantiate the Client class from the HinetPy library. Replace 'username' and 'password' with your actual Hi-net account credentials. ```python from HinetPy import Client client = Client("username", "password") # use your own account. ``` -------------------------------- ### Client Initialization Source: https://github.com/seisman/hinetpy/blob/main/docs/api/HinetPy.client.md Initializes the HinetPy client with user credentials and connection parameters. ```APIDOC ## Client(user=None, password=None, timeout=60, retries=3, sleep_time_in_seconds=5, max_sleep_count=30) ### Description Wrapper client to request waveform, catalog and manipulate stations. ### Parameters: * **user** (*str*) – Username of Hi-net account. * **password** (*str*) – Password of Hi-net account. * **timeout** (*float*) – Time to wait for the server to send data before giving up. * **retries** (*int*) – How many times to retry if a request fails. * **sleep_time_in_seconds** (*float*) – Sleep time between each data status check. * **max_sleep_count** (*int*) – Maximum number of sleeps before failing. ``` -------------------------------- ### catwin32 Usage Information Source: https://github.com/seisman/hinetpy/blob/main/docs/appendix/catwin32.md Displays the command-line usage and options for the catwin32 utility. This includes input file specifications, output file options, and sorting flags. ```bash catwin32 File_1 File_2 ... File_n [-oOutFile | -o OutFile] [-s] [-h] > [OutFile] File_n : Input WIN32 file name (accept wildcard). -o OutFile : Output WIN32 file name. Defaults to stdout if -o is ommitted. -s : Sort by date and channel number. This option is time consuming. -h : This usage print. ``` -------------------------------- ### Copy win32tools to PATH Source: https://github.com/seisman/hinetpy/blob/main/docs/installation.md Copies the compiled 'catwin32' and 'win2sac_32' commands to your home directory's bin folder, making them accessible in your system's PATH. ```bash cp catwin32.src/catwin32 win2sac.src/win2sac_32 $HOME/bin/ ``` -------------------------------- ### login Source: https://github.com/seisman/hinetpy/blob/main/docs/api/HinetPy.client.md Logs into the Hi-net server using provided user credentials. ```APIDOC ## login ### Description Login in the Hi-net server. ### Method Not specified (assumed to be a client library method call) ### Endpoint Not specified ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None #### Parameters * **user** (*str*) – Username of Hi-net account. * **password** (*str*) – Password of Hi-net account. ### Request Example None ### Response None specified ``` -------------------------------- ### Custom Output Filenames and Directory Source: https://github.com/seisman/hinetpy/blob/main/docs/tutorial/get-continuous-waveform.md Request continuous waveform data while specifying custom filenames for the waveform data and channel table, as well as a custom output directory. This allows for better organization of downloaded files. ```python >>> from HinetPy import Client >>> from datetime import datetime >>> client = Client("username", "password") >>> starttime = datetime(2010, 1, 1, 0, 0) # JST time >>> data, ctable = client.get_continuous_waveform( ... "0101", ... starttime, ... 20, ... data="201001010000.cnt", ... ctable="0101.ch", ... outdir="201001010000", ... ) [2017-03-11 17:46:20] INFO: 2010-01-01 00:00 ~20 [2017-03-11 17:46:20] INFO: [1/4] => 2010-01-01 00:00 ~5 [2017-03-11 17:46:41] INFO: [2/4] => 2010-01-01 00:05 ~5 [2017-03-11 17:46:50] INFO: [3/4] => 2010-01-01 00:10 ~5 [2017-03-11 17:47:04] INFO: [4/4] => 2010-01-01 00:15 ~5 >>> # You should see a directory "201001010000" with two files >>> # "0101.ch" and "201001010000.cnt" inside. ``` -------------------------------- ### win2sac_32 Command-Line Usage Source: https://github.com/seisman/hinetpy/blob/main/docs/appendix/win2sac.md This is the general command-line syntax for the win2sac_32 tool. It outlines the required arguments and available optional flags for conversion. ```bash win2sac_32 winfile ch_no sacfile [outdir] [-p(prmfile)] [-Y] [-e] [-b[BIN]] [-a[ASC]] [-r(RATIO)] [-m(PMAX)] ``` -------------------------------- ### Build win32tools Source: https://github.com/seisman/hinetpy/blob/main/docs/installation.md Commands to extract, navigate into, and build the win32tools package. This is necessary for processing win32 format data. ```bash tar -xvf win32tools.tar.gz cd win32tools/ make ``` -------------------------------- ### get_continuous_waveform(code, starttime, span, max_span=None, data=None, ctable=None, outdir=None, threads=3, cleanup=True) Source: https://github.com/seisman/hinetpy/blob/main/docs/api/HinetPy.client.md Downloads continuous waveform data from the Hi-net server. ```APIDOC ## get_continuous_waveform(code, starttime, span, max_span=None, data=None, ctable=None, outdir=None, threads=3, cleanup=True) ### Description Get continuous waveform data from Hi-net server. ### Parameters: * **code** (*str*) – Network code. See [`info()`](#HinetPy.client.Client.info) for details. * **starttime** (`datetime.datetime` or str) – Starttime of a data request. * **span** (*int*) – Time span in minutes. * **max_span** (*int*) – Maximum time span for sub-requests. Defaults to be determined automatically. * **data** (*str*) – Filename of downloaded win32 data. * **ctable** (*str*) – Filename of downloaded channel table file. * **outdir** (*str*) – Save win32 and channel table data to a specified directory. * **threads** (*int*) – Parallel data download using more threads. * **cleanup** (*bool*) – Clean up one-minute cnt files after merging. ### Returns: * **data** (*str*) – Filename of downloaded win32 data. * **ctable** (*str*) – Filename of downloaded channel table file. ``` -------------------------------- ### Request Continuous Waveform Data and Convert to SAC Source: https://github.com/seisman/hinetpy/blob/main/README.rst This snippet demonstrates how to request continuous waveform data from the Hi-net network, convert it to SAC format, and extract instrumental responses as SAC polezero files. Ensure you have a Hi-net account and replace 'username' and 'password' with your credentials. ```python from HinetPy import Client, win32 # You need a Hi-net account to access the data client = Client("username", "password") # Let's try to request 20-minute data of the Hi-net network (with an internal # network code of '0101') starting at 2010-01-01T00:00 (JST, GMT+0900) data, ctable = client.get_continuous_waveform("0101", "201001010000", 20) # The request and download process usually takes a few minutes # waiting for data request ... # waiting for data download ... # Now you can see the data and corresponding channel table in your working directory # waveform data (in win32 format) : 0101_201001010000_20.cnt # channel table (plaintext file) : 0101_20100101.ch # Let's convert data from win32 format to SAC format win32.extract_sac(data, ctable) # Let's extract instrument response as PZ files from the channel table file win32.extract_sacpz(ctable) # Now you can see several SAC and SAC_PZ files in your working directory # N.NGUH.E.SAC N.NGUH.U.SAC N.NNMH.N.SAC # N.NGUH.N.SAC N.NNMH.E.SAC N.NNMH.U.SAC # ... # N.NGUH.E.SAC_PZ N.NGUH.U.SAC_PZ N.NNMH.N.SAC_PZ # N.NGUH.N.SAC_PZ N.NNMH.E.SAC_PZ N.NNMH.U.SAC_PZ # ... ``` -------------------------------- ### get_arrivaltime(startdate, span, filename=None, os='DOS') Source: https://github.com/seisman/hinetpy/blob/main/docs/api/HinetPy.client.md Fetches JMA arrival time data from Hi-net for a specified period. ```APIDOC ## get_arrivaltime(startdate, span, filename=None, os='DOS') ### Description Get JMA arrival time data from Hi-net. ### Parameters: * **startdate** (str, `datetime.date`, `datetime.datetime`) – Start date to request. * **span** (*int*) – Data length in days. * **os** (*str*) – File format. “DOS” or “UNIX”. * **filename** (*str*) – Filename to save. ### Returns: * **Filename saved.** * **Return type:** str ``` -------------------------------- ### Import HinetPy win32 module Source: https://github.com/seisman/hinetpy/blob/main/docs/tutorial/conversion.md Import the necessary win32 module from the HinetPy library and define input file paths for data and channel table. ```python from HinetPy import win32 data = "0101_201001010000_20.cnt" ctable = "0101_20100101.ch" ``` -------------------------------- ### write_sacpz Method Source: https://github.com/seisman/hinetpy/blob/main/docs/api/HinetPy.channel.md Writes the channel's information into a SAC polezero file. ```APIDOC ## write_sacpz(pzfile, keep_sensitivity=False) ### Description Write channel information into a SAC polezero file. ### Parameters * **pzfile** (str) - Name of the SAC polezero file. * **keep_sensitivity** (bool) - Keep sensitivity in the SAC polezero “CONSTANT” or not. ``` -------------------------------- ### info(code=None) Source: https://github.com/seisman/hinetpy/blob/main/docs/api/HinetPy.client.md Retrieves and displays information about Hi-net networks. ```APIDOC ## info(code=None) ### Description Show information of networks. ### Parameters: * **code** (*None* *or* *str*) – Network code. ``` -------------------------------- ### Download Continuous Waveform Data from Obspy Catalog Source: https://github.com/seisman/hinetpy/blob/main/docs/examples/example2.md This snippet fetches seismic events from an obspy catalog and then downloads continuous waveform data for each event using HinetPy. It includes logic to skip events if the output directory already exists and extracts SAC files with pole-zero information. ```python import os from datetime import timedelta from HinetPy import Client, win32 from obspy import UTCDateTime from obspy.clients.fdsn import Client as fdsnClient fdsnclient = fdsnClient("IRIS") starttime = UTCDateTime("2005-01-01") endtime = UTCDateTime("2005-01-03") catalog = fdsnclient.get_events( starttime=starttime, endtime=endtime, minmagnitude=6, catalog="ISC" ) client = Client("username", "password") for event in catalog: # loop over events origin = event.origins[0].time.datetime starttime = origin + timedelta(hours=9) # deal with TimeZone issue outdir = origin.strftime("%Y%m%d%H%M") # skip if outdir already exists to avoid overwrite if os.path.exits(outdir): continue data, ctable = client.get_continuous_waveform("0101", starttime, 20, outdir=outdir) win32.extract_sac(data, ctable, outdir=outdir, with_sacpz=True) ``` -------------------------------- ### View Supported Networks Source: https://github.com/seisman/hinetpy/blob/main/docs/api/HinetPy.header.md Iterate through the NETWORK dictionary to print the code and name of each supported seismic network. The NETWORK dictionary maps network codes to Network objects. ```pycon >>> from HinetPy import NETWORK >>> for code in NETWORK.keys(): ... print(code, NETWORK[code].name) 0101 NIED Hi-net 0103 NIED F-net (broadband) 0103A NIED F-net (strong motion) 0106 NIED Temp. obs. in eastern Shikoku 0120 NIED S-net (velocity)... ``` -------------------------------- ### Request Event Waveforms Source: https://github.com/seisman/hinetpy/blob/main/docs/tutorial/get-event-waveform.md Use this snippet to request waveforms for events within a given time range, magnitude, and depth. Ensure you have initialized the HinetPy Client with your username and password. ```python from HinetPy import Client client = Client("username", "password") client.get_event_waveform( "201001010000", "201001020000", minmagnitude=4.0, maxmagnitude=7.0, mindepth=0, maxdepth=70, ) ``` -------------------------------- ### HinetPy.win32.merge Source: https://github.com/seisman/hinetpy/blob/main/docs/api.md Merges Hi-net data files. ```APIDOC ## HinetPy.win32.merge ### Description Merges Hi-net data files. ### Method N/A (Python function) ### Endpoint N/A (Python function) ### Parameters N/A (Function signature not provided in source) ### Request Example N/A ### Response N/A ``` -------------------------------- ### get_station_list Source: https://github.com/seisman/hinetpy/blob/main/docs/api/HinetPy.client.md Retrieves a list of stations for supported networks including Hi-net, F-net, S-net, and MeSO-net. ```APIDOC ## get_station_list ### Description Get station list of a network. The function only supports the following networks: Hi-net (0101), F-net (0103, 0103A), S-net (0120, 0120A) and MeSO-net (0131). ### Method Not specified (assumed to be a client library method call) ### Endpoint Not specified ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None #### Parameters * **code** (str) – Network code. ### Request Example ```python stations = client.get_station_list("0101") for station in stations: print(station) ``` ### Response #### Success Response * **stations** (list) – List of stations with their metadata. ### Response Example ``` 0101 N.WNNH 45.4883 141.885 -159.06 0101 N.SFNH 45.3346 142.1185 -81.6 ... ``` ``` -------------------------------- ### HinetPy.win32.read_ctable Source: https://github.com/seisman/hinetpy/blob/main/docs/api/HinetPy.win32.md Reads a channel table file and returns a list of Channel objects. ```APIDOC ## HinetPy.win32.read_ctable ### Description Read a channel table file. ### Method `read_ctable(ctable)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **ctable** (*str*) – Channel table file. ### Request Example ```python channels = hinetpy.win32.read_ctable('channel_table.txt') ``` ### Response #### Success Response (200) * **List of `Channel`** – A list containing Channel objects. #### Response Example ```json [ { "id": "XXX.YYY.ZZ", "name": "StationName", "component": "BHZ", "latitude": 35.0, "longitude": 139.0, "elevation": 100.0, "sampling_rate": 100.0 } ] ``` ``` -------------------------------- ### Extract Waveform Data to SAC Format Source: https://github.com/seisman/hinetpy/blob/main/docs/tutorial/conversion.md Extract waveform data from win32 format to SAC format. The converted SAC files contain velocity in nm/s or acceleration in nm/s/s, with sensitivity removed and multiplied by 1.0e9. ```python win32.extract_sac(data, ctable) ``` ```python win32.extract_sac(data, ctable, suffix="", outdir="SAC") ``` -------------------------------- ### Merge and Sort WIN32 Files Source: https://github.com/seisman/hinetpy/blob/main/docs/appendix/catwin32.md Merges multiple specified WIN32 files into a single output file and sorts the combined data by date and channel number. The -s option is used for sorting, and the output file is specified with -o. ```bash catwin32 1.cnt 2.cnt 3.cnt -o total.cnt -s ``` -------------------------------- ### Extract Instrument Responses to SAC Polezero Format Source: https://github.com/seisman/hinetpy/blob/main/docs/tutorial/conversion.md Convert instrument response information from Hi-net's channel table to SAC Polezero (PZ) format. This function is specific to Hi-net network data. ```python win32.extract_sacpz(ctable) ``` ```python win32.extract_sacpz(ctable, suffix="SACPZ", outdir="PZ/") ``` -------------------------------- ### HinetPy.utils.check_cmd_exists Source: https://github.com/seisman/hinetpy/blob/main/docs/api/HinetPy.utils.md Verifies if a specified command is available in the system's PATH and is executable. ```APIDOC ## HinetPy.utils.check_cmd_exists(cmd: str) ### Description Check if a command exists in PATH and is executable. ### Parameters #### Path Parameters - **cmd** (str) - Required - Name of the command. ### Returns True if the command exists in PATH and is executable, False otherwise. ``` -------------------------------- ### Uninstall HinetPy Source: https://github.com/seisman/hinetpy/blob/main/docs/installation.md Run this command to remove HinetPy from your system. ```bash python -m pip uninstall HinetPy ``` -------------------------------- ### Request Waveform Data from CSV Catalog Source: https://github.com/seisman/hinetpy/blob/main/docs/examples/example1.md This Python script demonstrates how to read a CSV catalog, process event times, and request continuous waveform data using HinetPy. It handles potential timezone issues and skips processing if output directories already exist. ```python import csv import os from datetime import datetime, timedelta from HinetPy import Client, win32 client = Client("username", "password") with open("events.csv") as csvfile: reader = csv.DictReader(csvfile, delimiter="|") reader.fieldnames = [field.strip() for field in reader.fieldnames] for row in reader: # loop over events origin = datetime.strptime(row["Time"], "%Y-%m-%dT%H:%M:%S") starttime = origin + timedelta(hours=9) # deal with TimeZone issue outdir = origin.strftime("%Y%m%d%H%M") # skip if outdir already exists to avoid overwrite if os.path.exists(outdir): continue data, ctable = client.get_continuous_waveform( "0101", starttime, 20, outdir=outdir ) win32.extract_sac(data, ctable, outdir=outdir, with_sacpz=True) ``` -------------------------------- ### HinetPy.win32.read_ctable Source: https://github.com/seisman/hinetpy/blob/main/docs/api.md Reads the ctable file format. ```APIDOC ## HinetPy.win32.read_ctable ### Description Reads the ctable file format. ### Method N/A (Python function) ### Endpoint N/A (Python function) ### Parameters N/A (Function signature not provided in source) ### Request Example N/A ### Response N/A ``` -------------------------------- ### Merge WIN32 Files Matching a Pattern Source: https://github.com/seisman/hinetpy/blob/main/docs/appendix/catwin32.md Merges all WIN32 files that match a specified wildcard pattern into a single output file. The output file is named explicitly using the -o option. ```bash catwin32 20100101*.cnt -o 0101_201001010000_5.cnt ``` -------------------------------- ### HinetPy.utils.check_cmd_exists Source: https://github.com/seisman/hinetpy/blob/main/docs/api.md Checks if a command exists in the system's PATH. ```APIDOC ## HinetPy.utils.check_cmd_exists ### Description Checks if a command exists in the system's PATH. ### Method N/A (Python function) ### Endpoint N/A (Python function) ### Parameters N/A (Function signature not provided in source) ### Request Example N/A ### Response N/A ``` -------------------------------- ### select_stations Source: https://github.com/seisman/hinetpy/blob/main/docs/api/HinetPy.client.md Selects seismic stations from supported networks based on network code and geographical filters. ```APIDOC ## select_stations ### Description Selects seismic stations from supported networks (Hi-net, F-net, S-net, MeSO-net) based on network code and geographical filters. ### Method ```python select_stations(code, stations=None, minlatitude=None, maxlatitude=None, minlongitude=None, maxlongitude=None, latitude=None, longitude=None, minradius=None, maxradius=None) ``` ### Parameters * **code** (str) – Network code. Supported codes: 0101, 0103, 0103A, 0120, 0120A, 0131. * **stations** (str or list, optional) – Specific stations to select within the network. * **minlatitude** (float, optional) – Minimum latitude for station selection. * **maxlatitude** (float, optional) – Maximum latitude for station selection. * **minlongitude** (float, optional) – Minimum longitude for station selection. * **maxlongitude** (float, optional) – Maximum longitude for station selection. * **latitude** (float, optional) – Latitude for radius-based search. * **longitude** (float, optional) – Longitude for radius-based search. * **minradius** (float, optional) – Minimum radius (in degrees) from the specified latitude/longitude. * **maxradius** (float, optional) – Maximum radius (in degrees) from the specified latitude/longitude. ``` -------------------------------- ### HinetPy.win32.extract_sac Source: https://github.com/seisman/hinetpy/blob/main/docs/api/HinetPy.win32.md Extracts seismic waveform data from win32 format files into SAC format. It utilizes the `win2sac_32` command and can optionally extract SAC polezero files. Note that the extracted SAC files represent velocity in nm/s or acceleration in nm/s/s, not digital counts. ```APIDOC ## HinetPy.win32.extract_sac ### Description Extract data as SAC format files. This function calls the `win2sac_32` command, available in the Hi-net win32tools package, to convert data files from win32 format to SAC format. It can also extract the channel information as SAC polezero files. ### Method `extract_sac(data, ctable, suffix='SAC', outdir='.', pmax=8640000, filter_by_id=None, filter_by_name=None, filter_by_component=None, with_sacpz=False, processes=None)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **data** (*str*) – win32 file to be processed. * **ctable** (*str*) – Channel table file. * **suffix** (*str*) – Suffix of output SAC files. Defaults to `SAC`. * **outdir** (*str*) – Output directory. Defaults to current directory. * **pmax** (*int*) – Maximum number of data points for one channel. Defaults to 8640000. If one channel has more than 8640000 data points (i.e., longer than one day for a 100 Hz sampling rate), you MUST increase `pmax`. * **filter_by_id** (*list* or *str*) – Filter channels by ID. It can be a list of IDs or a wildcard. * **filter_by_name** (*list* or *str*) – Filter channels by name. It can be a list of names or a wildcard. * **filter_by_component** (*list* or *str*) – Filter channels by component. It can be a list of component names or a wildcard. * **with_sacpz** (*bool*) – Also extract SAC PZ files. By default, the suffix is `.SAC_PZ` and the channel sensitivity is not kept in the “CONSTANT”. * **processes** (*None* or *int*) – Number of processes to speed up data extraction parallelly. `None` means using all CPUs. ### Request Example ```python hinetpy.win32.extract_sac('input.win32', 'channel_table.txt') ``` ### Response #### Success Response (200) This function does not return a value, but creates SAC files in the specified output directory. #### Response Example None ``` -------------------------------- ### get_selected_stations Source: https://github.com/seisman/hinetpy/blob/main/docs/api/HinetPy.client.md Queries stations selected for requesting data, supporting Hi-net and F-net networks. ```APIDOC ## get_selected_stations ### Description Query stations selected for requesting data. It supports two networks: Hi-net (0101) and F-net (0103, 0103A). ### Method Not specified (assumed to be a client library method call) ### Endpoint Not specified ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None #### Parameters * **code** (str) – Network code. ### Request Example None ### Response #### Success Response * **stations** (list of [`Station`](#HinetPy.client.Station)) – List of selected stations with station metadata information. ### Response Example None specified ``` -------------------------------- ### Filter PZ Extraction by Channel Name Source: https://github.com/seisman/hinetpy/blob/main/docs/tutorial/conversion.md Extract instrument responses to SAC PZ format, filtering by a channel name pattern using wildcards. ```python win32.extract_sacpz(ctable, filter_by_name="N.NA*") ``` -------------------------------- ### Filter Waveform Extraction by Channel Name Source: https://github.com/seisman/hinetpy/blob/main/docs/tutorial/conversion.md Extract waveform data to SAC format, filtering by a channel name pattern using wildcards. ```python win32.extract_sac(data, ctable, filter_by_name="N.NA*") ``` -------------------------------- ### Select Stations Dynamically Source: https://github.com/seisman/hinetpy/blob/main/docs/tutorial/get-started.md Use select_stations() to filter stations based on specific criteria such as station names, geographical bounding boxes, or circular regions. Calling select_stations() without arguments retrieves all stations for the specified network. ```python # select only two stations of Hi-net if you know the station names client.select_stations("0101", ["N.AAKH", "N.ABNH"]) ``` ```python # select Hi-net stations in a box region client.select_stations( "0101", minlatitude=36, maxlatitude=50, minlongitude=140, maxlongitude=150 ) ``` ```python # select Hi-net stations in a circular region client.select_stations("0101", latitude=36, longitude=139, minradius=0, maxradius=3) ``` ```python # select all Hi-net stations client.select_stations("0101") ``` -------------------------------- ### doctor() Source: https://github.com/seisman/hinetpy/blob/main/docs/api/HinetPy.client.md Performs checks to ensure HinetPy is up-to-date and dependencies are met. ```APIDOC ## doctor() ### Description Doctor does some checks. This is a utility function that checks: - if HinetPy has a new release - if Hi-net web service is updated - if `catwin32` and `win2sac_32` are in PATH ### Example ```pycon >>> client.doctor() Hi-net web service is NOT updated. You're using the latest release (v0.x.x). catwin32: Full path is /home/user/bin/catwin32. win2sac_32: Full path is /home/user/bin/win2sac_32. ``` ``` -------------------------------- ### HinetPy.win32.extract_sacpz Source: https://github.com/seisman/hinetpy/blob/main/docs/api/HinetPy.win32.md Extracts instrumental responses in SAC polezero format from a channel table file. This function is specifically designed for Hi-net instrumental responses. ```APIDOC ## HinetPy.win32.extract_sacpz ### Description Extract instrumental responses in SAC polezero format from a channel table. #### WARNING The function only works for Hi-net instrumental responses. ### Method `extract_sacpz(ctable, suffix='SAC_PZ', outdir='.', keep_sensitivity=False, filter_by_id=None, filter_by_name=None, filter_by_component=None, processes=None)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **ctable** (*str*) – Channel table file. * **suffix** (*str*) – Suffix of SAC PZ files. Defaults to `SAC_PZ`. * **outdir** (*str*) – Output directory. Defaults to current directory. * **keep_sensitivity** (*bool*) – The `win2sac_32` program automatically removes sensitivity from waveform data during the win32-to-SAC format conversion. So the generated polezero file should omit the sensitivity. * **filter_by_id** (*list* or *str*) – Filter channels by ID. It can be a list of IDs or a wildcard. * **filter_by_name** (*list* or *str*) – Filter channels by name. It can be a list of names or a wildcard. * **filter_by_component** (*list* or *str*) – Filter channels by component. It can be a list of component names or a wildcard. * **processes** (*None* or *int*) – Number of processes to speed up data extraction parallelly. `None` means using all CPUs. ### Request Example ```python hinetpy.win32.extract_sacpz('channel_table.txt') ``` ### Response #### Success Response (200) This function does not return a value, but creates SAC PZ files in the specified output directory. #### Response Example None ``` -------------------------------- ### Filter Waveform Extraction by Name and Component Source: https://github.com/seisman/hinetpy/blob/main/docs/tutorial/conversion.md Extract waveform data to SAC format, filtering by both a channel name pattern and a specific component (e.g., vertical 'U'). ```python win32.extract_sac(data, ctable, filter_by_name="N.NA*", filter_by_component="U") ``` -------------------------------- ### HinetPy.win32.extract_sac Source: https://github.com/seisman/hinetpy/blob/main/docs/api.md Extracts SAC files from the Hi-net data format. ```APIDOC ## HinetPy.win32.extract_sac ### Description Extracts SAC files from the Hi-net data format. ### Method N/A (Python function) ### Endpoint N/A (Python function) ### Parameters N/A (Function signature not provided in source) ### Request Example N/A ### Response N/A ``` -------------------------------- ### Filter PZ Extraction by Name and Component Source: https://github.com/seisman/hinetpy/blob/main/docs/tutorial/conversion.md Extract instrument responses to SAC PZ format, filtering by both a channel name pattern and a specific component (e.g., vertical 'U'). ```python win32.extract_sacpz(ctable, filter_by_name="N.NA*", filter_by_component="U") ``` -------------------------------- ### check_service_update() Source: https://github.com/seisman/hinetpy/blob/main/docs/api/HinetPy.client.md Checks if the Hi-net web service has been updated. ```APIDOC ## check_service_update() ### Description Check if Hi-net service is updated. ### Example ```pycon >>> client.check_service_update() [2017-01-01 00:00:00] INFO: Hi-net web service is NOT updated. ``` ``` -------------------------------- ### Check Hi-net Service Update Status Source: https://github.com/seisman/hinetpy/blob/main/docs/api/HinetPy.client.md Use check_service_update to determine if the Hi-net web service has been updated. This helps in staying aware of potential changes to the service. ```python >>> client.check_service_update() [2017-01-01 00:00:00] INFO: Hi-net web service is NOT updated. ``` -------------------------------- ### Filter Waveform Extraction by Channel ID Source: https://github.com/seisman/hinetpy/blob/main/docs/tutorial/conversion.md Extract waveform data to SAC format, filtering by a list of specific channel IDs. ```python win32.extract_sac(data, ctable, filter_by_id=["3e83", "3e84", "3e85"]) ``` -------------------------------- ### Filter PZ Extraction by Channel ID Source: https://github.com/seisman/hinetpy/blob/main/docs/tutorial/conversion.md Extract instrument responses to SAC PZ format, filtering by a list of specific channel IDs. ```python win32.extract_sacpz(ctable, filter_by_id=["3e83", "3e84", "3e85"]) ``` -------------------------------- ### HinetPy.win32.extract_sacpz Source: https://github.com/seisman/hinetpy/blob/main/docs/api.md Extracts SAC PZs (poles and zeros) files from the Hi-net data format. ```APIDOC ## HinetPy.win32.extract_sacpz ### Description Extracts SAC PZs (poles and zeros) files from the Hi-net data format. ### Method N/A (Python function) ### Endpoint N/A (Python function) ### Parameters N/A (Function signature not provided in source) ### Request Example N/A ### Response N/A ``` -------------------------------- ### Channel Class Source: https://github.com/seisman/hinetpy/blob/main/docs/api/HinetPy.channel.md Represents a single seismic channel with detailed information including its ID, name, component, location, and sensor properties. ```APIDOC ## class HinetPy.channel.Channel ### Description Information for a single channel. ### Parameters * **id** (str) - Channel ID. * **name** (str) - Station Name. * **component** (str) - Channel component name (e.g., `U`, `N` or `E`). * **latitude** (float | str) - Station latitude. * **longitude** (float | str) - Station longitude. * **unit** (str) - Unit of data (e.g., `m`, `m/s`, `m/s/s`, `rad`). * **gain** (float | str) - Sensor sensitivity. * **damping** (float | str) - Damping constant of the sensor. * **period** (float | str) - Natural period of the seismometer. * **preamplification** (float | str) - Preamplification value. * **lsb_value** (float | str) - LSB value. ``` -------------------------------- ### HinetPy.win32.extract_pz Source: https://github.com/seisman/hinetpy/blob/main/docs/api.md Extracts PZs (poles and zeros) files from the Hi-net data format. ```APIDOC ## HinetPy.win32.extract_pz ### Description Extracts PZs (poles and zeros) files from the Hi-net data format. ### Method N/A (Python function) ### Endpoint N/A (Python function) ### Parameters N/A (Function signature not provided in source) ### Request Example N/A ### Response N/A ```