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


Python VRT.copy_dataset方法代码示例

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


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

示例1: test_fix_global_metadata

# 需要导入模块: from nansat.vrt import VRT [as 别名]
# 或者: from nansat.vrt.VRT import copy_dataset [as 别名]
 def test_fix_global_metadata(self):
     ds = gdal.Open(self.test_file_gcps)
     vrt = VRT.copy_dataset(ds)
     vrt.dataset.SetMetadataItem(str('test'), str('"test"'))
     vrt.fix_global_metadata(['AREA_OR_POINT'])
     self.assertNotIn('AREA_OR_POINT', vrt.dataset.GetMetadata())
     self.assertEqual('"test"', vrt.dataset.GetMetadataItem(str('test')))
开发者ID:nansencenter,项目名称:nansat,代码行数:9,代码来源:test_vrt.py

示例2: test_leave_few_bands

# 需要导入模块: from nansat.vrt import VRT [as 别名]
# 或者: from nansat.vrt.VRT import copy_dataset [as 别名]
 def test_leave_few_bands(self):
     ds = gdal.Open(self.test_file_gcps)
     vrt = VRT.copy_dataset(ds)
     vrt.leave_few_bands([1, 'L_469'])
     self.assertEqual(vrt.dataset.RasterCount,2)
     self.assertEqual(vrt.dataset.GetRasterBand(1).GetMetadataItem(str('name')), 'L_645')
     self.assertEqual(vrt.dataset.GetRasterBand(2).GetMetadataItem(str('name')), 'L_469')
开发者ID:nansencenter,项目名称:nansat,代码行数:9,代码来源:test_vrt.py

示例3: test_set_fake_gcps_empty

# 需要导入模块: from nansat.vrt import VRT [as 别名]
# 或者: from nansat.vrt.VRT import copy_dataset [as 别名]
    def test_set_fake_gcps_empty(self):
        ds = gdal.Open('NETCDF:"%s":UMass_AES' % self.test_file_arctic)
        vrt = VRT.copy_dataset(ds)

        dst_wkt = vrt._set_fake_gcps(self.nsr_wkt, [], 1)
        self.assertEqual(dst_wkt, self.nsr_wkt)
        self.assertEqual(len(vrt.dataset.GetGCPs()), 0)
开发者ID:nansencenter,项目名称:nansat,代码行数:9,代码来源:test_vrt.py

示例4: test_fix_band_metadata

# 需要导入模块: from nansat.vrt import VRT [as 别名]
# 或者: from nansat.vrt.VRT import copy_dataset [as 别名]
 def test_fix_band_metadata(self):
     ds = gdal.Open(self.test_file_gcps)
     vrt = VRT.copy_dataset(ds)
     self.assertIn('standard_name', vrt.dataset.GetRasterBand(1).GetMetadata())
     self.assertIn('time', vrt.dataset.GetRasterBand(1).GetMetadata())
     vrt.fix_band_metadata(['standard_name', 'time'])
     self.assertNotIn('standard_name', vrt.dataset.GetRasterBand(1).GetMetadata())
     self.assertNotIn('time', vrt.dataset.GetRasterBand(1).GetMetadata())
开发者ID:nansencenter,项目名称:nansat,代码行数:10,代码来源:test_vrt.py

示例5: test_set_gcps_geolocation_geotransform_with_geotransform

# 需要导入模块: from nansat.vrt import VRT [as 别名]
# 或者: from nansat.vrt.VRT import copy_dataset [as 别名]
 def test_set_gcps_geolocation_geotransform_with_geotransform(self):
     ds = gdal.Open('NETCDF:"%s":UMass_AES' % self.test_file_arctic)
     vrt = VRT.copy_dataset(ds)
     vrt._set_gcps_geolocation_geotransform()
     self.assertEqual(vrt.dataset.GetGeoTransform(),
                      (-1000000.0, 25000.0, 0.0, 5000000.0, 0.0, -25000.0))
     self.assertEqual(vrt.dataset.GetMetadata(str('GEOLOCATION')), {})
     self.assertEqual(vrt.dataset.GetGCPs(), ())
开发者ID:nansencenter,项目名称:nansat,代码行数:10,代码来源:test_vrt.py

