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

remove old files

上级 c83fdb6f
# This file is a template, and might need editing before it works on your project.
# Official language image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/python/tags/
image: continuumio/miniconda3:latest
# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
#
#
#
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache"
CODECOV_TOKEN: "19cc2f17-6db7-4633-9cb6-658b0b399ec2"
# Pip's cache doesn't store the python packages
# https://pip.pypa.io/en/stable/reference/pip_install/#caching
#
# If you want to also cache the installed packages, you have to install
# them in a virtualenv and cache it as well.
before_script:
- conda config --set always_yes yes
- conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
- conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
- conda config --add channels conda-forge
# - conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
- pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
- conda info -a
#- python -V # Print out python version for debugging
#- pip install virtualenv
#- virtualenv venv
#- source venv/bin/activate
stages:
- test
- deploy
- coverage
py37:
stage: test
script:
- conda create -n testenv37 python=3.7
- source activate testenv37
- conda install obspy pandas pytz netCDF4
- python setup.py install
- cd test/testcase01
- python testcase01.py
- cd ../testcase02
- python testcase02.py
# - pip install tox flake8 # you can also use tox
# - tox -e py36,flake8
py36:
stage: test
script:
- conda create -n testenv36 python=3.6
- source activate testenv36
- conda install obspy pandas pytz netCDF4
- python setup.py install
- cd test/testcase01
- python testcase01.py
- cd ../testcase02
- python testcase02.py
doc:
stage: deploy
script:
- bash -c "$(curl -fsSL https://git.nju.edu.cn/xumi1993/source/-/raw/master/trigger.sh)"
codecov:
stage: coverage
script:
- bash <(curl -s https://codecov.io/bash)
when: on_success
#pages:
# script:
# - pip install sphinx sphinx-rtd-theme
# - cd doc ; make html
# - mv build/html/ ../public/
# artifacts:
# paths:
# - public
# only:
# - master
# seispy
# 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://travis-ci.com/xumi1993/seispy-doc.post)
......@@ -26,7 +26,6 @@ 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.
......
#!/usr/bin/env python
try:
import urllib.request as rq
except:
import urllib as rq
import re
import sys, getopt, os
import datetime
def Usage():
print('Usage: python updateCatalog.py -I[oldcatalog] -O[newcatalog]')
print('-I -- Old catalog')
print('-O -- New catalog')
try:
opts,args = getopt.getopt(sys.argv[1:], "I:O:")
except:
print('Arguments are not found!')
Usage()
sys.exit(1)
if opts == []:
Usage()
sys.exit(1)
outlog = ''
for op, value in opts:
if op == "-I":
inlog = value
elif op == "-O":
outlog = value
if outlog == '':
outlog = inlog
url = 'http://www.ldeo.columbia.edu/~gcmt/projects/CMT/catalog/NEW_QUICK/qcmt.ndk'
try:
print('Connecting to http://www.ldeo.columbia.edu/.../qcmt.ndk')
response = rq.urlopen(url)
except:
print('Could not connect to http://www.ldeo.columbia.edu/~gcmt/projects/CMT/catalog/NEW_QUICK/qcmt.ndk')
html = str(response.read())
version = sys.version_info.major
if version == 3:
find_re = re.compile(r'[A-Z]+\s\d+/\d+/\d+\s.+?\\n',re.DOTALL)
else:
find_re = re.compile(r'[A-Z]+\s\d+/\d+/\d+\s.+?[\n]',re.DOTALL)
fid_old = open(inlog,'r')
all_old_log = fid_old.readlines()
old_log = all_old_log[-1]
old_time_end = datetime.datetime(int(old_log.split()[0]),int(old_log.split()[1]),int(old_log.split()[2]),int(old_log.split()[4]),int(old_log.split()[5]),int(old_log.split()[6]))
fid_old.close()
if inlog != outlog:
fid_new = open(outlog,'w+')
fid_new.writelines(all_old_log)
else:
fid_new = open(outlog,'a+')
i=0
maxcol = int(os.popen('stty size').read().strip().split()[1])
maxsharp = int(maxcol*0.8)
print('Writing station info to '+outlog)
for info in find_re.findall(html):
num = len(find_re.findall(html))
j = '#'*int((i/num)*maxsharp)
sys.stdout.write(str(int((i/num)*100+1))+'% ||'+j+'->'+"\r")
sys.stdout.flush()
i+=1
year = int(info.split()[1].split('/')[0])
mon = int(info.split()[1].split('/')[1])
day = int(info.split()[1].split('/')[2])
hour = int(info.split()[2].split(':')[0])
min = int(info.split()[2].split(':')[1])
sec = float(info.split()[2].split(':')[2])
sec = round(sec)
if sec == 60:
sec = 59
lat = float(info.split()[3])
lon = float(info.split()[4])
dep = info.split()[5]
mw = info.split()[7]
evt_time = datetime.datetime(year,mon,day,hour,min,sec)
if old_time_end < evt_time:
fid_new.write('%d %d %d %s %d %d %d %6.2f %6.2f %s %s\n' % (year,mon,day,evt_time.strftime('%j'),hour,min,sec,lat,lon,dep,mw))
print('\nNew catalog file has writen to '+outlog+'.')
Supports Markdown
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册