Support direct path to a raster file in file_path parameter#1192
Support direct path to a raster file in file_path parameter#1192
Conversation
c75128b to
0ae1da4
Compare
| }) | ||
|
|
||
| tif_files = get_file_path_geotiff_files(file_path_absolute) | ||
| if os.path.isdir(file_path_absolute) and len(tif_files) > 1 and not time_regex: |
There was a problem hiding this comment.
I do not like, that conditions are repeasted through this file. Like os.path.isdir(file_path_absolute) is here three times. Also check and error raise are split into many methods.
| os.makedirs(single_file_dir, exist_ok=True) | ||
| shutil.copy2(sample_file, os.path.join(single_file_dir, 'raster.tif')) | ||
| target_dirs.append(single_file_dir) | ||
|
|
There was a problem hiding this comment.
I would like to have also test for vector file.
| return get_geotiff_files(file_path_absolute) | ||
| if os.path.isfile(file_path_absolute): | ||
| ext = os.path.splitext(file_path_absolute)[1].lower() | ||
| if ext in settings.FILE_PATH_MAIN_FILE_EXTENSIONS: |
There was a problem hiding this comment.
You realy on fact, that FILE_PATH_MAIN_FILE_EXTENSIONS are lower case.
| }) | ||
| elif os.path.isfile(file_path_absolute): | ||
| ext = os.path.splitext(file_path_absolute)[1].lower() | ||
| if ext not in settings.FILE_PATH_MAIN_FILE_EXTENSIONS: |
There was a problem hiding this comment.
You realy on fact, that FILE_PATH_MAIN_FILE_EXTENSIONS are lower case.
| unsupported_file.write(b'not-a-geotiff') | ||
| target_dirs.append(unsupported_file_dir) | ||
|
|
||
| single_file_dir = os.path.join(layers_dir, TEST_UUID_SINGLE) |
There was a problem hiding this comment.
According to
- if directory is used, it must contain at least one GeoTIFF file (with extension `.tif` or `.tiff`)
- if directory contains more than one raster file, `time_regex` parameter is required
directory with one file should be working, but from this test name, it seems it is negative test.
0ae1da4 to
4de89c3
Compare
Addressed the requested changes and re-requested review.
Closing this review as outdated.
Part of issue #1180
[ ] Layman Test Client (including docker image at docker hub)