[GRASS-dev] Reading Float64 data as double using r.in.gdal

Upendra Dadi udadi at gmu.edu
Thu Oct 15 12:53:36 EDT 2009


Hi,
  I found this in the r.in.gdal documentation:

"Float32 and Float64 type bands are translated as GRASS floating point cells (but not double precision ... this could be added if needed)"

I guess r.out.gdal can translate DCELL_TYPE into Float64. Why is Float64 translated to FCELL_TYPE instead DCELL_TYPE? What is the reason for the discrepancy? What should I do to allow transformation of Float64 into DCELL_TYPE?

In main function(using C) for r.in.gdal, there is a function named importBand():

eRawGDT = GDALGetRasterDataType(hBand);

    switch (eRawGDT) {
    case GDT_Float32:
    case GDT_Float64:
	data_type = FCELL_TYPE;
	eGDT = GDT_Float32;
	complex = FALSE;
	break;

Would re-writing this to the following(and making some changes in the subsequent code) wouldn't work?:

    case GDT_Float32:
        data_type = FCELL_TYPE;
	eGDT = GDT_Float32;
	complex = FALSE;
	break;
    case GDT_Float64:
	data_type = DCELL_TYPE;
	eGDT = GDT_Float64;
	complex = FALSE;
	break;

Any suggestions are greatly appreciated. Thank you.

Regards,
Upendra



More information about the grass-dev mailing list