Skip to content
GitLab
菜单
项目
群组
代码片段
/
帮助
帮助
支持
社区论坛
快捷键
?
提交反馈
登录/注册
切换导航
菜单
打开侧边栏
NJU Geophy
seispy
提交
791a09fa
提交
791a09fa
编辑于
12月 02, 2021
作者:
Mijian Xu
😷
浏览文件
add logger of modcreator
上级
be7e6ec3
变更
3
Hide whitespace changes
Inline
Side-by-side
seispy/modcreator.py
浏览文件 @
791a09fa
import
numpy
as
np
from
scipy.interpolate
import
griddata
,
interp1d
from
seispy.rfcorrect
import
DepModel
from
seispy.setuplog
import
setuplog
import
argparse
class
ModCreator
():
def
__init__
(
self
):
def
__init__
(
self
,
log
=
None
):
if
log
is
None
:
self
.
logger
=
setuplog
()
else
:
self
.
logger
=
log
self
.
lats
=
np
.
array
([])
self
.
lons
=
np
.
array
([])
self
.
deps
=
np
.
array
([])
...
...
@@ -15,6 +20,7 @@ class ModCreator():
[
1.85
,
1.75
,
1.75
,
1.75
,
1.79
,
1.75
,
2
,
1.79
,
1.61
,
1.67
,
1.67
,
2.13
]])
def
init_grid
(
self
,
latmin
,
latmax
,
lonmin
,
lonmax
,
depmin
=
0
,
depmax
=
850
,
horival
=
0.5
,
depval
=
50
):
self
.
logger
.
ModCreatorlog
.
info
(
'Setting up grids.'
)
self
.
lat_inter
=
np
.
arange
(
latmin
,
latmax
,
horival
)
self
.
lon_inter
=
np
.
arange
(
lonmin
,
lonmax
,
horival
)
self
.
dep_inter
=
np
.
arange
(
depmin
,
depmax
,
depval
)
...
...
@@ -22,6 +28,7 @@ class ModCreator():
self
.
depmod
=
DepModel
(
self
.
dep_inter
)
def
gridvel
(
self
,
**
kwargs
):
self
.
logger
.
ModCreatorlog
.
info
(
'Interpolating unstructured velocity to grid'
)
points
=
np
.
array
([
self
.
deps
,
self
.
lats
,
self
.
lons
]).
T
self
.
vp_grid
=
griddata
(
points
,
self
.
vps
,
(
self
.
dep_grid
,
self
.
lat_grid
,
self
.
lon_grid
),
**
kwargs
)
self
.
fill_1d
()
...
...
seispy/setuplog.py
浏览文件 @
791a09fa
...
...
@@ -30,6 +30,10 @@ class setuplog(object):
if
not
self
.
CCPlog
.
handlers
:
self
.
CCPlog
.
setLevel
(
logging
.
INFO
)
self
.
CCPlog
.
addHandler
(
ch
)
self
.
ModCreatorlog
=
logging
.
getLogger
(
'ModCreator'
)
if
not
self
.
ModCreatorlog
.
handlers
:
self
.
ModCreatorlog
.
setLevel
(
logging
.
INFO
)
self
.
ModCreatorlog
.
addHandler
(
ch
)
if
__name__
==
'__main__'
:
...
...
setup.py
浏览文件 @
791a09fa
...
...
@@ -6,7 +6,7 @@ with open("README.md", "r") as fh:
long_description
=
fh
.
read
()
VERSION
=
"1.2.
9
"
VERSION
=
"1.2.
10
"
setup
(
name
=
'python-seispy'
,
version
=
VERSION
,
author
=
'Mijian Xu'
,
...
...
编辑
预览
支持
Markdown
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录