本文整理汇总了Python中test_cli_utilities.get_gdalinfo_path函数的典型用法代码示例。如果您正苦于以下问题:Python get_gdalinfo_path函数的具体用法?Python get_gdalinfo_path怎么用?Python get_gdalinfo_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_gdalinfo_path函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_gdalinfo_35
def test_gdalinfo_35():
if test_cli_utilities.get_gdalinfo_path() is None:
return 'skip'
try:
os.remove('../gcore/data/byte.tif.aux.xml')
except:
pass
ret = gdaltest.runexternal(test_cli_utilities.get_gdalinfo_path() + ' -json ../gcore/data/byte.tif')
ret = json.loads(ret)
if 'histogram' in ret['bands'][0]:
gdaltest.post_reason( 'did not expect histogram.' )
print(ret)
return 'fail'
ret = gdaltest.runexternal(test_cli_utilities.get_gdalinfo_path() + ' -json -hist ../gcore/data/byte.tif')
ret = json.loads(ret)
if ret['bands'][0]['histogram']['buckets'] != [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 37, 0, 0, 0, 0, 0, 0, 0, 57, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 0, 0, 0, 0, 66, 0, 0, 0, 0, 0, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1 ]:
gdaltest.post_reason( 'did not get expected histogram.' )
print(ret)
return 'fail'
# We will blow an exception if the file does not exist now!
os.remove('../gcore/data/byte.tif.aux.xml')
return 'success'
示例2: test_gdalinfo_5
def test_gdalinfo_5():
if test_cli_utilities.get_gdalinfo_path() is None:
return "skip"
try:
os.remove("../gcore/data/byte.tif.aux.xml")
except:
pass
ret = gdaltest.runexternal(test_cli_utilities.get_gdalinfo_path() + " ../gcore/data/byte.tif")
if ret.find("STATISTICS_MINIMUM=74") != -1:
gdaltest.post_reason("got wrong minimum.")
print(ret)
return "fail"
ret = gdaltest.runexternal(test_cli_utilities.get_gdalinfo_path() + " -stats ../gcore/data/byte.tif")
if ret.find("STATISTICS_MINIMUM=74") == -1:
gdaltest.post_reason("got wrong minimum (2).")
print(ret)
return "fail"
# We will blow an exception if the file does not exist now!
os.remove("../gcore/data/byte.tif.aux.xml")
return "success"
示例3: test_gdalinfo_22
def test_gdalinfo_22():
if test_cli_utilities.get_gdalinfo_path() is None:
return "skip"
ret = gdaltest.runexternal(test_cli_utilities.get_gdalinfo_path() + " --format GTiff", check_memleak=False)
expected_strings = [
"Short Name:",
"Long Name:",
"Extensions:",
"Mime Type:",
"Help Topic:",
"Supports: Create()",
"Supports: CreateCopy()",
"Supports: Virtual IO",
"Creation Datatypes",
"<CreationOptionList>",
]
for expected_string in expected_strings:
if ret.find(expected_string) < 0:
gdaltest.post_reason("did not find %s" % expected_string)
print(ret)
return "fail"
return "success"
示例4: test_gdalinfo_8
def test_gdalinfo_8():
if test_cli_utilities.get_gdalinfo_path() is None:
return "skip"
try:
os.remove("../gcore/data/byte.tif.aux.xml")
except:
pass
ret = gdaltest.runexternal(test_cli_utilities.get_gdalinfo_path() + " ../gcore/data/byte.tif")
if (
ret.find(
"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 0 37 0 0 0 0 0 0 0 57 0 0 0 0 0 0 0 62 0 0 0 0 0 0 0 66 0 0 0 0 0 0 0 0 72 0 0 0 0 0 0 0 31 0 0 0 0 0 0 0 24 0 0 0 0 0 0 0 12 0 0 0 0 0 0 0 0 7 0 0 0 0 0 0 0 12 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1"
)
!= -1
):
gdaltest.post_reason("did not expect histogram.")
print(ret)
return "fail"
ret = gdaltest.runexternal(test_cli_utilities.get_gdalinfo_path() + " -hist ../gcore/data/byte.tif")
if (
ret.find(
"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 0 37 0 0 0 0 0 0 0 57 0 0 0 0 0 0 0 62 0 0 0 0 0 0 0 66 0 0 0 0 0 0 0 0 72 0 0 0 0 0 0 0 31 0 0 0 0 0 0 0 24 0 0 0 0 0 0 0 12 0 0 0 0 0 0 0 0 7 0 0 0 0 0 0 0 12 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1"
)
== -1
):
gdaltest.post_reason("did not get expected histogram.")
print(ret)
return "fail"
# We will blow an exception if the file does not exist now!
os.remove("../gcore/data/byte.tif.aux.xml")
return "success"
示例5: test_gdalinfo_32
def test_gdalinfo_32():
if test_cli_utilities.get_gdalinfo_path() is None:
return "skip"
try:
os.remove("../gcore/data/byte.tif.aux.xml")
except:
pass
ret = gdaltest.runexternal(test_cli_utilities.get_gdalinfo_path() + " -json ../gcore/data/byte.tif")
ret = json.loads(ret)
if "" in ret["bands"][0]["metadata"]:
gdaltest.post_reason("got wrong minimum.")
print(ret)
return "fail"
ret = gdaltest.runexternal(test_cli_utilities.get_gdalinfo_path() + " -json -stats ../gcore/data/byte.tif")
ret = json.loads(ret)
if ret["bands"][0]["metadata"][""]["STATISTICS_MINIMUM"] != "74":
gdaltest.post_reason("got wrong minimum (2).")
print(ret)
return "fail"
# We will blow an exception if the file does not exist now!
os.remove("../gcore/data/byte.tif.aux.xml")
return "success"
示例6: test_gdalinfo_5
def test_gdalinfo_5():
if test_cli_utilities.get_gdalinfo_path() is None:
return 'skip'
try:
os.remove('../gcore/data/byte.tif.aux.xml')
except:
pass
ret = gdaltest.runexternal(test_cli_utilities.get_gdalinfo_path() + ' ../gcore/data/byte.tif')
if ret.find('STATISTICS_MINIMUM=74') != -1:
gdaltest.post_reason( 'got wrong minimum.' )
print(ret)
return 'fail'
ret = gdaltest.runexternal(test_cli_utilities.get_gdalinfo_path() + ' -stats ../gcore/data/byte.tif')
if ret.find('STATISTICS_MINIMUM=74') == -1:
gdaltest.post_reason( 'got wrong minimum (2).' )
print(ret)
return 'fail'
# We will blow an exception if the file does not exist now!
os.remove('../gcore/data/byte.tif.aux.xml')
return 'success'
示例7: test_gdalinfo_8
def test_gdalinfo_8():
if test_cli_utilities.get_gdalinfo_path() is None:
return 'skip'
try:
os.remove('../gcore/data/byte.tif.aux.xml')
except:
pass
ret = gdaltest.runexternal(test_cli_utilities.get_gdalinfo_path() + ' ../gcore/data/byte.tif')
if ret.find('0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 0 37 0 0 0 0 0 0 0 57 0 0 0 0 0 0 0 62 0 0 0 0 0 0 0 66 0 0 0 0 0 0 0 0 72 0 0 0 0 0 0 0 31 0 0 0 0 0 0 0 24 0 0 0 0 0 0 0 12 0 0 0 0 0 0 0 0 7 0 0 0 0 0 0 0 12 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1') != -1:
gdaltest.post_reason( 'did not expect histogram.' )
print(ret)
return 'fail'
ret = gdaltest.runexternal(test_cli_utilities.get_gdalinfo_path() + ' -hist ../gcore/data/byte.tif')
if ret.find('0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 0 0 0 0 0 0 0 0 37 0 0 0 0 0 0 0 57 0 0 0 0 0 0 0 62 0 0 0 0 0 0 0 66 0 0 0 0 0 0 0 0 72 0 0 0 0 0 0 0 31 0 0 0 0 0 0 0 24 0 0 0 0 0 0 0 12 0 0 0 0 0 0 0 0 7 0 0 0 0 0 0 0 12 0 0 0 0 0 0 0 5 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1') == -1:
gdaltest.post_reason( 'did not get expected histogram.' )
print(ret)
return 'fail'
# We will blow an exception if the file does not exist now!
os.remove('../gcore/data/byte.tif.aux.xml')
return 'success'
示例8: test_gdalinfo_32
def test_gdalinfo_32():
if test_cli_utilities.get_gdalinfo_path() is None:
return 'skip'
try:
os.remove('../gcore/data/byte.tif.aux.xml')
except:
pass
ret = gdaltest.runexternal(test_cli_utilities.get_gdalinfo_path() + ' -json ../gcore/data/byte.tif')
ret = json.loads(ret)
if '' in ret['bands'][0]['metadata']:
gdaltest.post_reason( 'got wrong minimum.' )
print(ret)
return 'fail'
ret = gdaltest.runexternal(test_cli_utilities.get_gdalinfo_path() + ' -json -stats ../gcore/data/byte.tif')
ret = json.loads(ret)
if ret['bands'][0]['metadata']['']['STATISTICS_MINIMUM'] != '74':
gdaltest.post_reason( 'got wrong minimum (2).' )
print(ret)
return 'fail'
# We will blow an exception if the file does not exist now!
os.remove('../gcore/data/byte.tif.aux.xml')
return 'success'
示例9: jpeg2000_8
def jpeg2000_8():
if gdaltest.jpeg2000_drv is None:
return 'skip'
# This test will cause a crash with an unpatched version of Jasper, such as the one of Ubuntu 8.04 LTS
# --> "jpc_dec.c:1072: jpc_dec_tiledecode: Assertion `dec->numcomps == 3' failed."
# Recent Debian/Ubuntu have the appropriate patch.
# So we try to run in a subprocess first
import test_cli_utilities
if test_cli_utilities.get_gdalinfo_path() is not None:
ret = gdaltest.runexternal(test_cli_utilities.get_gdalinfo_path() + ' --config GDAL_SKIP "JP2ECW JP2MRSID JP2KAK" data/3_13bit_and_1bit.jp2')
if ret.find('Band 1') == -1:
gdaltest.post_reason('Jasper library would need patches')
return 'fail'
ds = gdal.Open('data/3_13bit_and_1bit.jp2')
expected_checksums = [ 64570, 57277, 56048, 61292]
for i in range(4):
if ds.GetRasterBand(i+1).Checksum() != expected_checksums[i]:
gdaltest.post_reason('unexpected checksum (%d) for band %d' % (expected_checksums[i], i+1))
return 'fail'
if ds.GetRasterBand(1).DataType != gdal.GDT_UInt16:
gdaltest.post_reason('unexpected data type')
return 'fail'
return 'success'
示例10: test_gdal_translate_27
def test_gdal_translate_27():
if test_cli_utilities.get_gdal_translate_path() is None:
return "skip"
if test_cli_utilities.get_gdalinfo_path() is None:
return "skip"
f = open("tmp/test_gdal_translate_27.asc", "wb")
f.write(
"""ncols 2
nrows 2
xllcorner 440720.000000000000
yllcorner 3750120.000000000000
cellsize 60.000000000000
0 256
0 0""".encode(
"ascii"
)
)
f.close()
gdaltest.runexternal(test_cli_utilities.get_gdalinfo_path() + " -stats tmp/test_gdal_translate_27.asc")
# Translate to an output type that accepts 256 as maximum
gdaltest.runexternal(
test_cli_utilities.get_gdal_translate_path()
+ " tmp/test_gdal_translate_27.asc tmp/test_gdal_translate_27.tif -ot UInt16"
)
ds = gdal.Open("tmp/test_gdal_translate_27.tif")
if ds.GetRasterBand(1).GetMetadataItem("STATISTICS_MINIMUM") is None:
gdaltest.post_reason("failure")
return "fail"
ds = None
# Translate to an output type that accepts 256 as maximum
gdaltest.runexternal(
test_cli_utilities.get_gdal_translate_path()
+ " tmp/test_gdal_translate_27.asc tmp/test_gdal_translate_27.tif -ot Float64"
)
ds = gdal.Open("tmp/test_gdal_translate_27.tif")
if ds.GetRasterBand(1).GetMetadataItem("STATISTICS_MINIMUM") is None:
gdaltest.post_reason("failure")
return "fail"
ds = None
# Translate to an output type that doesn't accept 256 as maximum
gdaltest.runexternal(
test_cli_utilities.get_gdal_translate_path()
+ " tmp/test_gdal_translate_27.asc tmp/test_gdal_translate_27.tif -ot Byte"
)
ds = gdal.Open("tmp/test_gdal_translate_27.tif")
if ds.GetRasterBand(1).GetMetadataItem("STATISTICS_MINIMUM") is not None:
gdaltest.post_reason("failure")
return "fail"
ds = None
return "success"
示例11: test_gdalinfo_2
def test_gdalinfo_2():
if test_cli_utilities.get_gdalinfo_path() is None:
return 'skip'
ret = gdaltest.runexternal(test_cli_utilities.get_gdalinfo_path() + ' -checksum ../gcore/data/byte.tif')
if ret.find('Checksum=4672') == -1:
return 'fail'
return 'success'
示例12: test_gdalinfo_1
def test_gdalinfo_1():
if test_cli_utilities.get_gdalinfo_path() is None:
return 'skip'
ret = gdaltest.runexternal(test_cli_utilities.get_gdalinfo_path() + ' ../gcore/data/byte.tif')
if ret.find('Driver: GTiff/GeoTIFF') == -1:
return 'fail'
return 'success'
示例13: vrt_read_20
def vrt_read_20():
if test_cli_utilities.get_gdalinfo_path() is None:
return 'skip'
shutil.copy('data/byte.tif', 'tmp')
for i in range(3):
open('tmp/byte1_%d.vrt' % (i+1), 'wt').write("""<VRTDataset rasterXSize="20" rasterYSize="20">
<VRTRasterBand dataType="Byte" band="1">
<SimpleSource>
<SourceFilename relativeToVRT="1">byte.tif</SourceFilename>
<SourceBand>1</SourceBand>
<SourceProperties RasterXSize="20" RasterYSize="20" DataType="Byte" BlockXSize="20" BlockYSize="20" />
<SrcRect xOff="0" yOff="0" xSize="20" ySize="20" />
<DstRect xOff="0" yOff="0" xSize="20" ySize="20" />
</SimpleSource>
</VRTRasterBand>
</VRTDataset>""")
open('tmp/byte2.vrt', 'wt').write("""<VRTDataset rasterXSize="20" rasterYSize="20">
<VRTRasterBand dataType="Byte" band="1">
<SimpleSource>
<SourceFilename relativeToVRT="1">byte1_1.vrt</SourceFilename>
<SourceBand>1</SourceBand>
<SourceProperties RasterXSize="20" RasterYSize="20" DataType="Byte" BlockXSize="20" BlockYSize="20" />
<SrcRect xOff="0" yOff="0" xSize="20" ySize="20" />
<DstRect xOff="0" yOff="0" xSize="20" ySize="20" />
</SimpleSource>
<SimpleSource>
<SourceFilename relativeToVRT="1">byte1_2.vrt</SourceFilename>
<SourceBand>1</SourceBand>
<SourceProperties RasterXSize="20" RasterYSize="20" DataType="Byte" BlockXSize="20" BlockYSize="20" />
<SrcRect xOff="0" yOff="0" xSize="20" ySize="20" />
<DstRect xOff="0" yOff="0" xSize="20" ySize="20" />
</SimpleSource>
<SimpleSource>
<SourceFilename relativeToVRT="1">byte1_3.vrt</SourceFilename>
<SourceBand>1</SourceBand>
<SourceProperties RasterXSize="20" RasterYSize="20" DataType="Byte" BlockXSize="20" BlockYSize="20" />
<SrcRect xOff="0" yOff="0" xSize="20" ySize="20" />
<DstRect xOff="0" yOff="0" xSize="20" ySize="20" />
</SimpleSource>
</VRTRasterBand>
</VRTDataset>""")
ret = gdaltest.runexternal(test_cli_utilities.get_gdalinfo_path() + ' -checksum tmp/byte2.vrt --config VRT_SHARED_SOURCE 0 --config GDAL_MAX_DATASET_POOL_SIZE 3')
if ret.find('Checksum=4672') < 0:
gdaltest.post_reason('failure')
print(ret)
return 'fail'
os.unlink('tmp/byte.tif')
os.unlink('tmp/byte1_1.vrt')
os.unlink('tmp/byte1_2.vrt')
os.unlink('tmp/byte1_3.vrt')
os.unlink('tmp/byte2.vrt')
return 'success'
示例14: test_gdalinfo_29
def test_gdalinfo_29():
if test_cli_utilities.get_gdalinfo_path() is None:
return 'skip'
ret = gdaltest.runexternal(test_cli_utilities.get_gdalinfo_path() + ' -json -checksum ../gcore/data/byte.tif')
ret = json.loads(ret)
if ret['bands'][0]['checksum'] != 4672:
return 'fail'
return 'success'