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


Python test_cli_utilities.get_gdalwarp_path函数代码示例

本文整理汇总了Python中test_cli_utilities.get_gdalwarp_path函数的典型用法代码示例。如果您正苦于以下问题:Python get_gdalwarp_path函数的具体用法?Python get_gdalwarp_path怎么用?Python get_gdalwarp_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: test_gdalwarp_37

def test_gdalwarp_37():
    if test_cli_utilities.get_gdalwarp_path() is None:
        return 'skip'

    gdaltest.runexternal(test_cli_utilities.get_gdalwarp_path() + ' -tr 60 60 ./data/utmsmall.tif tmp/testgdalwarp37.tif')

    ds = gdal.Open('tmp/testgdalwarp37.tif')
    if ds is None:
        return 'fail'

    md = ds.GetRasterBand(1).GetMetadata()

    # basic metadata test
    if 'testkey' not in md or md['testkey'] != 'test value':
        gdaltest.post_reason('Output file metadata is wrong : { %s }' % md)
        return 'fail'

    # make sure stats not copied
    if 'STATISTICS_MEAN' in md :
        gdaltest.post_reason('Output file contains statistics metadata')
        return 'fail'

    min = ds.GetRasterBand(1).GetMinimum()
    if min is not None:
        gdaltest.post_reason('Output file has statistics')
        return 'fail'

    ds = None

    return 'success'
开发者ID:samalone,项目名称:gdal-ios,代码行数:30,代码来源:test_gdalwarp.py

示例2: test_gdalwarp_33

def test_gdalwarp_33():
    if test_cli_utilities.get_gdalwarp_path() is None:
        pytest.skip()
    if test_cli_utilities.get_gdal_translate_path() is None:
        pytest.skip()

    gdaltest.runexternal(test_cli_utilities.get_gdalwarp_path() + ' -dstalpha ../gcore/data/ycbcr_with_mask.tif tmp/testgdalwarp33.tif')

    src_ds = gdal.Open('../gcore/data/ycbcr_with_mask.tif')
    ds = gdal.Open('tmp/testgdalwarp33.tif')
    assert ds is not None

    # There are expected diffs because of the artifacts due to JPEG compression in 8x8 blocks
    # that are partially masked. gdalwarp will remove those artifacts
    max_diff = gdaltest.compare_ds(src_ds, ds)
    assert max_diff <= 40

    src_ds = None

    gdaltest.runexternal(test_cli_utilities.get_gdal_translate_path() + ' -expand gray GTIFF_DIR:2:../gcore/data/ycbcr_with_mask.tif tmp/testgdalwarp33_mask.tif')

    mask_ds = gdal.Open('tmp/testgdalwarp33_mask.tif')
    expected_cs = mask_ds.GetRasterBand(1).Checksum()
    mask_ds = None

    cs = ds.GetRasterBand(4).Checksum()

    ds = None

    assert cs == expected_cs, 'did not get expected checksum on alpha band'
开发者ID:AsgerPetersen,项目名称:gdal,代码行数:30,代码来源:test_gdalwarp.py

示例3: test_gdalwarp_34

def test_gdalwarp_34():
    if test_cli_utilities.get_gdalwarp_path() is None:
        pytest.skip()
    if test_cli_utilities.get_gdal_translate_path() is None:
        pytest.skip()

    try:
        os.remove('tmp/testgdalwarp34.tif')
    except OSError:
        pass

    gdaltest.runexternal(test_cli_utilities.get_gdal_translate_path() + ' ../gcore/data/byte.tif tmp/testgdalwarp34src_1.tif -srcwin 0 0 10 20')
    gdaltest.runexternal(test_cli_utilities.get_gdal_translate_path() + ' ../gcore/data/byte.tif tmp/testgdalwarp34src_2.tif -srcwin 10 0 10 20')
    gdaltest.runexternal(test_cli_utilities.get_gdalwarp_path() + ' tmp/testgdalwarp34src_1.tif tmp/testgdalwarp34src_2.tif tmp/testgdalwarp34.tif')
    os.remove('tmp/testgdalwarp34src_1.tif')
    os.remove('tmp/testgdalwarp34src_2.tif')

    ds = gdal.Open('tmp/testgdalwarp34.tif')
    cs = ds.GetRasterBand(1).Checksum()
    gt = ds.GetGeoTransform()
    xsize = ds.RasterXSize
    ysize = ds.RasterYSize
    ds = None

    os.remove('tmp/testgdalwarp34.tif')

    assert xsize == 20 and ysize == 20, 'bad dimensions'

    assert cs == 4672, 'bad checksum'

    expected_gt = (440720.0, 60.0, 0.0, 3751320.0, 0.0, -60.0)
    for i in range(6):
        assert abs(gt[i] - expected_gt[i]) <= 1e-5, 'bad gt'
