Python osgeo.gdal.VersionInfo() Examples

The following are code examples for showing how to use osgeo.gdal.VersionInfo(). They are from open source Python projects. You can vote up the examples you like or vote down the ones you don't like.

Example 1
Project: geobricks_qgis_plugin_trmm   Author: geobricks   File: environment.py    GNU General Public License v2.0 6 votes vote down vote up
def resampling(self, value):
        lut={ 'BILINEAR':gdal.GRA_Bilinear,
              'CUBIC':gdal.GRA_Cubic,
              'CUBICSPLINE':gdal.GRA_CubicSpline,
              'LANCZOS':gdal.GRA_Lanczos,
              'NEAREST':gdal.GRA_NearestNeighbour}

        if int(gdal.VersionInfo("VERSION_NUM"))>=1100000:
            lut['AVERAGE']=gdal.GRA_Average
            lut['MODE']=gdal.GRA_Mode
            
        try:
            value=value.upper()
            self._resampling=lut[value]
            return
        except:pass
        try:
            index=lut.values().index(value)
            self._resampling=value
            return
        except:pass
        raise AttributeError('%s not one of "AVERAGE"|"BILINEAR"|"CUBIC"|"CUBICSPLINE"|"LANCZOS"|"MODE"|"NEAREST"|gdal.GRA_*'%repr(value)) 
Example 2
Project: qgis-processing-r   Author: north-road   File: test_suite.py    GNU General Public License v3.0 5 votes vote down vote up
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())