From 23b306ede7fc5ffe5bc04be62879148e5a54bf2b Mon Sep 17 00:00:00 2001 From: Pete Bunting Date: Tue, 2 Jul 2024 12:01:03 +0100 Subject: [PATCH] Updated to ensure that when functions are using rios that define rsgislib image creation options are still used. --- .../rsgislib/changedetect/pxloutlierchng.py | 3 ++ .../rsgislib/classification/classcatboost.py | 6 +++ .../rsgislib/classification/classkeraspxl.py | 3 ++ .../rsgislib/classification/classlightgbm.py | 6 +++ .../rsgislib/classification/classsklearn.py | 3 ++ .../rsgislib/classification/classxgboost.py | 6 +++ .../rsgislib/classification/clustersklearn.py | 6 +++ python/rsgislib/imagecalc/__init__.py | 30 +++++++++++++ .../imagecalc/specunmixing/__init__.py | 24 +++++++++++ python/rsgislib/imagecalibration/__init__.py | 1 + .../imagecalibration/sensorlvl2data.py | 3 ++ .../rsgislib/imagecalibration/solarangles.py | 5 +++ python/rsgislib/imageutils/__init__.py | 42 +++++++++++++++++-- python/rsgislib/regression/regresssklearn.py | 3 ++ python/rsgislib/tools/mapping.py | 16 +++---- python/rsgislib/tools/testimages.py | 3 ++ python/rsgislib/tools/visualisation.py | 3 ++ python/rsgislib/vectorutils/createvectors.py | 18 ++++---- 18 files changed, 160 insertions(+), 21 deletions(-) diff --git a/python/rsgislib/changedetect/pxloutlierchng.py b/python/rsgislib/changedetect/pxloutlierchng.py index 4fccb75d..40998dad 100644 --- a/python/rsgislib/changedetect/pxloutlierchng.py +++ b/python/rsgislib/changedetect/pxloutlierchng.py @@ -199,6 +199,9 @@ def _applyPyOB(info, inputs, outputs, otherargs): aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False diff --git a/python/rsgislib/classification/classcatboost.py b/python/rsgislib/classification/classcatboost.py index b1012a6f..fa38ea92 100644 --- a/python/rsgislib/classification/classcatboost.py +++ b/python/rsgislib/classification/classcatboost.py @@ -275,6 +275,9 @@ def _applyCatBClassifier(info, inputs, outputs, otherargs): aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False @@ -534,6 +537,9 @@ def _applyCatBClassifier(info, inputs, outputs, otherargs): aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False diff --git a/python/rsgislib/classification/classkeraspxl.py b/python/rsgislib/classification/classkeraspxl.py index 5e59e7bd..21c34731 100644 --- a/python/rsgislib/classification/classkeraspxl.py +++ b/python/rsgislib/classification/classkeraspxl.py @@ -277,6 +277,9 @@ def _applyKerasPxlClassifier(info, inputs, outputs, otherargs): aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False diff --git a/python/rsgislib/classification/classlightgbm.py b/python/rsgislib/classification/classlightgbm.py index b54d78ee..9bfc491b 100644 --- a/python/rsgislib/classification/classlightgbm.py +++ b/python/rsgislib/classification/classlightgbm.py @@ -1327,6 +1327,9 @@ def _applyLGBMClassifier(info, inputs, outputs, otherargs): aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False @@ -2622,6 +2625,9 @@ def _applyLGMClassifier(info, inputs, outputs, otherargs): aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False diff --git a/python/rsgislib/classification/classsklearn.py b/python/rsgislib/classification/classsklearn.py index 54a661f8..c5fcc659 100644 --- a/python/rsgislib/classification/classsklearn.py +++ b/python/rsgislib/classification/classsklearn.py @@ -307,6 +307,9 @@ class ids should be consecutive and the out_ids aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False diff --git a/python/rsgislib/classification/classxgboost.py b/python/rsgislib/classification/classxgboost.py index 07c2ee56..1567f538 100644 --- a/python/rsgislib/classification/classxgboost.py +++ b/python/rsgislib/classification/classxgboost.py @@ -1019,6 +1019,9 @@ def _apply_xgb_classifier(info, inputs, outputs, otherargs): aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False @@ -2050,6 +2053,9 @@ def _applyXGBMClassifier(info, inputs, outputs, otherargs): aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False diff --git a/python/rsgislib/classification/clustersklearn.py b/python/rsgislib/classification/clustersklearn.py index 5a3d319f..67cf122f 100644 --- a/python/rsgislib/classification/clustersklearn.py +++ b/python/rsgislib/classification/clustersklearn.py @@ -119,6 +119,9 @@ def img_pixel_sample_cluster( otherargs.no_data_val = no_data_val aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False @@ -227,6 +230,9 @@ def img_pixel_tiled_cluster( otherargs.clusterer = clusterer aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False diff --git a/python/rsgislib/imagecalc/__init__.py b/python/rsgislib/imagecalc/__init__.py index 5b6d9654..a23a692f 100644 --- a/python/rsgislib/imagecalc/__init__.py +++ b/python/rsgislib/imagecalc/__init__.py @@ -898,6 +898,9 @@ def rescale_img_pxl_vals( otherargs.numpyDT = numpyDT aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False @@ -1131,6 +1134,9 @@ def calc_imgs_pxl_mode( otherargs.numpyDT = numpyDT aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False @@ -1200,6 +1206,9 @@ def calc_imgs_pxl_percentiles( otherargs.percentiles = percentiles aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False @@ -1327,6 +1336,9 @@ def _calcBasicStats(info, inputs, outputs, otherargs): aControls.referenceImage = in_ref_img aControls.footprint = applier.BOUNDS_FROM_REFERENCE aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False @@ -1421,6 +1433,9 @@ def recode_int_raster( otherargs.recode_dict = recode_dict aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = False aControls.calcStats = False @@ -1561,6 +1576,9 @@ def _retrieve_idx_info(info, inputs, outputs, otherargs): otherargs.h_box = y_res / 2 aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = False aControls.calcStats = False @@ -1910,6 +1928,9 @@ def count_imgs_int_val_occur( otherargs.bin_vals = bin_vals aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False @@ -2732,6 +2753,9 @@ def normalise_img_pxl_vals_py( otherargs.out_max = out_max aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False @@ -2848,6 +2872,9 @@ def calc_band_range_thres_msk( otherargs.combine_mthd = combine_mthd aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = False aControls.calcStats = False @@ -2935,6 +2962,9 @@ def calc_img_band_pxl_percentiles( otherargs.percentiles = percentiles aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False diff --git a/python/rsgislib/imagecalc/specunmixing/__init__.py b/python/rsgislib/imagecalc/specunmixing/__init__.py index 578e5860..f8d480f0 100644 --- a/python/rsgislib/imagecalc/specunmixing/__init__.py +++ b/python/rsgislib/imagecalc/specunmixing/__init__.py @@ -316,6 +316,9 @@ def spec_unmix_spts_ucls( otherargs.weight = weight aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False @@ -433,6 +436,9 @@ def spec_unmix_spts_nnls( otherargs.weight = weight aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False @@ -538,6 +544,9 @@ def spec_unmix_spts_fcls( otherargs.gain = gain aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False @@ -652,6 +661,9 @@ def spec_unmix_pymcr_nnls( otherargs.weight = weight aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False @@ -763,6 +775,9 @@ def spec_unmix_pymcr_fcls( otherargs.gain = gain aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False @@ -844,6 +859,9 @@ def rescale_unmixing_results(input_img, output_img, gdalformat="KEA", calc_stats otherargs = applier.OtherInputs() aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False @@ -904,6 +922,9 @@ def predict_refl_linear_unmixing( otherargs.endmembers_arr = endmembers_info[2] aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False @@ -990,6 +1011,9 @@ def calc_unmixing_rmse_residual_err( otherargs.endmembers_arr = endmembers_info[2] aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False diff --git a/python/rsgislib/imagecalibration/__init__.py b/python/rsgislib/imagecalibration/__init__.py index 3dff22f1..5c4f69a4 100644 --- a/python/rsgislib/imagecalibration/__init__.py +++ b/python/rsgislib/imagecalibration/__init__.py @@ -529,6 +529,7 @@ def createEstimateSREFSurface(inputTOAImg, imgBands, bandRescale, winSize, outIm otherargs.numpyDT = numpy.float32 aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts(gdalformat) aControls.drivername = 'KEA' aControls.omitPyramids = True aControls.calcStats = False diff --git a/python/rsgislib/imagecalibration/sensorlvl2data.py b/python/rsgislib/imagecalibration/sensorlvl2data.py index 55f64661..30166cc6 100644 --- a/python/rsgislib/imagecalibration/sensorlvl2data.py +++ b/python/rsgislib/imagecalibration/sensorlvl2data.py @@ -661,6 +661,9 @@ def parse_landsat_c2_qa_pixel_img( otherargs.qa_lut = qa_lut aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False diff --git a/python/rsgislib/imagecalibration/solarangles.py b/python/rsgislib/imagecalibration/solarangles.py index d62c5cc3..a7567f74 100644 --- a/python/rsgislib/imagecalibration/solarangles.py +++ b/python/rsgislib/imagecalibration/solarangles.py @@ -121,7 +121,12 @@ def calc_solar_azimuth_zenith(inputImg, inImgDateTime, outputImg, gdalformat): otherargs.dateTime = inImgDateTime aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat + aControls.omitPyramids = True + aControls.calcStats = False wgs84latlonProj = osr.SpatialReference() wgs84latlonProj.ImportFromEPSG(4326) diff --git a/python/rsgislib/imageutils/__init__.py b/python/rsgislib/imageutils/__init__.py index f6731243..91d28462 100644 --- a/python/rsgislib/imageutils/__init__.py +++ b/python/rsgislib/imageutils/__init__.py @@ -197,9 +197,13 @@ def set_env_vars_lzw_gtiff_outs(bigtiff: bool = False): """ if bigtiff: - os.environ["RSGISLIB_IMG_CRT_OPTS_GTIFF"] = "TILED=YES:COMPRESS=LZW:BIGTIFF=YES" + os.environ["RSGISLIB_IMG_CRT_OPTS_GTIFF"] = ( + "TILED=YES:COMPRESS=LZW:INTERLEAVE=BAND:BIGTIFF=YES" + ) else: - os.environ["RSGISLIB_IMG_CRT_OPTS_GTIFF"] = "TILED=YES:COMPRESS=LZW" + os.environ["RSGISLIB_IMG_CRT_OPTS_GTIFF"] = ( + "TILED=YES:COMPRESS=LZW:INTERLEAVE=BAND:BIGTIFF=IF_SAFER" + ) def set_env_vars_deflate_gtiff_outs(bigtiff: bool = False): @@ -221,10 +225,31 @@ def set_env_vars_deflate_gtiff_outs(bigtiff: bool = False): """ if bigtiff: os.environ["RSGISLIB_IMG_CRT_OPTS_GTIFF"] = ( - "TILED=YES:COMPRESS=DEFLATE:BIGTIFF=YES" + "TILED=YES:COMPRESS=DEFLATE:INTERLEAVE=BAND:BIGTIFF=YES" ) else: - os.environ["RSGISLIB_IMG_CRT_OPTS_GTIFF"] = "TILED=YES:COMPRESS=DEFLATE" + os.environ["RSGISLIB_IMG_CRT_OPTS_GTIFF"] = ( + "TILED=YES:COMPRESS=DEFLATE:INTERLEAVE=BAND:BIGTIFF=IF_SAFER" + ) + + +def get_rios_img_creation_opts(gdalformat: str) -> List[str]: + """ + An internal function used to get the RSGISLib specified GDAL image + creation options for input into RIOS applier. + + :param gdalformat: the GDAL format (e.g., GTIFF) + :return: list of creation options + + """ + gdalformat = gdalformat.upper() + var_name = f"RSGISLIB_IMG_CRT_OPTS_{gdalformat}" + ctr_out_opts = list() + if var_name in os.environ: + ctr_opts = os.environ[var_name] + for ind_ctr_opt in ctr_opts.split(":"): + ctr_out_opts.append(ind_ctr_opt) + return ctr_out_opts def pop_thmt_img_stats( @@ -2766,6 +2791,7 @@ def calc_pixel_locations(input_img: str, output_img: str, gdalformat: str): otherargs = applier.OtherInputs() aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = get_rios_img_creation_opts(gdalformat) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False @@ -2814,6 +2840,7 @@ def calc_wgs84_pixel_area( otherargs.scale = float(scale) aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = get_rios_img_creation_opts(gdalformat) aControls.drivername = gdalformat aControls.omitPyramids = False aControls.calcStats = False @@ -2986,6 +3013,7 @@ def generate_random_pxl_vals_img( otherargs.upVal = up_val aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = get_rios_img_creation_opts(gdalformat) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False @@ -3183,6 +3211,7 @@ def combine_binary_masks( otherargs = applier.OtherInputs() aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = get_rios_img_creation_opts(gdalformat) aControls.drivername = gdalformat aControls.omitPyramids = False aControls.calcStats = False @@ -4359,6 +4388,7 @@ def spectral_smoothing( otherargs.np_dtype = np_dtype aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = get_rios_img_creation_opts(gdalformat) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False @@ -4439,6 +4469,7 @@ def calc_wsg84_pixel_size(input_img: str, output_img: str, gdalformat: str = "KE otherargs.y_res = y_res aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = get_rios_img_creation_opts(gdalformat) aControls.drivername = gdalformat aControls.omitPyramids = False aControls.calcStats = False @@ -4497,6 +4528,7 @@ def mask_all_band_zero_vals( otherargs.out_val = out_val aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = get_rios_img_creation_opts(gdalformat) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False @@ -4649,6 +4681,7 @@ def mask_outliners_data_values( otherargs.np_dtype = np_dtype aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = get_rios_img_creation_opts(gdalformat) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False @@ -4755,6 +4788,7 @@ def polyfill_nan_data_values( otherargs.np_dtype = np_dtype aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = get_rios_img_creation_opts(gdalformat) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False diff --git a/python/rsgislib/regression/regresssklearn.py b/python/rsgislib/regression/regresssklearn.py index 3008a7dc..2c40fee3 100755 --- a/python/rsgislib/regression/regresssklearn.py +++ b/python/rsgislib/regression/regresssklearn.py @@ -409,6 +409,9 @@ def apply_regress_sklearn_mdl( aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False diff --git a/python/rsgislib/tools/mapping.py b/python/rsgislib/tools/mapping.py index 8c228ad4..126cf351 100644 --- a/python/rsgislib/tools/mapping.py +++ b/python/rsgislib/tools/mapping.py @@ -57,7 +57,7 @@ def define_axis_extent(ax: plt.axis, bbox: List[float]): ax.set_aspect("equal", "box") ax.set_xlim([bbox[0], bbox[1]]) ax.set_ylim([bbox[2], bbox[3]]) - ax.ticklabel_format(useOffset=False, style='plain') + ax.ticklabel_format(useOffset=False, style="plain") def define_map_tick_spacing(ax: plt.axis, tick_spacing: float): @@ -76,7 +76,7 @@ def define_map_tick_spacing(ax: plt.axis, tick_spacing: float): ax.xaxis.set_major_locator(ticker.MultipleLocator(tick_spacing)) ax.yaxis.set_major_locator(ticker.MultipleLocator(tick_spacing)) - ax.ticklabel_format(useOffset=False, style='plain') + ax.ticklabel_format(useOffset=False, style="plain") def get_overview_info( @@ -599,7 +599,7 @@ def create_vec_lyr_map( ) ax.set_xlim([bbox[0], bbox[1]]) ax.set_ylim([bbox[2], bbox[3]]) - ax.ticklabel_format(useOffset=False, style='plain') + ax.ticklabel_format(useOffset=False, style="plain") if use_grid: ax.grid() @@ -728,7 +728,7 @@ def create_raster_img_map( ) ax.set_xlim([img_coords[0], img_coords[1]]) ax.set_ylim([img_coords[2], img_coords[3]]) - ax.ticklabel_format(useOffset=False, style='plain') + ax.ticklabel_format(useOffset=False, style="plain") if use_grid: ax.grid() @@ -834,7 +834,7 @@ def create_thematic_raster_map( ax.set_xlim([img_coords_scns[0][0], img_coords_scns[0][1]]) ax.set_ylim([img_coords_scns[0][2], img_coords_scns[0][3]]) - ax.ticklabel_format(useOffset=False, style='plain') + ax.ticklabel_format(useOffset=False, style="plain") for img_data_arr, img_coords, plot_zorder in zip( img_data_arr_scns, img_coords_scns, lcl_plot_zorders @@ -952,7 +952,7 @@ def create_choropleth_vec_lyr_map( ) ax.set_xlim([bbox[0], bbox[1]]) ax.set_ylim([bbox[2], bbox[3]]) - ax.ticklabel_format(useOffset=False, style='plain') + ax.ticklabel_format(useOffset=False, style="plain") if use_grid: ax.grid() @@ -1078,7 +1078,7 @@ def create_raster_cmap_img_map( ax.imshow(img_data, extent=img_coords, cmap=c_cmap, norm=c_norm, zorder=plot_zorder) ax.set_xlim([img_coords[0], img_coords[1]]) ax.set_ylim([img_coords[2], img_coords[3]]) - ax.ticklabel_format(useOffset=False, style='plain') + ax.ticklabel_format(useOffset=False, style="plain") if use_grid: ax.grid() @@ -1213,7 +1213,7 @@ def create_vec_pt_density_map( ax.set_xlim([bbox[0], bbox[1]]) ax.set_ylim([bbox[2], bbox[3]]) - ax.ticklabel_format(useOffset=False, style='plain') + ax.ticklabel_format(useOffset=False, style="plain") if use_grid: ax.grid() diff --git a/python/rsgislib/tools/testimages.py b/python/rsgislib/tools/testimages.py index aa9a7b1c..7b2a5009 100644 --- a/python/rsgislib/tools/testimages.py +++ b/python/rsgislib/tools/testimages.py @@ -86,6 +86,9 @@ def create_random_int_img( otherargs.out_vals = out_vals aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False diff --git a/python/rsgislib/tools/visualisation.py b/python/rsgislib/tools/visualisation.py index 8b155ef9..f9d57a18 100644 --- a/python/rsgislib/tools/visualisation.py +++ b/python/rsgislib/tools/visualisation.py @@ -1374,6 +1374,9 @@ def burn_in_binary_msk( otherargs.msk_colour = msk_colour aControls = applier.ApplierControls() aControls.progress = progress_bar + aControls.creationoptions = rsgislib.imageutils.get_rios_img_creation_opts( + gdalformat + ) aControls.drivername = gdalformat aControls.omitPyramids = True aControls.calcStats = False diff --git a/python/rsgislib/vectorutils/createvectors.py b/python/rsgislib/vectorutils/createvectors.py index c8ff2b28..506f09bd 100644 --- a/python/rsgislib/vectorutils/createvectors.py +++ b/python/rsgislib/vectorutils/createvectors.py @@ -1677,13 +1677,13 @@ def create_img_transects( def create_random_pts_in_bbox( - bbox: List[float], - n_pts: int, - epsg_code: int, - out_vec_file: str, - out_vec_lyr: str, - out_format: str = "GPKG", - rnd_seed: int = None, + bbox: List[float], + n_pts: int, + epsg_code: int, + out_vec_file: str, + out_vec_lyr: str, + out_format: str = "GPKG", + rnd_seed: int = None, ): """ A function which generates a set of random points within a boundary @@ -1710,7 +1710,7 @@ def create_random_pts_in_bbox( # Create geopandas dataframe with the points. data_gdf = geopandas.GeoDataFrame( - geometry=geopandas.points_from_xy(x=x_coords, y=y_coords), crs=epsg_code + geometry=geopandas.points_from_xy(x=x_coords, y=y_coords), crs=epsg_code ) # Export the points @@ -1719,7 +1719,7 @@ def create_random_pts_in_bbox( import rsgislib.tools.filetools out_vec_lyr = rsgislib.tools.filetools.get_file_basename( - out_vec_file, check_valid=True + out_vec_file, check_valid=True ) data_gdf.to_file(out_vec_file, layer=out_vec_lyr, driver=out_format) else: