Subscribe to R-sig-geo feed
This is an archive for R-sig-geo, not a forum. It is not possible to post through Nabble - you may not start a new thread nor follow up an existing thread. If you wish to post, but are not subscribed to the list through the list homepage, subscribe first (through the list homepage, not via Nabble) and post from your subscribed email address. Until 2015-06-20, subscribers could post through Nabble, but policy has been changed as too many non-subscribers misunderstood the interface.
Updated: 1 hour 21 min ago

Re: Warning in fit.variogram: value out of range in 'bessel k' | automap and gstat packages

Mon, 09/16/2019 - 10:06
Hi Jon and others,

thank you. Apparently the gstat have the capacity to fit the parameters
only specifing the variogram model (
https://www.r-spatial.org/r/2016/02/14/gstat-variogram-fitting.html), but I
imagine there is a limitation to search for the correct parameters.
Then it is better when we provide some initial values for help in this
process as the autofitVariogram perform.

Best regards,

Frederico

On Mon, Sep 16, 2019 at 6:11 AM <[hidden email]> wrote:

> Hi Frederico,
>
>
> gstat does not have different behaviour, because autofitVariogram is using
> fit.variogram, after some preprocessing. You get the convergency problems
> with fit.variogram because you don't supply start values for the variogram,
> which is done in the preprocessing of autofitVariogram.
>
>
> Cheers,
>
> Jon
>
>
> --
> Jon Olav Skøien
> European Commission
> Joint Research Centre – JRC.E.1
> Disaster Risk Management Unit
> Building 26b 1/144 | Via E.Fermi 2749, I-21027 Ispra (VA) Italy, TP 267
> [hidden email] <https://remi.webmail.ec.europa.eu/owa/redir.aspx?C=O12RUARdbvGA3WF3zGoSV0j5xMoZlQcIEwiS4Y9G8jzXRqCCC1HUCA..&URL=mailto%3ajon.skoien%40jrc.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.
>
>
> ------------------------------
> *From:* Frederico Faleiro <[hidden email]>
> *Sent:* 13 September 2019 23:16:22
> *To:* SKOIEN Jon (JRC-ISPRA)
> *Cc:* RsigGeo
> *Subject:* Re: [R-sig-Geo] Warning in fit.variogram: value out of range
> in 'bessel k' | automap and gstat packages
>
> Hi Jon and others,
>
> thank you for your help. The problem is really in the Ste model (Matern,
> M. Stein's parameterization). The warning only happens
> when I execute this model. However in the gstat with the same parameters
> for lambda have problem of convergency. Do you think the gstat have
> different bevavior to the same issue?
>
> av <- autofitVariogram(jan~1, pr, model = "Ste", verbose = T)
> # In fit.variogram(experimental_variogram, model = vgm(psill = psill,
>  ... :  value out of range in 'bessel_k'
>
> # define the same kappa values of automap
> seq.k <- c(0.05, seq(0.2, 2, 0.1), 5, 10)
> ve <- variogram(jan~1, pr)
> v <- fit.variogram(v, vgm("Ste"), fit.kappa = seq.k)
> Warning messages:
> 1: In fit.variogram(object, model, fit.sills = fit.sills, fit.ranges =
> fit.ranges,  :
>   No convergence after 200 iterations: try different initial values?
> 2: In fit.variogram(object, model, fit.sills = fit.sills, fit.ranges =
> fit.ranges,  :
>   No convergence after 200 iterations: try different initial values?
> 3: In fit.variogram(o, m, fit.kappa = FALSE, fit.method = fit.method,  :
>   No convergence after 200 iterations: try different initial values?
>
>
> Best regards,
>
> Frederico
>
> On Wed, Sep 11, 2019 at 7:02 AM <[hidden email]> wrote:
>
>>
>> Frederico,
>>
>>
>> I don't think you need to worry about this warning in this case.
>> autofitVariogram tests a lot of variogram models (and different
>> kappa-values) in the search for the best one, and then fit.variogram tries
>> to optimize the parameters based on these. It seems the warnings were
>> generated in the C-code of gstat, based on some of the tested kappa-values
>> for the Matern variogram (Stein implementation). It also seems that these
>> kappa values did not give good fits to the sample variogram, so you did not
>> get the warning from the best fit variogram in this case.
>>
>>
>> Hope this helps,
>>
>> Jon
>>
>>
>>
>> --
>> Jon Olav Skøien
>> European Commission
>> Joint Research Centre – JRC.E.1
>> Disaster Risk Management Unit
>> Building 26b 1/144 | Via E.Fermi 2749, I-21027 Ispra (VA) Italy, TP 267
>> [hidden email] <https://remi.webmail.ec.europa.eu/owa/redir.aspx?C=O12RUARdbvGA3WF3zGoSV0j5xMoZlQcIEwiS4Y9G8jzXRqCCC1HUCA..&URL=mailto%3ajon.skoien%40jrc.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.
>>
>>
>> ------------------------------
>> *From:* R-sig-Geo <[hidden email]> on behalf of
>> Frederico Faleiro <[hidden email]>
>> *Sent:* 09 September 2019 21:28:32
>> *To:* RsigGeo
>> *Subject:* [R-sig-Geo] Warning in fit.variogram: value out of range in
>> 'bessel k' | automap and gstat packages
>>
>> Dear list,
>>
>> I am trying make an interpolation with the function autoKrige from the
>> package automap, but I received more than 50 times the following warning
>> message:
>>
>> In fit.variogram(experimental variogram, model = vgm(psill = psill, ... :
>> value out of range in 'bessel k'
>>
>> I have tryed identify it in the code of fit.variogram and vgm from the
>> gstat package, but they do not have any warning about it in the code. Then
>> I imagine the warning is from another function.
>> I fitted the variogram automatically in the automap and after I fitted in
>> the gstat to check if there is the same warning for that parameters, but
>> in
>> the last I do not have any warning. When I check the variogram model, it
>> has a good fit apparently. I provided the reproductible example below.
>>
>> Do you know the consequences of this warning and how can I avoid it? I
>> would like to use the automap package because I need interpolate many
>> other
>> files like this.
>>
>> # example
>> library(automap)
>> library(sp)
>>
>> # download the data in:
>>
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__drive.google.com_file_d_1L33-5FQgpNMdwvWff-5FuMrwhl-5FKCajrtlVe_view-3Fusp-3Dsharing&d=DwICAg&c=8NwulVB6ucrjuSGiwL_ckQ&r=DA6jV5X00Z1YpyMh4OS79xeSQGErBqY83CBz841DNnU&m=YlpT3yKlbNVLvXMp08O8X1LkniHGXTzJeLDHLTotwOI&s=U2z98vHb1mpKhKJ9UXA0RUrPi6r6IXibq1cuuyB0jWY&e=
>> # read the data
>> pr <- read.table('pr_monC.txt', header = TRUE, sep = "\t")
>> coordinates(pr) <- ~long+lat
>> # read the grid
>> gr <- read.table('grid.txt' , header = TRUE, sep = '\t')
>> gridded(gr) <-  ~long+lat
>>
>> # automatic fit variogram with automap
>> av <- autofitVariogram(jan~1, pr)
>> # warnings message:   In fit.variogram(experimental variogram, model =
>> vgm(psill = psill, ... : value out of range in 'bessel k'
>> plot(av) # get in the graph the parameters to fit the variogram
>>
>> # fit variogram in gstat with the model parameters from autofitVariogram
>> to
>> check if there is any warning message too
>> ve <- variogram(jan~1, pr)
>> v <- fit.variogram(ve, vgm(psill = 9723, model = "Ste", range = 20, nugget
>> = 194, kappa = 0.8))
>> # it does not produce any warning
>> plot(ve, v)
>>
>> Best regards,
>>
>> Frederico
>>
>>         [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> [hidden email]
>>
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dsig-2Dgeo&d=DwICAg&c=8NwulVB6ucrjuSGiwL_ckQ&r=DA6jV5X00Z1YpyMh4OS79xeSQGErBqY83CBz841DNnU&m=YlpT3yKlbNVLvXMp08O8X1LkniHGXTzJeLDHLTotwOI&s=wzYnAjR9sQtl23JiTMc5f1m79m8uQgUt9DSCj3wuTeA&e=
>>
>
        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: landmap package, predict method gave an error of memory exhausted

Mon, 09/16/2019 - 10:03
Thank you Tom.  Is a regression type problem.

I will send you a copy of my data.

Manuel

El lun., 16 sept. 2019 a las 8:54, Tomislav Hengl (<[hidden email]>)
escribió:

>
> Manuel,
>
> Please send me a private message and a copy of your data so I can test
> where does the RAM blows up. Is it a classification or regression type
> problem?
>
> T. Hengl
>
> On 9/16/19 4:01 PM, Manuel Spínola wrote:
> > Dear list members,
> >
> > I am fitting an Ensemble Machine Learning with the R package landmap,
> using
> > the function train.spLearner, the resulting object is large 2.5 GB, and
> > when I tried to predict I I got the message of memory exhausted.
> >
> > I have only 14 points and 23 covariables, in a very small area.
> >
> > Using R 3.6.1
> > MacOS, 16GB of ram
> >
> >
> > pred_co <- predict(m_co)
> >
> > Error: vector memory exhausted (limit reached?)
> > Error during wrapup: vector memory exhausted (limit reached?)
> >
> >
> >
>

--
*Manuel Spínola, Ph.D.*
Instituto Internacional en Conservación y Manejo de Vida Silvestre
Universidad Nacional
Apartado 1350-3000
Heredia
COSTA RICA
[hidden email] <[hidden email]>
[hidden email]
Teléfono: (506) 8706 - 4662
Personal website: Lobito de río <https://sites.google.com/site/lobitoderio/>
Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: landmap package, predict method gave an error of memory exhausted

Mon, 09/16/2019 - 09:54

Manuel,

Please send me a private message and a copy of your data so I can test
where does the RAM blows up. Is it a classification or regression type
problem?

T. Hengl

On 9/16/19 4:01 PM, Manuel Spínola wrote:
> Dear list members,
>
> I am fitting an Ensemble Machine Learning with the R package landmap, using
> the function train.spLearner, the resulting object is large 2.5 GB, and
> when I tried to predict I I got the message of memory exhausted.
>
> I have only 14 points and 23 covariables, in a very small area.
>
> Using R 3.6.1
> MacOS, 16GB of ram
>
>
> pred_co <- predict(m_co)
>
> Error: vector memory exhausted (limit reached?)
> Error during wrapup: vector memory exhausted (limit reached?)
>
>
>
_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

landmap package, predict method gave an error of memory exhausted

Mon, 09/16/2019 - 09:01
Dear list members,

I am fitting an Ensemble Machine Learning with the R package landmap, using
the function train.spLearner, the resulting object is large 2.5 GB, and
when I tried to predict I I got the message of memory exhausted.

I have only 14 points and 23 covariables, in a very small area.

Using R 3.6.1
MacOS, 16GB of ram


pred_co <- predict(m_co)

Error: vector memory exhausted (limit reached?)
Error during wrapup: vector memory exhausted (limit reached?)



--
*Manuel Spínola, Ph.D.*
Instituto Internacional en Conservación y Manejo de Vida Silvestre
Universidad Nacional
Apartado 1350-3000
Heredia
COSTA RICA
[hidden email] <[hidden email]>
[hidden email]
Teléfono: (506) 8706 - 4662
Personal website: Lobito de río <https://sites.google.com/site/lobitoderio/>
Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: Warning in fit.variogram: value out of range in 'bessel k' | automap and gstat packages

Mon, 09/16/2019 - 04:11
Hi Frederico,


gstat does not have different behaviour, because autofitVariogram is using fit.variogram, after some preprocessing. You get the convergency problems with fit.variogram because you don't supply start values for the variogram, which is done in the preprocessing of autofitVariogram.


Cheers,

Jon


--
Jon Olav Sk�ien
European Commission
Joint Research Centre � JRC.E.1
Disaster Risk Management Unit
Building 26b 1/144 | Via E.Fermi 2749, I-21027 Ispra (VA) Italy, TP 267
[hidden email]<https://remi.webmail.ec.europa.eu/owa/redir.aspx?C=O12RUARdbvGA3WF3zGoSV0j5xMoZlQcIEwiS4Y9G8jzXRqCCC1HUCA..&URL=mailto%3ajon.skoien%40jrc.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.

________________________________
From: Frederico Faleiro <[hidden email]>
Sent: 13 September 2019 23:16:22
To: SKOIEN Jon (JRC-ISPRA)
Cc: RsigGeo
Subject: Re: [R-sig-Geo] Warning in fit.variogram: value out of range in 'bessel k' | automap and gstat packages

Hi Jon and others,

thank you for your help. The problem is really in the Ste model (Matern, M. Stein's parameterization). The warning only happens
when I execute this model. However in the gstat with the same parameters for lambda have problem of convergency. Do you think the gstat have different bevavior to the same issue?

av <- autofitVariogram(jan~1, pr, model = "Ste", verbose = T)
# In fit.variogram(experimental_variogram, model = vgm(psill = psill,  ... :  value out of range in 'bessel_k'

# define the same kappa values of automap
seq.k <- c(0.05, seq(0.2, 2, 0.1), 5, 10)
ve <- variogram(jan~1, pr)
v <- fit.variogram(v, vgm("Ste"), fit.kappa = seq.k)
Warning messages:
1: In fit.variogram(object, model, fit.sills = fit.sills, fit.ranges = fit.ranges,  :
  No convergence after 200 iterations: try different initial values?
2: In fit.variogram(object, model, fit.sills = fit.sills, fit.ranges = fit.ranges,  :
  No convergence after 200 iterations: try different initial values?
3: In fit.variogram(o, m, fit.kappa = FALSE, fit.method = fit.method,  :
  No convergence after 200 iterations: try different initial values?


Best regards,

Frederico

On Wed, Sep 11, 2019 at 7:02 AM <[hidden email]<mailto:[hidden email]>> wrote:


Frederico,


I don't think you need to worry about this warning in this case. autofitVariogram tests a lot of variogram models (and different kappa-values) in the search for the best one, and then fit.variogram tries to optimize the parameters based on these. It seems the warnings were generated in the C-code of gstat, based on some of the tested kappa-values for the Matern variogram (Stein implementation). It also seems that these kappa values did not give good fits to the sample variogram, so you did not get the warning from the best fit variogram in this case.


Hope this helps,

Jon



--
Jon Olav Sk�ien
European Commission
Joint Research Centre � JRC.E.1
Disaster Risk Management Unit
Building 26b 1/144 | Via E.Fermi 2749, I-21027 Ispra (VA) Italy, TP 267
[hidden email]<https://remi.webmail.ec.europa.eu/owa/redir.aspx?C=O12RUARdbvGA3WF3zGoSV0j5xMoZlQcIEwiS4Y9G8jzXRqCCC1HUCA..&URL=mailto%3ajon.skoien%40jrc.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.

________________________________
From: R-sig-Geo <[hidden email]<mailto:[hidden email]>> on behalf of Frederico Faleiro <[hidden email]<mailto:[hidden email]>>
Sent: 09 September 2019 21:28:32
To: RsigGeo
Subject: [R-sig-Geo] Warning in fit.variogram: value out of range in 'bessel k' | automap and gstat packages

Dear list,

I am trying make an interpolation with the function autoKrige from the
package automap, but I received more than 50 times the following warning
message:

In fit.variogram(experimental variogram, model = vgm(psill = psill, ... :
value out of range in 'bessel k'

I have tryed identify it in the code of fit.variogram and vgm from the
gstat package, but they do not have any warning about it in the code. Then
I imagine the warning is from another function.
I fitted the variogram automatically in the automap and after I fitted in
the gstat to check if there is the same warning for that parameters, but in
the last I do not have any warning. When I check the variogram model, it
has a good fit apparently. I provided the reproductible example below.

Do you know the consequences of this warning and how can I avoid it? I
would like to use the automap package because I need interpolate many other
files like this.

# example
library(automap)
library(sp)

# download the data in:
https://urldefense.proofpoint.com/v2/url?u=https-3A__drive.google.com_file_d_1L33-5FQgpNMdwvWff-5FuMrwhl-5FKCajrtlVe_view-3Fusp-3Dsharing&d=DwICAg&c=8NwulVB6ucrjuSGiwL_ckQ&r=DA6jV5X00Z1YpyMh4OS79xeSQGErBqY83CBz841DNnU&m=YlpT3yKlbNVLvXMp08O8X1LkniHGXTzJeLDHLTotwOI&s=U2z98vHb1mpKhKJ9UXA0RUrPi6r6IXibq1cuuyB0jWY&e=
# read the data
pr <- read.table('pr_monC.txt', header = TRUE, sep = "\t")
coordinates(pr) <- ~long+lat
# read the grid
gr <- read.table('grid.txt' , header = TRUE, sep = '\t')
gridded(gr) <-  ~long+lat

# automatic fit variogram with automap
av <- autofitVariogram(jan~1, pr)
# warnings message:   In fit.variogram(experimental variogram, model =
vgm(psill = psill, ... : value out of range in 'bessel k'
plot(av) # get in the graph the parameters to fit the variogram

# fit variogram in gstat with the model parameters from autofitVariogram to
check if there is any warning message too
ve <- variogram(jan~1, pr)
v <- fit.variogram(ve, vgm(psill = 9723, model = "Ste", range = 20, nugget
= 194, kappa = 0.8))
# it does not produce any warning
plot(ve, v)

Best regards,

Frederico

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]<mailto:[hidden email]>
https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dsig-2Dgeo&d=DwICAg&c=8NwulVB6ucrjuSGiwL_ckQ&r=DA6jV5X00Z1YpyMh4OS79xeSQGErBqY83CBz841DNnU&m=YlpT3yKlbNVLvXMp08O8X1LkniHGXTzJeLDHLTotwOI&s=wzYnAjR9sQtl23JiTMc5f1m79m8uQgUt9DSCj3wuTeA&e=

        [[alternative HTML version deleted]]


_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: Raster reprojection in R

Sat, 09/14/2019 - 17:10
Hi again, I checked the actual extent and it makes more sense now as it is
a tiny region of the Aleutians. The problem in raster's heuristic is that
part of your projected raster overlaps the anti-meridan, and so the
extent-determiner unhelpfully expands to include the full extent of all
longitudes:

library(raster)
ex <- extent(-11119505, -10007555, 5559753, 6671703)
prj <- "+proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181
+ +b=6371007.181 +units=m +no_defs"
projectExtent(raster(ex, crs = prj, res = 463), crs = "+init=epsg:4326")
class      : RasterLayer
dimensions : 2402, 2402, 5769604  (nrow, ncol, ncell)
resolution : 0.1498734, 0.004163854  (x, y)
extent     : -179.9968, 179.999, 49.99842, 60  (xmin, xmax, ymin, ymax)
crs        : +init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs
+ellps=WGS84 +towgs84=0,0,0

Illustrated here:
https://gist.github.com/mdsumner/012c4c8e36ffa42e9053621420924eab

So, you'd want something like

projectRaster(tile, raster(extent(-180, -135, 50, 60), crs = geocrs, res =
0.02)

but, that's still outrageously wasteful and unnecessary as mentioned before
- but depends on what you are doing.

(It's a curious way to store data, but I'm pretty sure the MODIS terra
community settled on a global raster in sinusoidal to match the L3 bins in
a way the marine community doesn't usually do).

Thanks for the example, that gives a good way to approach this question on
various forums where it comes up quite a lot and I never was really
motivated to pursue before.

Cheers, Mike.



On Sat, Sep 14, 2019 at 7:49 PM Michael Sumner <[hidden email]> wrote:

> You should set a target raster with the extent and dimensions required.
> There are inherent limits in reprojection and heuristics won't always work.
> Generally using a target raster is much more efficient anyway.
>
> But, this is an intensive remodeling of the data, delivered in a
> projection for good reason (global equal area probably, and reasonably
> close to the L3 bins used for daily statistics.
>
> You should find an alternative process IMO, are you trying to extract
> pixel values or something else?
>
> Cheers, Mike
>
> On Sat., 14 Sep. 2019, 11:30 Víctor Rodríguez Galiano, <
> [hidden email]> wrote:
>
>> Hello,
>>
>>  I am trying to reproject a raster image from sinusoidal projection using
>> “projectRaster”. The size of the image is not very big (922 KB), but when
>> applying the reprojection I get this error message: “Error: cannot
>> allocate
>> vector of size 7.1 Gb”. Please see the code below:
>>
>> HDFpath <- "C:/images/" # dir with images
>> setwd(HDFpath)            # set working directory
>> library(raster)
>> library(rgdal)
>> geocrs <- "+proj=longlat +ellps=WGS84 +datum=WGS84"
>> tile <- brick(“image.tif”)
>> tile_reproj <- projectRaster(tile, crs=geocrs)
>>
>> Error: cannot allocate vector of size 7.1 Gb
>>
>> > tile
>> class       : RasterStack
>> dimensions  : 2400, 2400, 5760000, 1  (nrow, ncol, ncell, nlayers)
>> resolution  : 463.3127, 463.3127  (x, y)
>> extent      : -11119505, -10007555, 5559753, 6671703  (xmin, xmax, ymin,
>> ymax)
>> coord. ref. : +proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181
>> +b=6371007.181 +units=m +no_defs
>> names       : INCA.h08v03.Dormancy_median
>> min values  :                          19
>> max values  :                         540
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> [hidden email]
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
--
Michael Sumner
Software and Database Engineer
Australian Antarctic Division
Hobart, Australia
e-mail: [hidden email]

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: Area calculation of forest cover classes.

Sat, 09/14/2019 - 10:42
Hi Enoch,

It's inappropriate to email just me, rather than the whole list - I
don't have the capacity to provide private tutorials.

You could import your prediction maps into a GIS you're more familiar with.
You could read a tutorial on the raster package, which provides tools
to do what you want.
If you're still struggling with basic R commands, you could read the
Introduction to R that comes with it, or one of the many other
tutorials that are available online and in your library.

In general, this email list is excellent for "I tried this and
couldn't get it to work. How do I fix my error?" and not great for "I
don't know anything about R but I have this project please explain
everything."

So: You have a map. What format is your map? What have you tried? What
didn't work? Where have you searched? What documentation have you
read?

Sarah

On Thu, Sep 12, 2019 at 6:59 PM Enoch Gyamfi Ampadu <[hidden email]> wrote:
>
> Hi Sarah,
> Thank you for the mail and information. Please I have done the predictions already and have the output maps for both the RF and SVM. Find attached the output map. There are 4 classes and I need to determine the area for each. As I indicated I am now learning area and so not very familiar with a lot of functions. I will be glad of you could provide me with some functions and codes, then I will edit it to suite what I have. I realized you recommended aggregate () and table(), but I don't know how to use them. I will be glad to have some help from you.
>
> Thank you.
>
> Best regards,
>
> Enoch.
>
> On Thu, 12 Sep 2019 at 18:06, Sarah Goslee <[hidden email]> wrote:
>>
>> Hi,
>>
>> Without knowing any details of what you did, the general procedure is:
>>
>> Use your fitted Random Forest or SVM model to predict the class for
>> each pixel in your region of interest - the predict() function.
>> Use standard spatial data methods to aggregate the resulting spatial
>> data, or even standard non-spatial methods, since you know the pixel
>> size - perhaps aggregate() or even table().
>>
>> Sarah
>>
>> On Thu, Sep 12, 2019 at 3:30 AM Enoch Gyamfi Ampadu <[hidden email]> wrote:
>> >
>> > Dear List,
>> >
>> > Please I have carried out an RF and SVM forest cover classification in R. I
>> > want to determine the area in hectors for each of the forest cover classes.
>> > I have not been able to find my way out on it. I wanted to ask if it is
>> > possible to do this in R and will be glad to have assistance on how to
>> > carry that out. And possibly some lead codes to use (I am still learning R
>> > and and how to code.)
>> >
>> > Thank you.
>> >
>> > Best regards,
>> >
>> > Enoch
>> >
>>
>> --
Sarah Goslee (she/her)
http://www.numberwright.com

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: Spatiotemporal autocorrelation in R

Sat, 09/14/2019 - 08:50
Tks Roger for your patience and detailed instruction sincerely!





--



Jun Li
Business School of Anhui University of Technology
 



At 2019-09-14 16:33:19, "Roger Bivand" <[hidden email]> wrote:
>Please do not post HTML, choose plain text in your email client.
>
>Please include all links to previous postings you refer to in plain text,
>as HTML content is deleted. Checking HTML content for hostile payloads is
>a significant contributor to server-related energy use and thus emissions.
>I assume that your reference to "Todd" is to some previous posting here or
>elsewhere, but this link is lost: please provide it. Note that posting
>size is limited to 50KB, because sending large volumes needs to be
>checked, and 3.5K subscribers do not need large postings in their inboxes.
>Make your posting as specific as possible.
>
>Where possible, do include reproducible examples (code in posting, data
>from one of the packages you use. In that way, an interested subscriber
>can grasp more easily your intensions.
>
>Roger Bivand
>
>
>On Sat, 14 Sep 2019, � wrote:
>
>> Hi, all
>
>> I have also made some search on joint tempospatial correlation of
>> bivariate. Maybe it's possible to calculate spatial autocorrelation of
>> bivariate for each year(just by Geoda), then loop by yearly lag, as Todd
>> said. Some titles of relevant papers as follows:
>
>> 1.CARBayesST version 3.0.1 - spatiotemporal areal unit modeling in R
>> with conditional autoregressive priors
>
>> 2.Analyzing spatio-temporal auttocorrelation with LISTA-Viz
>
>> 3.Controlling for localised spatio-temporal autocorrelation in long-term
>> air pollution and health studies
>
>> 4.Multivariate temporal and spatio-temporal methods
>
>> 5.Spatiotemporal - An R package
>
>> 6.A spatio-temporal model for estimating the long-term effects of air
>> pollution on respiratory hospital admissions in Greater London
>
>> Similarly, we have measured two variables(urban land and population
>> yearly growth in 2010-2017 in Yangtze River Delta) and want to study
>> their joint tempospatial correlation, i.e.We just want to check if there
>> is significant tempospatial correlation between urban land and
>> population growth. If there is, where is main cluster located and what's
>> lag order of time and space where this cluster happened? Hope for your
>> direction.
>
>> Tks for Jay Lee's supply of above references.
>>
>>
>>
>>
>> Jun Li
>> Business School of AHUT, China
>>
>>
>>
>>
>>
>> [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> [hidden email]
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
>--
>Roger Bivand
>Department of Economics, Norwegian School of Economics,
>Helleveien 30, N-5045 Bergen, Norway.
>voice: +47 55 95 93 55; e-mail: [hidden email]
>https://orcid.org/0000-0003-2392-6140
>https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en        [[alternative HTML version deleted]]


_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: Raster reprojection in R

Sat, 09/14/2019 - 04:49
You should set a target raster with the extent and dimensions required.
There are inherent limits in reprojection and heuristics won't always work.
Generally using a target raster is much more efficient anyway.

But, this is an intensive remodeling of the data, delivered in a projection
for good reason (global equal area probably, and reasonably close to the L3
bins used for daily statistics.

You should find an alternative process IMO, are you trying to extract pixel
values or something else?

Cheers, Mike

On Sat., 14 Sep. 2019, 11:30 Víctor Rodríguez Galiano, <[hidden email]>
wrote:

> Hello,
>
>  I am trying to reproject a raster image from sinusoidal projection using
> “projectRaster”. The size of the image is not very big (922 KB), but when
> applying the reprojection I get this error message: “Error: cannot allocate
> vector of size 7.1 Gb”. Please see the code below:
>
> HDFpath <- "C:/images/" # dir with images
> setwd(HDFpath)            # set working directory
> library(raster)
> library(rgdal)
> geocrs <- "+proj=longlat +ellps=WGS84 +datum=WGS84"
> tile <- brick(“image.tif”)
> tile_reproj <- projectRaster(tile, crs=geocrs)
>
> Error: cannot allocate vector of size 7.1 Gb
>
> > tile
> class       : RasterStack
> dimensions  : 2400, 2400, 5760000, 1  (nrow, ncol, ncell, nlayers)
> resolution  : 463.3127, 463.3127  (x, y)
> extent      : -11119505, -10007555, 5559753, 6671703  (xmin, xmax, ymin,
> ymax)
> coord. ref. : +proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181
> +b=6371007.181 +units=m +no_defs
> names       : INCA.h08v03.Dormancy_median
> min values  :                          19
> max values  :                         540
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Raster reprojection in R

Sat, 09/14/2019 - 04:30
Hello,

 I am trying to reproject a raster image from sinusoidal projection using
“projectRaster”. The size of the image is not very big (922 KB), but when
applying the reprojection I get this error message: “Error: cannot allocate
vector of size 7.1 Gb”. Please see the code below:

HDFpath <- "C:/images/" # dir with images
setwd(HDFpath)            # set working directory
library(raster)
library(rgdal)
geocrs <- "+proj=longlat +ellps=WGS84 +datum=WGS84"
tile <- brick(“image.tif”)
tile_reproj <- projectRaster(tile, crs=geocrs)

Error: cannot allocate vector of size 7.1 Gb

> tile
class       : RasterStack
dimensions  : 2400, 2400, 5760000, 1  (nrow, ncol, ncell, nlayers)
resolution  : 463.3127, 463.3127  (x, y)
extent      : -11119505, -10007555, 5559753, 6671703  (xmin, xmax, ymin,
ymax)
coord. ref. : +proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181
+b=6371007.181 +units=m +no_defs
names       : INCA.h08v03.Dormancy_median
min values  :                          19
max values  :                         540

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: Spatiotemporal autocorrelation in R

Sat, 09/14/2019 - 03:33
Please do not post HTML, choose plain text in your email client.

Please include all links to previous postings you refer to in plain text,
as HTML content is deleted. Checking HTML content for hostile payloads is
a significant contributor to server-related energy use and thus emissions.
I assume that your reference to "Todd" is to some previous posting here or
elsewhere, but this link is lost: please provide it. Note that posting
size is limited to 50KB, because sending large volumes needs to be
checked, and 3.5K subscribers do not need large postings in their inboxes.
Make your posting as specific as possible.

Where possible, do include reproducible examples (code in posting, data
from one of the packages you use. In that way, an interested subscriber
can grasp more easily your intensions.

Roger Bivand


On Sat, 14 Sep 2019, 李俊 wrote:

> Hi, all

> I have also made some search on joint tempospatial correlation of
> bivariate. Maybe it's possible to calculate spatial autocorrelation of
> bivariate for each year(just by Geoda), then loop by yearly lag, as Todd
> said. Some titles of relevant papers as follows:

> 1.CARBayesST version 3.0.1 - spatiotemporal areal unit modeling in R
> with conditional autoregressive priors

> 2.Analyzing spatio-temporal auttocorrelation with LISTA-Viz

> 3.Controlling for localised spatio-temporal autocorrelation in long-term
> air pollution and health studies

> 4.Multivariate temporal and spatio-temporal methods

> 5.Spatiotemporal - An R package

> 6.A spatio-temporal model for estimating the long-term effects of air
> pollution on respiratory hospital admissions in Greater London

> Similarly, we have measured two variables(urban land and population
> yearly growth in 2010-2017 in Yangtze River Delta) and want to study
> their joint tempospatial correlation, i.e.We just want to check if there
> is significant tempospatial correlation between urban land and
> population growth. If there is, where is main cluster located and what's
> lag order of time and space where this cluster happened? Hope for your
> direction.

> Tks for Jay Lee's supply of above references.
>
>
>
>
> Jun Li
> Business School of AHUT, China
>
>
>
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> --
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: [hidden email]
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand
Department of Economics
Norwegian School of Economics
Helleveien 30
N-5045 Bergen, Norway

Re: Spatiotemporal autocorrelation in R

Fri, 09/13/2019 - 18:58
Hi, all
I have also made some search on joint tempospatial correlation of bivariate. Maybe it's possible to calculate spatial autocorrelation of bivariate for each year(just by Geoda), then loop by yearly lag, as Todd said. Some titles of relevant papers as follows:
1.CARBayesST version 3.0.1 - spatiotemporal areal unit modeling in R with conditional autoregressive priors
2.Analyzing spatio-temporal auttocorrelation with LISTA-Viz
3.Controlling for localised spatio-temporal autocorrelation in long-term air pollution and health studies
4.Multivariate temporal and spatio-temporal methods
5.Spatiotemporal - An R package
6.A spatio-temporal model for estimating the long-term effects of air pollution on respiratory hospital admissions in Greater London
Similarly, we have measured two variables(urban land and population yearly growth in 2010-2017 in Yangtze River Delta) and want to study their joint tempospatial correlation, i.e.We just want to check if there is significant tempospatial correlation between urban land and population growth. If there is, where is main cluster located and what's lag order of time and space where this cluster happened?
Hope for your direction.
Tks for Jay Lee's supply of above references.




Jun Li
Business School of AHUT, China




 
        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: Warning in fit.variogram: value out of range in 'bessel k' | automap and gstat packages

Fri, 09/13/2019 - 16:16
Hi Jon and others,

thank you for your help. The problem is really in the Ste model (Matern, M.
Stein's parameterization). The warning only happens
when I execute this model. However in the gstat with the same parameters
for lambda have problem of convergency. Do you think the gstat have
different bevavior to the same issue?

av <- autofitVariogram(jan~1, pr, model = "Ste", verbose = T)
# In fit.variogram(experimental_variogram, model = vgm(psill = psill,  ...
:  value out of range in 'bessel_k'

# define the same kappa values of automap
seq.k <- c(0.05, seq(0.2, 2, 0.1), 5, 10)
ve <- variogram(jan~1, pr)
v <- fit.variogram(v, vgm("Ste"), fit.kappa = seq.k)
Warning messages:
1: In fit.variogram(object, model, fit.sills = fit.sills, fit.ranges =
fit.ranges,  :
  No convergence after 200 iterations: try different initial values?
2: In fit.variogram(object, model, fit.sills = fit.sills, fit.ranges =
fit.ranges,  :
  No convergence after 200 iterations: try different initial values?
3: In fit.variogram(o, m, fit.kappa = FALSE, fit.method = fit.method,  :
  No convergence after 200 iterations: try different initial values?


Best regards,

Frederico

On Wed, Sep 11, 2019 at 7:02 AM <[hidden email]> wrote:

>
> Frederico,
>
>
> I don't think you need to worry about this warning in this case.
> autofitVariogram tests a lot of variogram models (and different
> kappa-values) in the search for the best one, and then fit.variogram tries
> to optimize the parameters based on these. It seems the warnings were
> generated in the C-code of gstat, based on some of the tested kappa-values
> for the Matern variogram (Stein implementation). It also seems that these
> kappa values did not give good fits to the sample variogram, so you did not
> get the warning from the best fit variogram in this case.
>
>
> Hope this helps,
>
> Jon
>
>
>
> --
> Jon Olav Skøien
> European Commission
> Joint Research Centre – JRC.E.1
> Disaster Risk Management Unit
> Building 26b 1/144 | Via E.Fermi 2749, I-21027 Ispra (VA) Italy, TP 267
> [hidden email] <https://remi.webmail.ec.europa.eu/owa/redir.aspx?C=O12RUARdbvGA3WF3zGoSV0j5xMoZlQcIEwiS4Y9G8jzXRqCCC1HUCA..&URL=mailto%3ajon.skoien%40jrc.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.
>
>
> ------------------------------
> *From:* R-sig-Geo <[hidden email]> on behalf of
> Frederico Faleiro <[hidden email]>
> *Sent:* 09 September 2019 21:28:32
> *To:* RsigGeo
> *Subject:* [R-sig-Geo] Warning in fit.variogram: value out of range in
> 'bessel k' | automap and gstat packages
>
> Dear list,
>
> I am trying make an interpolation with the function autoKrige from the
> package automap, but I received more than 50 times the following warning
> message:
>
> In fit.variogram(experimental variogram, model = vgm(psill = psill, ... :
> value out of range in 'bessel k'
>
> I have tryed identify it in the code of fit.variogram and vgm from the
> gstat package, but they do not have any warning about it in the code. Then
> I imagine the warning is from another function.
> I fitted the variogram automatically in the automap and after I fitted in
> the gstat to check if there is the same warning for that parameters, but in
> the last I do not have any warning. When I check the variogram model, it
> has a good fit apparently. I provided the reproductible example below.
>
> Do you know the consequences of this warning and how can I avoid it? I
> would like to use the automap package because I need interpolate many other
> files like this.
>
> # example
> library(automap)
> library(sp)
>
> # download the data in:
>
> https://urldefense.proofpoint.com/v2/url?u=https-3A__drive.google.com_file_d_1L33-5FQgpNMdwvWff-5FuMrwhl-5FKCajrtlVe_view-3Fusp-3Dsharing&d=DwICAg&c=8NwulVB6ucrjuSGiwL_ckQ&r=DA6jV5X00Z1YpyMh4OS79xeSQGErBqY83CBz841DNnU&m=YlpT3yKlbNVLvXMp08O8X1LkniHGXTzJeLDHLTotwOI&s=U2z98vHb1mpKhKJ9UXA0RUrPi6r6IXibq1cuuyB0jWY&e=
> # read the data
> pr <- read.table('pr_monC.txt', header = TRUE, sep = "\t")
> coordinates(pr) <- ~long+lat
> # read the grid
> gr <- read.table('grid.txt' , header = TRUE, sep = '\t')
> gridded(gr) <-  ~long+lat
>
> # automatic fit variogram with automap
> av <- autofitVariogram(jan~1, pr)
> # warnings message:   In fit.variogram(experimental variogram, model =
> vgm(psill = psill, ... : value out of range in 'bessel k'
> plot(av) # get in the graph the parameters to fit the variogram
>
> # fit variogram in gstat with the model parameters from autofitVariogram to
> check if there is any warning message too
> ve <- variogram(jan~1, pr)
> v <- fit.variogram(ve, vgm(psill = 9723, model = "Ste", range = 20, nugget
> = 194, kappa = 0.8))
> # it does not produce any warning
> plot(ve, v)
>
> Best regards,
>
> Frederico
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
>
> https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dsig-2Dgeo&d=DwICAg&c=8NwulVB6ucrjuSGiwL_ckQ&r=DA6jV5X00Z1YpyMh4OS79xeSQGErBqY83CBz841DNnU&m=YlpT3yKlbNVLvXMp08O8X1LkniHGXTzJeLDHLTotwOI&s=wzYnAjR9sQtl23JiTMc5f1m79m8uQgUt9DSCj3wuTeA&e=
>
        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: Problem of vector allocation in GSIF package

Fri, 09/13/2019 - 11:40
I wanted to say, "I would like to try landmap".

El vie., 13 sept. 2019 a las 9:45, Tomislav Hengl (<[hidden email]>)
escribió:

>
> You have two options:
>
> 1. Run predictions using tiling
> (
> https://github.com/Envirometrix/BigSpatialDataR#dem-analysis-using-tiling-and-parallelization
> )
>
> 2. Buy more RAM.
>
> I suggest using option 1 since option 2 can propagate to infinity.
>
> PS: I am working on a new package
> (https://github.com/Envirometrix/landmap/) that should give more
> flexibility to users and maybe even incorporate tiling of large objects
> by default.
>
>
> On 9/13/19 5:38 PM, Manuel Spínola wrote:
> > Dear list members,
> >
> > I am fitting a model with the GSIF package, but I ran into a problem of
> > vector allocation.  Is there any way to solve this problem?  See code and
> > error message below.
> >
> > I am using:
> > R 3.6.1
> > GSIF 0.5-5
> > Mac with 16 GB of RAM
> >
> >> rk_rf_ac <- fit.gstatModel(variables_todos_sp["ac"],
> ac_formulaString_correlacion, covar_finales_sp, method =
> "quantregForest")Fitting a Quantile Regression Forest model...Shapiro-Wilk
> normality test and Anderson-Darling normality test report probability of <
> .05 indicating lack of normal distribution for residualsFitting a 2D
> variogram...Saving an object of class 'gstatModel'...> rk_rf_ac_pred <-
> GSIF::predict(rk_rf_ac, covar_finales_sp, predict.method = "KED")Error:
> cannot allocate vector of size 19.4 Gb
> >
> > Thank you very much,
> >
> > Manuel
> >
>

--
*Manuel Spínola, Ph.D.*
Instituto Internacional en Conservación y Manejo de Vida Silvestre
Universidad Nacional
Apartado 1350-3000
Heredia
COSTA RICA
[hidden email] <[hidden email]>
[hidden email]
Teléfono: (506) 8706 - 4662
Personal website: Lobito de río <https://sites.google.com/site/lobitoderio/>
Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: Problem of vector allocation in GSIF package

Fri, 09/13/2019 - 11:39
Thank you very much Tom.

I will like to try landmap.

Best,

Manuel

El vie., 13 sept. 2019 a las 9:45, Tomislav Hengl (<[hidden email]>)
escribió:

>
> You have two options:
>
> 1. Run predictions using tiling
> (
> https://github.com/Envirometrix/BigSpatialDataR#dem-analysis-using-tiling-and-parallelization
> )
>
> 2. Buy more RAM.
>
> I suggest using option 1 since option 2 can propagate to infinity.
>
> PS: I am working on a new package
> (https://github.com/Envirometrix/landmap/) that should give more
> flexibility to users and maybe even incorporate tiling of large objects
> by default.
>
>
> On 9/13/19 5:38 PM, Manuel Spínola wrote:
> > Dear list members,
> >
> > I am fitting a model with the GSIF package, but I ran into a problem of
> > vector allocation.  Is there any way to solve this problem?  See code and
> > error message below.
> >
> > I am using:
> > R 3.6.1
> > GSIF 0.5-5
> > Mac with 16 GB of RAM
> >
> >> rk_rf_ac <- fit.gstatModel(variables_todos_sp["ac"],
> ac_formulaString_correlacion, covar_finales_sp, method =
> "quantregForest")Fitting a Quantile Regression Forest model...Shapiro-Wilk
> normality test and Anderson-Darling normality test report probability of <
> .05 indicating lack of normal distribution for residualsFitting a 2D
> variogram...Saving an object of class 'gstatModel'...> rk_rf_ac_pred <-
> GSIF::predict(rk_rf_ac, covar_finales_sp, predict.method = "KED")Error:
> cannot allocate vector of size 19.4 Gb
> >
> > Thank you very much,
> >
> > Manuel
> >
>

--
*Manuel Spínola, Ph.D.*
Instituto Internacional en Conservación y Manejo de Vida Silvestre
Universidad Nacional
Apartado 1350-3000
Heredia
COSTA RICA
[hidden email] <[hidden email]>
[hidden email]
Teléfono: (506) 8706 - 4662
Personal website: Lobito de río <https://sites.google.com/site/lobitoderio/>
Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: Problem of vector allocation in GSIF package

Fri, 09/13/2019 - 10:45

You have two options:

1. Run predictions using tiling
(https://github.com/Envirometrix/BigSpatialDataR#dem-analysis-using-tiling-and-parallelization)

2. Buy more RAM.

I suggest using option 1 since option 2 can propagate to infinity.

PS: I am working on a new package
(https://github.com/Envirometrix/landmap/) that should give more
flexibility to users and maybe even incorporate tiling of large objects
by default.


On 9/13/19 5:38 PM, Manuel Spínola wrote:
> Dear list members,
>
> I am fitting a model with the GSIF package, but I ran into a problem of
> vector allocation.  Is there any way to solve this problem?  See code and
> error message below.
>
> I am using:
> R 3.6.1
> GSIF 0.5-5
> Mac with 16 GB of RAM
>
>> rk_rf_ac <- fit.gstatModel(variables_todos_sp["ac"], ac_formulaString_correlacion, covar_finales_sp, method = "quantregForest")Fitting a Quantile Regression Forest model...Shapiro-Wilk normality test and Anderson-Darling normality test report probability of < .05 indicating lack of normal distribution for residualsFitting a 2D variogram...Saving an object of class 'gstatModel'...> rk_rf_ac_pred <- GSIF::predict(rk_rf_ac, covar_finales_sp, predict.method = "KED")Error: cannot allocate vector of size 19.4 Gb
>
> Thank you very much,
>
> Manuel
>
_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Problem of vector allocation in GSIF package

Fri, 09/13/2019 - 10:38
Dear list members,

I am fitting a model with the GSIF package, but I ran into a problem of
vector allocation.  Is there any way to solve this problem?  See code and
error message below.

I am using:
R 3.6.1
GSIF 0.5-5
Mac with 16 GB of RAM

> rk_rf_ac <- fit.gstatModel(variables_todos_sp["ac"], ac_formulaString_correlacion, covar_finales_sp, method = "quantregForest")Fitting a Quantile Regression Forest model...Shapiro-Wilk normality test and Anderson-Darling normality test report probability of < .05 indicating lack of normal distribution for residualsFitting a 2D variogram...Saving an object of class 'gstatModel'...> rk_rf_ac_pred <- GSIF::predict(rk_rf_ac, covar_finales_sp, predict.method = "KED")Error: cannot allocate vector of size 19.4 Gb

Thank you very much,

Manuel

--
*Manuel Spínola, Ph.D.*
Instituto Internacional en Conservación y Manejo de Vida Silvestre
Universidad Nacional
Apartado 1350-3000
Heredia
COSTA RICA
[hidden email] <[hidden email]>
[hidden email]
Teléfono: (506) 8706 - 4662
Personal website: Lobito de río <https://sites.google.com/site/lobitoderio/>
Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: Gridding a daily time series in R

Thu, 09/12/2019 - 11:15


> On Sep 12, 2019, at 9:03 AM, Sarah Goslee <[hidden email]> wrote:
>
> Creating the NetCDF file is easy - there are multiple packages to do that.

Can I  just gently amend this statement.  Writing an arbitrary netCDF file is easy,  writing a useful netCDF file is hard. The difference is the first just pretty much dumps the data,  while the second has files with all the proper metadata and naming conventions and units that follow one of the conventions,  say the CF conventions and names  (http://cfconventions.org).  I strongly urge anyone creating netCDF files to take the time to learn how to create a file that will be really useful for others down the line.

-Roy


**********************
"The contents of this message do not reflect any position of the U.S. Government or NOAA."
**********************
Roy Mendelssohn
Supervisory Operations Research Analyst
NOAA/NMFS
Environmental Research Division
Southwest Fisheries Science Center
***Note new street address***
110 McAllister Way
Santa Cruz, CA 95060
Phone: (831)-420-3666
Fax: (831) 420-3980
e-mail: [hidden email] www: https://www.pfeg.noaa.gov/

"Old age and treachery will overcome youth and skill."
"From those who have been given much, much will be expected"
"the arc of the moral universe is long, but it bends toward justice" -MLK Jr.

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: Area calculation of forest cover classes.

Thu, 09/12/2019 - 11:06
Hi,

Without knowing any details of what you did, the general procedure is:

Use your fitted Random Forest or SVM model to predict the class for
each pixel in your region of interest - the predict() function.
Use standard spatial data methods to aggregate the resulting spatial
data, or even standard non-spatial methods, since you know the pixel
size - perhaps aggregate() or even table().

Sarah

On Thu, Sep 12, 2019 at 3:30 AM Enoch Gyamfi Ampadu <[hidden email]> wrote:
>
> Dear List,
>
> Please I have carried out an RF and SVM forest cover classification in R. I
> want to determine the area in hectors for each of the forest cover classes.
> I have not been able to find my way out on it. I wanted to ask if it is
> possible to do this in R and will be glad to have assistance on how to
> carry that out. And possibly some lead codes to use (I am still learning R
> and and how to code.)
>
> Thank you.
>
> Best regards,
>
> Enoch
>

--
Sarah Goslee (she/her)
http://www.numberwright.com

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: Gridding a daily time series in R

Thu, 09/12/2019 - 11:03
Hi,

Creating the NetCDF file is easy - there are multiple packages to do that.

Everything else you ask about is hard, and not really R questions.

You need to know:

What is the best way to impute missing precipitation data to fit my needs?

What is the best way to grid point-based precipitation data to fit my needs?

Both of these are very complex, and questions better suited to experts
in the field. At the very least, you need to review the copious
existing statistical literature on those topics. Once you have the
theoretical questions answered, the question of "How do I do this in
R?" might be suitable for the list.

But honestly, you are probably better off finding extant gridded data
for your region, rather than trying to do it yourself.

Sarah

On Thu, Sep 12, 2019 at 11:21 AM Cristo Facundo Pérez <[hidden email]> wrote:
>
> Dear community,
>
> I have a daily time series of precipitation, which I intend to transform it
> into a single NetCDF file of daily precipitation. So, first, I would like
> to explore the best way to impute missing values, grid the daily values of
> the different available weather stations and get daily raster files into a
> .nc format. I have read about different climate/hydrological packages such
> as "hyfo",  "meteoland", "gstat" and "hydroTMS". However, I haven't found a
>  way to do it. I am a beginner in spatial/temporal analysis with R. So, my
> question is *does anybody have experience/document in developing a similar
> task so I can get some ideas?*
>
> My database contains id, date, cod, lon, lat, elev, and precipitation value
> of 41 climate stations for the period 1980-2018. I have NAs values in the
> database. I organised my database in two datasets:
>
> 1. where the first column presents date and the other 50 columns present a
> climate station, while rows present the values/NAs [14245 observations of
> 42 variables].
>
> 2. where the name, long, lat, and elev, are presented in the columns. 4
> columns presenting information of 41 weather stations.
>
> I would appreciate any input, idea or suggestion to find a way out to grid
> the daily time series and get the ".nc" file.
>
> Thank you,
>
> Cristo Facundo Pérez
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo


--
Sarah Goslee (she/her)
http://www.numberwright.com

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Pages