diff --git a/resources/instrument_cfgs/avhrr_3.json b/resources/instrument_cfgs/avhrr_3.json index 9b39abe67..f0a4473b7 100644 --- a/resources/instrument_cfgs/avhrr_3.json +++ b/resources/instrument_cfgs/avhrr_3.json @@ -141,6 +141,7 @@ }, { "name": "NDVI", + "expression": "cch1=(1, sun_angle_compensated_reflective_radiance, 0.000000, 46.203000);cch2=(2, sun_angle_compensated_reflective_radiance, 0.000000, 97.050700);lut=lut(lut/NDVI.png);lut(0, ((cch2-cch1)/((cch2+cch1) == 0 ? 0.000001 : (cch1+cch2))+1)/2, 0),lut(0, ((cch2-cch1)/((cch2+cch1) == 0 ? 0.000001 : (cch1+cch2))+1)/2, 1),lut(0, ((cch2-cch1)/((cch2+cch1) == 0 ? 0.000001 : (cch1+cch2))+1)/2, 2)", "image": { "geo_correct": true }, @@ -148,6 +149,7 @@ }, { "name": "NDWI", + "expression": "cch2=(2, sun_angle_compensated_reflective_radiance, 0.000000, 97.050700);cch3a=(3a, sun_angle_compensated_reflective_radiance, 0.000000, 5.416650);lut=lut(lut/NDWI.png);lut(0, 1-((cch2-cch3a)/((cch2+cch3a) == 0 ? 0.000001 : (cch3a+cch2))+1)/2, 0),lut(0, 1-((cch2-cch3a)/((cch2+cch3a) == 0 ? 0.000001 : (cch3a+cch2))+1)/2, 1),lut(0, 1-((cch2-cch3a)/((cch2+cch3a) == 0 ? 0.000001 : (cch3a+cch2))+1)/2, 2)", "image": { "geo_correct": true }, diff --git a/resources/instrument_cfgs/fci.json b/resources/instrument_cfgs/fci.json index 8a747675a..dc1d64044 100644 --- a/resources/instrument_cfgs/fci.json +++ b/resources/instrument_cfgs/fci.json @@ -8,6 +8,22 @@ { "name": "321", "expression": "ch3, ch2, ch1" + }, + { + "name": "NDVI", + "expression": "cch1=(3, sun_angle_compensated_reflective_radiance, 0.000000, 46.203000);cch2=(4, sun_angle_compensated_reflective_radiance, 0.000000, 97.050700);lut=lut(lut/NDVI.png);lut(0, ((cch2-cch1)/((cch2+cch1) == 0 ? 0.000001 : (cch1+cch2))+1)/2, 0),lut(0, ((cch2-cch1)/((cch2+cch1) == 0 ? 0.000001 : (cch1+cch2))+1)/2, 1),lut(0, ((cch2-cch1)/((cch2+cch1) == 0 ? 0.000001 : (cch1+cch2))+1)/2, 2)", + "image": { + "geo_correct": true + }, + "description": "descriptions/NDVI.md" + }, + { + "name": "NDWI", + "expression": "cch2=(4, sun_angle_compensated_reflective_radiance, 0.000000, 97.050700);cch3a=(7, sun_angle_compensated_reflective_radiance, 0.000000, 5.416650);lut=lut(lut/NDWI.png);lut(0, 1-((cch2-cch3a)/((cch2+cch3a) == 0 ? 0.000001 : (cch3a+cch2))+1)/2, 0),lut(0, 1-((cch2-cch3a)/((cch2+cch3a) == 0 ? 0.000001 : (cch3a+cch2))+1)/2, 1),lut(0, 1-((cch2-cch3a)/((cch2+cch3a) == 0 ? 0.000001 : (cch3a+cch2))+1)/2, 2)", + "image": { + "geo_correct": true + }, + "description": "descriptions/NDWI.md" } ], "default": { diff --git a/resources/instrument_cfgs/msu_mr.json b/resources/instrument_cfgs/msu_mr.json index 0a9c52ced..e9bb8bec1 100644 --- a/resources/instrument_cfgs/msu_mr.json +++ b/resources/instrument_cfgs/msu_mr.json @@ -311,7 +311,23 @@ "image": { "geo_correct": true } - } + }, + { + "name": "NDVI", + "expression": "cch1=(1, sun_angle_compensated_reflective_radiance, 0.000000, 46.203000);cch2=(2, sun_angle_compensated_reflective_radiance, 0.000000, 97.050700);lut=lut(lut/NDVI.png);lut(0, ((cch2-cch1)/((cch2+cch1) == 0 ? 0.000001 : (cch1+cch2))+1)/2, 0),lut(0, ((cch2-cch1)/((cch2+cch1) == 0 ? 0.000001 : (cch1+cch2))+1)/2, 1),lut(0, ((cch2-cch1)/((cch2+cch1) == 0 ? 0.000001 : (cch1+cch2))+1)/2, 2)", + "image": { + "geo_correct": true + }, + "description": "descriptions/NDVI.md" + }, + { + "name": "NDWI", + "expression": "cch2=(2, sun_angle_compensated_reflective_radiance, 0.000000, 97.050700);cch3a=(3, sun_angle_compensated_reflective_radiance, 0.000000, 5.416650);lut=lut(lut/NDWI.png);lut(0, 1-((cch2-cch3a)/((cch2+cch3a) == 0 ? 0.000001 : (cch3a+cch2))+1)/2, 0),lut(0, 1-((cch2-cch3a)/((cch2+cch3a) == 0 ? 0.000001 : (cch3a+cch2))+1)/2, 1),lut(0, 1-((cch2-cch3a)/((cch2+cch3a) == 0 ? 0.000001 : (cch3a+cch2))+1)/2, 2)", + "image": { + "geo_correct": true + }, + "description": "descriptions/NDWI.md" + }, ], "default": { "calibration_ranges": { diff --git a/resources/instrument_cfgs/seviri.json b/resources/instrument_cfgs/seviri.json index 5ae96df96..f0313811a 100644 --- a/resources/instrument_cfgs/seviri.json +++ b/resources/instrument_cfgs/seviri.json @@ -177,7 +177,19 @@ }, { "name": "NDVI", + "expression": "cch1=(1, sun_angle_compensated_reflective_radiance, 0.000000, 46.203000);cch2=(2, sun_angle_compensated_reflective_radiance, 0.000000, 97.050700);lut=lut(lut/NDVI.png);lut(0, ((cch2-cch1)/((cch2+cch1) == 0 ? 0.000001 : (cch1+cch2))+1)/2, 0),lut(0, ((cch2-cch1)/((cch2+cch1) == 0 ? 0.000001 : (cch1+cch2))+1)/2, 1),lut(0, ((cch2-cch1)/((cch2+cch1) == 0 ? 0.000001 : (cch1+cch2))+1)/2, 2)", + "image": { + "geo_correct": true + }, "description": "descriptions/NDVI.md" + }, + { + "name": "NDWI", + "expression": "cch2=(2, sun_angle_compensated_reflective_radiance, 0.000000, 97.050700);cch3a=(3, sun_angle_compensated_reflective_radiance, 0.000000, 5.416650);lut=lut(lut/NDWI.png);lut(0, 1-((cch2-cch3a)/((cch2+cch3a) == 0 ? 0.000001 : (cch3a+cch2))+1)/2, 0),lut(0, 1-((cch2-cch3a)/((cch2+cch3a) == 0 ? 0.000001 : (cch3a+cch2))+1)/2, 1),lut(0, 1-((cch2-cch3a)/((cch2+cch3a) == 0 ? 0.000001 : (cch3a+cch2))+1)/2, 2)", + "image": { + "geo_correct": true + }, + "description": "descriptions/NDWI.md" } ], "default": { diff --git a/resources/scripted_compos/ndvi.lua b/resources/scripted_compos/ndvi.lua deleted file mode 100644 index 3479a7a6e..000000000 --- a/resources/scripted_compos/ndvi.lua +++ /dev/null @@ -1,56 +0,0 @@ --- NDVI - -function init() - --create an empty image for the LUT - img_lut = image_t.new() - --load the LUT - image_load_png(img_lut, get_resource_path("lut/NDVI.png")) - --return 3 channels, RGB - return 3 -end - -function process() - for x = 0, rgb_output:width() - 1, 1 do - for y = 0, rgb_output:height() - 1, 1 do - - --get channels from satdump.json - - get_channel_values(x, y) - local cch1 = get_channel_value(0) - local cch2 = get_channel_value(1) - --perform NDVI - local ndvi = (cch2-cch1)/(cch2+cch1) - - --range convert from -1 -> 1 to 0 -> 256 - local ndvi_lutval = (((ndvi-(-1))*256) / (1-(-1))) - - --sanity checks (noise) - if ndvi_lutval < 0 then - ndvi_lutval = 0 - end - - if ndvi_lutval > 255 then - ndvi_lutval = 255 - end - - - --don't forget to create a table! - local lut_result = {} - - --send the ndvi_lutval to the LUT, retrieve it back in the table as 3 R,G,B channels - lut_result[0] = img_lut:get(0 * img_lut:height() * img_lut:width() + ndvi_lutval * img_lut:width() + ndvi_lutval) / 255.0 - lut_result[1] = img_lut:get(1 * img_lut:height() * img_lut:width() + ndvi_lutval * img_lut:width() + ndvi_lutval) / 255.0 - lut_result[2] = img_lut:get(2 * img_lut:height() * img_lut:width() + ndvi_lutval * img_lut:width() + ndvi_lutval) / 255.0 - - - - --return RGB 0=R 1=G 2=B - set_img_out(0, x, y, lut_result[0]) - set_img_out(1, x, y, lut_result[1]) - set_img_out(2, x, y, lut_result[2]) - - end - --set the progress bar accordingly - set_progress(x, rgb_output:width()) - end -end diff --git a/resources/scripted_compos/ndwi.lua b/resources/scripted_compos/ndwi.lua deleted file mode 100644 index cea36ddf2..000000000 --- a/resources/scripted_compos/ndwi.lua +++ /dev/null @@ -1,54 +0,0 @@ --- NDWI - -function init() - --create an empty image for the LUT - img_lut = image_t.new() - --load the LUT - image_load_png(img_lut, get_resource_path("lut/NDWI.png"), false) - --return 3 channels, RGB - return 3 -end - -function process() - for x = 0, rgb_output:width() - 1, 1 do - for y = 0, rgb_output:height() - 1, 1 do - - --get channels from satdump.json - get_channel_values(x, y) - local cch2 = get_channel_value(0) - local cch3a = get_channel_value(1) - - --perform NDWI - local ndwi = (cch2-cch3a)/(cch2+cch3a) - - --range convert from -1 -> 1 to 0 -> 256 - local ndwi_lutval = (((ndwi-(-1))*256) / (1-(-1))) - - --sanity checks (noise) - if ndwi_lutval < 0 then - ndwi_lutval = 0 - end - - if ndwi_lutval > 255 then - ndwi_lutval = 255 - end - - - --don't forget to create a table! - local lut_result = {} - - --send the ndwi_lutval to the LUT, retrieve it back in the table as 3 R,G,B channels - lut_result[0] = img_lut:get(0 * img_lut:height() * img_lut:width() + ndwi_lutval * img_lut:width() + ndwi_lutval) / 255.0 - lut_result[1] = img_lut:get(1 * img_lut:height() * img_lut:width() + ndwi_lutval * img_lut:width() + ndwi_lutval) / 255.0 - lut_result[2] = img_lut:get(2 * img_lut:height() * img_lut:width() + ndwi_lutval * img_lut:width() + ndwi_lutval) / 255.0 - - --return RGB 0=R 1=G 2=B - set_img_out(0, x, y, lut_result[0]) - set_img_out(1, x, y, lut_result[1]) - set_img_out(2, x, y, lut_result[2]) - - end - --set the progress bar accordingly - set_progress(x, rgb_output:width()) - end -end