Re: [R-sig-Geo] Google Earth Engine?

2017-05-30 Thread Andy Bunn

On 5/26/17, 4:02 PM, "b.rowling...@gmail.com on behalf of Barry
Rowlingson"  wrote:

>On Fri, May 26, 2017 at 11:34 PM, Andy Bunn  wrote:
>> Does anybody out there interface with the google earth engine from R?
>>I'm too old a dog to learn python. -Andy
>
>Too old? Never! See: https://www.xkcd.com/353/


Perfect! I had forgotten that one. Well, I think I might have found a new
project. The GEE seems like the perfect tool for Landsat products. Thanks,
A



>
>Given that the other supported option is Javascript
>
>I suspect a solution using one of the R-Python interfaces
>("reticulate" perhaps) might be the best solution, but you still might
>have to learn python to construct the analysis jobs.
>
>Barry
>
>
>
>> [[alternative HTML version deleted]]
>>
>> ___
>> R-sig-Geo mailing list
>> R-sig-Geo@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Re: [R-sig-Geo] Deal with multiple factorlevel in one grid square

2017-05-30 Thread Michael Sumner
maybe fasterize? Only on GitHub, and requires sf.

(Mixing raster and sf is piece-meal, but very doable).

https://github.com/ecohealthalliance/fasterize

On Tue, 30 May 2017, 21:55 Miriam Püts  wrote:

> Hi all,
>
> @Pat: yes, that is almost what I need. If I would do it in ArcGIS I would
> use Polygon to raster (with a second raster as reference) and then choose
> majority.  there a way to do it in R? If I use raster::extract() I would
> extract data from the raster object for the locations of other spatial
> data, but I need spatial data for the raster object...
>
>
> Cheers,
> Miriam
>
> <°)))>< >°)))>< >°)))>< >°)))><
>
> Miriam Püts
> Marine Lebende Ressourcen/ Marine Living Resources
> Thünen-Institut für Seefischerei/ Thünen Institute of Sea fisheries
> Palmaille 9
> 22767 Hamburg (Germany)
>
> Tel:  +49 40 38905-105
> Mail: miriam.pu...@thuenen.de
>
> - Ursprüngliche Mail -
> Von: "Alexander Herr" 
> An: "patrick schratz" , mdsum...@gmail.com,
> "miriam puets" 
> CC: r-sig-geo@r-project.org
> Gesendet: Donnerstag, 25. Mai 2017 02:28:40
> Betreff: RE: [R-sig-Geo] Deal with multiple factorlevel in one grid square
>
> Hiya,
>
> Do you want a raster with attribute information (ie several attributes
> from your  shape file)? You can achieve this with a workflow that uses
> raster::extract() to assigne unique IDs of polygon to raster cells
> create a RAT for you raster
> assign to the unique IDs of raster RAT the attributes of your polygon
> unique IDs (many to one relationship) with something like merge() or
> functions in libraries like diplyr or data.table
>
> Cheers
> Herry
>
> -Original Message-
> From: R-sig-Geo [mailto:r-sig-geo-boun...@r-project.org] On Behalf Of
> Patrick Schratz
> Sent: Wednesday, 24 May 2017 10:48 PM
> To: Michael Sumner ; Miriam Püts <
> miriam.pu...@thuenen.de>
> Cc: r-sig-geo@r-project.org
> Subject: Re: [R-sig-Geo] Deal with multiple factorlevel in one grid square
>
> Do you want to do what is called “zonal statistics” in ArcGIS with
> “majority" option?
>
> You may check out this SO question and try the “mode” function within
> raster::extract() - maybe it does what you need.
>
> (I’m also unsure if I understand the question correctly)
>
> Cheers, Pat
>
> PhD Student at Department of Geography - GIScience group
> Friedrich-Schiller-University Jena, Germany
> Tel.: +49-3641-9-48973
> Web: https://pat-s.github.io
>
> On 24. May 2017, 12:35 +0200, Miriam Püts ,
> wrote:
> > Hi Mike,
> >
> > I will try to explain it a bit more in detail. Maybe it is easier to
> understand if I start from the end. In the end I would like to have an
> ASCII file to read into Ecospace, which has the same extensions and
> coordinates as other files I already created. This ASCII should contain
> information about the sediment type within each predefined cell. To create
> this ASCII file I have a shape file with the polygons representing the
> sediment type and my grid which I applied to other variables to have the
> same extend. Now I would like to create a grid containing the information
> on sediment. Here, per grid cell the sediment type which covers the most of
> the cell should be defined and connected with the coordinates for the grid
> cell.
> >
> > I hope this makes it more clear...
> >
> >
> > <°)))>< >°)))>< >°)))>< >°)))><
> >
> > Miriam Püts
> > Marine Lebende Ressourcen/ Marine Living Resources Thünen-Institut für
> > Seefischerei/ Thünen Institute of Sea fisheries Palmaille 9
> > 22767 Hamburg (Germany)
> >
> > Tel: +49 40 38905-105
> > Mail: miriam.pu...@thuenen.de
> >
> >
> > Von: "Michael Sumner"  > An: "Miriam Püts" , r-sig-geo@r-project.org
> > Gesendet: Mittwoch, 24. Mai 2017 11:55:14
> > Betreff: Re: [R-sig-Geo] Deal with multiple factorlevel in one grid
> > square
> >
> >
> >
> > raster::extract(grid, poly, weights = TRUE) is a start. It returns a
> list which is painful to deal with at first, but can be collected into one
> data frame for standard summarizing.
> >
> > I'm still a bit confused about whether you want an estimate of a cell
> overlap in a polygon or something else.
> >
> > Cheers, Mike
> > On Wed, 24 May 2017, 17:12 Miriam Püts < [ mailto:
> miriam.pu...@thuenen.de | miriam.pu...@thuenen.de ] > wrote:
> >
> >
> > Hi everyone,
> >
> > I have the following problem: I have a personalized grid and a shape
> file with polygons representing sediment types. Now I would like to apply
> this grid to the Polygons to identify the sediment type most common within
> each grid. I tried it with rasterize, but here I can only chose last or
> first. Die you have any suggestions how I might get the sediment type for
> each raster cell?
> >
> > Thank you for your help!
> >
> > <°)))>< >°)))>< >°)))>< >°)))><
> >
> > Miriam Püts
> > Marine Lebende Ressourcen/ Marine Living 

