[R-sig-Geo] help: krigged map do not show colours

Jon Skoien jon.skoien at jrc.ec.europa.eu
Tue Aug 4 14:55:17 CEST 2015


Anand,

I could not open your .grd file in R, I think the .gri file is missing.
However, looking at it in a text editor, and comparing with your 
R-script, it seems something went wrong with your projections. Your 
.csv-file has LatLong coordinates, but you are setting the projection to 
"+proj=utm +zone=40 +south +datum=WGS84 +units=m +no_defs +ellps=WGS84 
+towgs84=0,0,0", the same as you seem to have in your prediction raster. 
But you need to reproject your observations in this case.

# First set the right projection:
proj4string(carbon_seq) <- CRS("+init=epsg4326") # epsg-code for latlong
# Then transform
carbon_seq = spTransform(carbon_seq, CRS("+proj=utm +zone=40 +south 
+datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0"))

If you do this, your prediction grid should overlap your observations, 
and the colors should reflect your color ramp. What you essentially did 
before was to make a prediction thousands of km away from your 
observations, and then all values will be the same.

Best wishes,
Jon


On 8/4/2015 12:48 PM, Anand Sookun wrote:
> Dear Jon and Roman
>
> Thanks for the reply.
>
> Im attaching the code.
>
> You may be right that the variogram may be problematic but it fitted
> well visually.
>
> I think also that the prediction grid was not well created. I wiould be
> grateful to have to hints.code how to create a useful grid and also for
> the spplot or other alternatives
>
> I can send more info if required.
>
> Cheers
>
> Anand
>
> On Tue, Aug 4, 2015 at 1:39 PM, Jon Skoien <jon.skoien at jrc.ec.europa.eu
> <mailto:jon.skoien at jrc.ec.europa.eu>> wrote:
>
>     Hi,
>
>     You have attached some data, but we still dont know exactly what you
>     do with the data (do you use the logarithm, how many bins, did you
>     project the data set...?). However, having had a quick look using
>     the LatLong coordinates (not really recommended), I can see that the
>     variogram from this data set is not particularly well defined, and
>     it could well be that you fitted a model with pure nugget effect. In
>     that case you will get the same prediction everywhere and no color
>     differences.
>
>     Have a look at
>      > summary(map)
>     and particularly the summary of var1.pred.
>     You could also plot the variogram of the data together with your
>     model, vmf, and see how they fit.
>
>     I am not sure what you mean by not being able to create a prediction
>     grid with data included. Do you mean that you want a grid which
>     exactly overlays some of the data points? Matching one point should
>     not be difficult, 2 and 3 should be possible, but you might get some
>     problems with precision (FAQ 7.31).
>
>     Best wishes,
>     Jon
>
>
>
>
>     On 8/3/2015 5:30 PM, Anand Sookun wrote:
>>     Hi
>>
>>     Thank you Roman for your kind response.
>>
>>     The data is as attached which is part of the whole dataset.
>>
>>     My other problem is that im not able to create an appropriate
>>     prediction grid with some data included.
>>
>>     The codes which failed to show colour ramps are
>>
>>     map <- krige(logcarbseq ~ 1, locations = carbon_seq, newdata =
>>     map,model = vmf)
>>     str(map)
>>     print(spplot(map, "var1.pred", asp=1,
>>     col.regions=bpy.colors(64),main="OK prediction, carbon"))
>>     print(spplot(map, "var1.var",col.regions=cm.colors(64),asp=1,
>>     main="OK prediction variance, carbon"))
>>
>>     I look forward to hopefully get some solutions.
>>
>>     Thanks again and warm regards
>>
>>     Anand
>>
>>     On Mon, Aug 3, 2015 at 4:09 PM, Roman Luštrik
>>     <roman.lustrik at gmail.com <mailto:roman.lustrik at gmail.com>> wrote:
>>
>>         What is the variability of the plotted variable?
>>
>>         Cheers,
>>         Roman
>>
>>         On Sun, Aug 2, 2015 at 11:03 AM, Anand Sookun
>>         <<mailto:asookun at gmail.com>asookun at gmail.com
>>         <mailto:asookun at gmail.com>> wrote:
>>
>>             Hi
>>
>>             I have kriged my data but the map shows uniform colours -
>>             no gradual
>>             contour colour plot on map
>>
>>             code: print(spplot(k40, "var1.pred", asp=1,
>>             col.regions=bpy.colors(64),main="OK prediction, log-ppm Zn"))
>>
>>             thnaks for any help
>>
>>             Anand Sookun
>>             --
>>             -------------------------------------------------------
>>             *Anand Sookun (**MPhil. **PhD Candidate, University of
>>             Mauritius)*
>>             *Director cum Freelance Consultant*
>>             *Soft Sustainable Services (Mauritius)*
>>             *Research and Consultancy*
>>
>>             Website: http://sustain-ability.webs.com/
>>
>>
>>             https://www.linkedin.com/profile/view?id=161468467&trk=nav_responsive_tab_profile_pic
>>
>>                     [[alternative HTML version deleted]]
>>
>>             _______________________________________________
>>             R-sig-Geo mailing list
>>             R-sig-Geo at r-project.org <mailto:R-sig-Geo at r-project.org>
>>             https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>>
>>
>>
>>         --
>>         In God we trust, all others bring data.
>>
>>
>>
>>
>>     --
>>     -------------------------------------------------------
>>     /*Anand Sookun (*//*MPhil. *//*PhD Candidate, University of
>>     Mauritius)*/
>>     /*Director cum Freelance Consultant*/
>>     /*Soft Sustainable Services (Mauritius)*/
>>     /*Research and Consultancy*/
>>
>>     Website:
>>     <http://sustain-ability.webs.com/>http://sustain-ability.webs.com/
>>
>>
>>     <https://www.linkedin.com/profile/view?id=161468467&trk=nav_responsive_tab_profile_pic>https://www.linkedin.com/profile/view?id=161468467&trk=nav_responsive_tab_profile_pic
>>
>>
>>
>>     _______________________________________________
>>     R-sig-Geo mailing list
>>     R-sig-Geo at r-project.org <mailto:R-sig-Geo at r-project.org>
>>     https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>     --
>     Jon Olav Skøien
>     Joint Research Centre - European Commission
>     Institute for Environment and Sustainability (IES)
>     Climate Risk Management Unit
>
>     Via Fermi 2749, TP 100-01,  I-21027 Ispra (VA), ITALY
>
>     jon.skoien at jrc.ec.europa.eu <mailto:jon.skoien at jrc.ec.europa.eu>
>     Tel:+39 0332 789205 <tel:%2B39%200332%20789205>
>
>     Disclaimer: Views expressed in this email are those of the individual and do not necessarily represent official views of the European Commission.
>
>
>
>
> --
> -------------------------------------------------------
> /*Anand Sookun (*//*MPhil. *//*PhD Candidate, University of Mauritius)*/
> /*Director cum Freelance Consultant*/
> /*Soft Sustainable Services (Mauritius)*/
> /*Research and Consultancy*/
>
> Website: http://sustain-ability.webs.com/
>
>
> https://www.linkedin.com/profile/view?id=161468467&trk=nav_responsive_tab_profile_pic
>

-- 
Jon Olav Skøien
Joint Research Centre - European Commission
Institute for Environment and Sustainability (IES)
Climate Risk Management Unit

Via Fermi 2749, TP 100-01,  I-21027 Ispra (VA), ITALY

jon.skoien at jrc.ec.europa.eu
Tel:  +39 0332 789205

Disclaimer: Views expressed in this email are those of the individual 
and do not necessarily represent official views of the European Commission.



More information about the R-sig-Geo mailing list