开发者ID:AsgerPetersen,项目名称:gdal,代码行数:33,代码来源:test_gdalwarp.py

示例4: test_gdalwarp_25

def test_gdalwarp_25():
    if test_cli_utilities.get_gdalwarp_path() is None:
        return 'skip'

    gdaltest.runexternal(test_cli_utilities.get_gdalwarp_path() + ' -t_srs "+proj=sinu" data/w_jpeg.tiff tmp/testgdalwarp25.tif')

    ds = gdal.Open('tmp/testgdalwarp25.tif')
    if ds is None:
        return 'fail'

    cs = ds.GetRasterBand(1).Checksum()
    if cs != 8016 and cs != 6157:
        print(cs)
        gdaltest.post_reason('Bad checksum')
        return 'fail'
        
    gt = ds.GetGeoTransform()
    expected_gt = [-20037508.342789248, 78245.302611923355, 0.0, 10001965.729313632, 0.0, -77939.656898595524]
    for i in range(6):
        if abs(gt[i] - expected_gt[i]) > 1:
            print(gt)
            gdaltest.post_reason('Bad gt')
            return 'fail'

    ds = None

    return 'success'
开发者ID:samalone,项目名称:gdal-ios,代码行数:27,代码来源:test_gdalwarp.py

示例5: test_gdalwarp_5

def test_gdalwarp_5():
    if test_cli_utilities.get_gdalwarp_path() is None:
        return 'skip'

    if test_cli_utilities.get_gdal_translate_path() is None:
        return 'skip'

    gdaltest.runexternal(test_cli_utilities.get_gdal_translate_path() + ' -a_srs EPSG:26711 -gcp 0 0  440720.000 3751320.000 -gcp 20 0 441920.000 3751320.000 -gcp 20 20 441920.000 3750120.000 0 -gcp 0 20 440720.000 3750120.000 ../gcore/data/byte.tif tmp/testgdalwarp_gcp.tif')
    
    gdaltest.runexternal(test_cli_utilities.get_gdalwarp_path() + ' tmp/testgdalwarp_gcp.tif tmp/testgdalwarp5.tif')

    ds = gdal.Open('tmp/testgdalwarp5.tif')
    if ds is None:
        return 'fail'

    if ds.GetRasterBand(1).Checksum() != 4672:
        gdaltest.post_reason('Bad checksum')
        return 'fail'

    if not gdaltest.geotransform_equals(gdal.Open('../gcore/data/byte.tif').GetGeoTransform(), ds.GetGeoTransform(), 1e-9) :
        gdaltest.post_reason('Bad geotransform')
        return 'fail'

    ds = None

    return 'success'
开发者ID:samalone,项目名称:gdal-ios,代码行数:26,代码来源:test_gdalwarp.py

示例6: test_gdalwarp_27

def test_gdalwarp_27():
    if test_cli_utilities.get_gdalwarp_path() is None:
        return 'skip'

    gdaltest.runexternal(test_cli_utilities.get_gdalwarp_path() + ' -t_srs "+proj=vandg" data/w_jpeg.tiff tmp/testgdalwarp27.tif')

    ds = gdal.Open('tmp/testgdalwarp27.tif')
    if ds is None:
        return 'fail'

    cs = ds.GetRasterBand(1).Checksum()
    if cs != 22006 and cs != 22615:
        print(cs)
        gdaltest.post_reason('Bad checksum')
        return 'fail'
        
    gt = ds.GetGeoTransform()
    expected_gt = [-20015109.356056381, 98651.645855415176, 0.0, 20015109.356056374, 0.0, -98651.645855415176]
    for i in range(6):
        if abs(gt[i] - expected_gt[i]) > 1:
            print(gt)
            gdaltest.post_reason('Bad gt')
            return 'fail'

    ds = None

    return 'success'
开发者ID:samalone,项目名称:gdal-ios,代码行数:27,代码来源:test_gdalwarp.py

示例7: test_gdalwarp_26