Re: [R-sig-Geo] How to fit a pure spatial variogram on a spatio-temporal empirical one

2017-05-30 Thread Dr . Benedikt Gräler

Dear Carlo,

the code below is a bit of a hack, but does what you are asking for. The 
classes "gstatVariogram" and "StVariogram" have slight different design 
and so do the functions fit.variogram and fit.StVariogram. Note that 
spVv is now a pooled variogram across all time steps of your dataset 
treating each time slice as an independent copy of the same pure spatial 
process (i.e. strong temporal autocorrelation might influence your 
estimation).


HTH,

 Ben


library(gstat)
data("vv")
plot(vv)

spaceOnly <- vv$timelag == 0

spVv <- cbind(vv[spaceOnly,],
  data.frame(dir.hor=rep(0, sum(spaceOnly)),
 dir.ver=rep(0, sum(spaceOnly

# drop empty (NA) first row
spVv <- spVv[-1, ]

# manually re-class
class(spVv) <- c("gstatVariogram","data.frame")

plot(spVv)

fitSpVgm <- fit.variogram(spVv, vgm(30, "Exp", 150, 10))
plot(spVv, fitSpVgm)



On 29/05/2017 20:13, Carlo Cavalieri wrote:

Hi, I am using the R package GSTAT to make a spatio-temporal interpolation for 
my thesis and I wanted to know if it was possible to obtain the pure spatial 
empirical variogram from the spatio-temporal so that I can use it to fit a pure 
spatial variogram, for example exponential.
Unfortunately fit.variogram only accepts objects output of variogram, not of 
variogramST. One possible solution could be to extract tlag=0 from the 
StVariogram and convert the output to class variogramModel, but I have no idea 
on how to do this.
I look for a way to do this because fit the spatial variogram for each day 
separately is not a good idea given the small number of observation stations.

One way is definitely possible since the authors of the paper "Spatio-Temporal 
Interpolation using gstat” managed to compare the results of pure spatial and 
spatio-temporal interpolation (that is what I want to do): Below a quotation from 
that paper.

"For comparison with classical approaches, we interpolate across Germany 
iteratively for each single day using all available data for variogram estimation. 
The purely spatial empirical variogram can directly be obtained from the empirical 
spatio-temporal variogram, by fixing the temporal lag at 0 separation. From the same 
set of variogram models as investigated for the spatio-temporal models, the 
exponential model (partial sill: 66.5, range: 224 km, nugget: 13.5) is the best 
suited based on the optimisation criterion.”

Does anyone have any idea?
Thank you
Carlo
[[alternative HTML version deleted]]

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo



--
Dr. Benedikt Gräler
52°North Initiative for Geospatial Open Source Software GmbH
Martin-Luther-King-Weg 24
48155 Muenster, Germany

E-Mail: b.grae...@52north.org
Fon: +49-(0)-251/396371-39
Fax: +49-(0)-251/396371-11

http://52north.org/
Twitter: @FiveTwoN

General Managers: Dr. Albert Remke, Dr. Andreas Wytzisk
Local Court Muenster HRB 10849
<>___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo