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


Python Nansat.has_band方法代码示例

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


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

示例1: test_export_selected_bands

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import has_band [as 别名]
 def test_export_selected_bands(self):
     n = Nansat(self.test_file_gcps)
     resfile = 'tmp.nc'
     new_band = np.random.randn(n.shape()[0], n.shape()[1])
     n.add_band(new_band, {'name': 'newBand'})
     # Test with band numbers
     n.export(resfile, bands=[4, 2])
     self.assertTrue(os.path.exists(resfile))
     nn = Nansat(resfile)
     self.assertTrue(nn.has_band('newBand'))
     self.assertTrue(nn.has_band('L_555'))
     os.unlink(resfile)
开发者ID:WYC19910220,项目名称:nansat,代码行数:14,代码来源:test_nansat.py

示例2: test_export_option

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import has_band [as 别名]
 def test_export_option(self):
     n = Nansat(self.test_file_arctic)
     tmpfilename = os.path.join(ntd.tmp_data_path,
                                'nansat_export_option.nc')
     # Test with band numbers
     n.export(tmpfilename, options='WRITE_LONLAT=YES')
     n.export(tmpfilename + '2', options=['WRITE_LONLAT=YES'])
     nn = Nansat(tmpfilename)
     nn2 = Nansat(tmpfilename + '2')
     self.assertTrue(nn.has_band('lon'))
     self.assertTrue(nn.has_band('lat'))
     self.assertTrue(nn.has_band('Bristol'))
     self.assertTrue(nn2.has_band('lon'))
     self.assertTrue(nn2.has_band('lat'))
     self.assertTrue(nn2.has_band('Bristol'))
开发者ID:,项目名称:,代码行数:17,代码来源:

示例3: test_reproject_no_addmask

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import has_band [as 别名]
    def test_reproject_no_addmask(self):
        ''' Should not add swath mask and return 0 in areas out of swath '''
        n = Nansat(self.test_file_complex, logLevel=40)
        d = Domain(4326, '-te -92.08 26.85 -92.00 26.91 -ts 200 200')
        n.reproject(d, addmask=False)
        b = n[1]

        self.assertTrue(not n.has_band('swathmask'))
        self.assertTrue(np.isfinite(b[0, 0]))
        self.assertTrue(np.isfinite(b[100, 100]))
开发者ID:,项目名称:,代码行数:12,代码来源:

示例4: test_reproject_of_complex

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import has_band [as 别名]
    def test_reproject_of_complex(self):
        ''' Should return np.nan in areas out of swath '''
        n = Nansat(self.test_file_complex, logLevel=40)
        d = Domain(4326, '-te -92.08 26.85 -92.00 26.91 -ts 200 200')
        n.reproject(d)
        b = n[1]

        self.assertTrue(n.has_band('swathmask'))
        self.assertTrue(np.isnan(b[0, 0]))
        self.assertTrue(np.isfinite(b[100, 100]))
开发者ID:,项目名称:,代码行数:12,代码来源:

示例5: test_reproject_domain

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import has_band [as 别名]
    def test_reproject_domain(self):
        n = Nansat(self.test_file_gcps, logLevel=40)
        d = Domain(4326, "-te 27 70 30 72 -ts 500 500")
        n.reproject(d)
        tmpfilename = os.path.join(ntd.tmp_data_path,
                                   'nansat_reproject_domain.png')
        n.write_figure(tmpfilename, 2, clim='hist')

        self.assertEqual(n.shape(), (500, 500))
        self.assertEqual(type(n[1]), np.ndarray)
        self.assertTrue(n.has_band('swathmask'))
开发者ID:,项目名称:,代码行数:13,代码来源:

示例6: test_add_band_and_reproject

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import has_band [as 别名]
    def test_add_band_and_reproject(self):
        ''' Should add band and swath mask
        and return 0 in areas out of swath '''
        n = Nansat(self.test_file_gcps, logLevel=40)
        d = Domain(4326, "-te 27 70 30 72 -ts 500 500")
        n.add_band(np.ones(n.shape()))
        n.reproject(d)
        b1 = n[1]
        b4 = n[4]

        self.assertTrue(n.has_band('swathmask'))
        self.assertTrue(b1[0, 0] == 0)
        self.assertTrue(b1[300, 300] > 0)
        self.assertTrue(np.isnan(b4[0, 0]))
        self.assertTrue(b4[300, 300] == 1.)
开发者ID:,项目名称:,代码行数:17,代码来源:

示例7: test_mappers_advanced

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import has_band [as 别名]
    def test_mappers_advanced(self):
        ''' Run similar NansenCloud reated tests for all mappers '''
        for fileName, mapperName in self.testData.mapperData:
            sys.stderr.write('\nMapper '+mapperName+' -> '+fileName+'\n')
            n = Nansat(fileName, mapperName=mapperName)
            yield self.is_correct_mapper, n, mapperName
            yield self.has_start_time, n
            yield self.has_end_time, n
            yield self.has_correct_platform, n
            yield self.has_correct_instrument, n

            # Test that SAR objects have sigma0 intensity bands in addition
            # to complex bands
            if n.has_band(
                'surface_backwards_scattering_coefficient_of_radar_wave'
                    ):
                yield self.exist_intensity_band, n
开发者ID:scollis,项目名称:nansat,代码行数:19,代码来源:test_mappers.py

示例8: test_has_band

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import has_band [as 别名]
    def test_has_band(self):
        n = Nansat(self.test_file_gcps, logLevel=40)
        hb = n.has_band('L_645')

        self.assertTrue(hb)
开发者ID:WYC19910220,项目名称:nansat,代码行数:7,代码来源:test_nansat.py


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