[GRASS-SVN] r62245 - in grass/trunk/raster: r.in.bin r.out.bin
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Oct 12 05:08:22 PDT 2014
Author: glynn
Date: 2014-10-12 05:08:22 -0700 (Sun, 12 Oct 2014)
New Revision: 62245
Modified:
grass/trunk/raster/r.in.bin/main.c
grass/trunk/raster/r.out.bin/main.c
Log:
Explicit support for null=nan
Modified: grass/trunk/raster/r.in.bin/main.c
===================================================================
--- grass/trunk/raster/r.in.bin/main.c 2014-10-10 16:23:33 UTC (rev 62244)
+++ grass/trunk/raster/r.in.bin/main.c 2014-10-12 12:08:22 UTC (rev 62245)
@@ -228,7 +228,7 @@
const char *outpre;
char output[GNAME_MAX];
const char *title;
- double null_val = 0;
+ double null_val = 0.0/0.0;
int is_fp;
int is_signed;
int bytes, hbytes;
@@ -494,7 +494,7 @@
if (bytes != 1 && bytes != 2 && bytes != 4 && bytes != 8)
G_fatal_error(_("%s= must be 1, 2, 4 or 8"), parm.bytes->key);
- if (parm.null->answer)
+ if (parm.null->answer && G_strcasecmp(parm.null->answer, "nan") != 0)
null_val = atof(parm.null->answer);
cellhd.zone = G_zone();
Modified: grass/trunk/raster/r.out.bin/main.c
===================================================================
--- grass/trunk/raster/r.out.bin/main.c 2014-10-10 16:23:33 UTC (rev 62244)
+++ grass/trunk/raster/r.out.bin/main.c 2014-10-12 12:08:22 UTC (rev 62245)
@@ -341,7 +341,9 @@
if (G_parser(argc, argv))
exit(EXIT_FAILURE);
- if (sscanf(parm.null->answer, "%lf", &null_val) != 1)
+ if (G_strcasecmp(parm.null->answer, "nan") == 0)
+ Rast_set_d_null_value(&null_val, 1);
+ else if (sscanf(parm.null->answer, "%lf", &null_val) != 1)
G_fatal_error(_("Invalid value for null (integers only)"));
name = parm.input->answer;
More information about the grass-commit
mailing list