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

add logger of modcreator

上级 be7e6ec3
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()
......
......@@ -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__':
......
......@@ -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.
先完成此消息的编辑!
想要评论请 注册