提交 49a07905 编辑于 作者: Mijian Xu's avatar Mijian Xu 😷
浏览文件

Merge branch 'dev' into 'master'

merge Dev

See merge request !2
# 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 }}
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
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
# Seispy
# <img src="https://user-images.githubusercontent.com/7437523/128596331-dc5c5e40-93e1-4d9e-b92d-9c53fe51145a.png" width="500"/>
[![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)
[![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)
<a href="https://dev.azure.com/conda-forge/feedstock-builds/_build/latest?definitionId=13623&branchName=master">
<img src="https://dev.azure.com/conda-forge/feedstock-builds/_apis/build/status/seispy-feedstock?branchName=master">
</a>
[![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)]()
......@@ -26,7 +31,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
```
......@@ -36,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/)).<br />
* `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.
......
......@@ -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)
......
......@@ -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)
......
......@@ -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,11 +146,11 @@ 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=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():
......@@ -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__':
......
......@@ -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__":
......
......@@ -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)
......
......@@ -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.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',
......
支持 Markdown
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册