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


Python Dataset.set_auto_maskandscale方法代码示例

本文整理汇总了Python中netCDF4.Dataset.set_auto_maskandscale方法的典型用法代码示例。如果您正苦于以下问题:Python Dataset.set_auto_maskandscale方法的具体用法?Python Dataset.set_auto_maskandscale怎么用?Python Dataset.set_auto_maskandscale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在netCDF4.Dataset的用法示例。


在下文中一共展示了Dataset.set_auto_maskandscale方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: read_dataset

# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import set_auto_maskandscale [as 别名]
    def read_dataset(pathname):
        """

        :type pathname: str
        :rtype : Dataset
        """
        dataset = Dataset(pathname)
        dataset.set_auto_maskandscale(True)

        return dataset
开发者ID:bcdev,项目名称:sst-cci-toolbox,代码行数:12,代码来源:matchupverifier.py

示例2: _check_product_can_be_opened

# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import set_auto_maskandscale [as 别名]
 def _check_product_can_be_opened(self):
     try:
         dataset = Dataset(self.source_pathname)
         dataset.set_auto_maskandscale(False)
         self.report['product_can_be_opened_check'] = 0
         return dataset
     except:
         self.report['product_can_be_opened_check'] = 1
         filename = os.path.basename(self.source_pathname)
         self.report['product_can_be_opened_check_failed_for'] = filename
         raise VerificationError
开发者ID:gerritholl,项目名称:sst-cci-toolbox,代码行数:13,代码来源:productverifier.py

示例3: read_mmd

# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import set_auto_maskandscale [as 别名]
    def read_mmd(sensor, pathname):
        """

        :type sensor: str
        :type pathname: str
        :rtype : tuple
        """
        mmd = Dataset(pathname)
        mmd.set_auto_maskandscale(True)
        nx = len(mmd.dimensions['atsr.nx'])
        ny = len(mmd.dimensions['atsr.ny'])
        m_ids = mmd.variables['matchup.id'][:]
        mmd.variables[sensor + '.matchup_elem'].set_auto_maskandscale(False)
        mmd.variables[sensor + '.matchup_line'].set_auto_maskandscale(False)
        m_elems = mmd.variables['atsr.3.matchup_elem'][:]
        m_lines = mmd.variables['atsr.3.matchup_line'][:]
        m_source_filenames = chartostring(mmd.variables[sensor + '.l1b_filename'][:])

        return mmd, nx, ny, m_ids, m_source_filenames, m_elems, m_lines
开发者ID:bcdev,项目名称:sst-cci-toolbox,代码行数:21,代码来源:matchupverifier.py

示例4: runTest

# 需要导入模块: from netCDF4 import Dataset [as 别名]
# 或者: from netCDF4.Dataset import set_auto_maskandscale [as 别名]
    def runTest(self):

        # Note: The default behaviour is to to have both auto-masking and auto-scaling activated.
        #       This is already tested in tst_scaled.py, so no need to repeat here. Instead,
        #       disable auto-masking and auto-scaling altogether.

        f = Dataset(self.testfile, "r")

        # Neither scaling and masking enabled

        f.set_auto_maskandscale(False)

        v0 = f.variables['var0']
        v1 = f.groups['Group1'].variables['var1']
        v2 = f.groups['Group2'].variables['var2']

        self.assertFalse(v0.scale)
        self.assertFalse(v0.mask)

        self.assertFalse(v1.scale)
        self.assertFalse(v1.mask)

        self.assertFalse(v2.scale)
        self.assertFalse(v2.mask)

        # No auto-masking, but auto-scaling

        f.set_auto_maskandscale(True)
        f.set_auto_mask(False)

        self.assertTrue(v0.scale)
        self.assertFalse(v0.mask)

        self.assertTrue(v1.scale)
        self.assertFalse(v1.mask)

        self.assertTrue(v2.scale)
        self.assertFalse(v2.mask)

        f.close()
开发者ID:Unidata,项目名称:netcdf4-python,代码行数:42,代码来源:tst_masked3.py


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