raster

Stacking an existing RasterStack multiple times

久未见 提交于 2019-11-29 04:56:33
My question is pretty similar to an unfortunately unanswered issue recently posted on Stackoverflow . I am dealing with a RasterStack object consisting of twelve layers (one for each month of the year), and I would like to replicate the layers ten times, ending up with a RasterStack consisting of 120 layers, with every 12th layer being similar (i.e., layer 1 is the same like layer 13 is the same like layer 25 and so on). For replication purposes, let's take an example from the raster package: library(raster) file <- system.file("external/test.grd", package = "raster") s <- stack(file, file,

raster package taking all hard drive

跟風遠走 提交于 2019-11-29 03:30:09
问题 I am processing a time series of rasters (modis ndvi imagery) to calculate average and st.deviation of the series. Each yearly series is composed of 23 ndvi.tif images, each of 508Mb, so total is a big 11Gb to process. Below is the script for one year. I have to repeat this for a number of years. library(raster) library("rgeos") filesndvi <- list.files(, pattern="NDVI.tif",full.names=TRUE) filesetndvi10 <- stack(filesndvi) names(filesetndvi10) avgndvi10<-mean(filesetndvi10) desviondvi10 <-

How to extract data from a RasterBrick?

∥☆過路亽.° 提交于 2019-11-29 02:25:56
I have a RasterBrick consisting of monthly rainfall data over 7 years, so it has 7 layers with 12 slots each: rainfall <- brick("Rainfall.tif") > rainfall class : RasterBrick dimensions : 575, 497, 285775, 7 (nrow, ncol, ncell, nlayers) resolution : 463.3127, 463.3127 (x, y) extent : 3763026, 3993292, -402618.8, -136213.9 (xmin, xmax, ymin, ymax) coord. ref. : +proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs data source : in memory names : layer.1.1, layer.2.1, layer.1.2, layer.2.2, layer.1, layer.2, layer min values : 239.6526, 499.8343, 521.0316, 617.2896,

Pixel by pixel Bézier Curve

纵饮孤独 提交于 2019-11-28 21:57:31
The quadratic/cubic bézier curve code I find via google mostly works by subdividing the line into a series of points and connects them with straight lines. The rasterization happens in the line algorithm, not in the bézier one. Algorithms like Bresenham's work pixel-by-pixel to rasterize a line, and can be optimized (see Po-Han Lin's solution ). What is a quadratic bézier curve algorithm that works pixel-by-pixel like line algorithms instead of by plotting a series of points? A variation of Bresenham's Algorithm works with quadratic functions like circles, ellipses, and parabolas, so it should

What is the simplest RGB image format?

Deadly 提交于 2019-11-28 20:08:05
I am working in C on a physics experiment, Young's interference experiment and i made a program who prints to file a huge bunch of pixels : for (i=0; i < width*width; i++) { fwrite(hue(raster_matrix[i]), 1, 3, file); } Where hue , when given a value [0..255], gives back a char * with 3 bytes, R,G,B. I would like to put a minimal header in my image file in order to make this raw file a valid image file. More concise : Switching from : offset 0000 : height * width : data } my data, 24bit RGB pixels to offset 0000 : dword : magic \ : /* ?? */ \ 0012 : dword : height } Header <--> common image

Clipping raster using shapefile in R, but keeping the geometry of the shapefile

时光总嘲笑我的痴心妄想 提交于 2019-11-28 18:50:38
I am using {raster} to clip (or crop) a raster based on an irregular shapefile (the Amazon biome) but the output always has a rectangular extent. However, I need the output in the exact same geometry of the shapefile. Any tips? Cheers. library(raster) library(rgdal) myshp <- readOGR("Amazon.shp", layer="Amazon") e <- extent(myshp) myraster <- raster("Temperature.tif") myraster.crop <- crop(myraster, e, snap="out", filename="myoutput.tif") One option is to use raster::mask() library(maptools) ## For wrld_simpl library(raster) ## Example SpatialPolygonsDataFrame data(wrld_simpl) SPDF <- subset

Java getSubimage() outside of raster

时光毁灭记忆、已成空白 提交于 2019-11-28 14:03:17
I'm trying to take an image and store it in an array of 16x16 subimages. The image I am using is 512x512 pixels. However, while iterating through the loop, getSubimage() is stopped by a Raster exception. Here is the code: public class TileList extends JPanel { private static final int width = 16; //width of a tile private static final int height = width; private int col = 1; private int row = 1; private BufferedImage image; File tilesetImage = new File("image.png"); BufferedImage tileset[]; public void loadAndSplitImage (File loadImage) { try{ image = ImageIO.read(loadImage); }catch(Exception

How to take raster scan of order 2 x 3 in java? [closed]

冷暖自知 提交于 2019-11-28 13:06:38
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . I have an buffered image(Say Ib ). I want to take raster scan to order 2 x 3 block(Say Bb ) with pixels p1,p2...p6 . How to do this in java? 回答1: You may be looking for ConvolveOp; see the articles cited here for

How can I create raster mosaic using list of rasters?

橙三吉。 提交于 2019-11-28 07:41:12
问题 I need to create several raster mosaics. I'm using Package raster version 2.0-31 on a 64bits windows computer. I believe I did my homework checking through all possible blogs and asking this question to some colleagues, but still can't find a solution. The problem I have is that I can't create a mosaic if my grids are listed in a raster object. I found this example that I though I could apply, but not, I get a weird error message. The example below represents my problem: r <- raster() r1 <-

How to create a raster from a data frame in r?

女生的网名这么多〃 提交于 2019-11-28 07:38:58
I have a data frame in which values (l) are specified for Cartesian coordinates (x, y) as in the following minimal working example. set.seed(2013) df <- data.frame( x = rep( 0:1, each=2 ), y = rep( 0:1, 2), l = rnorm( 4 )) df # x y l # 1 0 0 -0.09202453 # 2 0 1 0.78901912 # 3 1 0 -0.66744232 # 4 1 1 1.36061149 I want to create a raster using the raster package, but my reading of the documentation has not revealed a simple method for loading data in the form that I have it into the raster cells. I've come up with a couple ways to do it using for loops, but I suspect that there's a much more