示例6: test_hardcopy_bands

# 需要导入模块: from nansat.vrt import VRT [as 别名]
# 或者: from nansat.vrt.VRT import copy_dataset [as 别名]
    def test_hardcopy_bands(self):
        ds = gdal.Open(self.test_file_gcps)
        vrt = VRT.copy_dataset(ds)
        vrt.hardcopy_bands()

        self.assertTrue(np.allclose(vrt.dataset.ReadAsArray(), ds.ReadAsArray()))
        band_nodes = Node.create(str(vrt.xml)).nodeList('VRTRasterBand')
        self.assertEqual(band_nodes[0].node('SourceFilename').value, vrt.band_vrts[1].filename)
        self.assertEqual(band_nodes[1].node('SourceFilename').value, vrt.band_vrts[2].filename)
        self.assertEqual(band_nodes[2].node('SourceFilename').value, vrt.band_vrts[3].filename)
开发者ID:nansencenter,项目名称:nansat,代码行数:12,代码来源:test_vrt.py

示例7: test_set_fake_gcps

# 需要导入模块: from nansat.vrt import VRT [as 别名]
# 或者: from nansat.vrt.VRT import copy_dataset [as 别名]
    def test_set_fake_gcps(self):
        ds = gdal.Open('NETCDF:"%s":UMass_AES' % self.test_file_arctic)
        gcps = gdal.Open(self.test_file_gcps).GetGCPs()
        vrt = VRT.copy_dataset(ds)

        dst_wkt = vrt._set_fake_gcps(self.nsr_wkt, gcps, 1)
        self.assertEqual(dst_wkt, None)
        self.assertEqual(len(vrt.dataset.GetGCPs()), len(gcps))
        self.assertEqual([gcp.GCPPixel for gcp in gcps],
                         [gcp.GCPX for gcp in vrt.dataset.GetGCPs()])
        self.assertEqual([gcp.GCPLine for gcp in gcps],
                         [gcp.GCPY for gcp in vrt.dataset.GetGCPs()])
开发者ID:nansencenter,项目名称:nansat,代码行数:14,代码来源:test_vrt.py

示例8: test_update_warped_vrt_xml

# 需要导入模块: from nansat.vrt import VRT [as 别名]
# 或者: from nansat.vrt.VRT import copy_dataset [as 别名]
    def test_update_warped_vrt_xml(self):
        dataset = gdal.Open('NETCDF:"%s":UMass_AES' % self.test_file_arctic)
        warped_dataset = gdal.AutoCreateWarpedVRT(dataset, None, str(self.nsr_wkt), 0)
        warped_vrt = VRT.copy_dataset(warped_dataset)
        x_size = 100
        y_size = 200
        geo_transform = (0.0, 1.0, 0.0, 200.0, 0.0, -1.0)
        block_size = 64
        working_data_type = 'Float32'
        warped_vrt._update_warped_vrt_xml(x_size, y_size, geo_transform, block_size,
                                          working_data_type)

        self.assertEqual(warped_vrt.dataset.RasterXSize, x_size)
        self.assertEqual(warped_vrt.dataset.RasterYSize, y_size)
        self.assertEqual(warped_vrt.dataset.GetGeoTransform(), geo_transform)
        self.assertEqual(warped_vrt.dataset.GetRasterBand(1).GetBlockSize(),
                         [block_size, block_size])
        self.assertIn('<WorkingDataType>Float32</WorkingDataType>', warped_vrt.xml)
开发者ID:nansencenter,项目名称:nansat,代码行数:20,代码来源:test_vrt.py

示例9: test_remove_geotransform

# 需要导入模块: from nansat.vrt import VRT [as 别名]
# 或者: from nansat.vrt.VRT import copy_dataset [as 别名]
 def test_remove_geotransform(self):
     ds = gdal.Open('NETCDF:"%s":UMass_AES' % self.test_file_arctic)
     vrt = VRT.copy_dataset(ds)
     self.assertTrue('<GeoTransform>' in vrt.xml)
     vrt._remove_geotransform()
     self.assertFalse('<GeoTransform>' in vrt.xml)
开发者ID:nansencenter,项目名称:nansat,代码行数:8,代码来源:test_vrt.py


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