Tim Richter-Heitmann | 20 Aug 17:58 2014

Beginner's question on choosing the correct test

Hi there,

i am new to the spatial statistics, so please bear with me.

My dataset consists of 60 plots, semi-randomly distributed on a 10x6m 
area. We measured species data on  6 sampling dates, so i ended up with 
six different sample by species matrices.
My first task should be to evaluate the spatial autocorrelation for each 
of the species we have found. I am also going to do variogramming and 
kriging based on the moran I results (is that a feasible approach? or 
are correlograms and variograms redundant? - i would like to have a 
single number to decide if each of my species is SACed or not).

I got very basic R code running from the spdep package:

#my species data
data <- read.table("species.txt", header = TRUE, sep = "\t", dec = ".")
#x,y coordinates
apr.D <- read.table("xy_april.txt", row.names=1, header = TRUE, sep = 
"\t", dec = ",")
#april only (only 59 plots!)

nb <- tri2nb(apr.D)
list <- nb2listw(nb)
moran.test(ap$Ac2, list)
moran.mc(ap$Ac2, list, nsim=999)

For now, i have omitted every single option spdep is giving me. 
(Continue reading)

Chagaris, Dave | 19 Aug 21:42 2014

Re: raster brick error cells are not equally spaced

Thanks Mike.  That appears to be the problem.  I was able to install all the libraries from my laptop onto the
workstation and the code now works on both machines (with older version of raster). 


-----Original Message-----
From: Michael Sumner [mailto:mdsumner <at> gmail.com] 
Sent: Thursday, August 14, 2014 10:19 AM
To: Chagaris, Dave
Subject: Re: [R-sig-Geo] raster brick error cells are not equally spaced

On Thu, Aug 14, 2014 at 11:58 PM, Chagaris, Dave <Dave.Chagaris <at> myfwc.com> wrote:
> [deleted].  Any reason why it would work on one computer and not on the other?  Is it possible I don't have all
the required packages (or wrong versions) on the workstation?

Only if you had a more recent version of raster on one computer that predated checks for these irregular axes.

(Please use the list in public).

Cheers, Mike.

> -----Original Message-----
> From: Michael Sumner [mailto:mdsumner <at> gmail.com]
> Sent: Wednesday, August 13, 2014 8:59 PM
> To: Chagaris, Dave
> Cc: r-sig-geo <at> r-project.org
> Subject: Re: [R-sig-Geo] raster brick error cells are not equally 
(Continue reading)

Fabiana garcia papani | 19 Aug 15:29 2014

Fwd: Cut map

---------- Forwarded message ----------
From: Fabiana garcia papani <fgarciapapani <at> gmail.com>
Date: 2014-08-19 10:23 GMT-03:00
Subject: Cut map
To: r-sig-geo <at> r-project.org

I have a regular grid of points. I have a border. How to determine only the
points inside  the border?

	[[alternative HTML version deleted]]
Kristin Graves | 16 Aug 21:08 2014

spatstat inverse-distance-weighted plot - change the axis range

Hello --

I am pretty new to R and to spatstat, so apologize for any ignorance.

I have a dataset with three variables:  x, y, and avgidw where x and y are
UTM coordinates and avgidw is a numeric mask of type "double".  My x range
is (585000,610000) and my y range is (4473000,4523000).

My end goal is to create an IDW plot that limits the plot to the (x,y)
range.  I am able to obtain the plot, but the y-axis origin is zero, not
4473000 as desired.  My code is below.

> library(spatstat)

spatstat 1.38-0       (nickname: ‘Wicked Plot’)
For an introduction to spatstat, type ‘beginner’
Warning message:
package ‘spatstat’ was built under R version 3.1.1
> idw_df <- read.table(idw_input, header=TRUE)
> attach(idw_df)
> idw_pp <- ppp(x, y, c(585000,610000), c(4473000,4523000), marks=avgidw)
> idw_win <- owin(c(585000,610000), c(4473000,4523000))
> idw_chop <- idw_pp[idw_win]
> x=585000:610000
> y=4473000:4523000
> idw_mask <- as.mask(idw_win,xy=list(x=x, y=y))
> idw_pix2 <- idw(idw_chop, power=2, at="pixels", idw_mask)
Error in ensure2vector(eps) : eps is not numeric

(Continue reading)

nahm | 14 Aug 20:37 2014

Re: Levelplot(RasterVis) two marginal plot scale?

marginal plot in a levelplot gives very nice row and clo. mean value profile
on a top and right side.
How can I add two little scales top/right to marginal plot?

here is my codes.



RAD1998.all <- stack(list.ras)

list.files <- mixedsort(list.files(paste(getwd(), "/1998bil/", sep = ""),
full.names = F, pattern = ".asc.bil"))

outlist <- substr(list.files, 31, 43)


View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Levelplot-RasterVis-two-marginal-plot-scale-tp7586928p7586942.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
Arnold Salvacion | 14 Aug 02:27 2014

Converting .hdf file to raster layer

Dear Colleagues,

