From 7fc59ac2e17d2f5d30c31210488cf35a8b293b2d Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Thu, 28 Mar 2024 13:19:04 +0800 Subject: [PATCH] Support more networks --- HinetPy/header.py | 727 ++++++++---------------------------- docs/api/HinetPy.header.rst | 2 + tests/localtest_channels.py | 18 +- 3 files changed, 159 insertions(+), 588 deletions(-) diff --git a/HinetPy/header.py b/HinetPy/header.py index b9e35d36..3e7aef3f 100644 --- a/HinetPy/header.py +++ b/HinetPy/header.py @@ -1,598 +1,169 @@ """ -Basic information of networks. -""" - -from collections import namedtuple -from datetime import datetime - -Network = namedtuple("Network", "name, channels, starttime, url") -""" -An object containing information of a network. - -.. py:attribute:: name - - Network name. - -.. py:attribute:: channels +This module provides a dict of seismic networks that are available from the Hi-net +website. - Number of channels the network has. +The dict is named ``NETWORK``. The network code is the key of the dict, and the value is +a :class:`~HinetPy.header.Network` object, which contains the network name, number of +channels, start time when waveform data is available, and the homepage URL. The network +code is a string, e.g., "0101" for Hi-net. The number of channels, start time, and +homepage URL are obtained from the Hi-net website, but they may not be up-to-date so +don't rely on them too much. -.. py:attribute:: starttime - - Start time (JST: UTC+0900) when waveform data is avaiable. - -.. py:attribute:: url - - Homepage of the network. - -``NETWORK`` is a dict of :class:`~HinetPy.header.Network`, containing information of all -networks available from Hi-net website. +To view the list of supported networks, use: >>> 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) -0120 NIED S-net (speed motion) -0120A NIED S-net (acceleration) -0131 NIED MeSO-net -0201 Hokkaido University -... +0106 NIED Temp. obs. in eastern Shikoku +0120 NIED S-net (velocity)... """ +from __future__ import annotations + +from datetime import datetime + + +class Network: + def __init__( + self, name: str, channels: int | None, starttime: str | datetime, url: str + ): + """ + A seismic network and its information. + + Parameters + ---------- + name + Network name. + channels + Number of channels the network has. + starttime + Start time (JST: UTC+0900) when waveform data is avaiable. + url + Homepage of the network. + """ + self.name = name + self.channels = channels + self.starttime = starttime + self.url = url + + URL = { "Hinet": "http://www.hinet.bosai.go.jp", "Fnet": "http://www.fnet.bosai.go.jp", "Vnet": "http://www.vnet.bosai.go.jp", "JMA": "http://www.jma.go.jp/jma/indexe.html", + "Snet": "https://www.seafloor.bosai.go.jp/", } - -NETWORK = {} - -NETWORK["0101"] = Network( - name="NIED Hi-net", - channels=2336, - starttime=datetime(2004, 4, 1, 0, 0), - url=URL["Hinet"], -) -NETWORK["0103"] = Network( - name="NIED F-net (broadband)", - channels=438, - starttime=datetime(2004, 4, 1, 0, 0), - url=URL["Fnet"], -) -NETWORK["0103A"] = Network( - name="NIED F-net (strong motion)", - channels=438, - starttime=datetime(2004, 4, 1, 0, 0), - url=URL["Fnet"], -) -NETWORK["0120"] = Network( - name="NIED S-net (speed motion)", - channels=450 * 2, # 450 velocity + 450 acceleration - starttime=datetime(2016, 8, 15, 0, 0), - url=URL["Hinet"], -) -NETWORK["0120A"] = Network( - name="NIED S-net (acceleration)", - channels=450 * 2, # 450 velocity + 450 acceleration - starttime=datetime(2016, 8, 15, 0, 0), - url=URL["Hinet"], -) -NETWORK["0131"] = Network( - name="NIED MeSO-net", - channels=900, - starttime=datetime(2017, 4, 1, 0, 0), - url=URL["Hinet"], -) - -NETWORK["0201"] = Network( - name="Hokkaido University", - channels=183, - starttime=datetime(2004, 4, 1, 0, 0), - url="http://www.sci.hokudai.ac.jp/isv/english/", -) -NETWORK["0202"] = Network( - name="Tohoku University", - channels=157, - starttime=datetime(2004, 4, 1, 0, 0), - url="http://www.aob.geophys.tohoku.ac.jp/aob-e/", -) -NETWORK["0203"] = Network( - name="Tokyo University", - channels=301, - starttime=datetime(2004, 4, 1, 0, 0), - url="http://www.eri.u-tokyo.ac.jp/eng/", -) -NETWORK["0204"] = Network( - name="Kyoto University", - channels=196, - starttime=datetime(2004, 4, 1, 0, 0), - url="http://www.dpri.kyoto-u.ac.jp/en/", -) -NETWORK["0205"] = Network( - name="Kyushu University", - channels=73, - starttime=datetime(2004, 4, 1, 0, 0), - url="http://www.sevo.kyushu-u.ac.jp/index-e.html", -) -NETWORK["0206"] = Network( - name="Hirosaki University", - channels=13, - starttime=datetime(2004, 4, 1, 0, 0), - url="http://hrsryu.geo.hirosaki-u.ac.jp/", -) -NETWORK["0207"] = Network( - name="Nagoya University", - channels=75, - starttime=datetime(2004, 4, 1, 0, 0), - url="http://www.seis.nagoya-u.ac.jp/index_e/", -) -NETWORK["0208"] = Network( - name="Kochi University", - channels=28, - starttime=datetime(2004, 4, 1, 0, 0), - url="http://www-en.kochi-u.ac.jp/", -) -NETWORK["0209"] = Network( - name="Kagoshima University", - channels=45, - starttime=datetime(2004, 4, 1, 0, 0), - url="http://leopard.sci.kagoshima-u.ac.jp/noev/English/home.htm", -) - -NETWORK["0301"] = Network( - name="JMA Seismometer Network", - channels=869, - starttime=datetime(2004, 4, 1, 0, 0), - url=URL["JMA"], -) - -NETWORK["0401"] = Network( - name="JAMSTEC Realtime Data " "from the Deep Sea Floor Observatory", - channels=73, - starttime=datetime(2004, 4, 1, 0, 0), - url="http://www.jamstec.go.jp/e/index.html", -) -NETWORK["0402"] = Network( - name="NIED DONET1 (broadband)", - channels=132, - starttime=datetime(2014, 10, 1, 0, 0), - url=URL["Hinet"], -) -NETWORK["0402N"] = Network( - name="JAMSTEC NIED DONET1 (broadband)", - channels=132, - starttime=datetime(2014, 10, 1, 0, 0), - url=URL["Hinet"], -) -NETWORK["0402A"] = Network( - name="NIED DONET1 (strong motion)", - channels=132, - starttime=datetime(2014, 10, 1, 0, 0), - url=URL["Hinet"], -) -NETWORK["0402AN"] = Network( - name="JAMSTEC NIED DONET1 (broadband)", - channels=132, - starttime=datetime(2014, 10, 1, 0, 0), - url=URL["Hinet"], -) - -NETWORK["0501"] = Network( - name="AIST", - channels=81, - starttime=datetime(2004, 4, 1, 0, 0), - url="http://www.aist.go.jp/index_en.html", -) - -NETWORK["0601"] = Network( - name="GSI", - channels=6, - starttime=datetime(2004, 4, 1, 0, 0), - url="http://www.gsi.go.jp/ENGLISH/index.html", -) - -NETWORK["0701"] = Network( - name="Tokyo Metropolitan Government", - channels=54, - starttime=datetime(2004, 4, 1, 0, 0), - url="http://www.metro.tokyo.jp/ENGLISH/index.htm", -) -NETWORK["0702"] = Network( - name="Hot Spring Research Institute " "of Kanagawa Prefecture", - channels=42, - starttime=datetime(2004, 4, 1, 0, 0), - url="http://www.onken.odawara.kanagawa.jp/", -) -NETWORK["0703"] = Network( - name="Aomori Prefectural Government", - channels=15, - starttime=datetime(2004, 4, 1, 0, 0), - url="http://www.pref.aomori.lg.jp/foreigners/", -) -NETWORK["0705"] = Network( - name="Shizuoka Prefectural Government", - channels=3, - starttime=datetime(2004, 6, 15, 0, 0), - url="http://www.pref.shizuoka.jp/a_foreign/english/", -) - -NETWORK["0801"] = Network( - name="ADEP", - channels=606, - starttime=datetime(2015, 1, 1, 0, 0), - url="http://www.adep.or.jp/", -) - -NETWORK["010501"] = Network( - name="NIED V-net (Tokachidake)", - channels=33, - starttime=datetime(2010, 4, 1, 0, 0), - url=URL["Vnet"], -) -NETWORK["010502"] = Network( - name="NIED V-net (Tarumaesan)", - channels=33, - starttime=datetime(2010, 4, 1, 0, 0), - url=URL["Vnet"], -) -NETWORK["010503"] = Network( - name="NIED V-net (Usuzan)", - channels=33, - starttime=datetime(2010, 4, 1, 0, 0), - url=URL["Vnet"], -) -NETWORK["010504"] = Network( - name="NIED V-net (Hokkaido-Komagatake)", - channels=33, - starttime=datetime(2010, 4, 1, 0, 0), - url=URL["Vnet"], -) -NETWORK["010505"] = Network( - name="NIED V-net (Iwatesan)", - channels=33, - starttime=datetime(2010, 4, 1, 0, 0), - url=URL["Vnet"], -) -NETWORK["010506"] = Network( - name="NIED V-net (Nasudake)", - channels=9, - starttime=datetime(2010, 4, 1, 0, 0), - url=URL["Vnet"], -) -NETWORK["010507"] = Network( - name="NIED V-net (Asamayama)", - channels=33, - starttime=datetime(2010, 4, 1, 0, 0), - url=URL["Vnet"], -) -NETWORK["010508"] = Network( - name="NIED V-net (Kusatsu-Shiranesan)", - channels=33, - starttime=datetime(2010, 4, 1, 0, 0), - url=URL["Vnet"], -) -NETWORK["010509"] = Network( - name="NIED V-net (Fujisan)", - channels=57, - starttime=datetime(2010, 4, 1, 0, 0), - url=URL["Vnet"], -) -NETWORK["010510"] = Network( - name="NIED V-net (Miyakejima)", - channels=40, - starttime=datetime(2010, 4, 1, 0, 0), - url=URL["Vnet"], -) -NETWORK["010511"] = Network( - name="NIED V-net (Izu-Oshima)", - channels=39, - starttime=datetime(2010, 4, 1, 0, 0), - url=URL["Vnet"], -) -NETWORK["010512"] = Network( - name="NIED V-net (Asosan)", - channels=44, - starttime=datetime(2010, 4, 1, 0, 0), - url=URL["Vnet"], -) -NETWORK["010513"] = Network( - name="NIED V-net (Unzendake)", - channels=33, - starttime=datetime(2010, 4, 1, 0, 0), - url=URL["Vnet"], -) -NETWORK["010514"] = Network( - name="NIED V-net (Kirishimayama)", - channels=22, - starttime=datetime(2010, 4, 1, 0, 0), - url=URL["Vnet"], -) - JMA_VNET = "JMA Volcanic Seismometer Network " -NETWORK["030201"] = Network( - name=JMA_VNET + "(Atosanupuri)", - channels=7, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030202"] = Network( - name=JMA_VNET + "(Meakandake)", - channels=16, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030203"] = Network( - name=JMA_VNET + "(Taisetsuzan)", - channels=4, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030204"] = Network( - name=JMA_VNET + "(Tokachidake)", - channels=23, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030205"] = Network( - name=JMA_VNET + "(Tarumaesan)", - channels=18, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030206"] = Network( - name=JMA_VNET + "(Kuttara)", - channels=4, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030207"] = Network( - name=JMA_VNET + "(Usuzan)", - channels=15, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030208"] = Network( - name=JMA_VNET + "(Hokkaido-Komagatake)", - channels=20, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030209"] = Network( - name=JMA_VNET + "(Esan)", - channels=7, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030210"] = Network( - name=JMA_VNET + "(Iwakisan)", - channels=4, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030211"] = Network( - name=JMA_VNET + "(Akita-Yakeyama)", - channels=4, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030212"] = Network( - name=JMA_VNET + "(Iwatesan)", - channels=10, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030213"] = Network( - name=JMA_VNET + "(Akita-Komagatake)", - channels=7, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030214"] = Network( - name=JMA_VNET + "(Chokaisan)", - channels=4, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030215"] = Network( - name=JMA_VNET + "(Kurikomayama)", - channels=4, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030216"] = Network( - name=JMA_VNET + "(Zaozan)", - channels=4, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030217"] = Network( - name=JMA_VNET + "(Azumayama)", - channels=17, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030218"] = Network( - name=JMA_VNET + "(Adatarayama)", - channels=8, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030219"] = Network( - name=JMA_VNET + "(Bandaisan)", - channels=11, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030220"] = Network( - name=JMA_VNET + "(Nasudake)", - channels=8, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030221"] = Network( - name=JMA_VNET + "(Nikko-Shiranesan)", - channels=4, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030222"] = Network( - name=JMA_VNET + "(Kusatsu-Shiranesan)", - channels=8, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030223"] = Network( - name=JMA_VNET + "(Asamayama)", - channels=24, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030224"] = Network( - name=JMA_VNET + "(Niigata-Yakeyama)", - channels=4, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030225"] = Network( - name=JMA_VNET + "(Yakedake)", - channels=4, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030226"] = Network( - name=JMA_VNET + "(Norikuradake)", - channels=4, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030227"] = Network( - name=JMA_VNET + "(Ontakesan)", - channels=8, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030228"] = Network( - name=JMA_VNET + "(Hakusan)", - channels=4, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030229"] = Network( - name=JMA_VNET + "(Fujisan)", - channels=18, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030230"] = Network( - name=JMA_VNET + "(Hakoneyama)", - channels=4, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030231"] = Network( - name=JMA_VNET + "(Izu-Tobu Volcanoes)", - channels=11, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030232"] = Network( - name=JMA_VNET + "(Izu-Oshima)", - channels=16, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030233"] = Network( - name=JMA_VNET + "(Niijima)", - channels=4, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030234"] = Network( - name=JMA_VNET + "(Kozushima)", - channels=4, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030235"] = Network( - name=JMA_VNET + "(Miyakejima)", - channels=14, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030236"] = Network( - name=JMA_VNET + "(Hachijojima)", - channels=4, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030237"] = Network( - name=JMA_VNET + "(Aogashima)", - channels=4, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030238"] = Network( - name=JMA_VNET + "(Tsurumidake and Garandake)", - channels=7, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030239"] = Network( - name=JMA_VNET + "(Kujusan)", - channels=4, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030240"] = Network( - name=JMA_VNET + "(Asosan)", - channels=18, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030241"] = Network( - name=JMA_VNET + "(Unzendake)", - channels=10, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030242"] = Network( - name=JMA_VNET + "(Kirishimayama)", - channels=19, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030243"] = Network( - name=JMA_VNET + "(Sakurajima)", - channels=25, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030244"] = Network( - name=JMA_VNET + "(Satsuma-Iojima)", - channels=7, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030245"] = Network( - name=JMA_VNET + "(Kuchinoerabujima)", - channels=13, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030246"] = Network( - name=JMA_VNET + "(Suwanosejima)", - channels=6, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) -NETWORK["030247"] = Network( - name=JMA_VNET + "(Hakkodasan)", - channels=9, - starttime=datetime(2010, 12, 1, 0, 0), - url=URL["JMA"], -) +# fmt: off +_networks = [ + ("0101", "NIED Hi-net", 2336, "20040401", URL["Hinet"]), + ("0103", "NIED F-net (broadband)", 438, "20040401", URL["Fnet"]), + ("0103A", "NIED F-net (strong motion)", 438, "20040401", URL["Fnet"]), + ("010501", "NIED V-net (Tokachidake)", 33, "20100401", URL["Vnet"]), + ("010502", "NIED V-net (Tarumaesan)", 33, "20100401", URL["Vnet"]), + ("010503", "NIED V-net (Usuzan)", 33, "20100401", URL["Vnet"]), + ("010504", "NIED V-net (Hokkaido-Komagatake)", 33, "20100401", URL["Vnet"]), + ("010505", "NIED V-net (Iwatesan)", 33, "20100401", URL["Vnet"]), + ("010506", "NIED V-net (Nasudake)", 42, "20100401", URL["Vnet"]), + ("010507", "NIED V-net (Asamayama)", 33, "20100401", URL["Vnet"]), + ("010508", "NIED V-net (Kusatsu-Shiranesan)", 33, "20100401", URL["Vnet"]), + ("010509", "NIED V-net (Fujisan)", 57, "20100401", URL["Vnet"]), + ("010510", "NIED V-net (Miyakejima)", 40, "20100401", URL["Vnet"]), + ("010511", "NIED V-net (Izu-Oshima)", 39, "20100401", URL["Vnet"]), + ("010512", "NIED V-net (Asosan)", 44, "20100401", URL["Vnet"]), + ("010513", "NIED V-net (Unzendake)", 33, "20100401", URL["Vnet"]), + ("010514", "NIED V-net (Kirishimayama)", 22, "20100401", URL["Vnet"]), + ("0106", "NIED Temp. obs. in eastern Shikoku", 15, "20151013", "https://doi.org/10.17598/NIED.0027"), + ("0120", "NIED S-net (velocity)", 450, "20160815", URL["Hinet"]), + ("0120A", "NIED S-net (acceleration)", 450, "20160815", URL["Hinet"]), + ("0120B", "NIED S-net (acceleration 2LG)", 450, "20160815", URL["Hinet"]), + ("0120C", "NIED S-net (acceleration 2HG)", 450, "20160815", URL["Hinet"]), + ("0131", "NIED MeSO-net", 900, "20170401", URL["Hinet"]), + ("0201", "Hokkaido University", 205, "20040401", "http://www.sci.hokudai.ac.jp/isv/english/"), + ("0202", "Tohoku University", 157, "20040401", "http://www.aob.geophys.tohoku.ac.jp/aob-e/"), + ("0203", "Tokyo University", 316, "20040401", "http://www.eri.u-tokyo.ac.jp/eng/"), + ("0204", "Kyoto University", 196, "20040401", "http://www.dpri.kyoto-u.ac.jp/en/"), + ("0205", "Kyushu University", 73, "20040401", "http://www.sevo.kyushu-u.ac.jp/index-e.html"), + ("0206", "Hirosaki University", 13, "20040401", "http://hrsryu.geo.hirosaki-u.ac.jp/"), + ("0207", "Nagoya University", 75, "20040401", "http://www.seis.nagoya-u.ac.jp/index_e/"), + ("0208", "Kochi University", 34, "20040401", "http://www-en.kochi-u.ac.jp/"), + ("0209", "Kagoshima University", 48, "20040401", "http://leopard.sci.kagoshima-u.ac.jp/noev/English/home.htm"), + ("0231", "MeSO-net (~2017.03)", 900, "20080516", ""), + ("0301", "JMA Seismometer Network", 872, "20040401", URL["JMA"]), + ("030201", JMA_VNET + "(Atosanupuri)", 18, "20101201", URL["JMA"]), + ("030202", JMA_VNET + "(Meakandake)", 16, "20101201", URL["JMA"]), + ("030203", JMA_VNET + "(Taisetsuzan)", 9, "20101201", URL["JMA"]), + ("030204", JMA_VNET + "(Tokachidake)", 32, "20101201", URL["JMA"]), + ("030205", JMA_VNET + "(Tarumaesan)", 27, "20101201", URL["JMA"]), + ("030206", JMA_VNET + "(Kuttara)", 15, "20101201", URL["JMA"]), + ("030207", JMA_VNET + "(Usuzan)", 24, "20101201", URL["JMA"]), + ("030208", JMA_VNET + "(Hokkaido-Komagatake)", 30, "20101201", URL["JMA"]), + ("030209", JMA_VNET + "(Esan)", 14, "20101201", URL["JMA"]), + ("030210", JMA_VNET + "(Iwakisan)", 9, "20101201", URL["JMA"]), + ("030211", JMA_VNET + "(Akita-Yakeyama)", 11, "20101201", URL["JMA"]), + ("030212", JMA_VNET + "(Iwatesan)", 17, "20101201", URL["JMA"]), + ("030213", JMA_VNET + "(Akita-Komagatake)", 14, "20101201", URL["JMA"]), + ("030214", JMA_VNET + "(Chokaisan)", 6, "20101201", URL["JMA"]), + ("030215", JMA_VNET + "(Kurikomayama)", 11, "20101201", URL["JMA"]), + ("030216", JMA_VNET + "(Zaozan)", 15, "20101201", URL["JMA"]), + ("030217", JMA_VNET + "(Azumayama)", 28, "20101201", URL["JMA"]), + ("030218", JMA_VNET + "(Adatarayama)", 19, "20101201", URL["JMA"]), + ("030219", JMA_VNET + "(Bandaisan)", 18, "20101201", URL["JMA"]), + ("030220", JMA_VNET + "(Nasudake)", 15, "20101201", URL["JMA"]), + ("030221", JMA_VNET + "(Nikko-Shiranesan)", 11, "20101201", URL["JMA"]), + ("030222", JMA_VNET + "(Kusatsu-Shiranesan)", 21, "20101201", URL["JMA"]), + ("030223", JMA_VNET + "(Asamayama)", 44, "20101201", URL["JMA"]), + ("030224", JMA_VNET + "(Niigata-Yakeyama)", 14, "20101201", URL["JMA"]), + ("030225", JMA_VNET + "(Yakedake)", 15, "20101201", URL["JMA"]), + ("030226", JMA_VNET + "(Norikuradake)", 9, "20101201", URL["JMA"]), + ("030227", JMA_VNET + "(Ontakesan)", 40, "20101201", URL["JMA"]), + ("030228", JMA_VNET + "(Hakusan)", 10, "20101201", URL["JMA"]), + ("030229", JMA_VNET + "(Fujisan)", 27, "20101201", URL["JMA"]), + ("030230", JMA_VNET + "(Hakoneyama)", 11, "20101201", URL["JMA"]), + ("030231", JMA_VNET + "(Izu-Tobu Volcanoes)", 18, "20101201", URL["JMA"]), + ("030232", JMA_VNET + "(Izu-Oshima)", 22, "20101201", URL["JMA"]), + ("030233", JMA_VNET + "(Niijima)", 9, "20101201", URL["JMA"]), + ("030234", JMA_VNET + "(Kozushima)", 9, "20101201", URL["JMA"]), + ("030235", JMA_VNET + "(Miyakejima)", 19, "20101201", URL["JMA"]), + ("030236", JMA_VNET + "(Hachijojima)", 11, "20101201", URL["JMA"]), + ("030237", JMA_VNET + "(Aogashima)", 9, "20101201", URL["JMA"]), + ("030238", JMA_VNET + "(Tsurumidake and Garandake)", 16, "20101201", URL["JMA"]), + ("030239", JMA_VNET + "(Kujusan)", 13, "20101201", URL["JMA"]), + ("030240", JMA_VNET + "(Asosan)", 31, "20101201", URL["JMA"]), + ("030241", JMA_VNET + "(Unzendake)", 28, "20101201", URL["JMA"]), + ("030242", JMA_VNET + "(Kirishimayama)", 66, "20101201", URL["JMA"]), + ("030243", JMA_VNET + "(Sakurajima)", 31, "20101201", URL["JMA"]), + ("030244", JMA_VNET + "(Satsuma-Iojima)", 16, "20101201", URL["JMA"]), + ("030245", JMA_VNET + "(Kuchinoerabujima)", 29, "20101201", URL["JMA"]), + ("030246", JMA_VNET + "(Suwanosejima)", 12, "20101201", URL["JMA"]), + ("030247", JMA_VNET + "(Hakkodasan)", 18, "20101201", URL["JMA"]), + ("030248", JMA_VNET + "(Towada)", 9, "20101201", URL["JMA"]), + ("030249", JMA_VNET + "(Midagahara)", 9, "20101201", URL["JMA"]), + ("0401", "JAMSTEC Realtime Data from the Deep Sea Floor Observatory", 73, "20040401", "http://www.jamstec.go.jp/e/index.html"), + ("0402", "NIED DONET1 (broadband)", 132, "20160401", URL["Snet"]), + ("0402A", "NIED DONET1 (strong motion)", 132, "20160401", URL["Snet"]), + ("0402N", "JAMSTEC NIED DONET1 (broadband)", 132, "20160401", URL["Snet"]), + ("0402AN", "JAMSTEC NIED DONET1 (strong motion)", 132, "20160401", URL["Snet"]), + ("0403", "NIED DONET2 (broadband)", 174, "20160401", URL["Snet"]), + ("0403A", "NIED DONET2 (strong motion)", 174, "20160401", URL["Snet"]), + ("0403N", "JAMSTEC NIED DONET2 (broadband)", 174, "20160401", URL["Snet"]), + ("0403AN", "JAMSTEC NIED DONET2 (strong motion)", 174, "20160401", URL["Snet"]), + ("0501", "AIST", 84, "20040401", "http://www.aist.go.jp/index_en.html"), + ("0601", "GSI", 6, "20040401", "http://www.gsi.go.jp/ENGLISH/index.html"), + ("0701", "Tokyo Metropolitan Government", 54, "20040401", "http://www.metro.tokyo.jp/ENGLISH/index.htm"), + ("0702", "Hot Spring Research Institute of Kanagawa Prefecture", 42, "20040401", "http://www.onken.odawara.kanagawa.jp/"), + ("0703", "Aomori Prefectural Government", 15, "20040401", "http://www.pref.aomori.lg.jp/foreigners/"), + ("0705", "Shizuoka Prefectural Government", 3, "20040615", "http://www.pref.shizuoka.jp/a_foreign/english/"), + ("0801", "ADEP", 780, "20150101", "http://www.adep.or.jp/"), +] +# fmt: on + +NETWORK = { + code: Network(name, channels, datetime.strptime(starttime, "%Y%m%d"), url) + for code, name, channels, starttime, url in _networks +} diff --git a/docs/api/HinetPy.header.rst b/docs/api/HinetPy.header.rst index 10702950..8506d112 100644 --- a/docs/api/HinetPy.header.rst +++ b/docs/api/HinetPy.header.rst @@ -1,4 +1,6 @@ HinetPy.header module --------------------- +.. automodule:: HinetPy.header + .. autoclass:: HinetPy.header.Network diff --git a/tests/localtest_channels.py b/tests/localtest_channels.py index 3dd793a2..b3f510ec 100644 --- a/tests/localtest_channels.py +++ b/tests/localtest_channels.py @@ -1,25 +1,23 @@ -"""Check if a network has more channels""" +""" +Check the number of channels for each network. +""" import os from datetime import datetime, timedelta from HinetPy import Client from HinetPy.header import NETWORK -from HinetPy.win32 import _get_channels +from HinetPy.win32 import read_ctable username = os.environ["HINET_USERNAME"] password = os.environ["HINET_PASSWORD"] client = Client(username, password) -difference = {} # always set one day before today as starttime starttime = datetime.today() - timedelta(days=1) for code in sorted(NETWORK.keys()): win32, chfile = client.get_continuous_waveform(code, starttime, 1) - count = len(_get_channels(chfile)) - - if count > NETWORK[code].channels: # more - difference[code] = count - - for dcode in difference: - print(dcode, difference[dcode]) + if chfile is None: + continue + count = len(read_ctable(chfile)) + print(code, count)