Displaying 20 results from an estimated 6000 matches similar to: "S4 classes and debugging - Is there a summary?"
2010 Aug 26
1
Passing arguments between S4 methods fails within a function:bug? example with raster package.
Dear all,
This problem came up initially while debugging a function, but it
seems to be a more general problem of R. I hope I'm wrong, but I can't
find another explanation. Let me illustrate with the raster package.
For an object "RasterLayer" (which inherits from Raster), there is a
method xyValues defined with the signature
2010 Jul 28
2
Beginner stucked with raster + geoR package.
Hello everyone.
I am trying to build up understanding in R by trying to develop just some simple
scenarios.
I would like to explain you what I am trying to do and what I did so far.
I would like to put inside a RasterLayer (raster package) a Gaussian field (for
given covariance) using grf function (geoR package)
1. First I created a Raster Layer object
r <- raster() # Default values are
2017 Sep 06
2
rgdal error when trying to import raster
Dear useRs,
I am trying to import a raster with the line:
nlcd <- raster("/home/jpolo/NRI/nlcd_nri5000.tif")
And I keep getting an error like this:
"Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE,
logical.return = TRUE,? :
? there is no package called 'rgdal'
Error in .rasterObjectFromFile(x, band = band, objecttype =
2018 Mar 08
3
add single points to a level plot
Hi all,
I'm trying to add single points with known coordinates to a level plot, but
could not find the proper answer. I got to know that layer() function is
good for this, but I don't know which package is related to this function.
The source is here:
https://stackoverflow.com/questions/28597149/add-xy-points-to-raster-map-generated-by-levelplot
but my question is a little different as I
2018 Mar 08
0
add single points to a level plot
Hi all,
I ran the code:
> s <- stack(replicate(2, raster(matrix(runif(100), 10))))
> xy <- data.frame(coordinates(sampleRandom(s, 10, sp=TRUE)),
+ z1=runif(10), z2=runif(10))
> levelplot(s, margin=FALSE, at=seq(0, 1, 0.05)) +
+ layer(sp.points(xy, pch=ifelse(pts$z1 < 0.5, 2, 3), cex=2, col=1),
columns=1) +
+ layer(sp.points(xy, pch=ifelse(pts$z2 < 0.5, 2,
2018 May 24
2
Problem with adding a raster and a brick
Hi,
I seem to be having a problem adding the following two raster objects
together - one is a rasterLayer, the other is a rasterBrick. The extent,
resolution, and origin are the same, so according to my understand it
should work. The objects look like so:
> obs.clim
class : RasterLayer
dimensions : 60, 200, 12000 (nrow, ncol, ncell)
resolution : 0.5, 0.5 (x, y)
extent : -70,
2013 Jan 18
2
How to re-project ease( Equal Area Scalable Earth) grid with a ~25 km cylindrical projection to WGS84 0.25 degree?
I have nc files for global soil moisture,here is one file
https://echange-fichiers.inra.fr/get?k=f9DDllPKdUKs5ZNQwfq
from the metadata ,the projection is cylindrical and the resolution is 25
km(it is based on authalic sphere based on International 1924 ellipsoid).As
I want to compare with other data, I have to make them identical.
- my other data are in WGS84 with 0.25*0.25 degree resolution
2017 Sep 06
0
rgdal error when trying to import raster
Hi,
The message "there is no package called 'rgdal'" means that you don't have rgdal installed.
https://cran.r-project.org/web/packages/rgdal/index.html
Also, you will get very good patial-centric help if you subscribed to r-sig-geo here
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Cheers,
Ben
> On Sep 6, 2017, at 2:52 PM, john polo <jpolo at mail.usf.edu>
2018 Mar 28
0
netCDF to GeoTIFF by layer in r
Hi Ahmed,
When reading from a ncdf file you can use the 'varname', 'lvar' and 'level' arguments - see the 'Details' section in the docs
https://www.rdocumentation.org/packages/raster/versions/2.6-7/topics/raster <https://www.rdocumentation.org/packages/raster/versions/2.6-7/topics/raster>
We can't tell what is in the ncdf file from what you report other
2017 Sep 06
1
rgdal error when trying to import raster
Indeed, Ben, but the question was something more like it is not a Dependency, just Suggested, so why the error...
John:
If you read the Introduction to the 'raster' package vignette, it indicates that some input formats are supported within the raster package and some rely on other packages. Clearly the attempt to read a TIFF was an example of the latter. Had you used a different input
2018 Mar 28
2
Fwd: netCDF to GeoTIFF by layer in r
Hi
I have a netCDF file of volumetric soil water content at four
different soil layers and want to convert each soil layer in the
netCDF file to a GeoTIFF layer. This code converts the netCDF file to
one GeoTIFF layer, i.e. unclear which soil depth.
file.nc <- "C:/Soil_Weather_data/Agro/VMC21/VMC21.nc"
file.tiff <- "C:/Soil_Weather_data/Agro /VMC21/VMC21"
importnetcdf
2018 Mar 08
1
add single points to a level plot
You need to load the package 'rasterVis'
> library(rasterVis)
HTH,
Eric
On Thu, Mar 8, 2018 at 5:11 PM, lily li <chocold12 at gmail.com> wrote:
> Hi all,
>
> I ran the code:
> > s <- stack(replicate(2, raster(matrix(runif(100), 10))))
> > xy <- data.frame(coordinates(sampleRandom(s, 10, sp=TRUE)),
> + z1=runif(10), z2=runif(10))
2012 Feb 28
1
colour by z value, persp in raster package
Hi all!
My question is how to colour pixels by z value in persp plot in raster package. Here is an example:
x <- seq(-1.95, 1.95, length = 30)
y <- seq(-1.95, 1.95, length = 35)
z <- outer(x, y, function(a,b) a*b^2)
r1 <- raster(nrows=35, ncols=30, xmn=0, xmx=30, ymn = 0, ymx = 35)
r1[] <- c(z)
persp(r1)
There already exist some function to produce persp plot for anothe
2011 Feb 15
1
Using rasterImage on a CairoWin device prevents adding further elements to device?
I was pointed to the Cairo package for plotting PNG images on a
device. I've been playing around with it, but found that after I use
the rasterImage function, I can't add anything any more to the device,
eg :
img <- readPNG(system.file("img", "Rlogo.png", package="png"))
r = as.raster(img[,,1:3])
r[img[,,4] == 0] = "white"
CairoWin()
2012 Nov 27
5
Predict function in Raster package
Hey,
I am having troubles using the 'predict' function with in the Raster
package. I am using pm<-predict(mm, predictors) where mm is the
mahalanobis distance and the predictors are a stack of 6 raster layers
containing environmental variables.
When I try to run the prediction I get the following warning message:
Warning message:
In layerNames(x): the layerNames function is
2016 Apr 30
0
Could not find function "pointsToRaster"
Hi,
A terrific resource for this type of issue (and pretty much anything related to R) is http://rseek.org/ I'm sure I use it at least daily. Check out ...
http://rseek.org/?q=pointsToRaster
The first hit is about pointsToRaster() - it has been replaced by raster::rasterize()
Cheers,
Ben
> On Apr 30, 2016, at 4:28 AM, Ogbos Okike <giftedlife2014 at gmail.com> wrote:
>
>
2016 Apr 30
3
Could not find function "pointsToRaster"
Dear All,
I have a script that draws longitude and latitude of lightning
occurrence. This script was running fine before. But when I changed my
system and do a fresh install on another laptop, this error persist.
source("script")
Error in eval(expr, envir, enclos) :
could not find function "pointsToRaster"
I have tried to see if there is any other package I need to install
2013 Feb 13
1
[lattice] display a projected map on a layerplot
summary: I can display a lon-lat map on a lattice::layerplot, and I
can display a Lambert conformal conic (LCC) map on a spam::image, but
I can't display an LCC map on a lattice::layerplot. Example follows.
What am I doing wrong?
details:
I've been using `lattice` (via `rasterVis`) successfully to display
global atmospheric data, which works well enough (though I am
definitely intrigued
2010 Aug 26
1
my function decided to stop working, problem with scoping?
Hello list.
Until last week, I've been using my function without a problem. I can only
imagine what has changed (no package updates), but all of a sudden, a custom
function that uses raster::xyValues stopped working. For some reason, one of
the values is not found, even though it's there. Here is a snippet of code
from browser() call from within my custom function where everything goes
2010 Jul 20
2
data from SpatialGridDataFrame
Dear All,
I have a raster map of the class 'SpatialPointsDataFrame' and coordinates
of the class 'SpatialPoints'. I would like to retrieve the values that are
contained in the raster map at the specific locations given by the
coordinates.
Can anyone help me out?
Kind regards,
Katrin Fleischer