Seis
Module for seis file of hypomh, a file about arrival time picks.
Future Update
- v0.2.1
- remove mkseis
History
- v0.2.0
- add WIN
- remove
read_seis
: because it was under editing but now available with Seis. - add Seis
- move
mkseis
to Seismkseis
is now a static method of classSeis
. When usemkseis
, useSeis.make
. - edit Final renew read
- bug fix conversion from yy to yyyy: yyyy = 1000 + yy -> 1"9"00 + yy fatal error in pnd2seis: second was contained in reftime. -> set seconds=0
- v0.2.0-a3 2024/06/29
- change parameter name in Seis.make.(2024/06/27) stnelv_m -> stnelv_m
- enhance Seis.make 2024/06/29 None or np.nan for ptime and stime is now acceptable when P or S arrival is absent.
- change Seis.make 2024/06/29 savefp is now splited into savedir and savename.
- enhance Seis.read 2024/06/29 io.StringIO is acceptable for input "fp", when directly read a text of seis file.
- add Seis.read_seis 2024/06/29
- v0.2.0-a4 2024/8/13
- bug fix: Seis.add Solved the problem that self.reftime was not changed when self.reftime > other.reftime,
logger = logging.getLogger(__name__)
module-attribute
Seis
Class for seis file of win. Contains reference time and picked arrival times. If no pick, the arrival time is set to 0.
.. versionadded:: 0.2.0
Attributes:
Name | Type | Description |
---|---|---|
reftime |
datetime
|
A reference time of arrival times for line 1 of seis file. |
arrivals |
DataFrame
|
A table of stations and arrival times for line >= 2 of seis file.
The table should have columns below:
- stncode: str
Station code.
- polarity: str
Polarity of P wave.
If no data, should be set to ".".
- ptime: float
Arrival time of P wave.
Defined as seconds from |
See Also
-
WIN System Official documentation https://wwweic.eri.u-tokyo.ac.jp/WIN/man.ja/pickfile.html
seis 到着時刻と観測点座標のデータファイル。 win の験測情報ファイル(pickファイル)中では、 "#s"で始まる部分から"#s"を取り除いたもの。フィルタ seis(1W) で 作れる。フォーマットは pickfile(1W)参照。 99/11/09 06:46 99/11/10 18:26:03 ASO D 6.854 0.015 0.000 0.000 43.9 1.77e-06 36.64934 139.45970 720 NIK U 6.884 0.006 0.000 0.000 0.0 6.84e-06 36.62144 139.49072 1310 KBH U 6.963 0.006 0.000 0.000 16.9 1.28e-06 36.65450 139.52824 750 KRO U 7.043 0.006 0.000 0.000 0.0 6.89e-07 36.68685 139.49794 865 1行目は2行目以降の秒単位の到着時刻データの基準になる年〜分、および 右側にこのファイル(hypomhへの入力ファイル)を作った時刻が入ります。 2行目からは各行が1つの観測点の験測データで、左から、観測点コード、 P初動極性(データなしは ".")、P時刻(s)、P精度(s)、S時刻(s)、S精度(s)、 F-P時間(s)、最大振幅(m/sのときのみ書きだされる)、観測点緯度(度)、 経度(度)、高度(m)、Pの観測点補正(s)、Sの観測点補正(s)です。 PとSの観測点補正は、この値が到着時刻に加えらるもので、0のときには 省略されます。最後に空行("#s"のみの行)が1行あります。
走時モード PとSの到着時刻データをすべてゼロにしてください。
-
hypomh.f line ~572-578 READ(13,1300,END=40) IYR,MNT,IDY,IHR,MIN 1300 FORMAT(5(I2,1X)) IF(NERQ.EQ.-1) RETURN I=1 2 READ(13,1310,END=4) SA1(I),POLA1(I),PT1(I),PE1(I),ST1(I),SE1(I), 1XT,AMP(I),ALAT(I),ALNG(I),IAHGT,STCP(I),STCS(I) 1310 FORMAT(A10,1X,A1,2(F8.3,F6.3),F6.1,E9.2,2F11.5,I7,2F7.3)
arrivals = arrivals
instance-attribute
fp = None
instance-attribute
reftime = reftime
instance-attribute
__add__(other)
Concat two Seis objects. Reference time will be set to the min of two reference times.
__getitem__(index)
Return a Seis object with given rows.
__init__(reftime=None, arrivals=None)
__len__()
__str__()
Return text for seis file.
change_reftime(newreftime)
Shift reference time of arrival picks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
newreftime |
datetime
|
A new reference time but only units greater than minute are used. |
required |
make(refyy, refmm, refdd, refHH, refMM, stnlat, stnlon, stnelv_m, stncode, polarity=[], ptime=[], pcert=[], stime=[], scert=[], fptime=[], maxamp=[], pcorrection=[], scorrection=[], savedir='.', savename=None, overwrite=False, save=False)
staticmethod
Generate text for seis file.
.. versionadded:: 0.2.0
Parameters:
Name | Type | Description | Default |
---|---|---|---|
refyy |
int
|
Year of reference time. |
required |
refmm |
int
|
Month of reference time. |
required |
refdd |
int
|
Date of reference time. |
required |
refHH |
int
|
Hour of reference time. |
required |
refMM |
int
|
Minute of reference time. |
required |
stnlat |
list[float]
|
Latitude of stations. |
required |
stnlon |
list[float]
|
Longitude of stations. |
required |
stnelv_m |
list[float]
|
Elevation of stations [m]. |
required |
stncode |
list[str]
|
Station codes. Its length should be shorter than 10 characters. |
required |
polarity |
list[str]
|
Polarity of P wave. "U"(Up), "D"(Down), "."(No data) are allowed. If not given, all polarities will be set to ".". |
[]
|
ptime |
list[float]
|
Arrival time of P wave in seconds from the referential time(given by refyy,refmm,...,refMM). If there is no pick of P arrival at the certain channel, please set the value to None or np.nan. At that case, pcert will be automatically set to 0 at that channel. |
[]
|
stime |
list[float]
|
Arrival time of S wave in seconds from the referential time(given by refyy,refmm,...,refMM). If there is no pick of P arrival at the certain channel, please set the value to None or np.nan. At that case, pcert will be automatically set to 0 at that channel. |
[]
|
pcert |
list[float]
|
Certainty of arrival time of P wave. If ptime is None or np.nan, this value will be automatically set to 0. |
[]
|
scert |
list[float]
|
Certainty of arrival time of S wave. If stime is None or np.nan, this value will be automatically set to 0. |
[]
|
fptime |
list[float]
|
F-P time in second. If not given, set to 0. |
[]
|
maxamp |
list[float]
|
Maximum amplitude. If not given, set to 0. |
[]
|
pcorrection |
list[float]
|
Station correction value [s] for P wave. If not given, set to 0. |
[]
|
scorrection |
list[float]
|
Station correction value [s] for S wave. If not given, set to 0. |
[]
|
read(fp)
read a seis file of win. reference time and arrival picks are stored in self.reftime and self.arrivals.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fp |
str
|
File path to seis file. StringIO of the text of seis file is also acceptable. |
required |
write(outdir, outname=None, overwrite=False)
Convert Seis into text and save as a seis file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
outdir |
str
|
Directory to save the seis file. |
required |
outname |
str
|
File name of the seis file. If None, the basename of self.fp is used. |
None
|
overwrite |
bool
|
If True, allow to overwrite the file with same file path. |
False
|
jma2win4seis(catalog, tbl, save=False, savedir='seis')
jmaのカタログとdasのチャネルテーブルから走時計算用のseisファイルを作る.
linux(command, verbose=False)
mkseis(refyy, refmm, refdd, refHH, refMM, stnlat, stnlon, stnelv_m, stncode, polarity=[], ptime=[], pcert=[], stime=[], scert=[], fptime=[], maxamp=[], pcorrection=[], scorrection=[], savefp=[], save=False)
Old version of Seis.make and had moved to Seis.make. Support had stopped after v0.1.2. Will be removed in v0.2.1.
read_seis(fp)
Read a seis file of win and return a Seis object.
yy2yyyy(yy)
Convert yy of hypomh to yyyy.