[R-sig-Geo] daily precipitation idw & kriging and beginner questions
Edzer Pebesma
edzer.pebesma at uni-muenster.de
Tue Aug 18 22:42:54 CEST 2009
Hi Ivan,
Soenario, Ivan (KNMI) wrote:
>
>> Pd.idw <- krige(as.formula(kol), Pd200001, nl.grd)
>>
>
> [inverse distance weighted interpolation]
>
There is also the equivalent
Pd.idw <- idw(as.formula(kol), Pd200001, nl.grd)
where the function does what it's named after.
> Warning message:
>
> In points2grid(points, tolerance, round, fuzz.tol) :
>
> grid has empty column/rows in dimension 2
>
It means that you have a grid with empty (missing valued) rows and/or
columns. Ignore it.
>
>
>
>> spplot(Pd.idw, "var1.pred")
>>
>
> Warning message:
>
> In data.row.names(row.names, rowsi, i) :
>
> some row.names duplicated: 2,3,4,5,6,7,8,9,10,
>
This would not worry me.
>
>
> Question 2
>
> I use 2 different plotting techniques, which makes the images hard to
> compare. At this stage I do not need real map data for further analysis,
> just some jpegs to quickly compare the results. How can I plot the idw's
> and de krige results the same way? They are of different class.
>
Save the results to a single object, and use spplot to plot in a single
plot. Untried:
Pd.idw$idw = Pd.idw$var1.pred
Pd.idw$ok = Pd.kri$krige_output$var1.pred
spplot(Pd.idw, c("idw", "ok"))
>
>
> Question 3
>
> automapPlot(plot_data, zcol, col.regions, ...)
>
> The ... is intriguing: "Arguments that are passed on to spplot." This is
> also the case for many R functions, which makes R very flexible, but for
> a beginner this seems endlessly layered. For instance, I would like to
> create my own colour ramp, in either image(), plot() or spplot(). But I
> can't figure it out. Is it also possible to reverse the standard ramps
> heat.colors, topo.colors etc?
>
yes, just use col.regions. E.g. col.regions = bpy.colors()
I will ignore your comments on ... , as you will start appreciating it
the day you start writing functions in R. Looking where you are now,
this should be within a few weeks.
>
>
> Question 4
>
> After the jpg is written to HD, I remove the objects Pd.idw and Pd.kri.
> Need I do this, or is the object overwritten anyway, at the start of the
> next loop?
It gets overwritten.
> Also, is there another method to deal with the results, for
> instance can I create an object Pd.idw.many which contains all of the 31
> interpolated maps? This would be convenient for further R processing.
>
Yes, by giving each of the output variables a different name, just as I
did above.
Best wishes,
--
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de/
http://www.springer.com/978-0-387-78170-9 e.pebesma at wwu.de
More information about the R-sig-Geo
mailing list