Re: [R-sig-Geo] Adding text to rasterVis levelplot

2017-07-19 Thread Thiago V. dos Santos via R-sig-Geo
You can manually define the names that you want and pass them as arguments to 
'names.attr' (the name of each panel) and 'ylab' (the title of the y axis).
Following your example:
col.titles = c('col1','col2','','')
row.titles = c('row1','row2')

levelplot(s, layout=c(2,2),
  names.attr=col.titles,
  ylab=row.titles)

HTH,
Greetings, -- Thiago V. dos Santos
PhD studentLand and Atmospheric ScienceUniversity of Minnesota


On Wednesday, July 19, 2017, 11:13:31 AM CDT, Mauricio Zambrano Bigiarini 
 wrote:

Dear all,

I would like to add custom text labels for the columns and rows of a
levelplot object created with he rasterVis package, similar to the
c("Fall", "Winter", "Spring", Summer") used to label the rows and the
c("a",..., "h") used to label the columns in the plot shown int he
following link:

https://stackoverflow.com/questions/43007241/how-to-add-text-to-a-specific-fixed-location-in-rastervis-levelplot

In particular, how can I add c("col1", "col2") and c("row1", "row2")
as column and row headers, respectively, to the following example
plot:

- START
library(rasterVis)
f <- system.file("external/test.grd", package="raster")
r <- raster(f)
s <- stack(r, r+500, r-500, r+200)
levelplot(s, layout=c(2,2), names.att=rep("",4))
- END


Thanks in advance for your help,


Mauricio Zambrano-Bigiarini, PhD

=
Department of Civil Engineering
Faculty of Engineering and Sciences
Universidad de La Frontera, Temuco, Chile
=
"The ultimate inspiration is the deadline"
(Nolan Bushnell)
=
Linux user #454569 -- Linux Mint user

-- 
La información contenida en este correo electrónico y cualquier anexo o 
respuesta relacionada, puede contener datos e información confidencial y no 
puede ser usada o difundida por personas distintas a su(s) destinatario(s). 
Si usted no es el destinatario de esta comunicación, le informamos que 
cualquier divulgación, distribución o copia de esta información constituye 
un delito conforme a la ley chilena. Si lo ha recibido por error, por favor 
borre el mensaje y todos sus anexos y notifique al remitente.

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
[[alternative HTML version deleted]]

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

Re: [R-sig-Geo] raster - unrotate?

2017-07-19 Thread Michael Sumner
That's great, thanks for the update! I didn't actually realize all that
oceandata stuff was on Thredds. You might try ROpenSci's rerddap package
too.

I will try that source with the in-dev https://Github.com/hypertidy/tidync
. Please check it out if you can, and are feeling brave!

(tidync aims to provide more general outputs than raster can, more easily
than the API wrappers.)

Cheers, Mike

On Thu, 20 Jul 2017, 10:39 Ben Tupper,  wrote:

> Ahoy!
>
> My (current) solution is to user raster::merge().  Works a treat and fits
> my workflow nicely.  Since I am obtaining the raster data using OPeNDAP it
> is easy to get the two regions, rotate the extent of the eastern region,
> and then merge.  Below is a pseudo-example (that works!) as it crops a
> local file twice, once for each region, rather than using an OPeNDaP calls
> via `ncdf4::nccvar_get(start = blah, count = something)` to get the two
> regions.
>
>
> ### start
>
> library(raster)
> uri <- '
> https://oceandata.sci.gsfc.nasa.gov:443/opendap/MODISA/L3SMI/2016/001/A20160012016032.L3m_R32_SST_sst_9km.nc
> '
> R <- raster::raster(uri, varname = 'sst')
>
> R
> #class   : RasterLayer
> #dimensions  : 180, 360, 64800  (nrow, ncol, ncell)
> #resolution  : 1, 1  (x, y)
> #extent  : -180, 180, -90, 90  (xmin, xmax, ymin, ymax)
> #coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
> #data source : in memory
> #names   : layer
> #values  : 1.482572e-05, 0.928  (min, max)
>
> par(mfrow = c(2,1))
> plot(R)
> lines(c(180, 100, 100, 180), c(80,80,0,0))
> lines(c(-180,-90,-90,-180), c(80,80,0,0))
>
> # eastern section
> eR <- raster::crop(R, c(100, 180, 0, 80))
>
> # rotate the extent
> eExtent <- raster::extent(eR)
> raster::extent(eR) <- c(-260, -180, eExtent[3:4])
>
> # western section
> wR <- raster::crop(R, c(-180, -90, 0, 80))
>
> # merge
> newR <- raster::merge(eR, wR)
> newR
>
> plot(newR)
>
>  end
>
> Cheers,
> Ben
>
> > On Jun 22, 2017, at 7:26 PM, Michael Sumner  wrote:
> >
> >
> >
> >
> > On Thu, 22 Jun 2017 at 21:28 Ben Tupper  wrote:
> > Hi,
> >
> > Wow!  A treasure from the past!
> >
> > Hmmm.   I see what you mean; it might be best to snip-clip-and-smush
> from the native presentation.  We are testing out the performance of the
> dineof function in the sinkr package (
> https://github.com/marchtaylor/sinkr/blob/master/R/dineof.R) to
> interpolate patchy chlorophyl data.
> >
> > Thanks for the tip!
> >
> >
> >
> > For what it's worth, I'm happy to help, there's no one size fits all
> here. The dateline is one of those "easy problems" that does not have a
> general fix and will bite in many different contexts. :)
> >
> > The best distillation of my tricks is in this project, but it does
> depend on your workflow and the actual data in use.
> >
> > https://github.com/hypertidy/tabularaster
> >
> > If you have performance issues raster's cell abstraction  will help, but
> they are a bit old-school when it comes to multi-part geometries. (It's
> identical to standard database indexing concepts as are all "spatial"
> optimization tricks)
> >
> > (I see a desperate need for a general API for this kind of problem so
> that we can build tools from a general framework, which I'm working on -
> that's some kind of excuse for why this and related projects are quite raw
> and unfinished.)
> >
> > Cheers, Mike.
> >
> > Cheers,
> > Ben
> >
> >> On Jun 22, 2017, at 4:46 AM, Michael Sumner  wrote:
> >>
> >>
> >> It used to do the inverse, and I preserved a copy of the old behaviour
> here:
> >>
> >>
> https://github.com/AustralianAntarcticDivision/raadtools/blob/master/R/utils.R#L9
> >>
> >> You're probably best to learn from how it approaches it rather than
> just use it, since it's not a general capability, just works for those very
> specific cases.
> >>
> >> I just tested it and it still seems to work fine, I used
> >>
> >>
> oceandata.sci.gsfc.nasa.gov/MODISA/Mapped/Monthly/9km/chlor/A20021822002212.L3m_MO_CHL_chlor_a_9km.nc
> >>
> >> obtainable with
> >>
> >>
> https://oceandata.sci.gsfc.nasa.gov/cgi/getfile/A20021822002212.L3m_MO_CHL_chlor_a_9km.nc
> >>
> >> If you're extracting points you might as well just convert them into
> the "Atlantic" range, but it's painful to get that right for polygons or
> lines (and very hard to generalize once you get it working anyway).
> >>
> >> For simple regions like the one you show I'd probably split it into two
> extents() and use those - but depends on your workflow, all these options
> are useful here and there.
> >>
> >> Cheers, Mike.
> >>
> >>
> >> On Thu, 22 Jun 2017 at 18:30 Ben Tupper  wrote:
> >> Hello,
> >>
> >> We have rasters that span [-180, 180] from NASA's Ocean Color (
> https://oceancolor.gsfc.nasa.gov/)  datasets.  We are trying to extract a
> region that spans 100E to 90W, that is 100 to -90.  The region 'wraps'
> across the edges as shown by the plot at the 

[R-sig-Geo] spatial structure of residuals in nlme mixed model

2017-07-19 Thread Javier Moreira
hi,
im trying to asses about the diference in puting the spatial estructure in
a mixed linear model.
What i need to do is to compare the actual distribution of the residuals of
two models, one that consider the correlation and one that not.

model with and without:

*without*

modelo3_MM<-lme(REND_SE~1+TRATAMIENTO*AMBIENTE,

 random=list(BLOQUE=pdIdent(~1),AMBIENTE=pdIdent(~1),TRATAMIENTO=pdIdent(~1)),
 data=data1,
 control=lmeControl(niterEM=150,msMaxIter=200))
modelo33_MM<-update(modelo3_MM,
weights=varComb(varIdent(form=~1|TRATAMIENTO)))

*with*
modelo34_MM<-update(modelo33_MM,
correlation=corExp(form=~1|BLOQUE/AMBIENTE/TRATAMIENTO))

until now, what i could do is to cheq the existance of that structure by
computing the semivariogram to the residuals.

plot(Variogram(modelo33_MM))

plot((modelo34_MM,resType="n",robust=T))

the question is how can i do the next step and krige this residuals in
order to get a map of predicted values and variance values?
im used to do it wity gstat package but i cant figured out with an object
of class "lme"

thanks

-- 
Javier Moreira de Souza
Ingeniero Agrónomo
099 406 006

[[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] Adding text to rasterVis levelplot

2017-07-19 Thread Mauricio Zambrano Bigiarini
Dear all,

I would like to add custom text labels for the columns and rows of a
levelplot object created with he rasterVis package, similar to the
c("Fall", "Winter", "Spring", Summer") used to label the rows and the
c("a",..., "h") used to label the columns in the plot shown int he
following link:

https://stackoverflow.com/questions/43007241/how-to-add-text-to-a-specific-fixed-location-in-rastervis-levelplot

In particular, how can I add c("col1", "col2") and c("row1", "row2")
as column and row headers, respectively, to the following example
plot:

- START
library(rasterVis)
f <- system.file("external/test.grd", package="raster")
r <- raster(f)
s <- stack(r, r+500, r-500, r+200)
levelplot(s, layout=c(2,2), names.att=rep("",4))
- END


Thanks in advance for your help,


Mauricio Zambrano-Bigiarini, PhD

=
Department of Civil Engineering
Faculty of Engineering and Sciences
Universidad de La Frontera, Temuco, Chile
=
"The ultimate inspiration is the deadline"
(Nolan Bushnell)
=
Linux user #454569 -- Linux Mint user

-- 
La información contenida en este correo electrónico y cualquier anexo o 
respuesta relacionada, puede contener datos e información confidencial y no 
puede ser usada o difundida por personas distintas a su(s) destinatario(s). 
Si usted no es el destinatario de esta comunicación, le informamos que 
cualquier divulgación, distribución o copia de esta información constituye 
un delito conforme a la ley chilena. Si lo ha recibido por error, por favor 
borre el mensaje y todos sus anexos y notifique al remitente.

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

Re: [R-sig-Geo] Wavelet analysis of anisotropy in point patterns

2017-07-19 Thread Marcelino de la Cruz Rot

Hi Domenico,

AFAIK, you should build your own functions to get the same analysis 
provided by the PASSaGE software. If you have some elementary R 
programming skills, following the description of the analysis proposed 
by Rosenberg(2004) shouldn't be much complicated. Otherwise...I don't know.


Good luck!

Marcelino


El 19/07/2017 a las 12:12, Domenico Giusti escribió:

Thank you Marcelino,

I already had a look at those functions and, although they do the job, 
I was wondering how to analyze anisotropy in point pattern using 
wavelet analysis.


I tried to use the WaveletComp package, but with no success. It looks 
to me that packages for wavelet analysis work fine with temporal data, 
but I couldn't find the way to use it with spatial point patterns.


How could I get in R the same analysis provided by the PASSaGE software?

Thank you!

On 07/18/2017 06:17 PM, Marcelino de la Cruz Rot wrote:

Hi Domenico,

In spatstat you have several functions to detect anysotropy in point 
patterns:

- the sector K-function, Ksector();
- the pair orientation distribution, pairorient();
- the anisotropic pair correlation function, Kmeasure().

See the help pages of these functios or, even better, consult pages 
236:242 in  Adrian Baddeley, Ege Rubak, Rolf Turner (2015). Spatial 
Point  Patterns: Methodology and Applications with R. London: Chapman 
and   Hall/CRC Press, 2015.
http://www.crcpress.com/Spatial-Point-Patterns-Methodology-and-Applications-with-R/Baddeley-Rubak-Turner/9781482210200/ 



Cheers,

Marcelino

El 18/07/2017 a las 16:30, Domenico Giusti escribió:

Hi all,

I'm running wavelet analysis of anisotropy in point patterns using 
the PASSaGE software by Rosenberg et al.


Rosenberg, M.S., and C.D. Anderson (2011) PASSaGE: Pattern Analysis, 
Spatial Statistics and Geographic Exegesis. Version 2. Methods in 
Ecology & Evolution 2(3):229-232.

http://www.passagesoftware.net

Rosenberg, M.S. 2004. Wavelet analysis for detecting anisotropy in 
point patterns. Journal of Vegetation Science 15:277-284.

DOI: 10./j.1654-1103.2004.tb02262.x

I wonder how I can do the same analysis using R.

Thanks,

Dome





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



--
Marcelino de la Cruz Rot
Depto. de Biología y Geología
Física y Química Inorgánica
Universidad Rey Juan Carlos
Móstoles España

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

Re: [R-sig-Geo] Wavelet analysis of anisotropy in point patterns

2017-07-19 Thread Domenico Giusti

Thank you Marcelino,

I already had a look at those functions and, although they do the job, I 
was wondering how to analyze anisotropy in point pattern using wavelet 
analysis.


I tried to use the WaveletComp package, but with no success. It looks to 
me that packages for wavelet analysis work fine with temporal data, but 
I couldn't find the way to use it with spatial point patterns.


How could I get in R the same analysis provided by the PASSaGE software?

Thank you!

On 07/18/2017 06:17 PM, Marcelino de la Cruz Rot wrote:

Hi Domenico,

In spatstat you have several functions to detect anysotropy in point 
patterns:

- the sector K-function, Ksector();
- the pair orientation distribution, pairorient();
- the anisotropic pair correlation function, Kmeasure().

See the help pages of these functios or, even better, consult pages 
236:242 in  Adrian Baddeley, Ege Rubak, Rolf Turner (2015). Spatial 
Point  Patterns: Methodology and Applications with R. London: Chapman 
and   Hall/CRC Press, 2015.
http://www.crcpress.com/Spatial-Point-Patterns-Methodology-and-Applications-with-R/Baddeley-Rubak-Turner/9781482210200/ 



Cheers,

Marcelino

El 18/07/2017 a las 16:30, Domenico Giusti escribió:

Hi all,

I'm running wavelet analysis of anisotropy in point patterns using 
the PASSaGE software by Rosenberg et al.


Rosenberg, M.S., and C.D. Anderson (2011) PASSaGE: Pattern Analysis, 
Spatial Statistics and Geographic Exegesis. Version 2. Methods in 
Ecology & Evolution 2(3):229-232.

http://www.passagesoftware.net

Rosenberg, M.S. 2004. Wavelet analysis for detecting anisotropy in 
point patterns. Journal of Vegetation Science 15:277-284.

DOI: 10./j.1654-1103.2004.tb02262.x

I wonder how I can do the same analysis using R.

Thanks,

Dome





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