Skip to content
GitLab
菜单
项目
群组
代码片段
/
帮助
帮助
支持
社区论坛
快捷键
?
提交反馈
登录/注册
切换导航
菜单
打开侧边栏
NJU Geophy
seispy
提交
be7e6ec3
提交
be7e6ec3
编辑于
11月 30, 2021
作者:
Mijian Xu
😷
浏览文件
remove netcdf dependence
上级
9794be9f
变更
2
Hide whitespace changes
Inline
Side-by-side
seispy/io.py
浏览文件 @
be7e6ec3
...
...
@@ -3,7 +3,7 @@ from obspy import UTCDateTime
import
numpy
as
np
import
argparse
from
obspy.clients.fdsn
import
Client
from
netCDF4
import
Dataset
#
from netCDF4 import Dataset
import
sys
...
...
@@ -48,19 +48,19 @@ def nc2npz(ncdata, minlat=-90, maxlat=90, minlon=-180, maxlon=180, mindep=0, max
return
cut_data
,
cut_dep
,
cut_lat
,
cut_lon
def
lsnc
():
parser
=
argparse
.
ArgumentParser
(
description
=
"List all fields of netCDF file"
)
parser
.
add_argument
(
'-k'
,
help
=
'Key name of fields'
,
type
=
str
,
dest
=
'key'
,
default
=
None
)
parser
.
add_argument
(
'ncfile'
,
type
=
str
,
help
=
'Path to netCDF file'
)
arg
=
parser
.
parse_args
()
if
len
(
sys
.
argv
)
==
1
:
parser
.
print_help
()
sys
.
exit
(
1
)
ncdata
=
Dataset
(
arg
.
ncfile
)
if
arg
.
key
is
None
:
print
(
ncdata
.
variables
)
else
:
print
(
ncdata
.
variables
[
arg
.
key
])
#
def lsnc():
#
parser = argparse.ArgumentParser(description="List all fields of netCDF file")
#
parser.add_argument('-k', help='Key name of fields', type=str, dest='key', default=None)
#
parser.add_argument('ncfile', type=str, help='Path to netCDF file')
#
arg = parser.parse_args()
#
if len(sys.argv) == 1:
#
parser.print_help()
#
sys.exit(1)
#
ncdata = Dataset(arg.ncfile)
#
if arg.key is None:
#
print(ncdata.variables)
#
else:
#
print(ncdata.variables[arg.key])
if
__name__
==
'__main__'
:
...
...
setup.py
浏览文件 @
be7e6ec3
...
...
@@ -18,7 +18,7 @@ setup(name='python-seispy',
package_dir
=
{
'seispy'
:
'seispy'
},
package_data
=
{
''
:
[
'data/*'
]},
install_requires
=
[
'netcdf4>=1.5.2'
,
#
'netcdf4>=1.5.2',
'obspy>=1.2.0'
,
'pandas>=1.0.0'
,
'numpy>=1.19.0'
,
...
...
编辑
预览
支持
Markdown
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录