[STATSGRASS] moving-window analysis

Carlos "Guâno" Grohmann carlos.grohmann at gmail.com
Wed Jun 6 17:17:31 EDT 2007


Thanks Edzer. I guess that did it
(my problem was with the ~s1+s2, I even tried ~x+y...)

thanks

Carlos

On 6/6/07, Edzer J. Pebesma <e.pebesma at geo.uu.nl> wrote:
> If you mean by plane a first order linear trend surface, you'd have to
> use S25W049~s1+s2, or something like that. locations and newdata can be
> the same object, if needed.
> --
> Edzer
>
> Carlos "Guâno" Grohmann wrote:
> > I guess it's something like that. this is what I did:
> >
> > after importing a DEM from GRASS, creating a mask etc:
> >
> > x <- krige(S25W049 ~ 1, locations=srtm, newdata=mask, nmax=24)
> >
> >> summary(x)
> > Object of class SpatialPixelsDataFrame
> > Coordinates:
> >       min     max
> > s1  719500  776650
> > s2 7260800 7300400
> > Is projected: TRUE
> > proj4string :
> > [+proj=utm +south +zone=22 +a=6378160 +rf=298.25 +no_defs
> > +towgs84=-60.0,-2.0,-41.0 +to_meter=1.0]
> > Number of points: 279400
> > Data attributes:
> >   var1.pred          var1.var
> > Min.   :  33.73   Min.   :    NA
> > 1st Qu.: 236.77   1st Qu.:    NA
> > Median : 434.94   Median :    NA
> > Mean   : 471.73   Mean   :   NaN
> > 3rd Qu.: 685.39   3rd Qu.:    NA
> > Max.   :1186.84   Max.   :    NA
> >                   NA's   :279400
> >
> >
> > So I have the var1.pred, which is basically my original DEM, and
> > var1.var is all NA's..
> >
> > What I want, is that the pixel final value to be equal to the
> > deviation of that pixel original value about the best-fit plane
> > calculated over the points in the moving window (8, 24..).
> >
> >
> > thanks
> >
> >
> >
> > On 6/6/07, Edzer J. Pebesma <e.pebesma at geo.uu.nl> wrote:
> >> Well, package gstat provides linear regression within a local search
> >> neighbourhood defined either by distance (circular window) or by nr of
> >> nearest neighbours. Is that what you want?
> >>
> >> try:
> >>
> >> library(gstat)
> >> data(meuse)
> >> data(meuse.grid)
> >> coordinates(meuse)=~x+y
> >> gridded(meuse.grid) = ~x+y
> >> x = krige(log(zinc)~sqrt(dist),meuse,meuse.grid,maxdist=600)
> >> image(x)
> >> --
> >> Edzer
> >>
> >> Carlos "Guâno" Grohmann wrote:
> >> > Basic moving-window (ie, mean, stddev etc) is easy. The tricky
> >> > question is how to make a best-fit least squares inside that moving
> >> > window? I mean that it has to be a general function, so you can choose
> >> > the size of the window.
> >> >
> >> > Carlos
> >> >
> >> >
> >> >
> >> > On 6/6/07, G. Allegri <giohappy at gmail.com> wrote:
> >> >> In my experience the easier way to realize a moving-window analysys
> >> >> between rasters is to use r.mapcalc. I never did it in R. I knew that
> >> >> caTools package could do it someway... but I think using r.mapcla is
> >> >> more straightforward.
> >> >> Look at this nice article:
> >> >> http://casoilresource.lawr.ucdavis.edu/drupal/node/221
> >> >> --
> >> >> Giovanni
> >> >>
> >> >> 2007/6/6, Carlos Guâno Grohmann <carlos.grohmann at gmail.com>:
> >> >> > > What kind of data do you have?
> >> >> >
> >> >> > DEMs, some LiDAR, maybe
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> > > 2007/6/6, Carlos Guâno Grohmann <carlos.grohmann at gmail.com>:
> >> >> > > > Hello. I was thinking what would be the best way to do a
> >> >> moving-window
> >> >> > > > analysis where the result is the deviation of values about a
> >> >> best-fit
> >> >> > > > plane?
> >> >> > > >
> >> >> > > > some modification to r.in.xyz?
> >> >> > > > r.mapcalc?
> >> >> > > > R? (which package, function..?)
> >> >> > > >
> >> >> > > > thanks
> >> >> > > >
> >> >> > > >
> >> >> > > >
> >> >> > > > --
> >> >> > > > +-----------------------------------------------------------+
> >> >> > > >               Carlos Henrique Grohmann - Guano
> >> >> > > >   Visiting Researcher at Kingston University London - 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
> >> >> > > >
> >> >> > > > _______________________________________________
> >> >> > > > statsgrass mailing list
> >> >> > > > statsgrass at grass.itc.it
> >> >> > > > http://grass.itc.it/mailman/listinfo/statsgrass
> >> >> > > >
> >> >> > >
> >> >> >
> >> >> >
> >> >> > --
> >> >> > +-----------------------------------------------------------+
> >> >> >               Carlos Henrique Grohmann - Guano
> >> >> >   Visiting Researcher at Kingston University London - 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
> >> >> >
> >> >> > _______________________________________________
> >> >> > statsgrass mailing list
> >> >> > statsgrass at grass.itc.it
> >> >> > http://grass.itc.it/mailman/listinfo/statsgrass
> >> >> >
> >> >>
> >> >
> >> >
> >>
> >>
> >
> >
>
>


-- 
+-----------------------------------------------------------+
              Carlos Henrique Grohmann - Guano
  Visiting Researcher at Kingston University London - 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




More information about the grass-stats mailing list