Visualizing Histogram of cell-specific values across layers of RasterStack using R? [closed] Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Using histogram in ArcGIS 10 with dates and sum of valuesHistogram Matching using Python to improve mosaicking process of multiple overlapping rasters?replace raster cell values with values in a .csvHow to add a layer on a RasterStack in a specific position?Keeping original cell values when replacing NA values using nearest neighbour with focal function of R?Extract values from large rasterstack, RAccessing raster values to create histogram using ArcPy?Values on top of each bar of a histogram in QGISSetting pixels of a all raster layers in a raster stack to NA based on the pixel values of corresponding raster layers of another raster stackSubsetting rasterstack for subtraction between elements using R?
Where did Ptolemy compare the Earth to the distance of fixed stars?
Noise in Eigenvalues plot
Short story about astronauts fertilizing soil with their own bodies
Understanding piped commands in GNU/Linux
What was the last profitable war?
Why complex landing gears are used instead of simple, reliable and light weight muscle wire or shape memory alloys?
Determine whether an integer is a palindrome
Number of generators of subgroup
2018 MacBook Pro won't let me install macOS High Sierra 10.13 from USB installer
What is the proper term for etching or digging of wall to hide conduit of cables
Vertical ranges of Column Plots in 12
Table formatting with tabularx?
How does the body cool itself in a stillsuit?
Why do C and C++ allow the expression (int) + 4*5;
Did John Wesley plagiarize Matthew Henry...?
Should man-made satellites feature an intelligent inverted "cow catcher"?
Does the main washing effect of soap come from foam?
Random body shuffle every night—can we still function?
One-one communication
Why did Bronn offer to be Tyrion Lannister's champion in trial by combat?
Why are current probes so expensive?
Can the Haste spell grant both a Beast Master ranger and their animal companion extra attacks?
How do you write "wild blueberries flavored"?
Centre cell vertically in tabularx
Visualizing Histogram of cell-specific values across layers of RasterStack using R? [closed]
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Using histogram in ArcGIS 10 with dates and sum of valuesHistogram Matching using Python to improve mosaicking process of multiple overlapping rasters?replace raster cell values with values in a .csvHow to add a layer on a RasterStack in a specific position?Keeping original cell values when replacing NA values using nearest neighbour with focal function of R?Extract values from large rasterstack, RAccessing raster values to create histogram using ArcPy?Values on top of each bar of a histogram in QGISSetting pixels of a all raster layers in a raster stack to NA based on the pixel values of corresponding raster layers of another raster stackSubsetting rasterstack for subtraction between elements using R?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Working in R. I have rasterstacks of temperature / precipitation data for particular countries and agricultural seasons. For instance, a rasterstack of daily noon temperature for the growing season only, for 2011, covering Ethiopia only. That particular rasterstack would be 275 layers, since the growing season is 275 days.
I'd like to examine histograms of the cell-specific values across layers. That is, I want to see the rain / temp distribution that occurs within a season, over days, for any given location. I'm not wondering about a particular cell; I'd like to be able to quickly visualize these histograms for a bunch of different cells.
How would I do this?
r histogram rasterstack
closed as unclear what you're asking by Spacedman, Vince, Jochen Schwarze, whyzar, Simbamangu Apr 15 at 14:39
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
Working in R. I have rasterstacks of temperature / precipitation data for particular countries and agricultural seasons. For instance, a rasterstack of daily noon temperature for the growing season only, for 2011, covering Ethiopia only. That particular rasterstack would be 275 layers, since the growing season is 275 days.
I'd like to examine histograms of the cell-specific values across layers. That is, I want to see the rain / temp distribution that occurs within a season, over days, for any given location. I'm not wondering about a particular cell; I'd like to be able to quickly visualize these histograms for a bunch of different cells.
How would I do this?
r histogram rasterstack
closed as unclear what you're asking by Spacedman, Vince, Jochen Schwarze, whyzar, Simbamangu Apr 15 at 14:39
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
1
What does "any given location" in your last paragraph mean if it doesn't mean "a particular cell"?
– Spacedman
Apr 12 at 22:45
add a comment |
Working in R. I have rasterstacks of temperature / precipitation data for particular countries and agricultural seasons. For instance, a rasterstack of daily noon temperature for the growing season only, for 2011, covering Ethiopia only. That particular rasterstack would be 275 layers, since the growing season is 275 days.
I'd like to examine histograms of the cell-specific values across layers. That is, I want to see the rain / temp distribution that occurs within a season, over days, for any given location. I'm not wondering about a particular cell; I'd like to be able to quickly visualize these histograms for a bunch of different cells.
How would I do this?
r histogram rasterstack
Working in R. I have rasterstacks of temperature / precipitation data for particular countries and agricultural seasons. For instance, a rasterstack of daily noon temperature for the growing season only, for 2011, covering Ethiopia only. That particular rasterstack would be 275 layers, since the growing season is 275 days.
I'd like to examine histograms of the cell-specific values across layers. That is, I want to see the rain / temp distribution that occurs within a season, over days, for any given location. I'm not wondering about a particular cell; I'd like to be able to quickly visualize these histograms for a bunch of different cells.
How would I do this?
r histogram rasterstack
r histogram rasterstack
edited Apr 12 at 20:56
PolyGeo♦
54.1k1782246
54.1k1782246
asked Apr 12 at 18:00
Leah BevisLeah Bevis
356
356
closed as unclear what you're asking by Spacedman, Vince, Jochen Schwarze, whyzar, Simbamangu Apr 15 at 14:39
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
closed as unclear what you're asking by Spacedman, Vince, Jochen Schwarze, whyzar, Simbamangu Apr 15 at 14:39
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
1
What does "any given location" in your last paragraph mean if it doesn't mean "a particular cell"?
– Spacedman
Apr 12 at 22:45
add a comment |
1
What does "any given location" in your last paragraph mean if it doesn't mean "a particular cell"?
– Spacedman
Apr 12 at 22:45
1
1
What does "any given location" in your last paragraph mean if it doesn't mean "a particular cell"?
– Spacedman
Apr 12 at 22:45
What does "any given location" in your last paragraph mean if it doesn't mean "a particular cell"?
– Spacedman
Apr 12 at 22:45
add a comment |
1 Answer
1
active
oldest
votes
Use the extract()
function to find all values associated with a particular location, and visualize with hist()
. Your raster's projection and extent will determine what points you want to use for PointOfInterest
. A reproducible example:
library(raster)
r1 = raster(matrix(c(1:25),
nrow=5,ncol=5))
r2 = raster(matrix(rep(5, 25),
nrow=5,ncol=5))
r3 = raster(matrix(c(35:11),
nrow=5,ncol=5))
r_stack = stack(r1,r2,r3)
extent(r_stack) # Bounded by (0,1) in both dimensions
PointOfInterest = matrix(data=c(0.1,0.1),
ncol=2)
myValues = extract(x = r_stack,
y = PointOfInterest)
hist(myValues)
If you want to do this with more than one point, you can add rows to the matrix with coordinates you're interested in, or use raster::sampleRandom()
to randomly choose points. Then you just need to format the graphical parameters accordingly:
randomvals = sampleRandom(r_stack,
size = 4)
randomvals # This did the extracting for us
# Set up paneling so you can look at a bunch of histograms at once
n.points = nrow(randomvals)
par(mfrow=c(ceiling(n.points/2),2))
# Create a histogram for each point
for(i in 1:n.points)
hist(randomvals[i,])
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Use the extract()
function to find all values associated with a particular location, and visualize with hist()
. Your raster's projection and extent will determine what points you want to use for PointOfInterest
. A reproducible example:
library(raster)
r1 = raster(matrix(c(1:25),
nrow=5,ncol=5))
r2 = raster(matrix(rep(5, 25),
nrow=5,ncol=5))
r3 = raster(matrix(c(35:11),
nrow=5,ncol=5))
r_stack = stack(r1,r2,r3)
extent(r_stack) # Bounded by (0,1) in both dimensions
PointOfInterest = matrix(data=c(0.1,0.1),
ncol=2)
myValues = extract(x = r_stack,
y = PointOfInterest)
hist(myValues)
If you want to do this with more than one point, you can add rows to the matrix with coordinates you're interested in, or use raster::sampleRandom()
to randomly choose points. Then you just need to format the graphical parameters accordingly:
randomvals = sampleRandom(r_stack,
size = 4)
randomvals # This did the extracting for us
# Set up paneling so you can look at a bunch of histograms at once
n.points = nrow(randomvals)
par(mfrow=c(ceiling(n.points/2),2))
# Create a histogram for each point
for(i in 1:n.points)
hist(randomvals[i,])
add a comment |
Use the extract()
function to find all values associated with a particular location, and visualize with hist()
. Your raster's projection and extent will determine what points you want to use for PointOfInterest
. A reproducible example:
library(raster)
r1 = raster(matrix(c(1:25),
nrow=5,ncol=5))
r2 = raster(matrix(rep(5, 25),
nrow=5,ncol=5))
r3 = raster(matrix(c(35:11),
nrow=5,ncol=5))
r_stack = stack(r1,r2,r3)
extent(r_stack) # Bounded by (0,1) in both dimensions
PointOfInterest = matrix(data=c(0.1,0.1),
ncol=2)
myValues = extract(x = r_stack,
y = PointOfInterest)
hist(myValues)
If you want to do this with more than one point, you can add rows to the matrix with coordinates you're interested in, or use raster::sampleRandom()
to randomly choose points. Then you just need to format the graphical parameters accordingly:
randomvals = sampleRandom(r_stack,
size = 4)
randomvals # This did the extracting for us
# Set up paneling so you can look at a bunch of histograms at once
n.points = nrow(randomvals)
par(mfrow=c(ceiling(n.points/2),2))
# Create a histogram for each point
for(i in 1:n.points)
hist(randomvals[i,])
add a comment |
Use the extract()
function to find all values associated with a particular location, and visualize with hist()
. Your raster's projection and extent will determine what points you want to use for PointOfInterest
. A reproducible example:
library(raster)
r1 = raster(matrix(c(1:25),
nrow=5,ncol=5))
r2 = raster(matrix(rep(5, 25),
nrow=5,ncol=5))
r3 = raster(matrix(c(35:11),
nrow=5,ncol=5))
r_stack = stack(r1,r2,r3)
extent(r_stack) # Bounded by (0,1) in both dimensions
PointOfInterest = matrix(data=c(0.1,0.1),
ncol=2)
myValues = extract(x = r_stack,
y = PointOfInterest)
hist(myValues)
If you want to do this with more than one point, you can add rows to the matrix with coordinates you're interested in, or use raster::sampleRandom()
to randomly choose points. Then you just need to format the graphical parameters accordingly:
randomvals = sampleRandom(r_stack,
size = 4)
randomvals # This did the extracting for us
# Set up paneling so you can look at a bunch of histograms at once
n.points = nrow(randomvals)
par(mfrow=c(ceiling(n.points/2),2))
# Create a histogram for each point
for(i in 1:n.points)
hist(randomvals[i,])
Use the extract()
function to find all values associated with a particular location, and visualize with hist()
. Your raster's projection and extent will determine what points you want to use for PointOfInterest
. A reproducible example:
library(raster)
r1 = raster(matrix(c(1:25),
nrow=5,ncol=5))
r2 = raster(matrix(rep(5, 25),
nrow=5,ncol=5))
r3 = raster(matrix(c(35:11),
nrow=5,ncol=5))
r_stack = stack(r1,r2,r3)
extent(r_stack) # Bounded by (0,1) in both dimensions
PointOfInterest = matrix(data=c(0.1,0.1),
ncol=2)
myValues = extract(x = r_stack,
y = PointOfInterest)
hist(myValues)
If you want to do this with more than one point, you can add rows to the matrix with coordinates you're interested in, or use raster::sampleRandom()
to randomly choose points. Then you just need to format the graphical parameters accordingly:
randomvals = sampleRandom(r_stack,
size = 4)
randomvals # This did the extracting for us
# Set up paneling so you can look at a bunch of histograms at once
n.points = nrow(randomvals)
par(mfrow=c(ceiling(n.points/2),2))
# Create a histogram for each point
for(i in 1:n.points)
hist(randomvals[i,])
edited Apr 13 at 0:46
answered Apr 12 at 22:56
JepsonNomadJepsonNomad
578515
578515
add a comment |
add a comment |
1
What does "any given location" in your last paragraph mean if it doesn't mean "a particular cell"?
– Spacedman
Apr 12 at 22:45