[R-sig-Geo] Bug in brick() (raster package)?

Robert J. Hijmans r.hijmans at gmail.com
Tue Feb 9 20:18:02 CET 2010


Hi Agus, Thanks for reporing this. It is not really a bug, as what is
reported by   dataType(object)   is used for reading native formats
and for writing. When I developed this, GDALinfo did not report the
data type (or perhaps I missed it).  I shall update the value in the
Raster* object accordingly to reflect the true data type; if anything
to avoid confusion.  Robert

On Tue, Feb 9, 2010 at 10:42 AM, Agustin Lobo <alobolistas at gmail.com> wrote:
> I might have found a bug in raster while trying to set the xlim for
> my histograms taking into account whether input files are 8 or 16 bits.
> In the following, note that GDALinfo reports one file as Byte and the
> other one as UInt16, while brick() sets the same file at datanotation slot
> for both files:
>
>>
>> GDALinfo("/media/Transcend/MONTSENY2008/Montseny20090409/TiffOri/sdim0373.tif")
> CPL Warning 1: TIFFReadDirectory:Unknown field with tag 37717 (0x9355)
> encountered
> rows        1760
> columns     2640
> bands       3
> origin.x        0
> origin.y        0
> res.x       1
> res.y       1
> oblique.x   0
> oblique.y   0
> driver      GTiff
> projection  NA
> file
>  /media/Transcend/MONTSENY2008/Montseny20090409/TiffOri/sdim0373.tif
> apparent band summary:
>  GDType Bmin Bmax
> 1   Byte    0  255
> 2   Byte    0  255
> 3   Byte    0  255
> Metadata:
> TIFFTAG_SOFTWARE=SIGMA PhotoPro 2.5.0.3250
> TIFFTAG_DATETIME=2010:02:09 17:25:29
> TIFFTAG_XRESOLUTION=180
> TIFFTAG_YRESOLUTION=180
> TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
> Warning message:
> In
> GDALinfo("/media/Transcend/MONTSENY2008/Montseny20090409/TiffOri/sdim0373.tif")
> :
>  GeoTransform values not available
>
>> r <-
>> brick("/media/Transcend/MONTSENY2008/Montseny20090409/TiffOri/sdim0373.tif")
> CPL Warning 1: TIFFReadDirectory:Unknown field with tag 37717 (0x9355)
> encountered
> Warning message:
> In GDALinfo(filename) : GeoTransform values not available
>
>> r at file@datanotation
> [1] "FLT4S"
>
>>
>> GDALinfo("/media/Transcend/MONTSENY2008/Montseny20090409/TiffOri/sdim0402.tif")
> CPL Warning 1: TIFFReadDirectory:Unknown field with tag 37717 (0x9355)
> encountered
> rows        3048
> columns     4573
> bands       3
> origin.x        0
> origin.y        0
> res.x       1
> res.y       1
> oblique.x   0
> oblique.y   0
> driver      GTiff
> projection  NA
> file
>  /media/Transcend/MONTSENY2008/Montseny20090409/TiffOri/sdim0402.tif
> apparent band summary:
>  GDType Bmin  Bmax
> 1 UInt16    0 65535
> 2 UInt16    0 65535
> 3 UInt16    0 65535
> Metadata:
> TIFFTAG_SOFTWARE=SIGMA PhotoPro 2.5.0.3250
> TIFFTAG_DATETIME=2009:11:05 09:08:39
> TIFFTAG_XRESOLUTION=180
> TIFFTAG_YRESOLUTION=180
> TIFFTAG_RESOLUTIONUNIT=2 (pixels/inch)
> Warning message:
> In
> GDALinfo("/media/Transcend/MONTSENY2008/Montseny20090409/TiffOri/sdim0402.tif")
> :
>  GeoTransform values not available
>
>> r <-
>> brick("/media/Transcend/MONTSENY2008/Montseny20090409/TiffOri/sdim0402.tif")
> CPL Warning 1: TIFFReadDirectory:Unknown field with tag 37717 (0x9355)
> encountered
> Warning message:
> In GDALinfo(filename) : GeoTransform values not available
>
>> r at file@datanotation
> [1] "FLT4S"
>
> Hope this is useful
>
> Agus
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



More information about the R-sig-Geo mailing list