Skip to content

Commit 08b0f6c

Browse files
committed
don't wrap src / ref filenames in Path
1 parent 68c018d commit 08b0f6c

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

docs/case_studies/drone_mosaic.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ While the corrected and reference colours are similar, improvement in surface re
1919
Evaluation
2020
----------
2121

22-
The source and corrected drone images were compared with a second, Landsat-8 reference to evaluate the change in surface reflectance accuracy. The scatter plots below show an improvement in correlation with the reference after correction.
22+
The source and corrected drone images were compared with a second, Landsat-8 reference to evaluate the change in surface reflectance accuracy. The scatter plots below show a meaningful improvement in correlation with the reference after correction.
2323

2424
.. figure:: drone_mosaic-eval.png
2525
:align: center

homonim/cli.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ def _param_file_cb(ctx: click.Context, param: click.Argument, value):
221221

222222
# define click options and arguments common to more than one command
223223
# use cloup's argument to auto print argument help on command line
224+
# TODO: rasterio 1.4 does not accept Path wrapped URLs
224225
ref_file_arg = cloup.argument(
225226
'ref-file', nargs=1, metavar='REFERENCE', type=click.Path(exists=False, dir_okay=False, path_type=pathlib.Path),
226227
help='Path or URL of a reference image.'
@@ -327,6 +328,7 @@ def cli(verbose: int, quiet: int):
327328
'-o', '--overwrite', is_flag=True, type=click.BOOL, default=False, show_default=True,
328329
help='Overwrite existing output file(s).'
329330
),
331+
# TODO: does this work in front of an argument? or should it be handles like oty rpc's --gcp-refine?
330332
click.option(
331333
'-cmp', '--compare', 'cmp_file', metavar='FILE',
332334
type=click.Path(exists=False, dir_okay=False, path_type=pathlib.Path), is_flag=False, flag_value='ref',

homonim/fuse.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,10 @@ def _set_metadata(self, im: DatasetWriter, **kwargs):
199199
raise IoError(f'The raster dataset is closed: {im.name}')
200200

201201
kwargs_meta_dict = {f'FUSE_{k.upper()}': v.name if hasattr(v, 'name') else v for k, v in kwargs.items()}
202+
src_name = Path(self._src_filename).name
203+
ref_name = Path(self._ref_filename).name
202204
meta_dict = dict(
203-
FUSE_SRC_FILE=self._src_filename.name, FUSE_REF_FILE=self._ref_filename.name,
204-
FUSE_PROC_CRS=self.proc_crs.name, **kwargs_meta_dict,
205+
FUSE_SRC_FILE=src_name, FUSE_REF_FILE=ref_name, FUSE_PROC_CRS=self.proc_crs.name, **kwargs_meta_dict,
205206
)
206207
im.update_tags(**meta_dict)
207208

homonim/raster_pair.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ def __init__(
8282
grid to use for processing. For most use cases, it can be left as the default of
8383
:attr:`~homonim.enums.ProcCrs.auto` i.e. the lowest resolution of the source and reference image CRS's.
8484
"""
85-
self._src_filename = Path(src_filename)
86-
self._ref_filename = Path(ref_filename)
85+
self._src_filename = src_filename
86+
self._ref_filename = ref_filename
8787

8888
with rio.open(self._src_filename, 'r') as src_im, rio.open(self._ref_filename, 'r') as ref_im:
8989
self._validate_pair_format(src_im, ref_im)
@@ -271,8 +271,10 @@ def _auto_block_shape(self, max_block_mem: float = np.inf) -> Tuple[int, int]:
271271
def _assert_open(self):
272272
""" Raise an IoError if the source and reference images are not open. """
273273
if self.closed:
274+
src_name = Path(self._src_filename).name
275+
ref_name = Path(self._ref_filename).name
274276
raise errors.IoError(
275-
f'The raster pair has not been opened: {self._src_filename.name} and {self._ref_filename.name}'
277+
f'The raster pair has not been opened: {src_name} and {ref_name}'
276278
)
277279

278280
def open(self):

0 commit comments

Comments
 (0)