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


Python Nansat.get_metadata方法代码示例

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


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

示例1: test_export_netcdf_complex_remove_meta

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_metadata [as 别名]
 def test_export_netcdf_complex_remove_meta(self):
     n = Nansat(self.test_file_complex, mapper=self.default_mapper)
     self.assertEqual(n.get_metadata('PRODUCT_TYPE'), 'SLC')
     n.export(self.tmp_filename, rm_metadata=['PRODUCT_TYPE'])
     exported = Nansat(self.tmp_filename, mapper=self.default_mapper)
     with self.assertRaises(ValueError):
         exported.get_metadata('PRODUCT_TYPE')
     self.assertTrue((n[1] == exported[1]).any())
开发者ID:nansencenter,项目名称:nansat,代码行数:10,代码来源:test_exporter.py

示例2: test_export_netcdf_complex_remove_meta

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_metadata [as 别名]
 def test_export_netcdf_complex_remove_meta(self):
     ''' Test export of complex data with pixelfunctions
     '''
     n = Nansat(self.test_file_complex)
     self.assertEqual(n.get_metadata('PRODUCT_TYPE'), 'SLC')
     n.export(self.tmpfilename, rmMetadata=['PRODUCT_TYPE'])
     exported = Nansat(self.tmpfilename)
     with self.assertRaises(OptionError):
         exported.get_metadata('PRODUCT_TYPE')
     self.assertTrue((n[1] == exported[1]).any())
     os.unlink(self.tmpfilename)
开发者ID:,项目名称:,代码行数:13,代码来源:

示例3: test_time_coverage_metadata_of_exported_equals_original

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_metadata [as 别名]
    def test_time_coverage_metadata_of_exported_equals_original(self):
        orig = Nansat(self.test_file_gcps, mapper=self.default_mapper)
        orig.set_metadata('time_coverage_start', '2010-01-02T08:49:02.347809')
        orig.set_metadata('time_coverage_end', '2010-01-02T08:50:03.599373')
        orig.export(self.tmp_filename)
        copy = Nansat(self.tmp_filename, mapper=self.default_mapper)

        self.assertEqual(orig.get_metadata('time_coverage_start'),
                copy.get_metadata('time_coverage_start'))
        self.assertEqual(orig.get_metadata('time_coverage_end'),
                copy.get_metadata('time_coverage_end'))
开发者ID:nansencenter,项目名称:nansat,代码行数:13,代码来源:test_exporter.py

示例4: test_special_characters_in_exported_metadata

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_metadata [as 别名]
 def test_special_characters_in_exported_metadata(self):
     orig = Nansat(self.test_file_gcps, mapper=self.default_mapper)
     orig.vrt.dataset.SetMetadataItem('jsonstring', json.dumps({'meta1':
                                      'hei', 'meta2': 'derr'}))
     orig.export(self.tmp_filename)
     copy = Nansat(self.tmp_filename, mapper=self.default_mapper)
     dd = json.loads(unescape(copy.get_metadata('jsonstring'), {'"':
                                                                '"'}))
     self.assertIsInstance(dd, dict)
开发者ID:nansencenter,项目名称:nansat,代码行数:11,代码来源:test_exporter.py

示例5: test_add_band

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_metadata [as 别名]
    def test_add_band(self):
        d = Domain(4326, "-te 25 70 35 72 -ts 500 500")
        arr = np.random.randn(500, 500)
        n = Nansat(domain=d, logLevel=40)
        n.add_band(arr, {'name': 'band1'})

        self.assertEqual(type(n), Nansat)
        self.assertEqual(type(n[1]), np.ndarray)
        self.assertEqual(n.get_metadata('name', 1), 'band1')
        self.assertEqual(n[1].shape, (500, 500))
开发者ID:WYC19910220,项目名称:nansat,代码行数:12,代码来源:test_nansat.py

