Code link: https://code.earthengine.google.com/a2c5293fff598d37ccb7843bff8bc27d
In this expression, the value of 'E' is derived from the image. All other values come from the asset table. So I wanted to use if/else
in this code:
If 'E' is greater than 0.78, it uses 'A', 'B', 'C', 'D' value defined in expression. Else if it is smaller than 0.78, it uses different 'A', 'B', 'C', 'D' value.
I created the expression code but don't now how to use if/else
statement for the expression.
var aqi = image.expression
('((A-B)/(C-D))*(E-D)+B'
, {
'A': ee.Number.parse(table.filter(ee.Filter.eq('No2', 10)).first().get('No2')),
'B': ee.Number.parse(table.filter(ee.Filter.eq('No2', 40)).first().get('No2')),
'C':ee.Number.parse(table.filter(ee.Filter.eq('No2', 50)).first().get('No2')),
'D':ee.Number.parse(table.filter(ee.Filter.eq('No2', 80)).first().get('No2')),
'E':image.select('NO2_column_number_density').multiply(1000),