[GRASS-SVN] r50821 - grass/trunk/raster/r.in.gdal
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Feb 15 12:34:13 EST 2012
Author: martinl
Date: 2012-02-15 09:34:13 -0800 (Wed, 15 Feb 2012)
New Revision: 50821
Modified:
grass/trunk/raster/r.in.gdal/main.c
Log:
r.in.gdal: add some more debug messages
Modified: grass/trunk/raster/r.in.gdal/main.c
===================================================================
--- grass/trunk/raster/r.in.gdal/main.c 2012-02-15 09:33:48 UTC (rev 50820)
+++ grass/trunk/raster/r.in.gdal/main.c 2012-02-15 17:34:13 UTC (rev 50821)
@@ -249,10 +249,11 @@
/* -------------------------------------------------------------------- */
hDS = GDALOpen(input, GA_ReadOnly);
if (hDS == NULL)
- return 1;
+ exit(EXIT_FAILURE);
hDriver = GDALGetDatasetDriver(hDS); /* needed for AVHRR data */
/* L1B - NOAA/AVHRR data must be treated differently */
/* for hDriver names see gdal/frmts/gdalallregister.cpp */
+ G_debug(3, "GDAL Driver: %s", GDALGetDriverShortName(hDriver));
if (strcmp(GDALGetDriverShortName(hDriver), "L1B") != 0)
l1bdriver = 0;
else {
@@ -262,9 +263,14 @@
"thin plate spline rectification instead. (-tps)"));
}
+ /* zero cell header */
+ G_zero(&cellhd, sizeof(struct Cell_head));
+
/* -------------------------------------------------------------------- */
/* Set up the window representing the data we have. */
/* -------------------------------------------------------------------- */
+ G_debug(3, "GDAL size: row = %d, col = %d", GDALGetRasterYSize(hDS),
+ GDALGetRasterXSize(hDS));
cellhd.rows = GDALGetRasterYSize(hDS);
cellhd.rows3 = GDALGetRasterYSize(hDS);
cellhd.cols = GDALGetRasterXSize(hDS);
@@ -504,9 +510,12 @@
I_init_group_ref(&ref);
+ colornamebuf2[0] = '\0';
for (nBand = 1; nBand <= GDALGetRasterCount(hDS); nBand++) {
+ G_debug(3, "Import raster band %d", nBand);
hBand = GDALGetRasterBand(hDS, nBand);
- hBand = GDALGetRasterBand(hDS, nBand);
+ if (!hBand)
+ G_fatal_error(_("Unable to get raster band number %d"), nBand);
if (!flag_k->answer) {
/* use channel color names if present: */
strcpy(colornamebuf,
@@ -722,7 +731,7 @@
/* Select a cell type for the new cell. */
/* -------------------------------------------------------------------- */
eRawGDT = GDALGetRasterDataType(hBand);
-
+
switch (eRawGDT) {
case GDT_Float32:
case GDT_Float64:
More information about the grass-commit
mailing list