Re: [R-sig-Geo] [DKIM] Re: Interpolating snowfall values on a Digital Elevation Model [SEC=UNCLASSIFIED]
Some thoughts. On Wed, 21 Feb 2018 at 09:09 Li Jin <jin...@ga.gov.au> wrote: > The statement ‘the kriging functions in R still don't accept lat/long’ is > incorrect. Please check the gstat and spm packages for details. When your > data is collected from one utm, it is a good idea to project the data using > utm. If the data is from two or more utms, you need to use different > projection systems. The references provided demonstrated that the commonly > used WGS84 is as good as relevant projection systems. > > From: Dominik Schneider [mailto:dominik.schnei...@colorado.edu] > Sent: Wednesday, 21 February 2018 5:02 AM > To: Li Jin > Cc: Stefano Sofia; r-sig-geo@r-project.org > Subject: Re: [DKIM] Re: [R-sig-Geo] Interpolating snowfall values on a > Digital Elevation Model [SEC=UNCLASSIFIED] > > The effects of spatial reference systems on interpolations and accuracy > are minimal, and lat and long can be used. > Fair enough, thanks for sending the references. But, as far as I know, the > kriging functions in R still don't accept lat/long. > > > Any such advice is completely dependent on the study area, and the goals of the study. UTM is really bad advice generally, it's just a simplistic system we've inherited and is used way too much, a self-fulfilling prophecy. Whether standard tools should or shouldn't accept data as given is a crux philosophical point, no tool in R is smart enough to know whether it's "correct enough" to assume one way or another. You can't assume any measurement represents reality in any projection, it depends how far, how much, how large - you can't traverse from local neighbourhood scales to continental, for example - you'd make different choices regarding compromises at *some such point*. Please don't ever advise use of UTM without specific caveats about the scope and extent of the research - which is impossible in general - learn to use map projections with the compromises they entail, there's nothing stopping creating a local new one, from any of the main families with PROJ.4, and with many variants of compromises on area, length, shape and scale. I tend not to say anything about this topic in this environment, but this time the back and forth is particularly misleading IMO. We actually have the worst of worlds at the moment, with many softwares opinionatedly preventing one from making educational mistakes. There's no real authority, lots of opinion and habit. lots of exploration but not enough pushing and argument - I advise keeping an open mind and exploring deeply. Cheers, Mike. > > On Mon, Feb 19, 2018 at 8:54 PM, Li Jin <jin...@ga.gov.au jin...@ga.gov.au>> wrote: > The effects of spatial reference systems on interpolations and accuracy > are minimal, and lat and long can be used. Please see the following studies > for details. > > Jiang, W., Li, J., 2013. Are Spatial Modelling Methods Sensitive to > Spatial Reference Systems for Predicting Marine Environmental Variables, > 20th International Congress on Modelling and Simulation: Adelaide, > Australia, pp. 387-393. > Jiang, W., Li, J., 2014. The effects of spatial reference systems on the > predictive accuracy of spatial interpolation methods. Record 2014/01. > Geoscience Australia: Canberra, pp 33. > http://dx.doi.org/10.11636/Record.2014.001. > Turner, A.J., Li, J., Jiang, W., 2017. Effects of Spatial Reference > Systems on the Accuracy of Spatial Predictive Modelling along a Latitudinal > Gradient, 22nd International Congress on Modelling and Simulation: Hobart, > Tasmania, Australia, pp. 106-112. > > > -Original Message- > From: R-sig-Geo [mailto:r-sig-geo-boun...@r-project.org r-sig-geo-boun...@r-project.org>] On Behalf Of Dominik Schneider > Sent: Wednesday, 14 February 2018 3:21 AM > To: Stefano Sofia > Cc: r-sig-geo@r-project.org<mailto:r-sig-geo@r-project.org> > Subject: [DKIM] Re: [R-sig-Geo] Interpolating snowfall values on a Digital > Elevation Model > > You can't use a lat/long coordinate system when kriging because the > concept of distance is ambiguous. Convert all your data a UTM grid like you > had in your first post and it should work. > > Another note, It looks like you are working at 0.01 deg which is on the > order of 1km resolution so you may find other covariates such as aspect, > slope, and wind sheltering/exposure, terrain roughness for estimating snow > on the ground useful. see some of the earliest papers by Carroll, Cressie, > and Elder. > > Carroll, S. S., and N. Cressie (1996), A comparison of geostatistical > methodologies used to estimate snow water equivalent, *JAWRA Journal of the > American Water Resources Association*, *32*(2), 267–278, > doi:10./j.1752-1688.1996.tb03450.x. > > Carroll, S. S., and N. Cressie (1997), Spatial modeling of sn
Re: [R-sig-Geo] [DKIM] Re: Interpolating snowfall values on a Digital Elevation Model [SEC=UNCLASSIFIED]
The statement ‘the kriging functions in R still don't accept lat/long’ is incorrect. Please check the gstat and spm packages for details. When your data is collected from one utm, it is a good idea to project the data using utm. If the data is from two or more utms, you need to use different projection systems. The references provided demonstrated that the commonly used WGS84 is as good as relevant projection systems. From: Dominik Schneider [mailto:dominik.schnei...@colorado.edu] Sent: Wednesday, 21 February 2018 5:02 AM To: Li Jin Cc: Stefano Sofia; r-sig-geo@r-project.org Subject: Re: [DKIM] Re: [R-sig-Geo] Interpolating snowfall values on a Digital Elevation Model [SEC=UNCLASSIFIED] The effects of spatial reference systems on interpolations and accuracy are minimal, and lat and long can be used. Fair enough, thanks for sending the references. But, as far as I know, the kriging functions in R still don't accept lat/long. On Mon, Feb 19, 2018 at 8:54 PM, Li Jin <jin...@ga.gov.au<mailto:jin...@ga.gov.au>> wrote: The effects of spatial reference systems on interpolations and accuracy are minimal, and lat and long can be used. Please see the following studies for details. Jiang, W., Li, J., 2013. Are Spatial Modelling Methods Sensitive to Spatial Reference Systems for Predicting Marine Environmental Variables, 20th International Congress on Modelling and Simulation: Adelaide, Australia, pp. 387-393. Jiang, W., Li, J., 2014. The effects of spatial reference systems on the predictive accuracy of spatial interpolation methods. Record 2014/01. Geoscience Australia: Canberra, pp 33. http://dx.doi.org/10.11636/Record.2014.001. Turner, A.J., Li, J., Jiang, W., 2017. Effects of Spatial Reference Systems on the Accuracy of Spatial Predictive Modelling along a Latitudinal Gradient, 22nd International Congress on Modelling and Simulation: Hobart, Tasmania, Australia, pp. 106-112. -Original Message- From: R-sig-Geo [mailto:r-sig-geo-boun...@r-project.org<mailto:r-sig-geo-boun...@r-project.org>] On Behalf Of Dominik Schneider Sent: Wednesday, 14 February 2018 3:21 AM To: Stefano Sofia Cc: r-sig-geo@r-project.org<mailto:r-sig-geo@r-project.org> Subject: [DKIM] Re: [R-sig-Geo] Interpolating snowfall values on a Digital Elevation Model You can't use a lat/long coordinate system when kriging because the concept of distance is ambiguous. Convert all your data a UTM grid like you had in your first post and it should work. Another note, It looks like you are working at 0.01 deg which is on the order of 1km resolution so you may find other covariates such as aspect, slope, and wind sheltering/exposure, terrain roughness for estimating snow on the ground useful. see some of the earliest papers by Carroll, Cressie, and Elder. Carroll, S. S., and N. Cressie (1996), A comparison of geostatistical methodologies used to estimate snow water equivalent, *JAWRA Journal of the American Water Resources Association*, *32*(2), 267–278, doi:10./j.1752-1688.1996.tb03450.x. Carroll, S. S., and N. Cressie (1997), Spatial modeling of snow water equivalent using covariances estimated from spatial and geomorphic attributes, *Journal of Hydrology*, *190*(1-2), 42–59. Balk, B., and K. Elder (2000), Combining binary decision tree and geostatistical methods to estimate snow distribution in a mountain watershed, *Water Resources Research*, *36*(1), 13–26, doi:10.1029/1999WR900251. Erxleben, J., K. Elder, and R. Davis (2002), Comparison of spatial interpolation methods for estimating snow distribution in the Colorado Rocky Mountains, *Hydrological Processes*, *16*(18), 3627–3649, doi:10.1002/hyp.1239. Erickson, T. A., M. W. Williams, and A. Winstral (2005), Persistence of topographic controls on the spatial distribution of snow in rugged mountain terrain, Colorado, United States, *Water Resour. Res.*, *41*(4), W04014, doi:10.1029/2003WR002973. On Tue, Feb 13, 2018 at 3:45 AM, Stefano Sofia < stefano.so...@regione.marche.it<mailto:stefano.so...@regione.marche.it>> wrote: > Dear Daniel and list users, > I tried to follow the instructions but I encountered two kinds of errors. > This is a reproducibile code: > > > --- > library(automap) > library(ggplot2) > library(gstat) > library(raster) > library(rasterVis) > library(rgdal) > library(maptools) > > ## LOADING DEM > ita_DEM <- getData('alt', country='ITA', mask=TRUE) > crs(ita_DEM) <- "+init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs > +ellps=WGS84 +towgs84=0,0,0" > #ita_DEM <- as(ita_DEM, "SpatialGridDataFrame") > str(ita_DEM) > > ## LOADING RAINFALL DATA > rain_data <- data.frame(Cumulata=c(11.8, 9.0, 8.0, 36.6, 9.4), > Long_Cent=c(12.61874, 12.78690, 12.96756, 13.15599, 13.2815
Re: [R-sig-Geo] [DKIM] Re: Interpolating snowfall values on a Digital Elevation Model [SEC=UNCLASSIFIED]
> > The effects of spatial reference systems on interpolations and accuracy > are minimal, and lat and long can be used. Fair enough, thanks for sending the references. But, as far as I know, the kriging functions in R still don't accept lat/long. On Mon, Feb 19, 2018 at 8:54 PM, Li Jinwrote: > The effects of spatial reference systems on interpolations and accuracy > are minimal, and lat and long can be used. Please see the following studies > for details. > > Jiang, W., Li, J., 2013. Are Spatial Modelling Methods Sensitive to > Spatial Reference Systems for Predicting Marine Environmental Variables, > 20th International Congress on Modelling and Simulation: Adelaide, > Australia, pp. 387-393. > Jiang, W., Li, J., 2014. The effects of spatial reference systems on the > predictive accuracy of spatial interpolation methods. Record 2014/01. > Geoscience Australia: Canberra, pp 33. http://dx.doi.org/10.11636/ > Record.2014.001. > Turner, A.J., Li, J., Jiang, W., 2017. Effects of Spatial Reference > Systems on the Accuracy of Spatial Predictive Modelling along a Latitudinal > Gradient, 22nd International Congress on Modelling and Simulation: Hobart, > Tasmania, Australia, pp. 106-112. > > > -Original Message- > From: R-sig-Geo [mailto:r-sig-geo-boun...@r-project.org] On Behalf Of > Dominik Schneider > Sent: Wednesday, 14 February 2018 3:21 AM > To: Stefano Sofia > Cc: r-sig-geo@r-project.org > Subject: [DKIM] Re: [R-sig-Geo] Interpolating snowfall values on a Digital > Elevation Model > > You can't use a lat/long coordinate system when kriging because the > concept of distance is ambiguous. Convert all your data a UTM grid like you > had in your first post and it should work. > > Another note, It looks like you are working at 0.01 deg which is on the > order of 1km resolution so you may find other covariates such as aspect, > slope, and wind sheltering/exposure, terrain roughness for estimating snow > on the ground useful. see some of the earliest papers by Carroll, Cressie, > and Elder. > > Carroll, S. S., and N. Cressie (1996), A comparison of geostatistical > methodologies used to estimate snow water equivalent, *JAWRA Journal of the > American Water Resources Association*, *32*(2), 267–278, > doi:10./j.1752-1688.1996.tb03450.x. > > Carroll, S. S., and N. Cressie (1997), Spatial modeling of snow water > equivalent using covariances estimated from spatial and geomorphic > attributes, *Journal of Hydrology*, *190*(1-2), 42–59. > > Balk, B., and K. Elder (2000), Combining binary decision tree and > geostatistical methods to estimate snow distribution in a mountain > watershed, *Water Resources Research*, *36*(1), 13–26, > doi:10.1029/1999WR900251. > > Erxleben, J., K. Elder, and R. Davis (2002), Comparison of spatial > interpolation methods for estimating snow distribution in the Colorado > Rocky Mountains, *Hydrological Processes*, *16*(18), 3627–3649, > doi:10.1002/hyp.1239. > > Erickson, T. A., M. W. Williams, and A. Winstral (2005), Persistence of > topographic controls on the spatial distribution of snow in rugged mountain > terrain, Colorado, United States, *Water Resour. Res.*, *41*(4), W04014, > doi:10.1029/2003WR002973. > > > On Tue, Feb 13, 2018 at 3:45 AM, Stefano Sofia < > stefano.so...@regione.marche.it> wrote: > > > Dear Daniel and list users, > > I tried to follow the instructions but I encountered two kinds of errors. > > This is a reproducibile code: > > > > > > --- > > library(automap) > > library(ggplot2) > > library(gstat) > > library(raster) > > library(rasterVis) > > library(rgdal) > > library(maptools) > > > > ## LOADING DEM > > ita_DEM <- getData('alt', country='ITA', mask=TRUE) > > crs(ita_DEM) <- "+init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs > > +ellps=WGS84 +towgs84=0,0,0" > > #ita_DEM <- as(ita_DEM, "SpatialGridDataFrame") > > str(ita_DEM) > > > > ## LOADING RAINFALL DATA > > rain_data <- data.frame(Cumulata=c(11.8, 9.0, 8.0, 36.6, 9.4), > > Long_Cent=c(12.61874, 12.78690, 12.96756, 13.15599, 13.28157), > > Lat_Cent=c(43.79447, 43.85185, 43.76267, 43.03470, 43.08003), > > Altitude=c(112.20, 42.93, 36.14, 747, 465)) > > > > stations <- data.frame(rain_data$Long_Cent, rain_data$Lat_Cent) > > rain_data <- SpatialPointsDataFrame(stations, rain_data, > > proj4string=CRS("+init=epsg:4326")) > > stations <- SpatialPoints(stations, > > proj4string=CRS("+init=epsg:4326")) > > > > ## EXTRACT THE ELEVATION VALUES TO MY POINTS > > rain_data$ExtractedElevationValues <- extract(x=ita_DEM, y=stations) > > > > ## CREATE GRID FOR KRIGING OUTPUT > > minx <- rain_data@bbox[1,1] > > maxx <- rain_data@bbox[1,2] > > miny <- rain_data@bbox[2,1] > > maxy <- rain_data@bbox[2,2] > > pixel <- 0.01 > > grd <- expand.grid(x=seq(minx, maxx, by=pixel), y=seq(miny, maxy, > > by=pixel)) > > coordinates(grd) <- ~x+y > > gridded(grd) <- TRUE > > proj4string(grd) <-
Re: [R-sig-Geo] [DKIM] Re: Interpolating snowfall values on a Digital Elevation Model [SEC=UNCLASSIFIED]
The effects of spatial reference systems on interpolations and accuracy are minimal, and lat and long can be used. Please see the following studies for details. Jiang, W., Li, J., 2013. Are Spatial Modelling Methods Sensitive to Spatial Reference Systems for Predicting Marine Environmental Variables, 20th International Congress on Modelling and Simulation: Adelaide, Australia, pp. 387-393. Jiang, W., Li, J., 2014. The effects of spatial reference systems on the predictive accuracy of spatial interpolation methods. Record 2014/01. Geoscience Australia: Canberra, pp 33. http://dx.doi.org/10.11636/Record.2014.001. Turner, A.J., Li, J., Jiang, W., 2017. Effects of Spatial Reference Systems on the Accuracy of Spatial Predictive Modelling along a Latitudinal Gradient, 22nd International Congress on Modelling and Simulation: Hobart, Tasmania, Australia, pp. 106-112. -Original Message- From: R-sig-Geo [mailto:r-sig-geo-boun...@r-project.org] On Behalf Of Dominik Schneider Sent: Wednesday, 14 February 2018 3:21 AM To: Stefano Sofia Cc: r-sig-geo@r-project.org Subject: [DKIM] Re: [R-sig-Geo] Interpolating snowfall values on a Digital Elevation Model You can't use a lat/long coordinate system when kriging because the concept of distance is ambiguous. Convert all your data a UTM grid like you had in your first post and it should work. Another note, It looks like you are working at 0.01 deg which is on the order of 1km resolution so you may find other covariates such as aspect, slope, and wind sheltering/exposure, terrain roughness for estimating snow on the ground useful. see some of the earliest papers by Carroll, Cressie, and Elder. Carroll, S. S., and N. Cressie (1996), A comparison of geostatistical methodologies used to estimate snow water equivalent, *JAWRA Journal of the American Water Resources Association*, *32*(2), 267–278, doi:10./j.1752-1688.1996.tb03450.x. Carroll, S. S., and N. Cressie (1997), Spatial modeling of snow water equivalent using covariances estimated from spatial and geomorphic attributes, *Journal of Hydrology*, *190*(1-2), 42–59. Balk, B., and K. Elder (2000), Combining binary decision tree and geostatistical methods to estimate snow distribution in a mountain watershed, *Water Resources Research*, *36*(1), 13–26, doi:10.1029/1999WR900251. Erxleben, J., K. Elder, and R. Davis (2002), Comparison of spatial interpolation methods for estimating snow distribution in the Colorado Rocky Mountains, *Hydrological Processes*, *16*(18), 3627–3649, doi:10.1002/hyp.1239. Erickson, T. A., M. W. Williams, and A. Winstral (2005), Persistence of topographic controls on the spatial distribution of snow in rugged mountain terrain, Colorado, United States, *Water Resour. Res.*, *41*(4), W04014, doi:10.1029/2003WR002973. On Tue, Feb 13, 2018 at 3:45 AM, Stefano Sofia < stefano.so...@regione.marche.it> wrote: > Dear Daniel and list users, > I tried to follow the instructions but I encountered two kinds of errors. > This is a reproducibile code: > > > --- > library(automap) > library(ggplot2) > library(gstat) > library(raster) > library(rasterVis) > library(rgdal) > library(maptools) > > ## LOADING DEM > ita_DEM <- getData('alt', country='ITA', mask=TRUE) > crs(ita_DEM) <- "+init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs > +ellps=WGS84 +towgs84=0,0,0" > #ita_DEM <- as(ita_DEM, "SpatialGridDataFrame") > str(ita_DEM) > > ## LOADING RAINFALL DATA > rain_data <- data.frame(Cumulata=c(11.8, 9.0, 8.0, 36.6, 9.4), > Long_Cent=c(12.61874, 12.78690, 12.96756, 13.15599, 13.28157), > Lat_Cent=c(43.79447, 43.85185, 43.76267, 43.03470, 43.08003), > Altitude=c(112.20, 42.93, 36.14, 747, 465)) > > stations <- data.frame(rain_data$Long_Cent, rain_data$Lat_Cent) > rain_data <- SpatialPointsDataFrame(stations, rain_data, > proj4string=CRS("+init=epsg:4326")) > stations <- SpatialPoints(stations, > proj4string=CRS("+init=epsg:4326")) > > ## EXTRACT THE ELEVATION VALUES TO MY POINTS > rain_data$ExtractedElevationValues <- extract(x=ita_DEM, y=stations) > > ## CREATE GRID FOR KRIGING OUTPUT > minx <- rain_data@bbox[1,1] > maxx <- rain_data@bbox[1,2] > miny <- rain_data@bbox[2,1] > maxy <- rain_data@bbox[2,2] > pixel <- 0.01 > grd <- expand.grid(x=seq(minx, maxx, by=pixel), y=seq(miny, maxy, > by=pixel)) > coordinates(grd) <- ~x+y > gridded(grd) <- TRUE > proj4string(grd) <- CRS("+init=epsg:4326") > > ## KRIGING: autoKrige(YourMeasurements ~ YourExtractedElevationValues, > YourMeasurementLocations, TargetGrid) OK_snow <- autoKrige(Cumulata ~ > rain_data$ExtractedElevationValues, > rain_data, grd) > > --- > > The error I get is: > Error in autoKrige(Cumulata ~ rain_data$ExtractedElevationValues, > rain_data, : > Either input_data or