Function index for RasterHistograms
RasterHistograms exported functions
RasterHistograms.RasterLayerHistogram
— Typemutable struct RasterLayerHistogram <: AbstractRasterHistogram
A RasterLayerHistogram
. The struct
is mutable
so that the histogram
field can be updated using the normalize
(or otherwise) function.
layer::Any
: The layer (variable) from theRaster
dimensions::Any
: The dimensions of theRaster
raster_size::Any
: The size of theRaster
histogram::StatsBase.Histogram
: The 1-dimensional histogram fitted to theRaster
layer data
RasterHistograms.RasterLayerHistogram
— Methodfunction RasterLayerHistogram(rs::Raster; closed = :left, nbins = nothing)
function RasterLayerHistogram(rs::Raster, weights::AbstractWeights;
closed = :left, nbins = nothing)
function RasterLayerHistogram(rs::Raster, edges::AbstractVector; closed = :left)
function RasterLayerHistogram(rs::Raster, weights::AbstractWeights,
edges::AbstractVector; closed = :left)
Construct a RasterLayerHistogram
from a Raster
. The flattened Raster
data, with the missing
values removed, is passed to the fit(::Histogram)
function from StatsBase.jl and a RasterLayerHistogram
type is returned.
RasterHistograms.RasterSeriesHistogram
— Typemutable struct RasterSeriesHistogram <: AbstractRasterHistogram
A RasterSeriesHistogram
where the child
s of the RasterSeries
are RasterStack
s or Raster
s. The struct
is mutable
so that the histogram
field can be updated using the normalize
(or otherwise) function.
layers::Any
: The layers (variables) from theRasterSeries
used to fit theHistogram
series_dimension::Any
: The dimension of theRasterSeries
(usually this will be time)series_length::Any
: The length of the `RasterSeriesdimensions::Any
: The dimensions of the elements (either aRaster
orRasterStack
) of theRasterSeries
raster_size::Any
: The size of the elements (either aRaster
orRasterStack
) of theRasterSeries
histogram::StatsBase.Histogram
: The N-dimensionalHistogram
fitted to the N layers fromRasterSeries
RasterHistograms.RasterSeriesHistogram
— Methodfunction RasterSeriesHistogram(series::RasterSeries, edges::NTuple{N, AbstractVector};
closed = :left)
function RasterSeriesHistogram(series::RasterSeries, weights::AbstractWeights,
edges::NTuple{N, AbstractVector}; closed = :left)
Construct a RasterSeriesHistogram
from a RasterSeries
. Note that to merge
Histograms
the bin edges must be the same, so for this constructor the edges must be passed in. This constructor assumes that the dimensions are the same across all RasterStack
s in the RasterSeries
.
RasterHistograms.RasterStackHistogram
— Typemutable struct RasterStackHistogram <: AbstractRasterHistogram
A RasterStackHistogram
. The struct
is mutable
so that the histogram
field can be updated using the normalize
(or otherwise) function.
layers::Any
: The layers (variables) from theRasterStack
used to fit theHistogram
dimensions::Any
: The dimensions of theRasterStack
raster_size::Any
: The size of theRasterStack
layershistogram::StatsBase.Histogram
: The N-dimensionalHistogram
fitted to the N layers fromRasterStack
RasterHistograms.RasterStackHistogram
— Methodfunction RasterStackHistogram(stack::RasterStack; closed = :left, nbins = nothing)
function RasterStackHistogram(stack::RasterStack, weights::AbstractWeights;
closed = :left, nbins = nothing)
function RasterStackHistogram(stack::RasterStack, edges::NTuple{N, AbstractVector};
closed = :left)
function RasterStackHistogram(stack::RasterStack, weights::AbstractWeights,
edges::NTuple{N, AbstractVector}; closed = :left)
Construct a RasterStackHistogram
from a RasterStack
. The resulting Histogram
is N-dimensional, where N is the number of layers. The flattened Raster
data for each layer, with themissing
values removed, is passed to the fit(::Histogram)
function from StatsBase.jl and a RasterStackHistogram
type is returned.
LinearAlgebra.normalize!
— Methodfunction normalize!(arh::AbstractRasterHistogram; mode::Symbol = :pdf)
Normalize the Histogram
in the AbstractRasterHistogram
according the desired mode
. See the StatsBase.jl docs for information on the possible mode
s and how they work.
MakieCore.convert_arguments
— Functionfunction convert_arguments(P::Type{<:AbstractPlot}, arh::AbstractRasterHistogram)
Converting method so Makie.jl can plot an AbstractRasterHistogram
. Note for plotting purposes a value correspnding to zero is replaced with NaN
. This is to avoid in 2D plotting many zero values and as a result not seeing the distribtution clearly (in Makie.kj heatmap
the NaN
value is left out in plotting).
RasterHistograms.area_weights
— Methodfunction area_weights(rs::Union{Raster, RasterStack}; equator_one_degree = 111e3)
Return the Weights
for a Histogram
calculated from the area of each grid cell in a Raster
or RasterStack
. The Raster
or RasterStack
must first be sliced over the dimensions one wishes to look at, e.g. for area weights at sea surface the function need rs[Z(1)]
to be passed in. If the original Raster
only has two spatial dimensions then this step may be skipped. The keyword argument equator_one_degree
is one degree at the equator in metres. The function returns a container Weights
so can be passed straight into the fit(::Histogram)
function.
RasterHistograms.volume_weights
— Methodfunction volume_weights(rs::Union{Raster, RasterStack}; equator_one_degree = 111e3)
Return the Weights
for a Histogram
calculated from the volume of each grid cell in a Raster
or RasterStack
. The model resolution is inferred from the X
and Y
dimensions of the Raster
or RasterStack
and assumes that along the X
and Y
the resolution is unique (though it can be different for X
and Y
). The keyword argument equator_one_degree
is one degree at the equator in metres. The function returns a container Weights
so can be passed straight into the fit(::Histogram)
function.
RasterHistograms private functions
RasterHistograms.AbstractRasterHistogram
— TypeAbstract supertype for a RasterHistogram
.
Base.iterate
— Functioniterate
methods for AbstractRasterHistogram
s.
Base.show
— Methodshow
methods for AbstractRasterHistogram
s.
RasterHistograms.find_stack_non_missing
— Methodfunction find_stack_non_missing(stack::RasterStack)
Return a Raster
of type Bool
that contains the intersection of the non-missing
values from the layers of a RasterStack
.
RasterHistograms.raster_zeros_to_nan
— Methodfunction raster_zeros_to_nan(arh::AbstractRasterHistogram)
Convert the zero
s (i.e. empty bins in the AbstractRasterHistogram
) to NaN
s for plotting in Makie.
RecipesBase.apply_recipe
— MethodConversion method for plotting in Plots.jl