i.atcorr uses the isnan() function which seems to cause
compilation to fail on Windows:
....
main.cpp includes <cmath>; I wonder if the problem is
due to the fact isnan() is a C99 function? Should it be changed?
if it helps, there is a is_nan() in r.in.mat/main.c:
int is_nan(void *p, RASTER_MAP_TYPE dtype)
{
/* fn to test if incoming data point is either a IEEE NaN or a GRASS CELL null
*
* Takes a value of type RASTER_MAP_TYPE stored at memory address "p"
* Returns 1 if we think it is a null, 0 otherwise
*/
On closer inspection (and using a comment in the code as a hint), I think i.atcorr is using isnan() where it wants to be using G_is_f_null_value(), i.e. this:
/* TODO: use G_set_f_null_value()?? */
if(vis && isnan(vis[col]) || alt && isnan(alt[col]) || isnan(buf[col])) {buf[col] = FP_NAN; continue;}
should really be:
if(vis && G_is_f_null_value(&vis[col]) ||
alt && G_is_f_null_value(&alt[col]) ||
G_is_f_null_value(&buf[col]))
{
G_set_f_null_value(&buf[col], 1);
continue;
}
>> main.cpp includes <cmath>; I wonder if the problem is due to the fact
>> isnan() is a C99 function? Should it be changed?
>
> Yes. This came up about a month ago:
>
> http://lists.osgeo.org/pipermail/grass-dev/2008-September/039910.html
>
> I thought it had been fixed already.
On closer inspection (and using a comment in the code as a hint), I think
i.atcorr is using isnan() where it wants to be using G_is_f_null_value(),
i.e. this:
/* TODO: use G_set_f_null_value()?? */
if(vis && isnan(vis[col]) || alt && isnan(alt[col]) || isnan(buf[col])) {buf[col] = FP_NAN; continue;}
should really be:
if(vis && G_is_f_null_value(&vis[col]) ||
alt && G_is_f_null_value(&alt[col]) ||
G_is_f_null_value(&buf[col]))
{
G_set_f_null_value(&buf[col], 1);
continue;
}
Any objections to me committing this?
None here.
FWIW, I've changed G_is_[fd]_null_value() to treat all NaNs as nulls,
not just the all-ones bit pattern.