Package 'quantarcticR'

Title: Access to Quantarctica Data Sets
Description: Quantarctica is a collection of Antarctic geographical datasets which works with the free, cross-platform, open-source software QGIS. It includes community-contributed, peer-reviewed data from ten different scientific themes and a professionally-designed basemap. This package provides access to Quantarctica data sets.
Authors: Kim Fitter [aut], Charlène Guillaumot [aut], David Ranzolin [aut], Marc Desgroseilliers [aut], Ben Raymond [aut, cre]
Maintainer: Ben Raymond <[email protected]>
License: MIT + file LICENSE
Version: 0.1.3
Built: 2024-11-03 03:21:01 UTC
Source: https://github.com/SCAR/quantarcticR

Help Index


Get or set the directory used to cache Quantarctica data

Description

The cache directory is used to store data locally, so that they can be used offline later. If called with no arguments (i.e. qa_cache_dir()), this function returns the current cache directory. By default, this is a per-session temporary directory. Calling with a path argument will set the cache directory to that path.

Usage

qa_cache_dir(path, verbose = FALSE)

Arguments

path

string: (optional) Values can be "session" (a per-session temporary directory will be used, default), "persistent" (the directory returned by rappdirs::user_cache_dir will be used), or a string giving the path to the directory to use. An attempt will be made to create the cache directory if it does not exist

verbose

logical: show progress messages?

Value

The path to the cache directory

See Also

qa_get

Examples

## return the current cache directory
qa_cache_dir()

## set the cache directory to a location that persists across
##  user sessions
qa_cache_dir("persistent")

## switch to a per-session cache
qa_cache_dir("session")

Retrieve details of a Quantarctica data set

Description

Retrieve details of a Quantarctica data set

Usage

qa_dataset(
  name,
  cache_directory = qa_cache_dir(),
  refresh_cache = 0,
  verbose = FALSE
)

Arguments

name

string: the name of the data set

cache_directory

string: the cache directory to use. As for the path parameter to the qa_cache_dir function

refresh_cache

numeric: 0 = do not overwrite existing files, 1 = overwrite if the remote file is newer than the local copy, 2 = always overwrite existing files

verbose

logical: show progress messages?

Value

A tibble

Examples

## Not run: 
  dsx <- qa_dataset("ALBMAP Bed/bathymetry elevation (5km)")

## End(Not run)

Available Quantarctica data sets

Description

Available Quantarctica data sets

Usage

qa_datasets(
  cache_directory = qa_cache_dir(),
  refresh_cache = 0,
  verbose = FALSE
)

Arguments

cache_directory

string: the cache directory to use. As for the path parameter to the qa_cache_dir function

refresh_cache

numeric: as for qa_get

verbose

logical: show progress messages?

Value

A tibble with columns layername, main_file, type, cached, and download_size

See Also

qa_get

Examples

## Not run: 
  qa_datasets()

## End(Not run)

Fetch a Quantarctica data set

Description

Fetch a Quantarctica data set

Usage

qa_get(
  dataset,
  cache_directory = qa_cache_dir(),
  refresh_cache = 0,
  verbose = FALSE,
  shapefile_reader,
  raster_reader
)

Arguments

dataset

string or qa_dataset: the name of the data set or a data set object as returned by qa_dataset

cache_directory

string: the cache directory to use. As for the path parameter to the qa_cache_dir function

refresh_cache

numeric: 0 = do not overwrite existing files, 1 = overwrite if the remote file is newer than the local copy, 2 = always overwrite existing files

verbose

logical: show progress messages?

shapefile_reader

function: function to use to read shapefiles. By default this is raster::shapefile

raster_reader

function: function to use to read raster files (TIFF, JP2, VRT). By default this is raster::raster

Value

By default, an object of class SpatialPolygonsDataFrame (for shapefile layers) or RasterLayer (for raster layers). Objects of other classes may be returned if non-default shapefile_reader or raster_reader functions are used


Has a dataset been downloaded to the local cache?

Description

Has a dataset been downloaded to the local cache?

Usage

qa_is_cached(dataset, cache_directory = qa_cache_dir(), verbose = FALSE)

Arguments

dataset

string or qa_dataset: the dataset object, or name of the dataset

cache_directory

string: the cache directory to check. As for the path parameter to the qa_cache_dir function

verbose

logical: show progress messages?

Value

Logical

See Also

qa_dataset, qa_cache_dir

Examples

## Not run: 
  ds <- qa_dataset("ADD Simple basemap")
  qa_is_cached(ds) ## FALSE
  x <- qa_get(ds)
  qa_is_cached(ds) ## TRUE

## End(Not run)

Get or set the Quantarctica download mirror site to use

Description

Get or set the Quantarctica download mirror site to use

Usage

qa_mirror(mirror)

Arguments

mirror

string: the URL of the mirror to use

Value

If called with no arguments, the current mirror URL will be returned as a string. If called with a mirror argument, the mirror will be set to that and then the mirror URL returned.

See Also

qa_mirrors

Examples

## current mirror
qa_mirror()

## all available mirrors
qa_mirrors()

## set to first mirror in that list
qa_mirror(qa_mirrors()$url[1])

## or equivalently
qa_mirror(qa_mirrors()[1, ])

A list of Quantarctic mirror sites

Description

Choose the mirror closest to you for the fastest and most reliable download.

Usage

qa_mirrors()

Value

A tibble with columns country, protocol, and url

References

http://quantarctica.npolar.no/downloads/

Examples

qa_mirrors()