def test_gdalwarp_26():
    if test_cli_utilities.get_gdalwarp_path() is None:
        return 'skip'

    gdaltest.runexternal(test_cli_utilities.get_gdalwarp_path() + ' -t_srs "+proj=eck4" data/w_jpeg.tiff tmp/testgdalwarp26.tif')

    ds = gdal.Open('tmp/testgdalwarp26.tif')
    if ds is None:
        return 'fail'

    cs = ds.GetRasterBand(1).Checksum()
    if cs != 8582 and cs != 3938:
        print(cs)
        gdaltest.post_reason('Bad checksum')
        return 'fail'
        
    gt = ds.GetGeoTransform()
    expected_gt = [-16921202.922943164, 41752.719393322564, 0.0, 8460601.4614715818, 0.0, -41701.109109770863]
    for i in range(6):
        if abs(gt[i] - expected_gt[i]) > 1:
            print(gt)
            gdaltest.post_reason('Bad gt')
            return 'fail'

    ds = None

    return 'success'
开发者ID:samalone,项目名称:gdal-ios,代码行数:27,代码来源:test_gdalwarp.py

示例8: test_gdalwarp_29

def test_gdalwarp_29():
    if test_cli_utilities.get_gdalwarp_path() is None:
        return 'skip'

    gdaltest.runexternal(test_cli_utilities.get_gdalwarp_path() + ' -t_srs EPSG:3785 data/w_jpeg.tiff tmp/testgdalwarp29.tif')

    ds = gdal.Open('tmp/testgdalwarp29.tif')
    if ds is None:
        return 'fail'

    cs = ds.GetRasterBand(1).Checksum()
    if cs != 55149 and cs != 56054:
        print(cs)
        gdaltest.post_reason('Bad checksum')
        return 'fail'
        
    gt = ds.GetGeoTransform()
    expected_gt = [ -20037508.342789248, 90054.726863985939, 0.0, 16213801.067583967, 0.0, -90056.750611190684 ]
    for i in range(6):
        if abs(gt[i] - expected_gt[i]) > 1:
            print(gt)
            gdaltest.post_reason('Bad gt')
            return 'fail'

    ds = None

    return 'success'
开发者ID:samalone,项目名称:gdal-ios,代码行数:27,代码来源:test_gdalwarp.py

示例9: test_gdalwarp_28

def test_gdalwarp_28():
    if test_cli_utilities.get_gdalwarp_path() is None:
        return 'skip'

    gdaltest.runexternal(test_cli_utilities.get_gdalwarp_path() + ' -t_srs "+proj=aeqd +lat_0=45 +lon_0=90" data/w_jpeg.tiff tmp/testgdalwarp28.tif')

    ds = gdal.Open('tmp/testgdalwarp28.tif')
    if ds is None:
        return 'fail'

    # First is GCC; Second is MSVC 6.0. Thid is jpeg8
    cs = ds.GetRasterBand(1).Checksum()
    if cs != 47506 and cs != 46728 and cs != 43789:
        print(cs)
        gdaltest.post_reason('Bad checksum')
        return 'fail'
        
    gt = ds.GetGeoTransform()
    # First is GCC; Second is MSVC 6.0
    expected_gt1 = [-10009026.853177125, 43693.733128680084, 0.0, 5024463.6669970695, 0.0, -43693.733128680084]
    expected_gt2 = [-10009026.853177125, 43691.280523668691, 0.0, 5022121.8610583926, 0.0, -43691.280523668691]
    for i in range(6):
        if abs(gt[i] - expected_gt1[i]) > 1 and abs(gt[i] - expected_gt2[i]) > 1:
            print(gt)
            gdaltest.post_reason('Bad gt')
            return 'fail'

    ds = None

    return 'success'
开发者ID:samalone,项目名称:gdal-ios,代码行数:30,代码来源:test_gdalwarp.py

示例10: test_gdalwarp_31

