Skip to content

Commit

Permalink
support output directory
Browse files Browse the repository at this point in the history
  • Loading branch information
hobu committed Mar 30, 2023
1 parent 933cb47 commit da425dc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/trenchrun/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__='0.0.5'
__version__='0.0.6'
2 changes: 2 additions & 0 deletions src/trenchrun/argparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ def get_parser(args):
help='PDAL-readable lidar content as a file or a pipeline', type=pathlib.Path)
parser.add_argument('--output',
help='Output filename', type=str, default='exposure')
parser.add_argument('--output-path',
help='Path to write output data', type=pathlib.Path, default=pathlib.Path.cwd())
parser.add_argument('--resolution',
help='Raster output resolution', type =float, default=1.0)
parser.add_argument('--alpha',
Expand Down
19 changes: 14 additions & 5 deletions src/trenchrun/blend.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,13 @@ def do(self):
title = 'Absorptive Daylight Exposure'

if self.data.args.full_output:
png.CreateCopy( f"{self.data.args.output}-trenchrun.png", rast, 0,
output = str(self.data.args.output_path / f"{self.data.args.output}-trenchrun.png")
png.CreateCopy( output, rast, 0,
[ f'TITLE={title}', f'COMMENT={description}' ] )

ds = gtif.CreateCopy( f"{self.data.args.output}-trenchrun.tif", rast, 0,
output = str(self.data.args.output_path / f"{self.data.args.output}-trenchrun.tif")
logs.logger.info(f'writing trenchrun to {output}')
ds = gtif.CreateCopy( output, rast, 0,
[ 'COMPRESS=Deflate', 'TILED=YES','PREDICTOR=2' ] )

if 'AREA_OR_POINT' in info['metadata']:
Expand All @@ -113,13 +116,19 @@ def do(self):

if self.data.args.full_output:
ao = gdal.Open(str(self.data.args.aoPath))
ds = gtif.CreateCopy( f"{self.data.args.output}-occlusion.tif", ao, 0,
output = str(self.data.args.output_path / f"{self.data.args.output}-occlusion.tif")
logs.logger.info(f'writing ambient occlusion to {output}')
ds = gtif.CreateCopy( output, ao, 0,
[ 'COMPRESS=Deflate', 'TILED=YES','PREDICTOR=2' ] )

ao = gdal.Open(str(self.data.args.dsmPath))
ds = gtif.CreateCopy( f"{self.data.args.output}-dsm.tif", ao, 0,
output = str(self.data.args.output_path / f"{self.data.args.output}-dsm.tif")
logs.logger.info(f'writing dsm to {output}')
ds = gtif.CreateCopy( output, ao, 0,
[ 'COMPRESS=LZW', 'TILED=YES','PREDICTOR=3' ] )

ao = gdal.Open(str(self.data.args.intensityPath))
ds = gtif.CreateCopy( f"{self.data.args.output}-intensity.tif", ao, 0,
output = str(self.data.args.output_path / f"{self.data.args.output}-intensity.tif")
logs.logger.info(f'writing intensity to {output}')
ds = gtif.CreateCopy( output, ao, 0,
[ 'COMPRESS=LZW', 'TILED=YES','PREDICTOR=2' ] )

0 comments on commit da425dc

Please sign in to comment.