search for: readasciigrid

Displaying 6 results from an estimated 6 matches for "readasciigrid".

2012 Mar 05
1
Error in file(fname, "r") : invalid 'description' argument when running maptools' readAsciiGrid on a dataframe
...e a sum of differences between two ascii grids. I have the file names of the two grid files in a data.frame along with other data. I'm then trying to add a new column to the data.frame with the result of that calculation. eg. library(maptools) difcount <- function(surfA, surfB) { A <- readAsciiGrid(surfA, colname="a") B <- readAsciiGrid(surfB, colname="b") sum(A$a - B$b) } attach(mydataframe) difcount(surfA[1],surfB[1]) #this test part works fine and gives me the correct result #But when I try to do a batch job by running the function against each row of the table...
2010 Sep 24
2
Reading in .aux (ESRI raster files) into R
Dear All, I'v tried to read in data in numerous ways including:- Spain10km<-data.frame(readAsciiGrid("F://RMap//sp10kpointid1.aux")) Error in readAsciiGrid("F://RMap//sp10kpointid1.aux") : object 'cellsize' not found In addition: Warning message: In readLines(t, n = 6) : incomplete final line found on 'F://RMap//sp10kpointid1.aux' Spain10km<-data.frame(...
2007 Mar 27
1
"Groups" in XYPLOT
...sired end result is a single xy plot of two separate (but similar in values and ranges). Full code follows, xyplot code at bottom #########Determine Frequencies ##########coastal_slope #needs the maptools package to read ESRI grid require(maptools) #import the flow slope grid basin.map <- readAsciiGrid("C:/R_PLots/coastal_slp.asc", colname="slope") basin_slope <- (basin.map$slope) #read the slopes into a dataframe freqs<-as.data.frame(table(basin_slope)) #rank the frequencies based on each unique occerence, note, ranks from 1 to n r<-rank(freqs$basin_slope) n<-leng...
2013 Jan 27
1
lapply and SpatialGridDataFrame error
...have a set of 54 files that I need to convert from ASCII grid format to .shp files to .bnd files for BayesX. I have the following R code to operate on those files: library(maptools) library(Grid2Polygons) library(BayesX) library(BayesXsrc) library(R2BayesX) readfunct <- function(x) { u <- readAsciiGrid(x) } modfilesmore <- paste0("MaxFloodDepth_", 1:54, ".txt") modeldepthsmore <- lapply(modfilesmore, readfunct) maxdepth.plys <- lapply(modeldepthsmore, Grid2Polygons(modeldepthsmore, level = FALSE)) layers <- paste0("examples/floodlayers_", 1:54) polysha...
2006 Oct 10
1
How to assign a rank to a range of values..
>From the following: basin.map <- readAsciiGrid("c:/temp/area.asc", colname="area") I have a SpatialGridDataFrame which has the x and y cordinate of a cell, and the drainage area of that cell. There are many cells with a low drainage area (in my case, 33000 with an area of 37.16) and one cell with the highest drainage area...
2012 Jul 04
3
Please help
...r=var.def.ncdf("mr","mm",list(x,y,t),-99.00, longname="monthly rainfall") #create ncdf file ncnew=create.ncdf("rainfall.nc", varmr) #read input files=list.files(pattern=".asc") mrain=matrix(0:0,0,3) for(i in files) {rainfall=data.frame(readAsciiGrid(i)) mrain=cbind(mrain,rainfall) } put.var.ncdf(ncnew, mrain) close.ncdf(ncnew) ------------------------------------------------------------------------------- [[elided Hotmail spam]] Many thanks, Jun [[alternative HTML version deleted]]