l2gen algorithm - source code error
Posted: Tue May 30, 2023 3:31 pm America/New_York
Hi.
I was looking at the source codes of l2gen algorithm on page: https://oceancolor.gsfc.nasa.gov/docs/ocssw/get__chl_8c_source.html
At this part of the code
252 float chl_oci(l2str *l2rec, float Rrs[]) {
253 static float t1 = 0.25;
254 static float t2 = 0.35;
255
256 float chl1 = chlbad;
257 float chl2 = chlbad;
258 float chl = chlbad;
259
260 chl1 = chl_hu(l2rec, Rrs);
261 if (chl1 <= t1)
262 chl = chl1;
263 else {
264 chl2 = get_chl_ocx(l2rec, Rrs);
265 if (chl2 > 0.0) {
266 if (chl1 >= t2)
267 chl = chl2;
268 else {
269 chl = chl1 * (t2 - chl1) / (t2 - t1)
270 + chl2 * (chl1 - t1) / (t2 - t1);
271 }
272 }
273 }
274
275 return (chl);
276 }
in line 266 (bold) is it right compare chl1 >= t2 ?? At this point the right way should not be: chl2 >= t2?
I was looking at the source codes of l2gen algorithm on page: https://oceancolor.gsfc.nasa.gov/docs/ocssw/get__chl_8c_source.html
At this part of the code
252 float chl_oci(l2str *l2rec, float Rrs[]) {
253 static float t1 = 0.25;
254 static float t2 = 0.35;
255
256 float chl1 = chlbad;
257 float chl2 = chlbad;
258 float chl = chlbad;
259
260 chl1 = chl_hu(l2rec, Rrs);
261 if (chl1 <= t1)
262 chl = chl1;
263 else {
264 chl2 = get_chl_ocx(l2rec, Rrs);
265 if (chl2 > 0.0) {
266 if (chl1 >= t2)
267 chl = chl2;
268 else {
269 chl = chl1 * (t2 - chl1) / (t2 - t1)
270 + chl2 * (chl1 - t1) / (t2 - t1);
271 }
272 }
273 }
274
275 return (chl);
276 }
in line 266 (bold) is it right compare chl1 >= t2 ?? At this point the right way should not be: chl2 >= t2?