EOX GitLab Instance

Skip to content
Snippets Groups Projects
Commit bee8a70d authored by Lubomir Dolezal's avatar Lubomir Dolezal
Browse files

when no rpc found to rename, do not fail (dimap is enough)

parent 83109a3f
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@ from glob import glob
import shutil
from typing import List, Tuple
from ..util import gdal, osr
from ..util import gdal, osr, replace_ext
logger = logging.getLogger(__name__)
......@@ -73,13 +73,14 @@ def rpc_georef(input_filename: os.PathLike, target_filename: os.PathLike, rpc_fi
filename=input_filename, fileroot=fileroot,
extension=extension,
)
rpc_filename = None
try:
rpc_filename = glob(rpc_file_glob)[0]
rpc_filename = glob(rpc_file_glob, recursive=True)[0]
except IndexError:
logger.warn('No RPC filename found with glob %s' % rpc_file_glob)
# rename RPC filename to be compatible with GDAL
shutil.move(rpc_filename, '%s.rpc' % input_filename)
if rpc_filename:
shutil.move(rpc_filename, replace_ext(input_filename, '.rpc'))
gdal.Warp(
target_filename,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment