[GRASS-SVN] r42120 - grass/trunk/raster/r.out.gdal

svn_grass at osgeo.org svn_grass at osgeo.org
Wed May 5 09:25:16 EDT 2010


Author: mmetz
Date: 2010-05-05 09:25:16 -0400 (Wed, 05 May 2010)
New Revision: 42120

Modified:
   grass/trunk/raster/r.out.gdal/export_band.c
   grass/trunk/raster/r.out.gdal/main.c
Log:
human-readable numbers, backport from devbr

Modified: grass/trunk/raster/r.out.gdal/export_band.c
===================================================================
--- grass/trunk/raster/r.out.gdal/export_band.c	2010-05-05 13:22:33 UTC (rev 42119)
+++ grass/trunk/raster/r.out.gdal/export_band.c	2010-05-05 13:25:16 UTC (rev 42120)
@@ -164,10 +164,11 @@
 	    G_percent(row + 1, rows, 2);
 	}
     }
+    G_debug(1, "min %g max %g", dfCellMin, dfCellMax);
 
     /* can the GDAL datatype hold the data range to be exported ? */
     /* f-flag does not override */
-    if (exact_range_check(export_datatype, dfCellMin, dfCellMax, name)) {
+    if (exact_range_check(dfCellMin, dfCellMax, export_datatype, name)) {
 	G_warning("Raster export results in data loss.");
 	ret = -2;
     }
@@ -181,7 +182,7 @@
 				(int)nodataval, nodatakey);
 	else
 	    G_important_message(_("Input raster map contains cells with NULL-value (no-data). "
-				 "The value %f will be used to represent no-data values in the input map. "
+				 "The value %g will be used to represent no-data values in the input map. "
 				 "You can specify a nodata value with the %s option."),
 				nodataval, nodatakey);
     }
@@ -479,7 +480,7 @@
 	    G_warning(_("GDAL datatype: %s, range: %d - %d"),
 		      GDALGetDataTypeName(datatype), TYPE_BYTE_MIN,
 		      TYPE_BYTE_MAX);
-	    G_warning(_("Raster map <%s> range: %f - %f"), name, min, max);
+	    G_warning(_("Raster map <%s> range: %g - %g"), name, min, max);
 	    return 1;
 	}
 	else
@@ -491,7 +492,7 @@
 	    G_warning(_("GDAL datatype: %s, range: %d - %d"),
 		      GDALGetDataTypeName(datatype), TYPE_UINT16_MIN,
 		      TYPE_UINT16_MAX);
-	    G_warning(_("Raster map <%s> range: %f - %f"), name, min, max);
+	    G_warning(_("Raster map <%s> range: %g - %g"), name, min, max);
 	    return 1;
 	}
 	else
@@ -504,7 +505,7 @@
 	    G_warning(_("GDAL datatype: %s, range: %d - %d"),
 		      GDALGetDataTypeName(datatype), TYPE_INT16_MIN,
 		      TYPE_INT16_MAX);
-	    G_warning(_("Raster map <%s> range: %f - %f"), name, min, max);
+	    G_warning(_("Raster map <%s> range: %g - %g"), name, min, max);
 	    return 1;
 	}
 	else
@@ -517,7 +518,7 @@
 	    G_warning(_("GDAL datatype: %s, range: %d - %d"),
 		      GDALGetDataTypeName(datatype), TYPE_INT32_MIN,
 		      TYPE_INT32_MAX);
-	    G_warning(_("Raster map <%s> range: %f - %f"), name, min, max);
+	    G_warning(_("Raster map <%s> range: %g - %g"), name, min, max);
 	    return 1;
 	}
 	else
@@ -529,7 +530,7 @@
 	    G_warning(_("GDAL datatype: %s, range: %u - %u"),
 		      GDALGetDataTypeName(datatype), TYPE_UINT32_MIN,
 		      TYPE_UINT32_MAX);
-	    G_warning(_("Raster map <%s> range: %f - %f"), name, min, max);
+	    G_warning(_("Raster map <%s> range: %g - %g"), name, min, max);
 	    return 1;
 	}
 	else
@@ -539,10 +540,10 @@
     case GDT_CFloat32:
 	if (min < TYPE_FLOAT32_MIN || max > TYPE_FLOAT32_MAX) {
 	    G_warning(_("Selected GDAL datatype does not cover data range."));
-	    G_warning(_("GDAL datatype: %s, range: %f - %f"),
+	    G_warning(_("GDAL datatype: %s, range: %g - %g"),
 		      GDALGetDataTypeName(datatype), TYPE_FLOAT32_MIN,
 		      TYPE_FLOAT32_MAX);
-	    G_warning(_("Raster map <%s> range: %f - %f"), name, min, max);
+	    G_warning(_("Raster map <%s> range: %g - %g"), name, min, max);
 	    return 1;
 	}
 	else
@@ -553,10 +554,10 @@
 	/* not possible because DCELL is FLOAT64, not 128bit floating point, but anyway... */
 	if (min < TYPE_FLOAT64_MIN || max > TYPE_FLOAT64_MAX) {
 	    G_warning(_("Selected GDAL datatype does not cover data range."));
-	    G_warning(_("GDAL datatype: %s, range: %f - %f"),
+	    G_warning(_("GDAL datatype: %s, range: %g - %g"),
 		      GDALGetDataTypeName(datatype), TYPE_FLOAT64_MIN,
 		      TYPE_FLOAT64_MAX);
-	    G_warning(_("Raster map <%s> range: %f - %f"), name, min, max);
+	    G_warning(_("Raster map <%s> range: %g - %g"), name, min, max);
 	    return 1;
 	}
 	else

Modified: grass/trunk/raster/r.out.gdal/main.c
===================================================================
--- grass/trunk/raster/r.out.gdal/main.c	2010-05-05 13:22:33 UTC (rev 42119)
+++ grass/trunk/raster/r.out.gdal/main.c	2010-05-05 13:25:16 UTC (rev 42120)
@@ -502,7 +502,7 @@
 	     &cellhead, maptype, nodataval, nodataopt->key,
 	     default_nodataval);
 
-	/* nodata problem */
+	/* nodata value is present in the data to be exported */
 	if (retval == -1) {
 	    if (flag_f->answer)
 		G_warning(_("Forcing raster export."));
@@ -631,7 +631,7 @@
 	    G_warning(_("GDAL datatype: %s, range: %d - %d"),
 		      GDALGetDataTypeName(datatype), TYPE_BYTE_MIN,
 		      TYPE_BYTE_MAX);
-	    G_warning(_("Range to be exported: %f - %f"), min, max);
+	    G_warning(_("Range to be exported: %g - %g"), min, max);
 	    return 1;
 	}
 	else
@@ -643,7 +643,7 @@
 	    G_warning(_("GDAL datatype: %s, range: %d - %d"),
 		      GDALGetDataTypeName(datatype), TYPE_UINT16_MIN,
 		      TYPE_UINT16_MAX);
-	    G_warning(_("Range to be exported: %f - %f"), min, max);
+	    G_warning(_("Range to be exported: %g - %g"), min, max);
 	    return 1;
 	}
 	else
@@ -656,7 +656,7 @@
 	    G_warning(_("GDAL datatype: %s, range: %d - %d"),
 		      GDALGetDataTypeName(datatype), TYPE_INT16_MIN,
 		      TYPE_INT16_MAX);
-	    G_warning(_("Range to be exported: %f - %f"), min, max);
+	    G_warning(_("Range to be exported: %g - %g"), min, max);
 	    return 1;
 	}
 	else
@@ -669,7 +669,7 @@
 	    G_warning(_("GDAL datatype: %s, range: %d - %d"),
 		      GDALGetDataTypeName(datatype), TYPE_INT32_MIN,
 		      TYPE_INT32_MAX);
-	    G_warning(_("Range to be exported: %f - %f"), min, max);
+	    G_warning(_("Range to be exported: %g - %g"), min, max);
 	    return 1;
 	}
 	else
@@ -681,7 +681,7 @@
 	    G_warning(_("GDAL datatype: %s, range: %u - %u"),
 		      GDALGetDataTypeName(datatype), TYPE_UINT32_MIN,
 		      TYPE_UINT32_MAX);
-	    G_warning(_("Range to be exported: %f - %f"), min, max);
+	    G_warning(_("Range to be exported: %g - %g"), min, max);
 	    return 1;
 	}
 	else
