List Info

Thread: cant read raster created with r.neighbours




cant read raster created with r.neighbours
user name
2007-07-26 06:07:54
Hi,
some strange stuff happened today:

in R:
this works fine:
elev<-readRAST6("dem3arcsec_srtm_reprojected")
slope<-readRAST6("dem3arcsec_srtm_reprojected_slope&
quot;)

but this
slope<-readRAST6("dem3arcsec_srtm_reprojected_slope_
avg")
gves

Creating BIL support files ...
Header File = wld
World File =
/home/guano/grassdata/srtm_krig_utm/death_valley/.tmp/eclips
e/dem3arcsec_srtm_reprojected_slope_avg.wld
Exporting Raster as floating values (bytes=4)
Using the Current Region settings ...
north=4031000.000000
south=4002650.000000
east=494850.000000
west=466500.000000
r=315
c=315
 100%
Error in readBinGrid(rtmpfl11, colname = vname[i],
proj4string = p4,
integer = to_int) :
        no such file:
/home/guano/grassdata/srtm_krig_utm/death_valley/.tmp/eclips
e/dem3arcsec_srtm_reprojected_slope_avg.hdr



the last map was created with
r.neighbors input=dem3arcsec_srtm_reprojected_slope
output=dem3arcsec_srtm_reprojected_slope_avg method=average
size=3
--overwrite


I'm lost..

tks

-- 
+-----------------------------------------------------------
+
              Carlos Henrique Grohmann - Guano
  Visiting Researcher at Kingston University bond - UK
  Geologist M.Sc  - Doctorate Student at IGc-USP - Brazil
Linux User #89721  - carlos dot grohmann at gmail dot com
+-----------------------------------------------------------
+
_________________
"Good morning, doctors. I have taken the liberty of
removing Windows
95 from my hard drive."
--The winning entry in a "What were HAL's first
words" contest judged
by 2001: A SPACE ODYSSEY creator Arthur C. Clarke

Can't stop the signal.

_______________________________________________
statsgrass mailing list
statsgrassgrass.itc.it
http:
//grass.itc.it/mailman/listinfo/statsgrass

Re: cant read raster created with r.neighbours
country flaguser name
Poland
2007-07-26 07:42:59
Carlos "Guâno" Grohmann wrote:
> Hi,
> some strange stuff happened today:
>
> in R:
> this works fine:
>
elev<-readRAST6("dem3arcsec_srtm_reprojected")
>
slope<-readRAST6("dem3arcsec_srtm_reprojected_slope&
quot;)
>
> but this
>
slope<-readRAST6("dem3arcsec_srtm_reprojected_slope_
avg")
> gves
>
> Creating BIL support files ...
> Header File = wld
> World File =
>
/home/guano/grassdata/srtm_krig_utm/death_valley/.tmp/eclips
e/dem3arcsec_srtm_reprojected_slope_avg.wld 
>
> Exporting Raster as floating values (bytes=4)
> Using the Current Region settings ...
> north=4031000.000000
> south=4002650.000000
> east=494850.000000
> west=466500.000000
> r=315
> c=315
> 100%
> Error in readBinGrid(rtmpfl11, colname = vname[i],
proj4string = p4,
> integer = to_int) :
>        no such file:
>
/home/guano/grassdata/srtm_krig_utm/death_valley/.tmp/eclips
e/dem3arcsec_srtm_reprojected_slope_avg.hdr 
>
>
>
>
> the last map was created with
> r.neighbors input=dem3arcsec_srtm_reprojected_slope
> output=dem3arcsec_srtm_reprojected_slope_avg
method=average size=3
> --overwrite
>
>
> I'm lost..
>
> tks
>
try to create a file with little shorter name....

_______________________________________________
statsgrass mailing list
statsgrassgrass.itc.it
http:
//grass.itc.it/mailman/listinfo/statsgrass

Re: cant read raster created with r.neighbours
user name
2007-07-26 11:27:58
Yes, it works..
I wonder why... I mean, who can't deal with long names? R?

cheers

On 7/26/07, Jarek Jasiewicz <jarekjamu.edu.pl> wrote:
> Carlos "Guâno" Grohmann wrote:
> > Hi,
> > some strange stuff happened today:
> >
> > in R:
> > this works fine:
> >
elev<-readRAST6("dem3arcsec_srtm_reprojected")
> >
slope<-readRAST6("dem3arcsec_srtm_reprojected_slope&
quot;)
> >
> > but this
> >
slope<-readRAST6("dem3arcsec_srtm_reprojected_slope_
avg")
> > gves
> >
> > Creating BIL support files ...
> > Header File = wld
> > World File =
> >
/home/guano/grassdata/srtm_krig_utm/death_valley/.tmp/eclips
e/dem3arcsec_srtm_reprojected_slope_avg.wld
> >
> > Exporting Raster as floating values (bytes=4)
> > Using the Current Region settings ...
> > north=4031000.000000
> > south=4002650.000000
> > east=494850.000000
> > west=466500.000000
> > r=315
> > c=315
> > 100%
> > Error in readBinGrid(rtmpfl11, colname = vname[i],
proj4string = p4,
> > integer = to_int) :
> >        no such file:
> >
/home/guano/grassdata/srtm_krig_utm/death_valley/.tmp/eclips
e/dem3arcsec_srtm_reprojected_slope_avg.hdr
> >
> >
> >
> >
> > the last map was created with
> > r.neighbors
input=dem3arcsec_srtm_reprojected_slope
> > output=dem3arcsec_srtm_reprojected_slope_avg
method=average size=3
> > --overwrite
> >
> >
> > I'm lost..
> >
> > tks
> >
> try to create a file with little shorter name....
>


-- 
+-----------------------------------------------------------
+
              Carlos Henrique Grohmann - Guano
  Visiting Researcher at Kingston University bond - UK
  Geologist M.Sc  - Doctorate Student at IGc-USP - Brazil
Linux User #89721  - carlos dot grohmann at gmail dot com
+-----------------------------------------------------------
+
_________________
"Good morning, doctors. I have taken the liberty of
removing Windows
95 from my hard drive."
--The winning entry in a "What were HAL's first
words" contest judged
by 2001: A SPACE ODYSSEY creator Arthur C. Clarke

Can't stop the signal.

_______________________________________________
statsgrass mailing list
statsgrassgrass.itc.it
http:
//grass.itc.it/mailman/listinfo/statsgrass

Re: cant read raster created with r.neighbours
country flaguser name
Norway
2007-07-26 11:58:17
On Thu, 26 Jul 2007, Carlos "Guâno" Grohmann
wrote:

> Yes, it works..
> I wonder why... I mean, who can't deal with long names?
R?

Not R in principle, I think, but if you run
debug(readBinGrid) first, and 
repeat with the long names, you can step through and see
whether the files 
get created in the location temporary directory with the
correct names, 
pointing list.files() at the right place. It looks like a
128-byte buffer 
somewhere, though GRASS filenames are GNAME_MAX (256) long,
and the 
offending string was only 104 characters. The temporary
files get deleted 
on exit.

list.files(dirname(fname))

within debug should show what is in the temporary
directory.

Roger

>
> cheers
>
> On 7/26/07, Jarek Jasiewicz <jarekjamu.edu.pl> wrote:
>>  Carlos "Guâno" Grohmann wrote:
>> >  Hi,
>> >  some strange stuff happened today:
>> > 
>> >  in R:
>> >  this works fine:
>> > 
elev<-readRAST6("dem3arcsec_srtm_reprojected")
>> > 
slope<-readRAST6("dem3arcsec_srtm_reprojected_slope&
quot;)
>> > 
>> >  but this
>> > 
slope<-readRAST6("dem3arcsec_srtm_reprojected_slope_
avg")
>> >  gves
>> > 
>> >  Creating BIL support files ...
>> >  Header File = wld
>> >  World File =
>> > 
/home/guano/grassdata/srtm_krig_utm/death_valley/.tmp/eclips
e/dem3arcsec_srtm_reprojected_slope_avg.wld
>> > 
>> >  Exporting Raster as floating values
(bytes=4)
>> >  Using the Current Region settings ...
>> >  north=4031000.000000
>> >  south=4002650.000000
>> >  east=494850.000000
>> >  west=466500.000000
>> >  r=315
>> >  c=315
>> >  100%
>> >  Error in readBinGrid(rtmpfl11, colname =
vname[i], proj4string = p4,
>> >  integer = to_int) :
>> >         no such file:
>> > 
/home/guano/grassdata/srtm_krig_utm/death_valley/.tmp/eclips
e/dem3arcsec_srtm_reprojected_slope_avg.hdr
>> > 
>> > 
>> > 
>> > 
>> >  the last map was created with
>> >  r.neighbors
input=dem3arcsec_srtm_reprojected_slope
>> >  output=dem3arcsec_srtm_reprojected_slope_avg
method=average size=3
>> >  --overwrite
>> > 
>> > 
>> >  I'm lost..
>> > 
>> >  tks
>> >
>>  try to create a file with little shorter name....
>> 
>
>
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics,
Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045
Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivandnhh.no

_______________________________________________
statsgrass mailing list
statsgrassgrass.itc.it
http:
//grass.itc.it/mailman/listinfo/statsgrass

Re: cant read raster created with r.neighbours
user name
2007-07-26 12:15:37
Here is the debug output:

> debug(readBinGrid)
>
slopeavg<-readRAST6("dem3arcsec_srtm_reprojected_slo
pe_avg2")
Creating BIL support files ...
Header File = .wld
World File =
/home/guano/grassdata/srtm_krig_utm/death_valley/.tmp/eclips
e/dem3arcsec_srtm_reprojected_slope_avg2.wld
Exporting Raster as floating values (bytes=4)
Using the Current Region settings ...
north=4031000.000000
south=4002650.000000
east=494850.000000
west=466500.000000
r=315
c=315
 100%
debugging in: readBinGrid(rtmpfl11, colname = vname[i],
proj4string =
p4, integer = to_int)
debug: {
    if (missing(integer))
        stop("integer TRUE/FALSE required")
    if (!file.exists(fname))
        stop(paste("no such file:", fname))
    if (!file.exists(paste(fname, "hdr", sep =
".")))
        stop(paste("no such file:", paste(fname,
"hdr", sep = ".")))
    if (!file.exists(paste(fname, "wld", sep =
".")))
        stop(paste("no such file:", paste(fname,
"wld", sep = ".")))
    con <- file(paste(fname, "hdr", sep =
"."), "r")
    l8 <- readLines(con, n = 8)
    close(con)
    l8 <- read.dcf(textConnection(gsub(" ",
":", l8)))
    lres <- as.list(l8)
    names(lres) <- colnames(l8)
    lres$nrows <- as.integer(lres$nrows)
    lres$ncols <- as.integer(lres$ncols)
    lres$nbands <- as.integer(lres$nbands)
    lres$nbits <- as.integer(lres$nbits)
    lres$skipbytes <- as.integer(lres$skipbytes)
    lres$nodata <- ifelse(integer,
as.integer(lres$nodata),
as.numeric(lres$nodata))
    con <- file(paste(fname, "wld", sep =
"."), "r")
    l6 <- readLines(con, n = 6)
    close(con)
    lres$ewres <- abs(as.numeric(l6[1]))
    lres$nsres <- abs(as.numeric(l6[4]))
    lres$n_cc <- as.numeric(l6[6])
    lres$w_cc <- as.numeric(l6[5])
    lres$s_cc <- lres$n_cc - lres$nsres * (lres$nrows -
1)
    what <- ifelse(integer, "integer",
"double")
    n <- lres$nrows * lres$ncols
    size <- lres$nbits/8
    map <- readBin(fname, what = what, n = n, size =
size, signed = TRUE)
    is.na(map) <- map == lres$nodata
    grid = GridTopology(c(lres$w_cc, lres$s_cc),
c(lres$ewres,
        lres$nsres), c(lres$ncols, lres$nrows))
    df <- list(var1 = map)
    names(df) <- colname
    if (.sp_lt_0.9()) {
        df1 <- AttributeList(df)
    }
    else {
        df1 <- data.frame(df)
    }
    res <- SpatialGridDataFrame(grid, data = df1,
proj4string = proj4string)
    res
}
Browse[1]> list.files(dirname(fname))
 [1] "162.0"
 [2] "162.1"
 [3] "162.2"
 [4] "260.0"
 [5] "260.1"
 [6] "260.2"
 [7] "284.0"
 [8] "284.1"
 [9] "284.2"
[10] "336.0"
[11] "336.1"
[12] "393.0"
[13] "393.1"
[14] "436.0"
[15] "436.1"
[16] "436.2"
[17] "436.3"
[18] "441.0"
[19] "60.0"
[20] "60.1"
[21] "60.2"
[22] "60.3"
[23] "6183.0"
[24] "6183.1"
[25] "6183.1.ppm"
[26] "6183.2"
[27] "6183.2.pgm"
[28] "6183.2.ppm"
[29] "6183.3"
[30] "6183.3.pgm"
[31] "6183.3.ppm"
[32] "653.0"
[33] "653.1"
[34] "653.2"
[35] "653.3"
[36] "653.4"
[37] "653.5"
[38] "661.0"
[39] "661.1"
[40] "661.2"
[41] "6630.0"
[42] "6630.1"
[43] "753.0"
[44] "753.1"
[45] "753.2"
[46] "786.0"
[47] "786.1"
[48] "786.2"
[49] "796.0"
[50] "796.1"
[51] "796.2"
[52] "796.3"
[53] "796.4"
[54] "846.0"
[55] "846.1"
[56] "846.2"
[57] "846.3"
[58] "847.0"
[59] "847.1"
[60] "847.2"
[61] "847.3"
[62] "940.0"
[63] "dem3arcsec_srtm_reprojected_aspect"
[64] "dem3arcsec_srtm_reprojected_slope_avg2"
[65] "dem3arcsec_srtm_reprojected_slope_avg2.wld"
Browse[1]>
debug: if (missing(integer)) stop("integer TRUE/FALSE
required")
Browse[1]>
debug: if (!file.exists(fname)) stop(paste("no such
file:", fname))
Browse[1]>
debug: if (!file.exists(paste(fname, "hdr", sep =
".")))
stop(paste("no such file:",
    paste(fname, "hdr", sep = ".")))
Browse[1]>
Error in readBinGrid(rtmpfl11, colname = vname[i],
proj4string = p4,
integer = to_int) :
        no such file:
/home/guano/grassdata/srtm_krig_utm/death_valley/.tmp/eclips
e/dem3arcsec_srtm_reprojected_slope_avg2.hdr
>


and then with a short file name


> elev<-readRAST6("srtm3sec_reprojected")
Creating BIL support files ...
Header File =
/home/guano/grassdata/srtm_krig_utm/death_valley/.tmp/eclips
e/srtm3sec_reprojected.hdr
World File =
/home/guano/grassdata/srtm_krig_utm/death_valley/.tmp/eclips
e/srtm3sec_reprojected.wld
Exporting Raster as floating values (bytes=4)
Using the Current Region settings ...
north=4031000.000000
south=4002650.000000
east=494850.000000
west=466500.000000
r=315
c=315
 100%
debugging in: readBinGrid(rtmpfl11, colname = vname[i],
proj4string =
p4, integer = to_int)
debug: {

<snip>

[60] "847.1"
[61] "847.2"
[62] "847.3"
[63] "940.0"
[64] "dem3arcsec_srtm_reprojected_aspect"
[65] "dem3arcsec_srtm_reprojected_slope_avg2"
[66] "dem3arcsec_srtm_reprojected_slope_avg2.wld"
[67] "srtm3sec_reprojected"
[68] "srtm3sec_reprojected.hdr"
[69] "srtm3sec_reprojected.wld"
Browse[1]>
debug: if (missing(integer)) stop("integer TRUE/FALSE
required")


So it appears to me that for some reason the .hdr was not
attached to
the file...


Carlos




+-----------------------------------------------------------
+
              Carlos Henrique Grohmann - Guano
  Visiting Researcher at Kingston University bond - UK
  Geologist M.Sc  - Doctorate Student at IGc-USP - Brazil
Linux User #89721  - carlos dot grohmann at gmail dot com
+-----------------------------------------------------------
+
_________________
"Good morning, doctors. I have taken the liberty of
removing Windows
95 from my hard drive."
--The winning entry in a "What were HAL's first
words" contest judged
by 2001: A SPACE ODYSSEY creator Arthur C. Clarke

Can't stop the signal.

_______________________________________________
statsgrass mailing list
statsgrassgrass.itc.it
http:
//grass.itc.it/mailman/listinfo/statsgrass

Re: cant read raster created with r.neighbours
country flaguser name
Norway
2007-07-26 12:39:47
CC-ed to GRASS-dev, short file name buffer issue in 
raster/r.out.bin/main.c line 225:

On Thu, 26 Jul 2007, Carlos "Guâno" Grohmann
wrote:

> Here is the debug output:
>
>>  debug(readBinGrid)
>> 
slopeavg<-readRAST6("dem3arcsec_srtm_reprojected_slo
pe_avg2")
> Creating BIL support files ...
> Header File = .wld
> World File =
>
/home/guano/grassdata/srtm_krig_utm/death_valley/.tmp/eclips
e/dem3arcsec_srtm_reprojected_slope_avg2.wld
> Exporting Raster as floating values (bytes=4)
> Using the Current Region settings ...
> north=4031000.000000
> south=4002650.000000
> east=494850.000000
> west=466500.000000
> r=315
> c=315
> 100%
> debugging in: readBinGrid(rtmpfl11, colname = vname[i],
proj4string =
> p4, integer = to_int)
> debug: {
>    if (missing(integer))
>        stop("integer TRUE/FALSE required")
>    if (!file.exists(fname))
>        stop(paste("no such file:", fname))
>    if (!file.exists(paste(fname, "hdr", sep =
".")))
>        stop(paste("no such file:",
paste(fname, "hdr", sep = ".")))
>    if (!file.exists(paste(fname, "wld", sep =
".")))
>        stop(paste("no such file:",
paste(fname, "wld", sep = ".")))
>    con <- file(paste(fname, "hdr", sep =
"."), "r")
>    l8 <- readLines(con, n = 8)
>    close(con)
>    l8 <- read.dcf(textConnection(gsub(" ",
":", l8)))
>    lres <- as.list(l8)
>    names(lres) <- colnames(l8)
>    lres$nrows <- as.integer(lres$nrows)
>    lres$ncols <- as.integer(lres$ncols)
>    lres$nbands <- as.integer(lres$nbands)
>    lres$nbits <- as.integer(lres$nbits)
>    lres$skipbytes <- as.integer(lres$skipbytes)
>    lres$nodata <- ifelse(integer,
as.integer(lres$nodata),
> as.numeric(lres$nodata))
>    con <- file(paste(fname, "wld", sep =
"."), "r")
>    l6 <- readLines(con, n = 6)
>    close(con)
>    lres$ewres <- abs(as.numeric(l6[1]))
>    lres$nsres <- abs(as.numeric(l6[4]))
>    lres$n_cc <- as.numeric(l6[6])
>    lres$w_cc <- as.numeric(l6[5])
>    lres$s_cc <- lres$n_cc - lres$nsres * (lres$nrows
- 1)
>    what <- ifelse(integer, "integer",
"double")
>    n <- lres$nrows * lres$ncols
>    size <- lres$nbits/8
>    map <- readBin(fname, what = what, n = n, size =
size, signed = TRUE)
>    is.na(map) <- map == lres$nodata
>    grid = GridTopology(c(lres$w_cc, lres$s_cc),
c(lres$ewres,
>        lres$nsres), c(lres$ncols, lres$nrows))
>    df <- list(var1 = map)
>    names(df) <- colname
>    if (.sp_lt_0.9()) {
>        df1 <- AttributeList(df)
>    }
>    else {
>        df1 <- data.frame(df)
>    }
>    res <- SpatialGridDataFrame(grid, data = df1,
proj4string = proj4string)
>    res
> }
> Browse[1]> list.files(dirname(fname))
> [1] "162.0"
> [2] "162.1"
> [3] "162.2"
> [4] "260.0"
> [5] "260.1"
> [6] "260.2"
> [7] "284.0"
> [8] "284.1"
> [9] "284.2"
> [10] "336.0"
> [11] "336.1"
> [12] "393.0"
> [13] "393.1"
> [14] "436.0"
> [15] "436.1"
> [16] "436.2"
> [17] "436.3"
> [18] "441.0"
> [19] "60.0"
> [20] "60.1"
> [21] "60.2"
> [22] "60.3"
> [23] "6183.0"
> [24] "6183.1"
> [25] "6183.1.ppm"
> [26] "6183.2"
> [27] "6183.2.pgm"
> [28] "6183.2.ppm"
> [29] "6183.3"
> [30] "6183.3.pgm"
> [31] "6183.3.ppm"
> [32] "653.0"
> [33] "653.1"
> [34] "653.2"
> [35] "653.3"
> [36] "653.4"
> [37] "653.5"
> [38] "661.0"
> [39] "661.1"
> [40] "661.2"
> [41] "6630.0"
> [42] "6630.1"
> [43] "753.0"
> [44] "753.1"
> [45] "753.2"
> [46] "786.0"
> [47] "786.1"
> [48] "786.2"
> [49] "796.0"
> [50] "796.1"
> [51] "796.2"
> [52] "796.3"
> [53] "796.4"
> [54] "846.0"
> [55] "846.1"
> [56] "846.2"
> [57] "846.3"
> [58] "847.0"
> [59] "847.1"
> [60] "847.2"
> [61] "847.3"
> [62] "940.0"
> [63] "dem3arcsec_srtm_reprojected_aspect"
> [64]
"dem3arcsec_srtm_reprojected_slope_avg2"
> [65]
"dem3arcsec_srtm_reprojected_slope_avg2.wld"
> Browse[1]>
> debug: if (missing(integer)) stop("integer
TRUE/FALSE required")
> Browse[1]>
> debug: if (!file.exists(fname)) stop(paste("no
such file:", fname))
> Browse[1]>
> debug: if (!file.exists(paste(fname, "hdr",
sep = ".")))
> stop(paste("no such file:",
>   paste(fname, "hdr", sep = ".")))
> Browse[1]>
> Error in readBinGrid(rtmpfl11, colname = vname[i],
proj4string = p4,
> integer = to_int) :
>       no such file:
>
/home/guano/grassdata/srtm_krig_utm/death_valley/.tmp/eclips
e/dem3arcsec_srtm_reprojected_slope_avg2.hdr
>> 
>
>
> and then with a short file name
>
>
>> 
elev<-readRAST6("srtm3sec_reprojected")
> Creating BIL support files ...
> Header File =
>
/home/guano/grassdata/srtm_krig_utm/death_valley/.tmp/eclips
e/srtm3sec_reprojected.hdr
> World File =
>
/home/guano/grassdata/srtm_krig_utm/death_valley/.tmp/eclips
e/srtm3sec_reprojected.wld
> Exporting Raster as floating values (bytes=4)
> Using the Current Region settings ...
> north=4031000.000000
> south=4002650.000000
> east=494850.000000
> west=466500.000000
> r=315
> c=315
> 100%
> debugging in: readBinGrid(rtmpfl11, colname = vname[i],
proj4string =
> p4, integer = to_int)
> debug: {
>
> <snip>
>
> [60] "847.1"
> [61] "847.2"
> [62] "847.3"
> [63] "940.0"
> [64] "dem3arcsec_srtm_reprojected_aspect"
> [65]
"dem3arcsec_srtm_reprojected_slope_avg2"
> [66]
"dem3arcsec_srtm_reprojected_slope_avg2.wld"
> [67] "srtm3sec_reprojected"
> [68] "srtm3sec_reprojected.hdr"
> [69] "srtm3sec_reprojected.wld"
> Browse[1]>
> debug: if (missing(integer)) stop("integer
TRUE/FALSE required")
>
>
> So it appears to me that for some reason the .hdr was
not attached to
> the file...

Yes, because a shorter file name buffer is declared on line
225 of main.c 
in r.out.bin - with a length of 100, so fname fits, but the
header 
overwrites it, I think - could I suggest that the lengths of
the out_bufs 
in line 255 be set to [GNAME_MAX] instead?

Roger

>
>
> Carlos
>
>
>
>
>
+-----------------------------------------------------------
+
>              Carlos Henrique Grohmann - Guano
>  Visiting Researcher at Kingston University bond - UK
>  Geologist M.Sc  - Doctorate Student at IGc-USP -
Brazil
> Linux User #89721  - carlos dot grohmann at gmail dot
com
>
+-----------------------------------------------------------
+
> _________________
> "Good morning, doctors. I have taken the liberty
of removing Windows
> 95 from my hard drive."
> --The winning entry in a "What were HAL's first
words" contest judged
> by 2001: A SPACE ODYSSEY creator Arthur C. Clarke
>
> Can't stop the signal.
>
> _______________________________________________
> statsgrass mailing list
> statsgrassgrass.itc.it
> http:
//grass.itc.it/mailman/listinfo/statsgrass
>
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics,
Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045
Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivandnhh.no
_______________________________________________
statsgrass mailing list
statsgrassgrass.itc.it
http:
//grass.itc.it/mailman/listinfo/statsgrass

Re: cant read raster created with r.neighbours
user name
2007-07-26 16:28:25
Roger, Carlos,

I have fixed the r.out.bin buffer issue in CVS (also in
6.2.3-CVS).

Markus

On Thu, Jul 26, 2007 at 07:39:47PM +0200, Roger Bivand
wrote:
> CC-ed to GRASS-dev, short file name buffer issue in
raster/r.out.bin/main.c 
> line 225:
>
> On Thu, 26 Jul 2007, Carlos "Guâno" Grohmann
wrote:
>
>> Here is the debug output:
>>
>>>  debug(readBinGrid)
>>> 
slopeavg<-readRAST6("dem3arcsec_srtm_reprojected_slo
pe_avg2")
>> Creating BIL support files ...
>> Header File = .wld
>> World File =
>>
/home/guano/grassdata/srtm_krig_utm/death_valley/.tmp/eclips
e/dem3arcsec_srtm_reprojected_slope_avg2.wld
>> Exporting Raster as floating values (bytes=4)
>> Using the Current Region settings ...
>> north=4031000.000000
>> south=4002650.000000
>> east=494850.000000
>> west=466500.000000
>> r=315
>> c=315
>> 100%
>> debugging in: readBinGrid(rtmpfl11, colname =
vname[i], proj4string =
>> p4, integer = to_int)
>> debug: {
>>    if (missing(integer))
>>        stop("integer TRUE/FALSE
required")
>>    if (!file.exists(fname))
>>        stop(paste("no such file:",
fname))
>>    if (!file.exists(paste(fname, "hdr",
sep = ".")))
>>        stop(paste("no such file:",
paste(fname, "hdr", sep = ".")))
>>    if (!file.exists(paste(fname, "wld",
sep = ".")))
>>        stop(paste("no such file:",
paste(fname, "wld", sep = ".")))
>>    con <- file(paste(fname, "hdr", sep
= "."), "r")
>>    l8 <- readLines(con, n = 8)
>>    close(con)
>>    l8 <- read.dcf(textConnection(gsub("
", ":", l8)))
>>    lres <- as.list(l8)
>>    names(lres) <- colnames(l8)
>>    lres$nrows <- as.integer(lres$nrows)
>>    lres$ncols <- as.integer(lres$ncols)
>>    lres$nbands <- as.integer(lres$nbands)
>>    lres$nbits <- as.integer(lres$nbits)
>>    lres$skipbytes <- as.integer(lres$skipbytes)
>>    lres$nodata <- ifelse(integer,
as.integer(lres$nodata),
>> as.numeric(lres$nodata))
>>    con <- file(paste(fname, "wld", sep
= "."), "r")
>>    l6 <- readLines(con, n = 6)
>>    close(con)
>>    lres$ewres <- abs(as.numeric(l6[1]))
>>    lres$nsres <- abs(as.numeric(l6[4]))
>>    lres$n_cc <- as.numeric(l6[6])
>>    lres$w_cc <- as.numeric(l6[5])
>>    lres$s_cc <- lres$n_cc - lres$nsres *
(lres$nrows - 1)
>>    what <- ifelse(integer, "integer",
"double")
>>    n <- lres$nrows * lres$ncols
>>    size <- lres$nbits/8
>>    map <- readBin(fname, what = what, n = n,
size = size, signed = TRUE)
>>    is.na(map) <- map == lres$nodata
>>    grid = GridTopology(c(lres$w_cc, lres$s_cc),
c(lres$ewres,
>>        lres$nsres), c(lres$ncols, lres$nrows))
>>    df <- list(var1 = map)
>>    names(df) <- colname
>>    if (.sp_lt_0.9()) {
>>        df1 <- AttributeList(df)
>>    }
>>    else {
>>        df1 <- data.frame(df)
>>    }
>>    res <- SpatialGridDataFrame(grid, data = df1,
proj4string = 
>> proj4string)
>>    res
>> }
>> Browse[1]> list.files(dirname(fname))
>> [1] "162.0"
>> [2] "162.1"
>> [3] "162.2"
>> [4] "260.0"
>> [5] "260.1"
>> [6] "260.2"
>> [7] "284.0"
>> [8] "284.1"
>> [9] "284.2"
>> [10] "336.0"
>> [11] "336.1"
>> [12] "393.0"
>> [13] "393.1"
>> [14] "436.0"
>> [15] "436.1"
>> [16] "436.2"
>> [17] "436.3"
>> [18] "441.0"
>> [19] "60.0"
>> [20] "60.1"
>> [21] "60.2"
>> [22] "60.3"
>> [23] "6183.0"
>> [24] "6183.1"
>> [25] "6183.1.ppm"
>> [26] "6183.2"
>> [27] "6183.2.pgm"
>> [28] "6183.2.ppm"
>> [29] "6183.3"
>> [30] "6183.3.pgm"
>> [31] "6183.3.ppm"
>> [32] "653.0"
>> [33] "653.1"
>> [34] "653.2"
>> [35] "653.3"
>> [36] "653.4"
>> [37] "653.5"
>> [38] "661.0"
>> [39] "661.1"
>> [40] "661.2"
>> [41] "6630.0"
>> [42] "6630.1"
>> [43] "753.0"
>> [44] "753.1"
>> [45] "753.2"
>> [46] "786.0"
>> [47] "786.1"
>> [48] "786.2"
>> [49] "796.0"
>> [50] "796.1"
>> [51] "796.2"
>> [52] "796.3"
>> [53] "796.4"
>> [54] "846.0"
>> [55] "846.1"
>> [56] "846.2"
>> [57] "846.3"
>> [58] "847.0"
>> [59] "847.1"
>> [60] "847.2"
>> [61] "847.3"
>> [62] "940.0"
>> [63]
"dem3arcsec_srtm_reprojected_aspect"
>> [64]
"dem3arcsec_srtm_reprojected_slope_avg2"
>> [65]
"dem3arcsec_srtm_reprojected_slope_avg2.wld"
>> Browse[1]>
>> debug: if (missing(integer)) stop("integer
TRUE/FALSE required")
>> Browse[1]>
>> debug: if (!file.exists(fname)) stop(paste("no
such file:", fname))
>> Browse[1]>
>> debug: if (!file.exists(paste(fname,
"hdr", sep = ".")))
>> stop(paste("no such file:",
>>   paste(fname, "hdr", sep =
".")))
>> Browse[1]>
>> Error in readBinGrid(rtmpfl11, colname = vname[i],
proj4string = p4,
>> integer = to_int) :
>>       no such file:
>>
/home/guano/grassdata/srtm_krig_utm/death_valley/.tmp/eclips
e/dem3arcsec_srtm_reprojected_slope_avg2.hdr
>>
>>
>> and then with a short file name
>>
>>
>>> 
elev<-readRAST6("srtm3sec_reprojected")
>> Creating BIL support files ...
>> Header File =
>>
/home/guano/grassdata/srtm_krig_utm/death_valley/.tmp/eclips
e/srtm3sec_reprojected.hdr
>> World File =
>>
/home/guano/grassdata/srtm_krig_utm/death_valley/.tmp/eclips
e/srtm3sec_reprojected.wld
>> Exporting Raster as floating values (bytes=4)
>> Using the Current Region settings ...
>> north=4031000.000000
>> south=4002650.000000
>> east=494850.000000
>> west=466500.000000
>> r=315
>> c=315
>> 100%
>> debugging in: readBinGrid(rtmpfl11, colname =
vname[i], proj4string =
>> p4, integer = to_int)
>> debug: {
>>
>> <snip>
>>
>> [60] "847.1"
>> [61] "847.2"
>> [62] "847.3"
>> [63] "940.0"
>> [64]
"dem3arcsec_srtm_reprojected_aspect"
>> [65]
"dem3arcsec_srtm_reprojected_slope_avg2"
>> [66]
"dem3arcsec_srtm_reprojected_slope_avg2.wld"
>> [67] "srtm3sec_reprojected"
>> [68] "srtm3sec_reprojected.hdr"
>> [69] "srtm3sec_reprojected.wld"
>> Browse[1]>
>> debug: if (missing(integer)) stop("integer
TRUE/FALSE required")
>>
>>
>> So it appears to me that for some reason the .hdr
was not attached to
>> the file...
>
> Yes, because a shorter file name buffer is declared on
line 225 of main.c 
> in r.out.bin - with a length of 100, so fname fits, but
the header 
> overwrites it, I think - could I suggest that the
lengths of the out_bufs 
> in line 255 be set to [GNAME_MAX] instead?
>
> Roger
>
>>
>>
>> Carlos
>>
>>
>>
>>
>>
+-----------------------------------------------------------
+
>>              Carlos Henrique Grohmann - Guano
>>  Visiting Researcher at Kingston University bond -
UK
>>  Geologist M.Sc  - Doctorate Student at IGc-USP -
Brazil
>> Linux User #89721  - carlos dot grohmann at gmail
dot com
>>
+-----------------------------------------------------------
+
>> _________________
>> "Good morning, doctors. I have taken the
liberty of removing Windows
>> 95 from my hard drive."
>> --The winning entry in a "What were HAL's
first words" contest judged
>> by 2001: A SPACE ODYSSEY creator Arthur C. Clarke
>>
>> Can't stop the signal.
>>
>> _______________________________________________
>> statsgrass mailing list
>> statsgrassgrass.itc.it
>> http:
//grass.itc.it/mailman/listinfo/statsgrass
>>
>>
>
> -- 
> Roger Bivand
> Economic Geography Section, Department of Economics,
Norwegian School of
> Economics and Business Administration, Helleveien 30,
N-5045 Bergen,
> Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
> e-mail: Roger.Bivandnhh.no

> _______________________________________________
> grass-dev mailing list
> grass-devgrass.itc.it
> http:/
/grass.itc.it/mailman/listinfo/grass-dev

_______________________________________________
statsgrass mailing list
statsgrassgrass.itc.it
http:
//grass.itc.it/mailman/listinfo/statsgrass

[1-7]

about | contact  Other archives ( Real Estate discussion Medical topics )