raster

Keeping raster variable names when converting to NetCDF using R

…衆ロ難τιáo~ 提交于 2020-03-18 15:22:18
问题 Taking a raster file of monthly temperature data for multiple years which has a name attached accessible via names(object) in the following format 'Jan.1981', 'Feb.1981' etc (example files for two years that works with code below here - adding all files makes it too big. Reading in and writing this to NetCDF using the following code: #Load Packages library(raster) library(ncdf4) #Read in temperature files r1 <- brick('TavgM_1981.grd') r2 <- brick('TavgM_1982.grd') #stack them together

Overlay raster layer on map in ggplot2 in R?

こ雲淡風輕ζ 提交于 2020-03-18 06:36:28
问题 I am trying to overlay a raster layer onto a map in ggplot. The raster layer contains likelihood surfaces for each time point from a satellite tag. I also want to set cumulative probabilities(95%, 75%, 50%) on the raster layer. I have figured out how to show the raster layer on the ggplot map, but the coordinates are not aligned with one another. I tried making each have the same projection but it does not seem to be working... I want them both to fit the boundaries of my model (xmin = 149,

Overlay raster layer on map in ggplot2 in R?

。_饼干妹妹 提交于 2020-03-18 06:36:08
问题 I am trying to overlay a raster layer onto a map in ggplot. The raster layer contains likelihood surfaces for each time point from a satellite tag. I also want to set cumulative probabilities(95%, 75%, 50%) on the raster layer. I have figured out how to show the raster layer on the ggplot map, but the coordinates are not aligned with one another. I tried making each have the same projection but it does not seem to be working... I want them both to fit the boundaries of my model (xmin = 149,

VFR Sectional Aeronautical Charts with matplotlib (python)

北慕城南 提交于 2020-01-25 21:05:08
问题 I'm looking for a means to add VFR Sectional Aeronautical Charts (a.k.a. sectionals) to preexisting matplotlib code I have. In short, can there be a quick and easy means to realize sectional charts with python and matplotlib? If not, what are the other paths to consider? Reference: http://robertjliguori.blogspot.com/2016/10/acquiring-vfr-sectional-aeronautical.html Thanks, Robert 回答1: I actually figured it out... map = Basemap(...) map.arcgisimage(server='http://maps7.arcgisonline.com/ArcGIS'

How do you write multiple rasters in [r]?

删除回忆录丶 提交于 2020-01-25 12:37:09
问题 I am using lapply() to load 144 rasters as in my previous post: How do you load multiple rasters in [r] using a for loop? library(raster) rastlist <- list.files(path=path, pattern='tif$', full.names=TRUE) allrasters <- lapply(rastlist, raster) allrasters ends up being a large list with 144 elements, of which 'name' looks like one of the attributes, I pasted the last (144th) element output below. [[144]] class : RasterLayer dimensions : 405, 345, 139725 (nrow, ncol, ncell) resolution : 30, 30

How do you write multiple rasters in [r]?

跟風遠走 提交于 2020-01-25 12:35:32
问题 I am using lapply() to load 144 rasters as in my previous post: How do you load multiple rasters in [r] using a for loop? library(raster) rastlist <- list.files(path=path, pattern='tif$', full.names=TRUE) allrasters <- lapply(rastlist, raster) allrasters ends up being a large list with 144 elements, of which 'name' looks like one of the attributes, I pasted the last (144th) element output below. [[144]] class : RasterLayer dimensions : 405, 345, 139725 (nrow, ncol, ncell) resolution : 30, 30

How do you write multiple rasters in [r]?

倖福魔咒の 提交于 2020-01-25 12:35:28
问题 I am using lapply() to load 144 rasters as in my previous post: How do you load multiple rasters in [r] using a for loop? library(raster) rastlist <- list.files(path=path, pattern='tif$', full.names=TRUE) allrasters <- lapply(rastlist, raster) allrasters ends up being a large list with 144 elements, of which 'name' looks like one of the attributes, I pasted the last (144th) element output below. [[144]] class : RasterLayer dimensions : 405, 345, 139725 (nrow, ncol, ncell) resolution : 30, 30

How to stack individual raster layers from files contained in individual subfolders in R?

旧巷老猫 提交于 2020-01-24 21:48:28
问题 I am working with raster layers. I have 10 subfolders in a parent folder. Each of the subfolders contains hundreds of raster. I would like to apply a script for each of the subfolders and to create several stacks for each of my subfolders. #List all my subfolders in my parent folder list_dirs<- list.dirs(path/parentfolder/, recursive = F) for (i in list_dir){ # set the working directory to the subfolder i setwd(i) # List all the files with a certain pattern in the subfolder i s<- list.files

How to create 10 random rasters in R?

不羁岁月 提交于 2020-01-24 21:26:05
问题 I am looking to generate several random raster in a loop that I plan to store. I tried something (below) that but it does not work: r1= raster(nrows = 1, ncols = 1, res = 0.5, xmn = -1.5, xmx = 1.5, ymn = -1.5, ymx = 1.5, vals = 0.3) a<- 10 for (i in 1:length(a)){ values(r1[i]) = round(runif(ncell(r1[i]), 0, 1))} Thanks for any help. 回答1: There's a much simpler way: library(raster) r1 <- raster(nrows = 1, ncols = 1, res = 0.5, xmn = -1.5, xmx = 1.5, ymn = -1.5, ymx = 1.5, vals = 0.3) rr <-

Pixels Array Too CPU Intensive

断了今生、忘了曾经 提交于 2020-01-24 18:57:46
问题 I have been working on a Java 2D game for a little while. It is a raster graphics system with an array of pixels (integers). private BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB); private int[] pixels = ((DataBufferInt) image.getRaster().getDataBuffer()).getData(); I then create an array of integers separately, manipulate it with the screen objects (rendered from external image files, such as .png), then copy that array into my main one, which is projected