def test_gdalwarp_31():
    if test_cli_utilities.get_gdalwarp_path() is None:
        return 'skip'

    gdaltest.runexternal(test_cli_utilities.get_gdalwarp_path() + " ../gcore/data/byte.tif tmp/testgdalwarp31.tif")

    ds = gdal.Open('tmp/testgdalwarp31.tif')
    cs1 = ds.GetRasterBand(1).Checksum()
    ds = None

    (out, err) = gdaltest.runexternal_out_and_err(test_cli_utilities.get_gdalwarp_path() + " ../gcore/data/byte.tif tmp/testgdalwarp31.tif -t_srs EPSG:4326")

    ds = gdal.Open('tmp/testgdalwarp31.tif')
    cs2 = ds.GetRasterBand(1).Checksum()
    ds = None

    (out, err2) = gdaltest.runexternal_out_and_err(test_cli_utilities.get_gdalwarp_path() + " ../gcore/data/byte.tif tmp/testgdalwarp31.tif -t_srs EPSG:4326 -overwrite")

    ds = gdal.Open('tmp/testgdalwarp31.tif')
    cs3 = ds.GetRasterBand(1).Checksum()
    ds = None

    if cs1 != 4672 or cs2 != 4672 or cs3 != 4727 or err == '' or err2 != '':
        print(cs1,cs2,cs3)
        print(err)
        print(err2)
        return 'fail'

    return 'success'
开发者ID:samalone,项目名称:gdal-ios,代码行数:29,代码来源:test_gdalwarp.py

示例11: test_gdalwarp_32

def test_gdalwarp_32():
    if test_cli_utilities.get_gdalwarp_path() is None:
        return 'skip'

    (out, err) = gdaltest.runexternal_out_and_err(test_cli_utilities.get_gdalwarp_path() + ' -tap ../gcore/data/byte.tif tmp/testgdalwarp32.tif',
                                                  check_memleak = False)
    if err.find('-tap option cannot be used without using -tr') == -1:
        gdaltest.post_reason('expected error')
        return 'fail'

    gdaltest.runexternal(test_cli_utilities.get_gdalwarp_path() + ' -tr 100 50 -tap ../gcore/data/byte.tif tmp/testgdalwarp32.tif')

    ds = gdal.Open('tmp/testgdalwarp32.tif')
    if ds is None:
        return 'fail'

    expected_gt = (440700.0, 100.0, 0.0, 3751350.0, 0.0, -50.0)
    got_gt = ds.GetGeoTransform()
    if not gdaltest.geotransform_equals(expected_gt, got_gt, 1e-9) :
        gdaltest.post_reason('Bad geotransform')
        print(got_gt)
        return 'fail'

    if ds.RasterXSize != 13 or ds.RasterYSize != 25:
        gdaltest.post_reason('Wrong raster dimensions : %d x %d' % (ds.RasterXSize, ds.RasterYSize) )
        return 'fail'

    ds = None

    return 'success'
开发者ID:samalone,项目名称:gdal-ios,代码行数:30,代码来源:test_gdalwarp.py

示例12: vrtwarp_11

def vrtwarp_11():
    
    if test_cli_utilities.get_gdalwarp_path() is None:
        return 'skip'

    src_ds = gdal.Open('../gcore/data/byte.tif')
    tmp_ds = gdal.GetDriverByName('GTiff').CreateCopy('tmp/vrtwarp_11.tif', src_ds)
    tmp_ds.BuildOverviews( 'NEAR', overviewlist = [2] )
    tmp_ds = None

    gdaltest.runexternal(test_cli_utilities.get_gdalwarp_path() + ' tmp/vrtwarp_11.tif tmp/vrtwarp_11.vrt -dstalpha -of VRT')
    ds = gdal.Open('tmp/vrtwarp_11.vrt')
    cs1 = ds.GetRasterBand(1).GetOverview(0).Checksum()
    cs2 = ds.GetRasterBand(2).GetOverview(0).Checksum()
    ds = None

    gdal.Unlink('tmp/vrtwarp_11.tif')
    gdal.Unlink('tmp/vrtwarp_11.vrt')
    
    if cs1 != 1087 or cs2 != 1218:
        gdaltest.post_reason('fail')
        print(cs1)
        print(cs2)
        return 'fail'

    return 'success'
开发者ID:garnertb,项目名称:gdal,代码行数:26,代码来源:vrtwarp.py

示例13: test_gdalwarp_46

