當前位置: 首頁>>代碼示例>>Python>>正文


Python gdal.VersionInfo方法代碼示例

本文整理匯總了Python中osgeo.gdal.VersionInfo方法的典型用法代碼示例。如果您正苦於以下問題:Python gdal.VersionInfo方法的具體用法?Python gdal.VersionInfo怎麽用?Python gdal.VersionInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在osgeo.gdal的用法示例。


在下文中一共展示了gdal.VersionInfo方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_CAPPI

# 需要導入模塊: from osgeo import gdal [as 別名]
# 或者: from osgeo.gdal import VersionInfo [as 別名]
def test_CAPPI(self):
        gridder = vpr.CAPPI(
            self.xyz,
            self.trgxyz,
            self.trgshape,
            self.maxrange,
            self.minelev,
            self.maxelev,
        )
        out = gridder(self.data)
        assert out.shape == (6084,)
        # Todo: find out where this discrepancy comes from
        from osgeo import gdal

        if gdal.VersionInfo()[0] >= "3":
            size = 3528
        else:
            size = 3512
        assert len(np.where(np.isnan(out))[0]) == size 
開發者ID:wradlib,項目名稱:wradlib,代碼行數:21,代碼來源:test_vpr.py

示例2: __init__

# 需要導入模塊: from osgeo import gdal [as 別名]
# 或者: from osgeo.gdal import VersionInfo [as 別名]
def __init__(self, iface):
        QObject.__init__(self)
        QgsMessageLog.logMessage('GDAL Version: ' + str(gdal.VersionInfo('VERSION_NUM')), 'CartoDB Plugin', QgsMessageLog.INFO)

        # Save reference to the QGIS interface
        self.iface = iface

        # initialize locale
        locale = QSettings().value("locale/userLocale")[0:2]
        localePath = os.path.join(CartoDBPlugin.PLUGIN_DIR, "i18n", "{}.qm".format(locale))

        if os.path.exists(localePath):
            self.translator = QTranslator()
            self.translator.load(localePath)

            if qVersion() > '4.3.3':
                QCoreApplication.installTranslator(self.translator)

        # SQLite available?
        driverName = "SQLite"
        self.sqLiteDrv = ogr.GetDriverByName(driverName)
        if self.sqLiteDrv is None:
            QgsMessageLog.logMessage('SQLite driver not found', 'CartoDB Plugin', QgsMessageLog.CRITICAL)
        else:
            QgsMessageLog.logMessage('SQLite driver is found', 'CartoDB Plugin', QgsMessageLog.INFO)
            self.databasePath = CartoDBPlugin.PLUGIN_DIR + '/db/database.sqlite'
            shutil.copyfile(CartoDBPlugin.PLUGIN_DIR + '/db/init_database.sqlite', self.databasePath)
        self.layers = []
        self.countLoadingLayers = 0
        self.countLoadedLayers = 0

        self._cdbMenu = None
        self._mainAction = None
        self._loadDataAction = None
        self._createVizAction = None
        self._addSQLAction = None
        self.toolbar = CartoDBToolbar()
        self._toolbarAction = None
        self._menu = None 
開發者ID:gkudos,項目名稱:qgis-cartodb,代碼行數:41,代碼來源:CartoDBPlugin.py

示例3: _run_tests

# 需要導入模塊: from osgeo import gdal [as 別名]
# 或者: from osgeo.gdal import VersionInfo [as 別名]
def _run_tests(test_suite, package_name, with_coverage=False):
    """Core function to test a test suite."""
    count = test_suite.countTestCases()
    print('########')
    print('%s tests has been discovered in %s' % (count, package_name))
    print('Python GDAL : %s' % gdal.VersionInfo('VERSION_NUM'))
    print('QT : {}'.format(QT_VERSION_STR))
    print('########')
    if with_coverage:
        cov = coverage.Coverage(
            source=['/processing_r'],
            omit=['*/test/*'],
        )
        cov.start()

    unittest.TextTestRunner(verbosity=3, stream=sys.stdout).run(test_suite)

    if with_coverage:
        cov.stop()
        cov.save()
        report = tempfile.NamedTemporaryFile(delete=False)
        cov.report(file=report)
        # Produce HTML reports in the `htmlcov` folder and open index.html
        # cov.html_report()
        report.close()
        with open(report.name, 'r') as fin:
            print(fin.read()) 
開發者ID:ghtmtt,項目名稱:DataPlotly,代碼行數:29,代碼來源:test_suite.py

示例4: test_get_radar_projection

