2

I've wrote the below code for chlorophyll detection using MODIS ocean reflectance data but I've got this error:

Image.bitwiseXor: Bitwise operands must be integer only.

enter image description here

code link: https://code.earthengine.google.com/31dc6a60f330ee27c8e2a3e75eddee3c

Map.centerObject(table);
Map.addLayer(table);

var chl = modis
.filterDate('2020-05-01','2020-06-01')
.filterBounds(table)
.map(function(img){
  var bands = img.multiply(0.0001).clip(table);
  
  var R = bands.expression('log(b9 / b12)',
  {'b9': bands.select('sur_refl_b09'),'b12': bands.select('sur_refl_b12')});
  
  var index = bands.expression('10.0 ^ (0.283 + (-2.753 * R) + (1.457 * R^2) + (0.659 * R^3) + (-1.403 * R^4))'
  ,{'R':R});
  
  return index.copyProperties(img,['system:time_start','system:time_end']);
}).mean();



print(chl);
Map.addLayer(chl);

1 Answer 1

5

^ is not the exponent operator, ** is (^ is xor). See https://developers.google.com/earth-engine/image_math:

enter image description here

Hence this line:

var index = bands.expression('10.0 ^ (0.283 + (-2.753 * R) + (1.457 * R^2) + (0.659 * R^3) + (-1.403 * R^4))' ,{'R':R});

should read:

var index = bands.expression('10.0**(0.283 + (-2.753 * R) + (1.457 * R**2) + (0.659 * R**3) + (-1.403 * R**4))' ,{'R':R});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.