Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve help text. #545

Merged
merged 1 commit into from
Feb 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions utilities/converter/large_image_converter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,13 @@ def _generate_geotiff(inputPath, outputPath, **kwargs):
cmdopt += ['-co', 'LEVEL=%s' % options['level']]
cmd = ['gdal_translate', inputPath, outputPath] + cmdopt
logger.info('Convert to geotiff: %r' % (cmd))
# subprocess.check_call(cmd)
ds = gdal.Open(inputPath, gdalconst.GA_ReadOnly)
gdal.Translate(outputPath, ds, options=cmdopt)
try:
# subprocess.check_call(cmd)
ds = gdal.Open(inputPath, gdalconst.GA_ReadOnly)
gdal.Translate(outputPath, ds, options=cmdopt)
except Exception:
os.unlink(outputPath)
raise


def _generate_multiframe_tiff(inputPath, outputPath, tempPath, lidata, **kwargs):
Expand Down
16 changes: 14 additions & 2 deletions utilities/converter/large_image_converter/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@


def get_parser():
parser = argparse.ArgumentParser(description='Large Image image converter')
parser = argparse.ArgumentParser(description="""
Convert files for use with Large Image.
Output files are written as tiled tiff files. For geospatial files, these
conform to the cloud-optimized geospatial tiff format (COG). For
non-geospatial, the output image will be either 8- or 16-bits per sample per
channel. Some compression formats are always 8-bits per sample (webp, jpeg),
even if that format could support more and the original image is higher bit
depth.
""")
parser.add_argument(
'--version', action='version',
version=large_image_converter.__version__, help='Report version')
Expand Down Expand Up @@ -202,7 +210,11 @@ def main(args=sys.argv[1:]):
import tifftools.commands

info = tifftools.read_tiff(dest)
desc = json.loads(info['ifds'][0]['tags'][tifftools.Tag.ImageDescription.value]['data'])
try:
desc = json.loads(info['ifds'][0]['tags'][tifftools.Tag.ImageDescription.value]['data'])
except Exception:
logger.debug('Cannot generate statistics.')
return
desc['large_image_converter']['conversion_stats'] = {
'time': end_time - start_time,
'filesize': os.path.getsize(dest),
Expand Down