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


Python VRT.get_projection方法代码示例

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


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

示例1: test_get_projection_raises_NansatProjectionError

# 需要导入模块: from nansat.vrt import VRT [as 别名]
# 或者: from nansat.vrt.VRT import get_projection [as 别名]
    def test_get_projection_raises_NansatProjectionError(self, dataset):
        dataset.GetProjection.return_value = ''
        dataset.GetGCPProjection.return_value = ''
        dataset.GetMetadata.return_value = {}

        vrt = VRT()
        with self.assertRaises(NansatProjectionError):
            proj = vrt.get_projection()
开发者ID:nansencenter,项目名称:nansat,代码行数:10,代码来源:test_vrt.py

示例2: test_get_projection_geolocation

# 需要导入模块: from nansat.vrt import VRT [as 别名]
# 或者: from nansat.vrt.VRT import get_projection [as 别名]
    def test_get_projection_geolocation(self, dataset):
        proj = 'SOME_PROJECTION'
        dataset.GetProjection.return_value = ''
        dataset.GetGCPProjection.return_value = ''
        dataset.GetMetadata.return_value = {'SRS': proj}

        vrt = VRT()
        proj_src = vrt.get_projection()
        self.assertEqual(proj_src, (proj, 'geolocation'))
开发者ID:nansencenter,项目名称:nansat,代码行数:11,代码来源:test_vrt.py

示例3: test_get_projection_dataset

# 需要导入模块: from nansat.vrt import VRT [as 别名]
# 或者: from nansat.vrt.VRT import get_projection [as 别名]
    def test_get_projection_dataset(self, dataset):
        proj = 'SOME_PROJECTION'
        dataset.GetProjection.return_value = proj
        dataset.GetGCPProjection.return_value = ''
        dataset.GetMetadata.return_value = {}

        vrt = VRT()
        proj_src = vrt.get_projection()
        self.assertEqual(proj_src, (proj, 'dataset'))
开发者ID:nansencenter,项目名称:nansat,代码行数:11,代码来源:test_vrt.py

示例4: Domain

# 需要导入模块: from nansat.vrt import VRT [as 别名]
# 或者: from nansat.vrt.VRT import get_projection [as 别名]

#.........这里部分代码省略.........
             rasterXSize, rasterYSize] = self._get_geotransform(extentDic)
            # create VRT object with given geo-reference parameters
            self.vrt = VRT(srcGeoTransform=geoTransform,
                           srcProjection=srs.wkt,
                           srcRasterXSize=rasterXSize,
                           srcRasterYSize=rasterYSize)
            self.extentDic = extentDic
        elif lat is not None and lon is not None:
            # create self.vrt from given lat/lon
            self.vrt = VRT(lat=lat, lon=lon)
        else:
            raise OptionError('"dataset" or "srsString and extentString" '
                              'or "dataset and srsString" are required')

        self.logger.debug('vrt.dataset: %s' % str(self.vrt.dataset))

    def __repr__(self):
        '''Creates string with basic info about the Domain object

        Modifies
        ---------
        Print size, projection and corner coordinates

        '''
        outStr = 'Domain:[%d x %d]\n' % (self.vrt.dataset.RasterXSize,
                                         self.vrt.dataset.RasterYSize)
        outStr += '-' * 40 + '\n'
        try:
            corners = self.get_corners()
        except:
            self.logger.error('Cannot read projection from source!')
        else:
            outStr += 'Projection:\n'
            outStr += (NSR(self.vrt.get_projection()).ExportToPrettyWkt(1)
                       + '\n')
            outStr += '-' * 40 + '\n'
            outStr += 'Corners (lon, lat):\n'
            outStr += '\t (%6.2f, %6.2f)  (%6.2f, %6.2f)\n' % (corners[0][0],
                                                               corners[1][0],
                                                               corners[0][2],
                                                               corners[1][2])
            outStr += '\t (%6.2f, %6.2f)  (%6.2f, %6.2f)\n' % (corners[0][1],
                                                               corners[1][1],
                                                               corners[0][3],
                                                               corners[1][3])
        return outStr

    def write_kml(self, xmlFileName=None, kmlFileName=None):
        '''Write KML file with domains

        Convert XML-file with domains into KML-file for GoogleEarth
        or write KML-file with the current Domain

        Parameters
        -----------
        xmlFileName : string, optional
            Name of the XML-file to convert. If only this value is given
            - kmlFileName=xmlFileName+'.kml'

        kmlFileName : string, optional
            Name of the KML-file to generate from the current Domain

        '''
        # test input options
        if xmlFileName is not None and kmlFileName is None:
            # if only input XML-file is given - convert it to KML
开发者ID:WYC19910220,项目名称:nansat,代码行数:70,代码来源:domain.py


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