[GRASS-SVN] r69793 - grass/trunk/imagery/i.landsat.toar
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Nov 9 01:34:18 PST 2016
Author: neteler
Date: 2016-11-09 01:34:18 -0800 (Wed, 09 Nov 2016)
New Revision: 69793
Modified:
grass/trunk/imagery/i.landsat.toar/landsat.c
Log:
i.landsat.toar: avoid endless loop and exit if approximation of atmospheric transmittance coefficients is unstable (DOS4 method) (contributed by Dmitry Kolesov, fix #2918)
Modified: grass/trunk/imagery/i.landsat.toar/landsat.c
===================================================================
--- grass/trunk/imagery/i.landsat.toar/landsat.c 2016-11-08 20:24:21 UTC (rev 69792)
+++ grass/trunk/imagery/i.landsat.toar/landsat.c 2016-11-09 09:34:18 UTC (rev 69793)
@@ -2,6 +2,7 @@
#include <stdlib.h>
#include <math.h>
#include <grass/gis.h>
+#include <grass/glocale.h>
#include "landsat.h"
@@ -111,6 +112,8 @@
TAUv = Tv;
Lp = Ro - percent * TAUv * (lsat->band[i].esun * sin_e * TAUz + PI * Lp) / pi_d2;
Tz = 1. - (4. * pi_d2 * Lp) / (lsat->band[i].esun * sin_e);
+ if (Tz <= 0)
+ G_fatal_error(_("The DOS4 method is not applicable here: approximation of atmospheric transmittance coefficients is unstable. Use another DOS method or use other sun_elevation parameter"));
Tv = exp(sin_e * log(Tz) / cos_v);
} while (TAUv != Tv && TAUz != Tz);
TAUz = (Tz < 1. ? Tz : 1.);
More information about the grass-commit
mailing list