本文整理汇总了Python中nco.Nco.ncea方法的典型用法代码示例。如果您正苦于以下问题:Python Nco.ncea方法的具体用法?Python Nco.ncea怎么用?Python Nco.ncea使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nco.Nco
的用法示例。
在下文中一共展示了Nco.ncea方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_returnArray
# 需要导入模块: from nco import Nco [as 别名]
# 或者: from nco.Nco import ncea [as 别名]
def test_returnArray(foo_nc):
nco = Nco(cdfMod='netcdf4')
random1 = nco.ncea(input=foo_nc, output="tmp.nc", returnCdf=True, options=['-O']).variables['random'][:]
assert type(random1) == np.ndarray
random2 = nco.ncea(input=foo_nc, output="tmp.nc",returnArray='random' ,options=['-O'])
assert type(random2) == np.ndarray
np.testing.assert_equal(random1, random2)
示例2: test_return_array
# 需要导入模块: from nco import Nco [as 别名]
# 或者: from nco.Nco import ncea [as 别名]
def test_return_array(foo_nc):
nco = Nco(cdf_module="netcdf4")
random1 = nco.ncea(
input=foo_nc, output="tmp.nc", returnCdf=True, options=["-O"]
).variables["random"][:]
assert isinstance(random1, np.ndarray)
random2 = nco.ncea(
input=foo_nc, output="tmp.nc", returnArray="random", options=["-O"]
)
assert isinstance(random2, np.ndarray)
np.testing.assert_equal(random1, random2)
示例3: test_return_cdf
# 需要导入模块: from nco import Nco [as 别名]
# 或者: from nco.Nco import ncea [as 别名]
def test_return_cdf(foo_nc):
nco = Nco(cdf_module="scipy")
test_cdf = nco.ncea(input=foo_nc, output="tmp.nc", returnCdf=True, options=["-O"])
assert type(test_cdf) == scipy.io.netcdf.netcdf_file
expected_vars = ["time", "random"]
for var in expected_vars:
assert var in list(test_cdf.variables.keys())
nco = Nco(cdf_module="netcdf4")
test_cdf = nco.ncea(input=foo_nc, output="tmp.nc", returnCdf=True, options=["-O"])
assert type(test_cdf) == netCDF4.Dataset
for var in expected_vars:
assert var in list(test_cdf.variables.keys())
示例4: test_returnCdf
# 需要导入模块: from nco import Nco [as 别名]
# 或者: from nco.Nco import ncea [as 别名]
def test_returnCdf(foo_nc):
nco = Nco(cdfMod='scipy')
testCdf = nco.ncea(input=foo_nc, output="tmp.nc", returnCdf=True,options=['-O'])
assert type(testCdf) == scipy.io.netcdf.netcdf_file
expected_vars = ['time', 'random']
for var in expected_vars:
assert var in list(testCdf.variables.keys())
nco = Nco(cdfMod='netcdf4')
testCdf = nco.ncea(input=foo_nc, output="tmp.nc", returnCdf=True, options=['-O'])
assert type(testCdf) == netCDF4.Dataset
for var in expected_vars:
assert var in list(testCdf.variables.keys())
示例5: test_return_ma_array
# 需要导入模块: from nco import Nco [as 别名]
# 或者: from nco.Nco import ncea [as 别名]
def test_return_ma_array(bar_mask_nc, random_masked_field):
nco = Nco()
field = nco.ncea(
input=bar_mask_nc, output="tmp.nc", returnMaArray="random", options=["-O"]
)
assert type(field) == np.ma.core.MaskedArray
示例6: test_ncea_mult_files
# 需要导入模块: from nco import Nco [as 别名]
# 或者: from nco.Nco import ncea [as 别名]
def test_ncea_mult_files(foo_nc, bar_nc):
nco = Nco(debug=True)
infiles = [foo_nc, bar_nc]
nco.ncea(input=infiles, output="out.nc")
示例7: test_returnMaArray
# 需要导入模块: from nco import Nco [as 别名]
# 或者: from nco.Nco import ncea [as 别名]
def test_returnMaArray(bar_mask_nc, random_masked_field):
nco = Nco()
field = nco.ncea(input=bar_mask_nc, returnMaArray='random')
assert type(field) == np.ma.core.MaskedArray