[R-sig-Geo] help: krigged map do not show colours
Anand Sookun
asookun at gmail.com
Wed Aug 5 16:09:47 CEST 2015
Dear Jon
I have to thank you so much for solving this issue. I did't notice that
there was a projection and grid problem.
I hope I would be able to move forward with my analysis with R and perhaps
still need your kind and much appreciated help.
Cheers
Anand
On Wed, Aug 5, 2015 at 12:08 PM, Jon Skoien <jon.skoien at jrc.ec.europa.eu>
wrote:
> Good.
> For the next function, I think you are trying to use an sp-function
> (gridded) on a raster object. You can convert between these, but not
> necessarily use the same functions. Use
> spgrid = rasterToPoints(YourRaster, spatial = TRUE)
> gridded(spgrid) = TRUE
> if you want to convert your raster layer to a spatial object.
>
> Best wishes,
> Jon
>
>
>
> On 8/5/2015 10:00 AM, Anand Sookun wrote:
>
> Dear John
>
> Thanks again.
> this time it worked but the variogram is not plotting well and some other
> problems croped.
> Error in (function (classes, fdef, mtable) :
> unable to find an inherited method for function ‘gridded’ for signature
> ‘"RasterLayer"
>
> I will try by looking closely at the scripts and be back to you soon
>
> Best Wishes
>
> Anand
>
> On Wed, Aug 5, 2015 at 11:36 AM, Jon Skoien <jon.skoien at jrc.ec.europa.eu>
> wrote:
>
>> Dear Anand
>>
>> On 8/5/2015 9:03 AM, Anand Sookun wrote:
>>
>> Dear John
>>
>> Greetings
>>
>> I really appreciate your help. Itried what you proposed but got stuck
>> with the following:
>>
>> > proj4string(carbon_seq) <- CRS("+init=epsg 4326") # epsg-code for
>> latlong
>> Error in CRS("+init=epsg 4326") : no colon in init= string
>>
>> Sorry, there is a : missing, should be
>> CRS("+init=epsg:4326")
>>
>> See if it works better!
>> Jon
>>
>>
>> Also I TRIED AGAIN
>> > proj4string(carbon_seq) <- CRS("+init=epsg4326") # epsg-code for latlong
>> Error in (function (classes, fdef, mtable) :
>> unable to find an inherited method for function ‘proj4string<-’ for
>> signature ‘"data.frame", "CRS"
>>
>> I tried with rgdal but got the same eror
>> > require(rgdal)
>> Loading required package: rgdal
>> rgdal: version: 0.8-16, (SVN revision 498)
>> Geospatial Data Abstraction Library extensions to R successfully loaded
>> Loaded GDAL runtime: GDAL 1.10.1, released 2013/08/26
>> Path to GDAL shared files:
>> C:/Users/Anand/Documents/R/win-library/3.0/rgdal/gdal
>> GDAL does not use iconv for recoding strings.
>> Loaded PROJ.4 runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 480]
>> Path to PROJ.4 shared files:
>> C:/Users/Anand/Documents/R/win-library/3.0/rgdal/proj
>>
>>
>> im attacing the gri file.
>>
>> Thanks for your time.
>>
>> CHEERS
>>
>> ANAND
>>
>> On Tue, Aug 4, 2015 at 4:55 PM, Jon Skoien <
>> <jon.skoien at jrc.ec.europa.eu>jon.skoien at jrc.ec.europa.eu> wrote:
>>
>>> 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>
>>>>> <asookun at gmail.com>asookun at gmail.com
>>>>> <mailto: <asookun at gmail.com>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/>
>>>>> 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>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/>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>
>>>>> 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 <%2B39%200332%20789205>
>>>> <tel:%2B39%200332%20789205> <%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 <%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/>
>> 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.
>>
>>
>
>
> --
> -------------------------------------------------------
> *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
>
>
> --
> 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.
>
>
--
-------------------------------------------------------
*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]]
More information about the R-sig-Geo
mailing list