@@ -694,7 +694,7 @@
 	    G_warning(_("GDAL datatype: %s, range: %g - %g"),
 		      GDALGetDataTypeName(datatype), TYPE_FLOAT32_MIN,
 		      TYPE_FLOAT32_MAX);
-	    G_warning(_("Range to be exported: %f - %f"), min, max);
+	    G_warning(_("Range to be exported: %g - %g"), min, max);
 	    return 1;
 	}
 	else
@@ -719,7 +719,7 @@
 	 * accordingly below for the other GDAL types */
 	if (nodataval != (double)(GByte)(CELL) nodataval) {
 	    G_warning(_("Mismatch between metadata nodata value and actual nodata value in exported raster: "
-		       "specified nodata value %f gets converted to %d by selected GDAL datatype."),
+		       "specified nodata value %g gets converted to %d by selected GDAL datatype."),
 		      nodataval, (GByte)(CELL) nodataval);
 	    G_warning(_("GDAL datatype: %s, valid range: %d - %d"),
 		      GDALGetDataTypeName(datatype), TYPE_BYTE_MIN,
@@ -732,7 +732,7 @@
     case GDT_UInt16:
 	if (nodataval != (double)(GUInt16)(CELL) nodataval) {
 	    G_warning(_("Mismatch between metadata nodata value and actual nodata value in exported raster: "
-		       "specified nodata value %f gets converted to %d by selected GDAL datatype."),
+		       "specified nodata value %g gets converted to %d by selected GDAL datatype."),
 		      nodataval, (GUInt16)(CELL) nodataval);
 	    G_warning(_("GDAL datatype: %s, valid range: %u - %u"),
 		      GDALGetDataTypeName(datatype), TYPE_UINT16_MIN,
@@ -746,7 +746,7 @@
     case GDT_CInt16:
 	if (nodataval != (double)(GInt16)(CELL) nodataval) {
 	    G_warning(_("Mismatch between metadata nodata value and actual nodata value in exported raster: "
-		       "specified nodata value %f gets converted to %d by selected GDAL datatype."),
+		       "specified nodata value %g gets converted to %d by selected GDAL datatype."),
 		      nodataval, (GInt16)(CELL) nodataval);
 	    G_warning(_("GDAL datatype: %s, valid range: %d - %d"),
 		      GDALGetDataTypeName(datatype), TYPE_INT16_MIN,
@@ -759,7 +759,7 @@
     case GDT_UInt32:
 	if (nodataval != (double)(GUInt32)(DCELL) nodataval) {
 	    G_warning(_("Mismatch between metadata nodata value and actual nodata value in exported raster: "
-		       "specified nodata value %f gets converted to %d by selected GDAL datatype."),
+		       "specified nodata value %g gets converted to %d by selected GDAL datatype."),
 		      nodataval, (GUInt32)(DCELL) nodataval);
 	    G_warning(_("GDAL datatype: %s, valid range: %u - %u"),
 		      GDALGetDataTypeName(datatype), TYPE_UINT32_MIN,
@@ -774,7 +774,7 @@
     	/* GInt32 is equal to CELL, but that may change in the future */
 	if (nodataval != (double)(GInt32)(CELL) nodataval) {
 	    G_warning(_("Mismatch between metadata nodata value and actual nodata value in exported raster: "
-		       "specified nodata value %f gets converted to %d by selected GDAL datatype."),
+		       "specified nodata value %g gets converted to %d by selected GDAL datatype."),
 		      nodataval, (GInt32)(CELL) nodataval);
 	    G_warning(_("GDAL datatype: %s, valid range: %d - %d"),
 		      GDALGetDataTypeName(datatype), TYPE_INT32_MIN,
@@ -788,7 +788,7 @@
     case GDT_CFloat32:
 	if (nodataval != (double)(float) nodataval) {
 	    G_warning(_("Mismatch between metadata nodata value and actual nodata value in exported raster: "
-		       "specified nodata value %f gets converted to %f by selected GDAL datatype."),
+		       "specified nodata value %g gets converted to %g by selected GDAL datatype."),
 		      nodataval, (float) nodataval);
 	    G_warning(_("GDAL datatype: %s, valid range: %g - %g"),
 		      GDALGetDataTypeName(datatype), TYPE_FLOAT32_MIN,



More information about the grass-commit mailing list