Commit 66fc768d authored by PIERSON Julie's avatar PIERSON Julie
Browse files

renaming bands after merging ok

parent 64fa9343
......@@ -144,19 +144,22 @@ class MergeAndRenameAlgorithm(QgsProcessingAlgorithm):
'SEPARATE' : True,
'OUTPUT' : output_raster_path
}
merge_result = processing.run("gdal:merge", merge_param, context=context, feedback=feedback)
#
# # RENAMING BANDS
#
# # iterate over each band to set its description using table input
# for band_number in range(nb_row):
# band = output_raster.GetRasterBand(band_number + 1)
# new_name = band_table[band_number][index_newname]
# # if no new name was set, use old name
# if new_name == '':
# new_name = band_table[band_number][index_oldname]
# band.SetDescription(new_name)
processing.run("gdal:merge", merge_param, context=context, feedback=feedback)
# RENAMING BANDS
# reading merged raster as a gdal raster
merged_raster = gdal.Open(output_raster_path)
# iterate over each band to set its description using table input
for band_number in range(nb_row):
band = merged_raster.GetRasterBand(band_number + 1)
new_name = band_table[band_number][index_newname]
# if no new name was set, use old name
if new_name == '':
new_name = band_table[band_number][index_oldname]
band.SetDescription(new_name)
# RETURNING RESULTS
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment