当前位置: 首页>>代码示例>>Python>>正文


Python Nco.ncea方法代码示例

本文整理汇总了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)
开发者ID:jvegasbsc,项目名称:pynco,代码行数:9,代码来源:test_nco.py

示例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)
开发者ID:nco,项目名称:pynco,代码行数:13,代码来源:test_nco.py

示例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())
开发者ID:nco,项目名称:pynco,代码行数:15,代码来源:test_nco.py

示例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())
开发者ID:jvegasbsc,项目名称:pynco,代码行数:15,代码来源:test_nco.py

示例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
开发者ID:nco,项目名称:pynco,代码行数:8,代码来源:test_nco.py

示例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")
开发者ID:nco,项目名称:pynco,代码行数:6,代码来源:test_nco.py

示例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
开发者ID:xuexianwu,项目名称:pynco,代码行数:6,代码来源:test_nco.py


注:本文中的nco.Nco.ncea方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。