本文整理汇总了Python中nansat.vrt.VRT.copy方法的典型用法代码示例。如果您正苦于以下问题:Python VRT.copy方法的具体用法?Python VRT.copy怎么用?Python VRT.copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nansat.vrt.VRT
的用法示例。
在下文中一共展示了VRT.copy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_copy_vrt_pixel_func
# 需要导入模块: from nansat.vrt import VRT [as 别名]
# 或者: from nansat.vrt.VRT import copy [as 别名]
def test_copy_vrt_pixel_func(self):
vrt1 = VRT()
vrt1_xml = '''
<VRTDataset rasterXSize="200" rasterYSize="200">
<VRTRasterBand dataType="Byte" band="1">
<ComplexSource>
<SourceFilename relativeToVRT="0">%s</SourceFilename>
<SourceBand>1</SourceBand>
<SourceProperties RasterXSize="200" RasterYSize="200" DataType="Byte" BlockXSize="200" BlockYSize="13" />
<SrcRect xOff="0" yOff="0" xSize="200" ySize="200" />
<DstRect xOff="0" yOff="0" xSize="200" ySize="200" />
</ComplexSource>
</VRTRasterBand>
<VRTRasterBand dataType="Float32" band="2" subClass="VRTDerivedRasterBand">
<ComplexSource>
<SourceFilename relativeToVRT="0">%s</SourceFilename>
<SourceBand>1</SourceBand>
<SourceProperties RasterXSize="200" RasterYSize="200" DataType="Byte" BlockXSize="128" BlockYSize="128" />
<SrcRect xOff="0" yOff="0" xSize="200" ySize="200" />
<DstRect xOff="0" yOff="0" xSize="200" ySize="200" />
</ComplexSource>
<PixelFunctionType>sqrt</PixelFunctionType>
</VRTRasterBand>
</VRTDataset>
''' % (self.test_file_gcps, vrt1.filename)
vrt1.write_xml(vrt1_xml)
vrt2 = vrt1.copy()
self.assertFalse(os.path.basename(vrt1.filename) in vrt2.xml)
示例2: test_copy_empty_vrt
# 需要导入模块: from nansat.vrt import VRT [as 别名]
# 或者: from nansat.vrt.VRT import copy [as 别名]
def test_copy_empty_vrt(self):
vrt1 = VRT()
vrt2 = vrt1.copy()
self.assertIsInstance(vrt2, VRT)
self.assertIsInstance(vrt2.filename, str)
self.assertEqual(vrt2.dataset.RasterXSize, vrt1.dataset.RasterXSize)
self.assertEqual(vrt2.dataset.RasterYSize, vrt1.dataset.RasterYSize)
self.assertEqual(vrt2.dataset.GetProjection(), vrt1.dataset.GetProjection())
self.assertEqual(vrt2.dataset.GetGeoTransform(), vrt1.dataset.GetGeoTransform())
self.assertEqual(vrt2.dataset.GetGCPProjection(), vrt1.dataset.GetGCPProjection())
self.assertIn('filename', list(vrt2.dataset.GetMetadata().keys()))