odcr is an R package that serves as a simple interface to the Open Data Cube. As such, it facilitates interaction with an Open Data Cube instance to access, query, list and load data as a native xarray-equivalent class. It implements basic methods to subset/index, plot and execute basic arithmetic operations on data and convert to native spatial raster classes such as stars or raster.

Features (in development)

  • basic database connection (see ?odcr::database)
  • datacube core Datacube class methods (see ?odcr::datacube)
  • datacube core data discovery methods (see ?odcr::datacube
  • datacube core data loading methods (see ?odcr::datacube
  • datacube core grid processing methods
  • datacube core indexing methods
  • support for native proxy class for streaming values directly (such as stars_proxy)
  • xarray xarray.core.dataarray.DataArray class and formal S3 definition
  • xarray xarray.core.dataset.Dataset class and formal S3 definition
  • xarray native S3 methods for retrieving dimensions (see ?odcr::dim)
  • xarray native S3 methods for indexing by arbitrary number of dimensions (see ?odcr::Extract)
  • xarray native S3 methods for indexing by variable (see ?odcr::Extract)
  • xarray native S3 methods for indexing by time strings (see ?odcr::Extract)
  • xarray native S3 methods for assigning/replacing variables (see ?odcr::Extract)
  • xarray native S3 methods for arithmetic operators (see ?odcr::Arithmetic)
  • xarray native S3 methods for coercing to native spatial classes raster* and stars (see ?odcr::as)
  • xarray native S3 methods for plotting (see ?odcr::plot)
  • unit tests
  • configuration (see ?odcr::config)

System requirements

odcr requires the Open Data Cube Python library datacube which needs to be installed as part of a working Open Data Cube installation. See odcbox, if you want to install and set-up an Open Data Cube container environment that meets all odcr system requirements “out-of-the-box”.

In case you have multiple Python installations or (virtual) environments installed, use odcr::config to make sure that odcr is using the correct Python installation and environment so that it can load and interact with the datacube library.

Installation

odcr is in active development and thus breaking changes to its interface need to be expected. Install the latest development version of odcr from GitHub:

devtools::install_github("eo2cube/odcr")

Build instructions

In case you want to build the package manually, clone the repository and cd to its main directory. odcr uses roxygen2 for documentation. Make sure, devtools, roxygen2 and pkgdown are installed. Run:

source("build.R")

Get Started

See the vignette Using odcr for a full introduction on how to use odcr with Sentinel-2 example data. Documentation and examples are available at https://eo2cube.github.io/odcr/.

List of functions and methods

See the package index.