Upgraining of atlas data to larger grain sizes

Share:

Description

Takes presence-absence atlas data and aggregates data to larger grain sizes, returning occupancy at each grain size for use in downscale modelling. Atlas data may be in the form of raster data or as a data frame with presence-absence information and cell coordinates.

The extent for all scales is standardised to that of the largest grain size by applying a threshold for the proportion of unsampled atlas cells allowed within a cell at the largest grain size. The threshold can be chosen by the user or one of four threshold selections methods apply. See upgrain.threshold for a visualisation of the thresholds.

The function outputs a data frame of occupancies suitable as input for downscale, and will also plot the original atlas data along with the standardised data for each upgrained scale. In all plots presence = red, absence = white, and NA = grey.

Usage

1
2
upgrain(atlas.data, cell.width = NULL, scales, threshold = NULL,
        method = "All_Sampled", plot = TRUE, return.rasters = FALSE)

Arguments

atlas.data

either a raster file of presence-absence atlas data or a data frame of sampled cells. If a data frame columns must be in the following order: longitude, latitude, presence-absence.

cell.width

if data is a data frame, the cell widths of sampled cells. If data is a raster then leave as default (= NULL)

scales

the number of cells to upgrain. Upgraining will happen by factors of 2 - ie if scales = 3, the atlas data will be aggregated in 2x2 cells, 4x4 cells and 8x8 cells.

threshold

default = NULL. A user defined threshold for the proportion of unsampled atlas cells allowed within a cell at the largest grain size. Note: if a method is selected then threshold must be NULL.

method

one of "All_Sampled", "All_Occurrences", "Gain_Equals_Loss" or "Sampled_Only" (default = "All_Sampled"). If the user wishes to define their own threshold then method must equal NULL. See details and upgrain.threshold for descriptions of the different methods.

plot

default = TRUE. Plots the original atlas data alongside the standardised atlas data at each grain size.

return.rasters

default = FALSE. If TRUE returns the extent-standardised atlas data upgrained to all grain sizes (NOTE: the extent-standardised atlas data at the original grain size is always returned regardless).

Details

When aggregating data to larger grain sizes, the extent of all grain sizes is set to the extent of the largest grain size. At the atlas scale, unsampled NA cells that fall within this extent are assigned as absences. This ensures that there are subsequently equal extents across all scales and therefore consistency of occupancy estimates. Therefore, it is necessary to apply a threshold whereby only those cells at the largest grain size are retained if a certain proportion of them are sampled at the altas scale. However, there is a trade-off between assigning unsampled cells as absences, and discarding sampled cells and presences.

It is highly advisable before selecting a threshold to explore this trade-off on a case-by-case basis with upgrain.threshold and to read the help file therein as well as referring to vignette("Upgraining", package = "downscale").

The user may input their own threshold or use one of four suggested threshold criteria:

Threshold Method Description
0 All_Sampled All of the original atlas data is included.
Species specific All_Occurrences The threshold where no occurrences in the atlas data are excluded.
Atlas specific Gain_Equals_Loss The threshold where the number of sampled atlas cells reclassified as No Data equals the number of unsampled exterior cells reclassified as absence. In this threshold the new standardised extent also equals the extent of the original atlas data.
1 Sampled_Only Only cells that contain 100% sampled atlas data are included.

Figure: Maps.png

Value

Returns a list of class "upgrain" that can be used as a direct input to downscale and hui.downscale. The list contains five objects:

threshold

The proportion of unsampled atlas cells allowed within a cell at the largest grain size, either defined by the user through threshold or calculated according to method.

extent.stand

The standardised extent after upgraining (equal to the extent of the largest grain size)

occupancy.stand

Occupancy for each grain size where extent has been standardised. The data frame contains three columns:

Cell.area Grain sizes for for each upgrained scale.
Extent Extent for each grain size.
Occupancy Observed area of occupancy for each grain size.
occupancy.orig

Original occupancies for each grain size before extent has been standardised. The data frame contains three columns:

Cell.area Grain sizes for for each upgrained scale.
Extent Extent for each grain size.
Occupancy Observed area of occupancy for each grain size.
atlas.raster.stand

A raster layer of the extent-standardised atlas data

scaled.rasters

If return.rasters = TRUE. A list containing the extent-standardised atlas data upgrained to all grain sizes

Author(s)

Charles Marsh <charliem2003@gmail.com>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
## example species data
data.file <- system.file("extdata", "atlas_data.txt", package = "downscale")
atlas.data <- read.table(data.file, header = TRUE)

## if the input data is a data frame it must have the columns "lon", "lat"
## and "presence"
head(atlas.data)

## explore thresholds using upgrain.threshold
thresh <- upgrain.threshold(atlas.data = atlas.data,
                            cell.width = 10,
                            scales = 3,
                            thresholds = seq(0, 1, 0.1))

## use a specified threshold - method must equal NULL
upgrain(atlas.data = atlas.data,
        cell.width= 10,
        scales = 3,
        threshold = 0.15,
        method = NULL)
        
## use one of the suggested methods - do not specify a threshold
all_sampled <- upgrain(atlas.data = atlas.data,
                       cell.width= 10,
                       scales = 3,
                       method = "All_Sampled")
        

## input data for downscale for All Sampled threshold
all_sampled$occupancy.stand

## and the original occupancies (note that extent varies with scale)
all_sampled$occupancy.orig