Does any here have already experience converting NOAA AVHRR VHP Product in .hdf
(ftp://ftp.star.nesdis.noaa.gov/pub/corp/scsb/wguo/data/VHP_16km/VH/ ) format to a raster layer
in R?

Best regards,

	[[alternative HTML version deleted]]

R-sig-Geo mailing list
R-sig-Geo <at> r-project.org
Chagaris, Dave | 13 Aug 18:26 2014

raster brick error cells are not equally spaced

I am trying to read netcdf files into R using the brick function.  I have many netcdf files and want to process
them on a 64bit workstation instead my 32bit laptop.  The code    I'm using works fine on my 32 bit laptop, but on
the workstation I get an error "Error in .rasterObjectFromCDF(x, type = objecttype, band = band, ...) :
  cells are not equally spaced; you should extract values as points".

Any  help is appreciated.

On Laptop...
> library(raster)

> library(ncdf)

> windows(record=T)

> sessionInfo()
R version 2.15.0 (2012-03-30)
Platform: i386-pc-mingw32/i386 (32-bit)

[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] grDevices datasets  splines   graphics  stats     tcltk     utils     methods   base

other attached packages:
[1] ncdf_1.6.6       raster_2.0-41    sp_1.0-11        svSocket_0.9-53  TinnR_1.0-5      R2HTML_2.2       Hmisc_3.9-3      survival_2.36-12

loaded via a namespace (and not attached):
(Continue reading)

Gregovich, Dave P (DFG | 12 Aug 18:48 2014

+no_uoff flag in proj4string, epsg 26931

I would like to project data in epsg 26931 (NAD83 Alaska State Plane zone 1 meters), variant A. There are two
variants to the projection:
--variant A has its origin on the central line of the projection, on the 'aposphere equator'
--variant B has its origin at the projection center
Apparently, variant A should be specifiable via a '+no_uoff' flag
I can specify variant B in this way...

#create a test point, and convert to SPDF

#Assign projection
proj4string(test.pt)<- '+proj=omerc +lat_0=57 +lonc=-133.6666666666667 +alpha=323.1301023611111
                                                                +k=0.9999 +x_0=5000000 +y_0=-5000000 +gamma=323.1301023611111 +datum=NAD83
                                                                +units=m +no_defs +ellps=GRS80 +towgs84=0,0,0'

# the above is the same as using proj4string(test.pt)<-'+init = epsg:26931',
# it is also identical to the proj4string obtained for a shapefile created in ArcGIS and imported to R
# using 'readOGR', that is originally projected in the 26931

#But when I try to specify variant A, the +no_uoff flag is ignored...
proj4string(test.pt)<- '+proj=omerc +lat_0=57 +lonc=-133.6666666666667
+alpha=323.1301023611111 +no_uoff
                                                                +k=0.9999 +x_0=5000000 +y_0=-5000000 +gamma=323.1301023611111 +datum=NAD83
                                                                +units=m +no_defs +ellps=GRS80 +towgs84=0,0,0'
#just to verify, I also try using spTransform...
test.pt<-spTransform(test.pt,CRS('+proj=omerc +lat_0=57 +lonc=-133.6666666666667
(Continue reading)

Barry Rowlingson | 12 Aug 18:25 2014

Re: histogram matching of cloud masked Landsat 8 messages

Instructions say (help(histmatch))


  master: The target image, in SpatialGridDataFrame, data frame, matrix
          or vector format.

   tofix: The image to be normalized, in any format.

but what you have is a *raster* object, not a SpatialGridDataFrame, or
any other of those.

 You can convert a raster, r, to a SpatialGridDataFrame, rg:

 > rg = as(r,"SpatialGridDataFrame")

and then feed those to histmatch. You probably have to convert both arguments.


On Tue, Aug 12, 2014 at 4:45 PM, sarah crabbe <sarah_crabbe <at> yahoo.com> wrote:
> Dear all,
> We are trying to apply a histogram matching on cloudmasked landsat 8 images, with the intention to fill the clouds.
> Therefore we want to use the package "Landsat"
> We tried to import two bands with the package "raster":
> image1<-raster("LC82280562013211LGN00_B1.tif")
> image2<-raster("LC82280562013227LGN00_B1.tif")
(Continue reading)

sarah crabbe | 12 Aug 17:45 2014

histogram matching of cloud masked Landsat 8 messages

Dear all,

We are trying to apply a histogram matching on cloudmasked landsat 8 images, with the intention to fill the
Therefore we want to use the package "Landsat"

We tried to import two bands with the package "raster":


whereafter we try to apply a histogram matching with the landsat package:

histmatch(image1, image2, minval=0, maxval= 65535, by=1)

And we get following error:

Error in as.vector(data) : 
no method for coercing this S4 class to a vector

This might be easy to solve, but we just started to learn how to work with R for image processing, So could we
please get some advice on this..
Many thanks
	[[alternative HTML version deleted]]
Barry Rowlingson | 12 Aug 17:26 2014

Re: writeRaster does not preserve names when writing to NetCDF

This chunk of code writes a character vector to a file.  It needs two
dimensions, one that has to be big enough for the longest character
string, and one which has to be the length of the vector.

writeChars <- function(fn){
    nameDim = dim.def.ncdf("NamesDim","", 1:3)
    charDim = dim.def.ncdf("CharsDim","", 1:10)
    nameVar = var.def.ncdf("Names","",list(charDim,nameDim),"NA")
    nc = create.ncdf(fn, list(nameVar))
    v = c("red  ","green","blue ")
    for(i in 1:length(v)){
        put.var.ncdf(nc, nameVar, v[i], start=c(1,i), count=c(-1,1))

Dumping the NetCDF gives:

 CharsDim = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ;
 NamesDim = 1, 2, 3 ;
 Names =
  "red  ",
  "blue " ;

Whether this is a good idea or not... Hmmmm....

I've noticed if you use `writeRaster` with format="CDF" you get the
(Continue reading)