# 需要導入模塊: from osgeo import gdal [as 別名]
# 或者: from osgeo.gdal import VersionInfo [as 別名]
def test_get_radar_projection(self):
        sitecoords = [5, 52, 90]
        p0 = georef.get_radar_projection(sitecoords)
        if gdal.VersionInfo()[0] >= "3":
            assert p0.GetName() == "Unknown Azimuthal Equidistant"
        assert p0.IsProjected()
        assert p0.IsSameGeogCS(georef.get_default_projection())
        assert p0.GetNormProjParm("latitude_of_center") == sitecoords[1]
        assert p0.GetNormProjParm("longitude_of_center") == sitecoords[0] 
開發者ID:wradlib,項目名稱:wradlib,代碼行數:11,代碼來源:test_georef.py

示例5: transform_geometry

# 需要導入模塊: from osgeo import gdal [as 別名]
# 或者: from osgeo.gdal import VersionInfo [as 別名]
def transform_geometry(geom, dest_srs, **kwargs):
    """Perform geotransformation to given destination SpatialReferenceSystem

    It transforms coordinates to a given destination osr spatial reference
    if a geotransform is neccessary.

    Parameters
    ----------
    geom : ogr.geometry
    dest_srs : osr.SpatialReference
        Destination Projection

    Keyword Arguments
    -----------------
    source_srs : osr.SpatialReference
        Source Projection

    Returns
    -------
    geom : ogr.Geometry
        Transformed Geometry
    """
    gsrs = geom.GetSpatialReference()
    srs = kwargs.get("source_srs", gsrs)

    # srs is None assume wgs84 lonlat, but warn too
    if srs is None:
        srs = projection.get_default_projection()
        warnings.warn("geometry without spatial reference - assuming wgs84")

    # transform if not the same spatial reference system
    if not srs.IsSame(dest_srs):
        if gsrs is None:
            geom.AssignSpatialReference(srs)
            gsrs = geom.GetSpatialReference()
        if gdal.VersionInfo()[0] >= "3":
            dest_srs.SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER)
            gsrs.SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER)
        geom.TransformTo(dest_srs)

    return geom 
開發者ID:wradlib,項目名稱:wradlib,代碼行數:43,代碼來源:vector.py

示例6: proj4_to_osr

# 需要導入模塊: from osgeo import gdal [as 別名]
# 或者: from osgeo.gdal import VersionInfo [as 別名]
def proj4_to_osr(proj4str):
    """Transform a proj4 string to an osr spatial reference object

    Parameters
    ----------
    proj4str : string
        Proj4 string describing projection

    Examples
    --------

    See :ref:`/notebooks/radolan/radolan_grid.ipynb#PROJ.4`.

    """
    proj = osr.SpatialReference()
    proj.ImportFromProj4(proj4str)
    proj.AutoIdentifyEPSG()

    if LooseVersion(gdal.VersionInfo("RELEASE_NAME")) < LooseVersion("3"):
        proj.Fixup()
        proj.FixupOrdering()
    if proj.Validate() == ogr.OGRERR_CORRUPT_DATA:
        raise ValueError(
            "proj4str validates to 'ogr.OGRERR_CORRUPT_DATA'"
            "and can't be imported as OSR object"
        )
    return proj 
開發者ID:wradlib,項目名稱:wradlib,代碼行數:29,代碼來源:projection.py

示例7: _run_tests

# 需要導入模塊: from osgeo import gdal [as 別名]
# 或者: from osgeo.gdal import VersionInfo [as 別名]
def _run_tests(test_suite, package_name, with_coverage=False):
    """Core function to test a test suite."""
    count = test_suite.countTestCases()
    print('########')
    print('%s tests has been discovered in %s' % (count, package_name))
    print('Python GDAL : %s' % gdal.VersionInfo('VERSION_NUM'))
    print('QT : %s' % Qt.QT_VERSION)
    print('########')
    if with_coverage:
        cov = coverage.Coverage(
            source=['/processing_r'],
            omit=['*/test/*'],
        )
        cov.start()

    unittest.TextTestRunner(verbosity=3, stream=sys.stdout).run(test_suite)

    if with_coverage:
        cov.stop()
        cov.save()
        report = tempfile.NamedTemporaryFile(delete=False)
        cov.report(file=report)
        # Produce HTML reports in the `htmlcov` folder and open index.html
        # cov.html_report()
        report.close()
        with open(report.name, 'r') as fin:
            print(fin.read()) 
開發者ID:north-road,項目名稱:qgis-processing-r,代碼行數:29,代碼來源:test_suite.py


注:本文中的osgeo.gdal.VersionInfo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。