Skip to contents

Extracts the soil moisture at the GPS points provided assuming that they are land-based coordinates in Australia from the Soil Moisture Integration and Prediction System SMIPS data set.

Usage

extract_smips(
  xy,
  day,
  locations = NULL,
  lonlat = NULL,
  collection = "totalbucket",
  api_key = nert::get_key(),
  max_tries = 3L,
  initial_delay = 1L
)

Source

You must be logged in to view this. https://data.tern.org.au/model-derived/smips/v1_0/

Arguments

xy

A list or data.frame object with names containing pairings of longitude and latitude values expressed as decimal degree values in that order. A data.frame may also be an sf points object. See Details for more.

day

A vector of date(s) to query, e.g., day = "2017-12-31" or day = seq.Date(as.Date("2017-12-01"), as.Date("2017-12-31"), "days"), both Character and Date classes are accepted.

locations

The column in which the location names are located as an Integer value. Defaults to 1.

lonlat

A vector of integer values indicating the column index in which the longitude and latitude values are contained. Defaults to 2:3.

collection

A character vector of the data collection to be queried, currently only “smips” is supported with the following collections:

  • SMindex

  • bucket1

  • bucket2

  • deepD

  • runoff

  • totalbucket.

Defaults to “totalbucket”. Multiple collections are supported, e.g., collection = c("SMindex", "totalbucket").

api_key

A character string containing your API key, a random string provided to you by TERN, for the request. You may directly provide your key as a string here or use functionality like that from keyring. If nothing is provided, you will be prompted on how to set up your R session.

max_tries, initial_delay

Passed to nert::read_smips; the maximum number of download attempts and the initial retry delay in seconds.

Value

A data.table::data.table() with the provided GPS coordinates and the respective soil moisture data from SMIPS, one column per collection named smips_<collection>_mm (smips_SMindex for the unitless soil moisture index). If more than one day is requested, a date column is included and each location has one row per date.

xy

xy as a List Object

If xy is a list object, each individual vector's items should be named “x” (longitude) and “y” (latitude), respectively. The list item names should be descriptive of the individual vectors and will be included in a “location” column of the output.

xy as a Data Frame Object

If xy is a data.frame, it should be a three column object with the first column being the location name, the second longitude and the third, latitude both as decimal degrees in numeric format.

xy as an sf Object

If xy is an sf object, it should only be point geometry and have a coordinate reference system. The points are reprojected to the coordinate reference system of fifo's AEZ boundaries before the extraction. The x and y columns of every extract_*() function are returned in this same coordinate reference system. The location names are taken from the column given in locations, or from a column named “location” if there is one, otherwise the row numbers are used.

Examples