本文整理汇总了Python中rasterio.rio.options.creation_options方法的典型用法代码示例。如果您正苦于以下问题:Python options.creation_options方法的具体用法?Python options.creation_options怎么用?Python options.creation_options使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rasterio.rio.options
的用法示例。
在下文中一共展示了options.creation_options方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: pansharpen
# 需要导入模块: from rasterio.rio import options [as 别名]
# 或者: from rasterio.rio.options import creation_options [as 别名]
def pansharpen(
src_paths, dst_path, dst_dtype,
weight, verbosity, jobs,
half_window, customwindow, out_alpha, creation_options):
"""Pansharpens a landsat scene.
Input is a panchromatic band, plus 3 color bands
pansharpen B8.tif B4.tif B3.tif B2.tif out.tif
Or with shell expansion
pansharpen LC80410332015283LGN00_B{8,4,3,2}.tif out.tif
"""
if customwindow != 0 and customwindow < 150:
raise click.BadParameter(
'custom blocksize must be greater than 150',
param=customwindow, param_hint='--customwindow')
return calculate_landsat_pansharpen(
src_paths, dst_path, dst_dtype, weight, verbosity,
jobs, half_window, customwindow, out_alpha, creation_options
)
示例2: streamdir
# 需要导入模块: from rasterio.rio import options [as 别名]
# 或者: from rasterio.rio.options import creation_options [as 别名]
def streamdir(input_dir, output_dir, compositezoom, maxzoom, logdir, readtemplate, scenetemplate, workers, creation_options, no_fill, tile_resolution):
# with MBTileExtractor(input_dir) as mbtmp:
# print mbtmp.extract()
untiler.stream_dir(input_dir, output_dir, compositezoom, maxzoom, logdir, readtemplate, scenetemplate, workers, creation_options, no_fill, tile_resolution)
示例3: streammbtiles
# 需要导入模块: from rasterio.rio import options [as 别名]
# 或者: from rasterio.rio.options import creation_options [as 别名]
def streammbtiles(mbtiles, output_dir, compositezoom, maxzoom, creation_options, scenetemplate, workers, no_fill):
with MBTileExtractor(mbtiles) as mbtmp:
input_tile_dir = mbtmp.extract()
with open(os.path.join(input_tile_dir, 'tiles', 'metadata.json')) as ofile:
metadata = json.loads(ofile.read())
readtemplate = "tiles/{z}/{x}/{y}.%s" % (metadata['format'])
untiler.stream_dir(input_tile_dir, output_dir, compositezoom, maxzoom, None, readtemplate, scenetemplate, workers, creation_options, no_fill)
示例4: overview
# 需要导入模块: from rasterio.rio import options [as 别名]
# 或者: from rasterio.rio.options import creation_options [as 别名]
def overview(
input_mosaic, cogeo_profile, prefix, threads, overview_level, creation_options, yes
):
"""Create a low resolution version of a mosaic."""
if input_mosaic.startswith("dynamodb://") and not yes:
value = click.prompt(
click.style(
"Creating overviews from a DynamoDB-backed mosaic will many read requests and might be expensive. Continue? (Y/n)"
),
type=str,
default="Y",
err=True,
)
if value.lower() != "y":
click.secho("Alright, this might be a good thing!", err=True)
return
output_profile = cog_profiles.get(cogeo_profile)
output_profile.update(dict(BIGTIFF=os.environ.get("BIGTIFF", "IF_SAFER")))
if creation_options:
output_profile.update(creation_options)
config = dict(
GDAL_NUM_THREADS="ALL_CPU",
GDAL_TIFF_INTERNAL_MASK=os.environ.get("GDAL_TIFF_INTERNAL_MASK", True),
GDAL_TIFF_OVR_BLOCKSIZE="128",
)
if not prefix:
prefix = os.path.basename(input_mosaic).split(".")[0]
create_low_level_cogs(
input_mosaic,
output_profile,
prefix,
max_overview_level=overview_level,
config=config,
threads=threads,
)
示例5: atmos
# 需要导入模块: from rasterio.rio import options [as 别名]
# 或者: from rasterio.rio.options import creation_options [as 别名]
def atmos(
ctx,
atmo,
contrast,
bias,
jobs,
out_dtype,
src_path,
dst_path,
creation_options,
as_color,
):
"""Atmospheric correction
"""
if as_color:
click.echo(
"rio color {} {} {}".format(
src_path, dst_path, simple_atmo_opstring(atmo, contrast, bias)
)
)
exit(0)
with rasterio.open(src_path) as src:
opts = src.profile.copy()
windows = [(window, ij) for ij, window in src.block_windows()]
opts.update(**creation_options)
opts["transform"] = guard_transform(opts["transform"])
out_dtype = out_dtype if out_dtype else opts["dtype"]
opts["dtype"] = out_dtype
args = {"atmo": atmo, "contrast": contrast, "bias": bias, "out_dtype": out_dtype}
jobs = check_jobs(jobs)
if jobs > 1:
with riomucho.RioMucho(
[src_path],
dst_path,
atmos_worker,
windows=windows,
options=opts,
global_args=args,
mode="manual_read",
) as mucho:
mucho.run(jobs)
else:
with rasterio.open(dst_path, "w", **opts) as dest:
with rasterio.open(src_path) as src:
rasters = [src]
for window, ij in windows:
arr = atmos_worker(rasters, window, ij, args)
dest.write(arr, window=window)