From 03c1f01ce4e365aefeea0263b01eda95abe60bf3 Mon Sep 17 00:00:00 2001 From: Mijian Xu Date: Sat, 7 Aug 2021 10:38:58 +0800 Subject: [PATCH 01/12] add skip_existing in travis-ci --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 81e2de1..41229c6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,13 +25,13 @@ jobs: script: skip deploy: provider: pypi + skip_existing: true username: "__token__" password: secure: "BsDdKkZlOSxIgfM/es1ta7S0UMxxnZFuHsvXZBfJlDYq2vI8zTi3IezB9BXCHx5MNxZJVC+LucE8mpFyJ6X5I6O0psFEHra/RDDt5wKo8FLSpqQzC8sGb+Bxc1o6BG6oVwbbvvYoZHxnLU4gDtnOcbUMVolHdIeXtR17zudyWhohN735/2cg1KSQg9wmk6d42Ze+BlNcZ6KWzoQPyyNf2j/7KLIhn6dZhj7oaj/Ib+z28xo4vi74EgGkCB4NRuoWl5ZyJWAUWBWnOUbw1QlgAQiEsgy5WW15JWhfCyCZ9xOtbu6ZW/+hsvMgic188tf8COUg2r8aAowQU2NAnVb5oGPvMrCyAQD93wd1ra2zvkXBY0/haFeNDeHeGE2XnZ70vg/YJdWEk+3i3WZTFTcXC9FsEZpnGUllBN0hE+1awfasv0nIRXM8Doo78wmXvkSUoAMc9DYEr+BMttwoWXK3hBJxTFCHym8up4Udm0oacw0Z7vGjH5pN1q/Ibn1NLc8lUbjXs/Sovz4d75yigWkH7kzqnfOq9JYxEsyPghtb9uXXiZ4nWw8PetROqGhsWZRYBFrCt2A543yxJmCvn2hl/1UkeeKp1943qaQ/iBHgwy2cu2XZAyO6/4vBDLs61cQ5Jcxmrn++9E8K1vLR1c9WZAAFezL/NVQnIKhWq2Ur87E=" on: branch: master - script: - git clone https://github.com/xumi1993/seispy-test test - cd test && bash run.sh -- GitLab From a34a19150e187e94a1692874c8a7e86d45b11feb Mon Sep 17 00:00:00 2001 From: Mijian Xu Date: Sat, 7 Aug 2021 17:55:10 +0800 Subject: [PATCH 02/12] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a1c2a46..9457cbb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Seispy +# [![pipeline status](https://img.shields.io/travis/com/xumi1993/seispy)](https://travis-ci.com/xumi1993/seispy) [![Build Status](https://img.shields.io/travis/com/xumi1993/seispy-doc.post?label=doc)](https://seispy.xumijian.me) @@ -26,7 +26,7 @@ Seispy is a Python module for processing seismological data and calculating Rece * [NumPy](http://www.numpy.org/) >= 1.16 * [SciPy](http://www.scipy.org/) >= 1.2.0 * [matplotlib](https://matplotlib.org/) >= 3.0.0 - * [PyQt5](https://www.riverbankcomputing.com/software/pyqt/) >= 5.15.0 + * [PyQt5](https://www.riverbankcomputing.com/software/pyqt/) >= 5.12.0 ## Installation ``` -- GitLab From 7b6dabb05cd8eeba567cf275a916f7f99edc68ef Mon Sep 17 00:00:00 2001 From: Mijian Xu Date: Sun, 8 Aug 2021 23:54:38 +0800 Subject: [PATCH 03/12] change figure name --- seispy/hk.py | 4 ++-- seispy/plotRT.py | 4 ++-- seispy/rfani.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/seispy/hk.py b/seispy/hk.py index 1dd6839..2b3959d 100644 --- a/seispy/hk.py +++ b/seispy/hk.py @@ -129,7 +129,7 @@ def plot(stack, allstack, h, kappa, besth, bestk, cvalue, cmap=load_cyan_map(), if path is None: plt.show() else: - f.savefig(path, format='pdf', bbox_inches='tight') + f.savefig(path, format='png', dpi=400, bbox_inches='tight') def ci(allstack, h, kappa, ev_num): @@ -178,7 +178,7 @@ def hksta(hpara, isplot=False, isdisplay=False): if isdisplay: print_result(besth, bestk, maxhsig, maxksig, print_comment=True) if isplot: - img_path = join(hpara.hkpath, station+'_Hk.pdf') + img_path = join(hpara.hkpath, station+'_Hk.png') plot(stack, allstack, hpara.hrange, hpara.krange, besth, bestk, cvalue, title=title, path=img_path) else: plot(stack, allstack, hpara.hrange, hpara.krange, besth, bestk, cvalue, title=title) diff --git a/seispy/plotRT.py b/seispy/plotRT.py index 628dcaf..94d182b 100644 --- a/seispy/plotRT.py +++ b/seispy/plotRT.py @@ -148,9 +148,9 @@ def plotrt(rfpath, enf=3, out_path='./', outformat='g'): plot_waves(axr, axt, axb, axr_sum, axt_sum, stadata, enf=enf) set_fig(axr, axt, axb, axr_sum, axt_sum, stadata, station) if outformat == 'g': - h.savefig(join(out_path, station+'_RT_bazorder_{:.1f}.png'.format(stadata.f0[0])), dpi=200) + h.savefig(join(out_path, station+'_RT_bazorder_{:.1f}.png'.format(stadata.f0[0])), dpi=400, bbox_inches='tight') elif outformat == 'f': - h.savefig(join(out_path, station+'_RT_bazorder_{:.1f}.pdf'.format(stadata.f0[0])), format='pdf') + h.savefig(join(out_path, station+'_RT_bazorder_{:.1f}.pdf'.format(stadata.f0[0])), format='pdf', bbox_inches='tight') def main(): diff --git a/seispy/rfani.py b/seispy/rfani.py index a53aaec..6b7cc4d 100644 --- a/seispy/rfani.py +++ b/seispy/rfani.py @@ -260,7 +260,7 @@ class RFAni(): if show: plt.show() else: - fig.savefig(join(outpath, 'joint_ani_'+self.sacdatar.staname+'.png'), dpi=400, bbox_inches='tight') + fig.savefig(join(outpath, self.sacdatar.staname+'joint_ani.png'), dpi=400, bbox_inches='tight') if __name__ == "__main__": -- GitLab From ac4b46c333b90724a0ce13c5e4f24cc4caa8be15 Mon Sep 17 00:00:00 2001 From: Mijian Xu Date: Sun, 8 Aug 2021 23:57:57 +0800 Subject: [PATCH 04/12] change figure name --- seispy/rfani.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seispy/rfani.py b/seispy/rfani.py index 6b7cc4d..e91faf8 100644 --- a/seispy/rfani.py +++ b/seispy/rfani.py @@ -260,7 +260,7 @@ class RFAni(): if show: plt.show() else: - fig.savefig(join(outpath, self.sacdatar.staname+'joint_ani.png'), dpi=400, bbox_inches='tight') + fig.savefig(join(outpath, self.sacdatar.staname+'_joint_ani.png'), dpi=400, bbox_inches='tight') if __name__ == "__main__": -- GitLab From c3d763947bc0936e53d9e198c7575aaa4e6b1d83 Mon Sep 17 00:00:00 2001 From: Mijian Xu Date: Mon, 9 Aug 2021 00:00:58 +0800 Subject: [PATCH 05/12] ch ver name --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b4d35a8..e497e6c 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ packages = find_packages() with open("README.md", "r") as fh: long_description = fh.read() -VERSION = "1.2.1" +VERSION = "1.2.2" setup(name='python-seispy', version=VERSION, author='Mijian Xu', -- GitLab From 46aa07e71973d288cb91e7c31ef3338963f1ce38 Mon Sep 17 00:00:00 2001 From: Mijian Xu Date: Mon, 9 Aug 2021 20:19:13 +0800 Subject: [PATCH 06/12] Create python-publish.yml --- .github/workflows/python-publish.yml | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/python-publish.yml diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 0000000..b7fce1d --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,37 @@ +# This workflow will upload a Python Package using Twine when a release is created +# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Upload Python Package + +on: + pull_request: + branches: + - master + +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + sudo pip install twine + - name: Build package + run: python setup.py sdist build + - name: Publish package + uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + with: + user: __token__ + password: ${{ secrets.PYPI_TOKEN }} -- GitLab From 0e9c3f89197d31093fca8c1cffc7582b26b5487b Mon Sep 17 00:00:00 2001 From: xumi1993 Date: Mon, 9 Aug 2021 20:40:34 +0800 Subject: [PATCH 07/12] fix output for rfani --- seispy/scripts.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/seispy/scripts.py b/seispy/scripts.py index aed253d..09f862a 100644 --- a/seispy/scripts.py +++ b/seispy/scripts.py @@ -11,9 +11,9 @@ def rfani(): parser = argparse.ArgumentParser(description="Estimate crustal anisotropy with a Joint inversion method. See Liu and Niu (2012) in detail.") parser.add_argument('rfpath', type=str, help="Path to PRFs") parser.add_argument('-t', help="Time window cut from tb to te", metavar='tb/te', required=True) - parser.add_argument('-c', help="List file in text format for saving results, defaults to rfani.dat", + parser.add_argument('-c', help="List file in text format for saving results, defaults to ./rfani.dat", default="rfani.dat", metavar="list_file_name") - parser.add_argument('-l', help="Half length of time window when cut out Pms phases", + parser.add_argument('-l', help="Half length of time window when cut out Pms phases, defaults to 3s", default=3, metavar="half_time_length", type=float) parser.add_argument('-o', dest='outpath', help="Directory to the image, defaults to current directory.", default='./') parser.add_argument('-p', help="If plot RFs stacked by back-azimuth, defaults to \'False\'", @@ -27,7 +27,7 @@ def rfani(): bf, bt = rfsta.jointani(timewin[0], timewin[1], tlen=arg.l, weight=weights) with open(arg.c, 'a+') as fid: for f, t in zip(bf, bt): - fid.write('{}\t{:.3f}\t{:.3f}\t{:.2f}\t{:.2f}'.format(rfsta.staname, rfsta.stla, rfsta.stlo, f, t)) + fid.write('{}\t{:.3f}\t{:.3f}\t{:.2f}\t{:.2f}\n'.format(rfsta.staname, rfsta.stla, rfsta.stlo, f, t)) if arg.isplot: rfsta.ani.plot_stack_baz(outpath=arg.outpath) rfsta.ani.plot_polar(outpath=arg.outpath) -- GitLab From 58077886531d2e6fef9a9ff1e32cb0c311691e8e Mon Sep 17 00:00:00 2001 From: xumi1993 Date: Mon, 9 Aug 2021 23:26:31 +0800 Subject: [PATCH 08/12] remove travis CI --- .travis.yml | 42 ------------------------------------------ 1 file changed, 42 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 41229c6..0000000 --- a/.travis.yml +++ /dev/null @@ -1,42 +0,0 @@ -language: python - -install: -- pip install . - - -jobs: - include: - - stage: test - python: '3.7' - - - stage: test - python: '3.8' - - - - stage: test - python: '3.9' - - - - stage: doc - script: bash -c "$(curl -fsSL https://git.nju.edu.cn/xumi1993/source/-/raw/master/trigger.sh)" - - - stage: deploy - python: 3.8 - script: skip - deploy: - provider: pypi - skip_existing: true - username: "__token__" - password: - secure: "BsDdKkZlOSxIgfM/es1ta7S0UMxxnZFuHsvXZBfJlDYq2vI8zTi3IezB9BXCHx5MNxZJVC+LucE8mpFyJ6X5I6O0psFEHra/RDDt5wKo8FLSpqQzC8sGb+Bxc1o6BG6oVwbbvvYoZHxnLU4gDtnOcbUMVolHdIeXtR17zudyWhohN735/2cg1KSQg9wmk6d42Ze+BlNcZ6KWzoQPyyNf2j/7KLIhn6dZhj7oaj/Ib+z28xo4vi74EgGkCB4NRuoWl5ZyJWAUWBWnOUbw1QlgAQiEsgy5WW15JWhfCyCZ9xOtbu6ZW/+hsvMgic188tf8COUg2r8aAowQU2NAnVb5oGPvMrCyAQD93wd1ra2zvkXBY0/haFeNDeHeGE2XnZ70vg/YJdWEk+3i3WZTFTcXC9FsEZpnGUllBN0hE+1awfasv0nIRXM8Doo78wmXvkSUoAMc9DYEr+BMttwoWXK3hBJxTFCHym8up4Udm0oacw0Z7vGjH5pN1q/Ibn1NLc8lUbjXs/Sovz4d75yigWkH7kzqnfOq9JYxEsyPghtb9uXXiZ4nWw8PetROqGhsWZRYBFrCt2A543yxJmCvn2hl/1UkeeKp1943qaQ/iBHgwy2cu2XZAyO6/4vBDLs61cQ5Jcxmrn++9E8K1vLR1c9WZAAFezL/NVQnIKhWq2Ur87E=" - on: - branch: master - -script: - - git clone https://github.com/xumi1993/seispy-test test - - cd test && bash run.sh - - - - - -- GitLab From af0b1280c4769af9cdcb0248279c967aa9b3dc05 Mon Sep 17 00:00:00 2001 From: Mijian Xu Date: Tue, 10 Aug 2021 09:21:15 +0800 Subject: [PATCH 09/12] Update README.md --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9457cbb..900a1b4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,12 @@ # -[![pipeline status](https://img.shields.io/travis/com/xumi1993/seispy)](https://travis-ci.com/xumi1993/seispy) +[![Upload Python Package](https://github.com/xumi1993/seispy/actions/workflows/python-publish.yml/badge.svg)](https://github.com/xumi1993/seispy/actions/workflows/python-publish.yml) + + + + [![Build Status](https://img.shields.io/travis/com/xumi1993/seispy-doc.post?label=doc)](https://seispy.xumijian.me) +[![Conda Version](https://img.shields.io/conda/vn/conda-forge/seispy.svg)](https://anaconda.org/conda-forge/seispy) [![PyPI](https://img.shields.io/pypi/v/python-seispy)](https://pypi.org/project/python-seispy/) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/python-seispy)](https://pypi.org/project/python-seispy/) [![GitHub](https://img.shields.io/github/license/xumi1993/seispy)]() -- GitLab From d959614a6c76d6e054783b9b7bb54faec91b806f Mon Sep 17 00:00:00 2001 From: Mijian Xu Date: Tue, 10 Aug 2021 11:14:48 +0800 Subject: [PATCH 10/12] Update README.md --- README.md | 46 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 900a1b4..a6965fb 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ # [![Upload Python Package](https://github.com/xumi1993/seispy/actions/workflows/python-publish.yml/badge.svg)](https://github.com/xumi1993/seispy/actions/workflows/python-publish.yml) +[![Deploy Seispy Docs](https://github.com/xumi1993/seispy-doc.post/actions/workflows/deploy.yml/badge.svg)](https://github.com/xumi1993/seispy-doc.post/actions/workflows/deploy.yml) -[![Build Status](https://img.shields.io/travis/com/xumi1993/seispy-doc.post?label=doc)](https://seispy.xumijian.me) [![Conda Version](https://img.shields.io/conda/vn/conda-forge/seispy.svg)](https://anaconda.org/conda-forge/seispy) [![PyPI](https://img.shields.io/pypi/v/python-seispy)](https://pypi.org/project/python-seispy/) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/python-seispy)](https://pypi.org/project/python-seispy/) @@ -41,23 +41,49 @@ python setup.py install # Inclusion ## Libraries - * `seispy.distaz`: Calculate distance and azimuth (by [the lithospheric seismology program at USC](http://www.seis.sc.edu/software/distaz/)).
- * `seispy.geo`: Tiny codes of geophysics. - * `seispy.bootstrap`: Bootstrap confidence interval estimation (by [scikits-bootstrap](https://github.com/cgevans/scikits-bootstrap)) - * `seispy.decon`: Iterative time domain deconvolution method (Ligorria and Ammon's 1999 BSSA) - * `seispy.rfcorrect`: Subsequent process of PRFs includeing moveout correct and time to depth conversion (1D and 3D) (see [Mijian Xu et al., 2018 EPSL](https://www.sciencedirect.com/science/article/pii/S0012821X17306921?via%3Dihub)) - * `seispy.ccp`: CCP stacking along a profile. + +- `seispy.distaz`: Calculate distance and azimuth (by the + [lithospheric seismology program at USC][]). +- `seispy.geo`: Tiny codes of geophysics. +- `seispy.bootstrap`: Bootstrap confidence interval estimation (by + [scikits-bootstrap][]) +- `seispy.decon`: Functions of deconvolution transferred from + [iwbailey/processRFmatlab][] including + - Iterative time domain deconvolution method (LigorrĂ­a and Ammon + 1999 BSSA). + - Water level frequency domain deconvolution method (CJ. Ammon + 1991 BSSA) +- `seispy.rf`: Procedure for RF calculation. The functions of + `match_eq`, `search_eq` invoked `obspy.core.UTCDateTime` and + `obspy.clients` from the [Obspy][]. +- `seispy.eq`: RF processing for each event, which invoked + `obspy.io.sac`, `obspy.signal`, `obspy.taup` and `obspy.core.Stream` + from the [Obspy][]. +- `seispy.rfcorrect`: Subsequent process of RFs including moveout + correction and time to depth conversion (1D and 3D) (see [Xu et al., + 2018 EPSL][]) +- `seispy.ccpprofile`: CCP stacking along a profile. +- `seispy.ccp3d`: 3-D CCP stacking with extracting depth D410 and + D660. + + [lithospheric seismology program at USC]: http://www.seis.sc.edu/software/distaz/ + [scikits-bootstrap]: https://github.com/cgevans/scikits-bootstrap + [iwbailey/processRFmatlab]: https://github.com/iwbailey/processRFmatlab + [Obspy]: https://docs.obspy.org/ + [Xu et al., 2018 EPSL]: https://www.sciencedirect.com/science/article/pii/S0012821X17306921?via%3Dihub ## Commands ### Receiver Functions * `prf`: Calculate PRFs for a station. * `pickrf`: Pick PRFs with virtual quality control after the calculation. - * `plotrt`: Plot PRFs in R and T components order by back-azimuth. - * `plotr`: Plot PRFs in R component order by back-azimuth. - * `hk`: H-Kappa stacking. + * `plotrt`: Plot PRFs with R and T components order by back-azimuth. + * `plotr`: Plot PRFs with R component order by back-azimuth. + * `hk`: H-Kappa stacking for estimating Moho depth and crustal Vp/Vs. * `rf2depth`: Convert PRFs to depth axis. * `ccp_profile`: Stack PRFs along a profile with a CCP stacking method. + * `ccp3d`: Stack PRFs with spaced bins. + * `rfani`: Estimating crustal anisotropy with a joint method. ### Others * `ndk2dat`: Convert the GCMT catalog file ("ndk" format) to the list file for the `prf` command. -- GitLab From dde78da4442444d1e1965e7345aee3af80f11572 Mon Sep 17 00:00:00 2001 From: xumi1993 Date: Tue, 10 Aug 2021 15:02:53 +0800 Subject: [PATCH 11/12] fix no data file in python package --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index e497e6c..1bbc29c 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ packages = find_packages() with open("README.md", "r") as fh: long_description = fh.read() -VERSION = "1.2.2" +VERSION = "1.2.3" setup(name='python-seispy', version=VERSION, author='Mijian Xu', @@ -39,7 +39,7 @@ setup(name='python-seispy', 'rfani=seispy.scripts:rfani', 'ccp3d=seispy.scripts:ccp3d', 'get_pierce_points=seispy.scripts:get_pierce_points']}, - include_package_data=True, + # include_package_data=True, zip_safe=False, classifiers=['Programming Language :: Python', 'Programming Language :: Python :: 3.7', -- GitLab From 041f3dfda7187884ad38cb846171a624be1aa340 Mon Sep 17 00:00:00 2001 From: xumi1993 Date: Tue, 10 Aug 2021 17:39:27 +0800 Subject: [PATCH 12/12] fix bugs of plotrt --- seispy/plotR.py | 9 +++------ seispy/plotRT.py | 11 +++++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/seispy/plotR.py b/seispy/plotR.py index b672fd8..6f3f5ae 100644 --- a/seispy/plotR.py +++ b/seispy/plotR.py @@ -81,23 +81,20 @@ def plotr(rfpath, outpath='./', xlim=[-2, 80], enf=6, format='pdf'): def main(): parser = argparse.ArgumentParser(description="Plot R&T receiver functions") parser.add_argument('rfpath', help='Path to PRFs with a \'finallist.dat\' in it', type=str) - parser.add_argument('-w', help="Time window from t1 to t2, defaults to -2/80", type=str, default='-2/80', metavar='t1/t2') parser.add_argument('-e', help='Enlargement factor, defaults to 6', dest='enf', type=float, default=6, metavar='enf') parser.add_argument('-o', help='Output path without file name, defaults to current path', dest='output', default='./', type=str, metavar='outpath') parser.add_argument('-t', help='Specify figure format. f = \'.pdf\', g = \'.png\', defaults to \'g\'', dest='format', default='g', type=str, metavar='f|g') + parser.add_argument('-x', help='The max time scale in sec, defaults to 85s', default=85, type=float, metavar='max_time') + arg = parser.parse_args() - try: - xlim = [float(v) for v in arg.w.split('/')] - except: - raise ValueError("Error format in time window") if arg.format not in ('f', 'g'): raise ValueError('Error: The format must be in \'f\' and \'g\'') elif arg.format == 'g': fmt = 'png' elif arg.format == 'f': fmt = 'pdf' - plotr(arg.rfpath, arg.output, enf=arg.enf, xlim=xlim, format=fmt) + plotr(arg.rfpath, arg.output, enf=arg.enf, xlim=[-2, arg.x], format=fmt) diff --git a/seispy/plotRT.py b/seispy/plotRT.py index 94d182b..485f0f7 100644 --- a/seispy/plotRT.py +++ b/seispy/plotRT.py @@ -123,7 +123,7 @@ def set_fig(axr, axt, axb, axr_sum, axt_sum, stadata, station, xmin=-2, xmax=30, axb.set_xlabel(r'Back-azimuth ($\circ$)', fontsize=13) -def plotrt(rfpath, enf=3, out_path='./', outformat='g'): +def plotrt(rfpath, enf=3, out_path='./', outformat='g', xmax=30): """[summary] :param rfpath: [description] @@ -146,7 +146,7 @@ def plotrt(rfpath, enf=3, out_path='./', outformat='g'): h, axr, axt, axb, axr_sum, axt_sum = init_figure() stadata = read_process_data(rfpath) plot_waves(axr, axt, axb, axr_sum, axt_sum, stadata, enf=enf) - set_fig(axr, axt, axb, axr_sum, axt_sum, stadata, station) + set_fig(axr, axt, axb, axr_sum, axt_sum, stadata, station, xmax=xmax, comp=stadata.comp) if outformat == 'g': h.savefig(join(out_path, station+'_RT_bazorder_{:.1f}.png'.format(stadata.f0[0])), dpi=400, bbox_inches='tight') elif outformat == 'f': @@ -160,12 +160,11 @@ def main(): parser.add_argument('-o', help='Output path without file name, defaults to current path', dest='output', default='./', type=str, metavar='outpath') parser.add_argument('-t', help='Specify figure format. f = \'.pdf\', g = \'.png\', defaults to \'g\'', dest='format', default='g', type=str, metavar='f|g') + parser.add_argument('-x', help='The max time scale in sec, defaults to 30s', default=30, type=float, metavar='max_time') arg = parser.parse_args() if arg.format not in ('f', 'g'): - print('Errpr: The format must be in \'f\' and \'g\'') - parser.print_help() - sys.exit(1) - plotrt(rfpath=arg.path, enf=arg.enf, out_path=arg.output, outformat=arg.format) + raise ValueError('Error: The format must be in \'f\' and \'g\'') + plotrt(rfpath=arg.rfpath, enf=arg.enf, out_path=arg.output, outformat=arg.format, xmax=arg.x) if __name__ == '__main__': -- GitLab