示例6: test_init_domain_array

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_metadata [as 别名]
    def test_init_domain_array(self):
        d = Domain(4326, "-te 25 70 35 72 -ts 500 500")
        n = Nansat(domain=d,
                   array=np.random.randn(500, 500),
                   parameters={'name': 'band1'},
                   logLevel=40)

        self.assertEqual(type(n), Nansat)
        self.assertEqual(type(n[1]), np.ndarray)
        self.assertEqual(n.get_metadata('name', 1), 'band1')
        self.assertEqual(n[1].shape, (500, 500))
开发者ID:WYC19910220,项目名称:nansat,代码行数:13,代码来源:test_nansat.py

示例7: test_set_metadata_bandid

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_metadata [as 别名]
    def test_set_metadata_bandid(self):
        n1 = Nansat(self.test_file_stere, logLevel=40)
        n1.set_metadata('newKey', 'newVal', 1)
        m = n1.get_metadata('newKey', 1)

        self.assertEqual(m, 'newVal')
开发者ID:WYC19910220,项目名称:nansat,代码行数:8,代码来源:test_nansat.py

示例8: test_get_metadata_bandid

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_metadata [as 别名]
    def test_get_metadata_bandid(self):
        n1 = Nansat(self.test_file_stere, logLevel=40)
        m = n1.get_metadata(bandID=1)

        self.assertEqual(type(m), dict)
        self.assertTrue('name' in m)
开发者ID:WYC19910220,项目名称:nansat,代码行数:8,代码来源:test_nansat.py

示例9: test_get_metadata_wrong_key

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_metadata [as 别名]
    def test_get_metadata_wrong_key(self):
        n1 = Nansat(self.test_file_stere, logLevel=40)
        m = n1.get_metadata('some_crap')

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

示例10: test_get_metadata_key

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_metadata [as 别名]
    def test_get_metadata_key(self):
        n1 = Nansat(self.test_file_stere, logLevel=40)
        m = n1.get_metadata('fileName')

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

示例11: test_get_metadata

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_metadata [as 别名]
    def test_get_metadata(self):
        n1 = Nansat(self.test_file_stere, logLevel=40)
        m = n1.get_metadata()

        self.assertEqual(type(m), dict)
        self.assertTrue('fileName' in m)
开发者ID:WYC19910220,项目名称:nansat,代码行数:8,代码来源:test_nansat.py

示例12: test_get_metadata_wrong_key

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_metadata [as 别名]
    def test_get_metadata_wrong_key(self):
        n1 = Nansat(self.test_file_stere, logLevel=40)

        with self.assertRaises(OptionError):
            n1.get_metadata('some_crap')
开发者ID:,项目名称:,代码行数:7,代码来源:

示例13: Nansat

# 需要导入模块: from nansat import Nansat [as 别名]
# 或者: from nansat.Nansat import get_metadata [as 别名]
# Open an input file, specify which Mapper to use, set logging level
n = Nansat(iFileName, mapperName='generic', logLevel=10)

# list bands and georeference of the object
print 'Raw Nansat:', n, '\n'

# get dictionary with metadata from all bands
print 'Bands:', n.bands(), '\n'

# get time of the image aquisition
print 'Time:', n.get_time()[0], '\n'

# set GlobalMetadata
n.set_metadata(key='GlobalKey', value='GlobalVal')
# get Global Metadata
print 'Global Metadata:', n.get_metadata(), '\n'

# set BandMetadata to the 1st band
n.set_metadata(key='BandKey', value='BandVal', bandID=1)
# get 1st Band Metadata
print '1st Band Metadata:', n.get_metadata(bandID=1), '\n'

# add a band from file (copy the 2nd band to the end (4th band)
n.add_band(fileName=n.fileName, bandID=2)
# add a band from numpy array (copy the 1st band to the end (5th band))
n.add_band(array=n[1], parameters={'name': 'Name1',
                                   'info':  'copy from the 1st band array'})
# print band list
n.list_bands()
# get GDAL raster band (2nd band)
band = n.get_GDALRasterBand(bandID=2)
开发者ID:yuxiaobu,项目名称:nansat,代码行数:33,代码来源:test_nansat.py


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