[GRASS-stats] Raster maps from GRASS to R and back to GRASS?

Nikos Alexandris nikos.alexandris at felis.uni-freiburg.de
Tue Apr 14 11:17:01 EDT 2009


Nikos:
> > > > What I actually do is nothing but a PCA on a combination of different
> > > > bands. The fact is that bands a, b, c are of equal "length" in R and
> > > > have _more_ non-NULLs than bands d, e, f.


Dylan:
> > > I think that you are going to have to maintain a band-wise null mask in
> > > R, as opposed to a single null mask for the entire set of bands.

[...]

> An idea on how to apply this function:
> 
> # load data
> # extract an NA mask using complete.cases 
> # do something like prcomp()

> # assign back to original data
> x.df$pca_1[x.na_mask] <-  predict(p)[,1]
> 
> This would of course be done the the @data slot on an sp object. Thanks to 
> Roger for this slick approach.
> 
> How about that!?

Very helpful Dylan. I am learning a lot, as usual. However, no-matter
what I try to do with my NA's I still get random NA's when I write back
to GRASS my data.

I tried to load the data, extract an NA_mask using complete.cases,
create "fake" columns and fill-in with the _untouched_ original data and
then write back to GRASS6. The result (or my process) is _noise_.

I'll try again tonight. If I am not going to make it I could try to
repeat this with spearfish data and see if something isn't ok with my
MODIS bands.

Cheers, Nikos

I don't understand what's the deal here :-(



More information about the grass-stats mailing list