Modifications of the methods in resample() function using raster package

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Modifications of the methods in resample() function using raster package

R-sig-geo mailing list
Dear r-sig-geo members,

 ??? I?ve like to know the possibility of make some modifications in
resample() function in raster package. First, in "bilinear" method by
default is assigns a weighted average of the four nearest cells, and
I?ll like to change for five and six nearest cells, too, is possible?
Second, is it possible too to create the mean method to calculate the
arithmetic average of the four, five, and six nearest cells?

Thanks in advanced,
Alexandre

--
Alexandre dos Santos
Geotechnologies and Spatial Statistics applied to Forest Entomology
Instituto Federal de Mato Grosso (IFMT) - Campus Caceres
Caixa Postal 244 (PO Box)
Avenida dos Ramires, s/n - Vila Real
Caceres - MT - CEP 78201-380 (ZIP code)
Phone: (+55) 65 99686-6970 / (+55) 65 3221-2674
Lattes CV: http://lattes.cnpq.br/1360403201088680
OrcID: orcid.org/0000-0001-8232-6722
ResearchGate: www.researchgate.net/profile/Alexandre_Santos10
Publons: https://publons.com/researcher/3085587/alexandre-dos-santos/
--

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Modifications of the methods in resample() function using raster package

Frederico Faleiro
Hi Alexandre,

you can use extract from raster (check the examples in the help page).
Depending of your data you can create a spatial polygon that cover the
number of cells you want and define the summary function or use the buffer
argument.

Best regards,

Frederico Faleiro
Postdoctoral Researcher in the INCT-EECBio (https://www.eecbio.ufg.br/)
Federal University of Goiás | Brazil
RG: https://www.researchgate.net/profile/Frederico_Faleiro



Em seg., 23 de mar. de 2020 às 10:41, ASANTOS via R-sig-Geo <
[hidden email]> escreveu:

> Dear r-sig-geo members,
>
>  ??? I?ve like to know the possibility of make some modifications in
> resample() function in raster package. First, in "bilinear" method by
> default is assigns a weighted average of the four nearest cells, and
> I?ll like to change for five and six nearest cells, too, is possible?
> Second, is it possible too to create the mean method to calculate the
> arithmetic average of the four, five, and six nearest cells?
>
> Thanks in advanced,
> Alexandre
>
> --
> Alexandre dos Santos
> Geotechnologies and Spatial Statistics applied to Forest Entomology
> Instituto Federal de Mato Grosso (IFMT) - Campus Caceres
> Caixa Postal 244 (PO Box)
> Avenida dos Ramires, s/n - Vila Real
> Caceres - MT - CEP 78201-380 (ZIP code)
> Phone: (+55) 65 99686-6970 / (+55) 65 3221-2674
> Lattes CV: http://lattes.cnpq.br/1360403201088680
> OrcID: orcid.org/0000-0001-8232-6722
> ResearchGate: www.researchgate.net/profile/Alexandre_Santos10
> Publons: https://publons.com/researcher/3085587/alexandre-dos-santos/
> --
>
> _______________________________________________
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Modifications of the methods in resample() function using raster package

R-sig-geo mailing list
Thanks Frederico,

But at this moment, I'll try to reduce steps (extract() - focal() -
resample()) and using only resample() function to change the number of
nearest cells, if is possible.

First, in "bilinear" method, I'll like to change the function for work
with the different number of nearest cells and second I'll expected to
create a mean method to calculate the arithmetic average of the n
nearest cells too.

For example, in the first case for 25 nearest cells, I'll like to do
something like resample (myraster, myresolution, window=matrix
(nrow=5,nol=5), method="bilinear") and in the second case resample
(myraster, myresolution, window=matrix (nrow=5,nol=5), fun=mean). But,
obviously this commands doesn't work but expressed my general goal.

Best wishes,

Alexandre

--
Alexandre dos Santos
Geotechnologies and Spatial Statistics applied to Forest Entomology
Instituto Federal de Mato Grosso (IFMT) - Campus Caceres
Caixa Postal 244 (PO Box)
Avenida dos Ramires, s/n - Vila Real
Caceres - MT - CEP 78201-380 (ZIP code)
Phone: (+55) 65 99686-6970 / (+55) 65 3221-2674
Lattes CV: http://lattes.cnpq.br/1360403201088680
OrcID: orcid.org/0000-0001-8232-6722
ResearchGate: www.researchgate.net/profile/Alexandre_Santos10
Publons: https://publons.com/researcher/3085587/alexandre-dos-santos/
--

Em 23/03/2020 14:23, Frederico Faleiro escreveu:

> Hi Alexandre,
>
> you can use extract from raster (check the examples in the help page).
> Depending of your data you can create a spatial polygon that cover the
> number of cells you want and define the summary function or use the
> buffer argument.
>
> Best regards,
>
> Frederico Faleiro
> Postdoctoral Researcher in the INCT-EECBio (https://www.eecbio.ufg.br/)
> Federal University of Goiás | Brazil
> RG: https://www.researchgate.net/profile/Frederico_Faleiro
>
>
> Em seg., 23 de mar. de 2020 às 10:41, ASANTOS via R-sig-Geo
> <[hidden email] <mailto:[hidden email]>> escreveu:
>
>     Dear r-sig-geo members,
>
>      ??? I?ve like to know the possibility of make some modifications in
>     resample() function in raster package. First, in "bilinear" method by
>     default is assigns a weighted average of the four nearest cells, and
>     I?ll like to change for five and six nearest cells, too, is possible?
>     Second, is it possible too to create the mean method to calculate the
>     arithmetic average of the four, five, and six nearest cells?
>
>     Thanks in advanced,
>     Alexandre
>
>     --
>     Alexandre dos Santos
>     Geotechnologies and Spatial Statistics applied to Forest Entomology
>     Instituto Federal de Mato Grosso (IFMT) - Campus Caceres
>     Caixa Postal 244 (PO Box)
>     Avenida dos Ramires, s/n - Vila Real
>     Caceres - MT - CEP 78201-380 (ZIP code)
>     Phone: (+55) 65 99686-6970 / (+55) 65 3221-2674
>     Lattes CV: http://lattes.cnpq.br/1360403201088680
>     OrcID: orcid.org/0000-0001-8232-6722
>     <http://orcid.org/0000-0001-8232-6722>
>     ResearchGate: www.researchgate.net/profile/Alexandre_Santos10
>     <http://www.researchgate.net/profile/Alexandre_Santos10>
>     Publons: https://publons.com/researcher/3085587/alexandre-dos-santos/
>     --
>
>     _______________________________________________
>     R-sig-Geo mailing list
>     [hidden email] <mailto:[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