swd_format: swd_format: Prepare data in Maxents swd format.

View source: R/swd_format.R

swd_formatR Documentation

swd_format: Prepare data in Maxents swd format.

Description

swd_format It reshapes your occurrence and background information using the format samples with data (swd) to run maxent with an ordinary samples file.

Usage

swd_format(
  env_layers,
  nbg = NULL,
  occs_points,
  sp_name = "sp",
  longitude,
  latitude,
  random_seed = NULL,
  parallel = TRUE,
  ncores = 4
)

Arguments

env_layers

A raster stack or brick with the environmental information.

nbg

Number of points for the background data.

occs_points

A data frame with longitude and latitude data.

sp_name

Species name. Default sp_name="sp".

longitude

Column name containing longitude data.

latitude

Column name containing latitude data.

random_seed

A numeric value for random seed

parallel

Run the process in parallel

ncores

Number of cores to run the parallel process

Details

The difference between the typical way of running MaxEnt models and it is that the program doesn’t need to look in the environmental layers to obtain values for the variables at the sample points or the background points. each time that you call maxent (see maxent_call). One of the main advantages is that MaxEnt runs much faster see section SWD Format here https://biodiversityinformatics.amnh.org/open_source/maxent/Maxent_tutorial2017.pdf for details.

Value

A list with the occurrence or/and background points in swd format. Note that coordinates correspond to pixel centroids

Examples

## Not run: 
# Bioclimatic layers path
wcpath <- list.files(system.file("extdata/bios",
                                package = "ntbox"),
                    pattern = ".tif$",full.names = TRUE)
# Bioclimatic layers
wc <- raster::stack(wcpath)
# Occurrence data for the giant hummingbird (Patagona gigas)
pg <- utils::read.csv(system.file("extdata/p_gigas.csv",
                                  package = "ntbox"))

pg_swd <- ntbox::swd_format(env_layers=wc,
                            nbg=10000,
                            occs_points =pg,
                            sp_name="p_gigas",
                            longitude = "longitude",
                            latitude  = "latitude")

head(pg_swd$occs_swd)

head(pg_swd$bg_swd)


## End(Not run)

luismurao/ntbox documentation built on May 9, 2024, 8:24 p.m.