def test_gdalwarp_46():
    if test_cli_utilities.get_gdalwarp_path() is None:
        pytest.skip()
    if test_cli_utilities.get_ogr2ogr_path() is None:
        pytest.skip()

    gdaltest.runexternal(test_cli_utilities.get_gdalwarp_path() + ' ../gcore/data/utmsmall.tif tmp/test_gdalwarp_46.tif -cutline data/cutline.vrt -crop_to_cutline -overwrite')

    ds = gdal.Open('tmp/test_gdalwarp_46.tif')
    assert ds is not None

    assert ds.GetRasterBand(1).Checksum() == 18837, 'Bad checksum'

    ds = None

    # With explicit -s_srs and -t_srs
    gdaltest.runexternal(test_cli_utilities.get_gdalwarp_path() + ' ../gcore/data/utmsmall.tif tmp/test_gdalwarp_46.tif -cutline data/cutline.vrt -crop_to_cutline -overwrite -s_srs EPSG:26711 -t_srs EPSG:26711')

    ds = gdal.Open('tmp/test_gdalwarp_46.tif')
    assert ds is not None

    assert ds.GetRasterBand(1).Checksum() == 18837, 'Bad checksum'

    ds = None

    # With cutline in another SRS
    gdaltest.runexternal(test_cli_utilities.get_ogr2ogr_path() + ' tmp/cutline_4326.shp data/cutline.vrt -s_srs EPSG:26711 -t_srs EPSG:4326')
    gdaltest.runexternal(test_cli_utilities.get_gdalwarp_path() + ' ../gcore/data/utmsmall.tif tmp/test_gdalwarp_46.tif -cutline tmp/cutline_4326.shp -crop_to_cutline -overwrite -t_srs EPSG:32711')

    ds = gdal.Open('tmp/test_gdalwarp_46.tif')
    assert ds is not None

    assert ds.GetRasterBand(1).Checksum() == 19582, 'Bad checksum'

    ds = None
开发者ID:AsgerPetersen,项目名称:gdal,代码行数:35,代码来源:test_gdalwarp.py

示例14: test_gdalwarp_44

def test_gdalwarp_44():
    if test_cli_utilities.get_gdalwarp_path() is None:
        pytest.skip()

    # Without  -wo SRC_COORD_PRECISION
    gdaltest.runexternal(test_cli_utilities.get_gdalwarp_path() + ' -q ../gcore/data/byte.tif tmp/test_gdalwarp_44.tif -wm 10 -overwrite -ts 500 500 -r cubic -ot float32 -t_srs EPSG:4326')
    ds = gdal.Open('tmp/test_gdalwarp_44.tif')
    cs1 = ds.GetRasterBand(1).Checksum()
    ds = None

    gdaltest.runexternal(test_cli_utilities.get_gdalwarp_path() + ' -q ../gcore/data/byte.tif tmp/test_gdalwarp_44.tif -wm 0.1 -overwrite -ts 500 500 -r cubic -ot float32 -t_srs EPSG:4326')
    ds = gdal.Open('tmp/test_gdalwarp_44.tif')
    cs2 = ds.GetRasterBand(1).Checksum()
    ds = None

    if cs1 == cs2:
        print('Unexpected cs1 == cs2')

    # With  -wo SRC_COORD_PRECISION
    gdaltest.runexternal(test_cli_utilities.get_gdalwarp_path() + ' -q ../gcore/data/byte.tif tmp/test_gdalwarp_44.tif -wm 10 -et 0.01 -wo SRC_COORD_PRECISION=0.1 -overwrite -ts 500 500 -r cubic -ot float32 -t_srs EPSG:4326')
    ds = gdal.Open('tmp/test_gdalwarp_44.tif')
    cs3 = ds.GetRasterBand(1).Checksum()
    ds = None

    gdaltest.runexternal(test_cli_utilities.get_gdalwarp_path() + ' -q ../gcore/data/byte.tif tmp/test_gdalwarp_44.tif -wm 0.1 -et 0.01 -wo SRC_COORD_PRECISION=0.1 -overwrite -ts 500 500 -r cubic -ot float32 -t_srs EPSG:4326')
    ds = gdal.Open('tmp/test_gdalwarp_44.tif')
    cs4 = ds.GetRasterBand(1).Checksum()
    ds = None

    assert cs3 == cs4
开发者ID:AsgerPetersen,项目名称:gdal,代码行数:30,代码来源:test_gdalwarp.py

示例15: test_gdalwarp_39

def test_gdalwarp_39():
    if test_cli_utilities.get_gdalwarp_path() is None:
        pytest.skip()

    gdaltest.runexternal(test_cli_utilities.get_gdalwarp_path() + ' ../gdrivers/data/float64.asc tmp/test_gdalwarp_39.tif -oo DATATYPE=Float64 -overwrite')

    ds = gdal.Open('tmp/test_gdalwarp_39.tif')
    assert ds.GetRasterBand(1).DataType == gdal.GDT_Float64
    ds = None
开发者ID:AsgerPetersen,项目名称:gdal,代码行数:9,代码来源:test_gdalwarp.py


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