dbW_createDatabase: Create a weather database

View source: R/sw_dbW_WeatherDatabase.R

dbW_createDatabaseR Documentation

Create a weather database

Description

Create a weather database

Usage

dbW_createDatabase(
  dbFilePath = "dbWeatherData.sqlite3",
  site_data = data.frame(Label = NA_character_, Longitude = NA_real_, Latitude =
    NA_real_, stringsAsFactors = FALSE)[0, , drop = FALSE],
  Scenarios = NULL,
  scen_ambient = "Current",
  compression_type = "gzip",
  verbose = FALSE,
  ...
)

Arguments

dbFilePath

A character string. The file path of the weather database. This will be a file of type sqlite3. In-memory databases are not supported.

site_data

A data.frame. The site data with column names Longitude, Latitude, and Label.

Scenarios

A vector of character strings. The climate scenarios of which the first one is enforced to be scen_ambient.

scen_ambient

A character string. The first/default climate scenario.

compression_type

A character string. The type of compression for the weather blob. See memCompress for the available choices.

verbose

A logical value.

...

Additional/deprecated arguments which are currently ignored.

Value

TRUE on success; FALSE otherwise. If the file dbFilePath didn't already exist, but creating it failed, then the attempt will be disconnected and removed.

Details

A rSOILWAT2 weather database has the following format:

Table Meta

contains two fields Desc and Value which contain

  • the records Version and Compression_type

Table Sites

contains four fields Site_id, Latitude, Longitude, and Label

Table WeatherData

contains six fields wdid (the ID of the weather data record), Site_id, Scenario (i.e., the ID of the scenario), StartYear, EndYear, and data

Table Scenarios

contains two fields id and Scenario (i.e., the scenario name)

'site_data' requires columns 'Longitude', 'Latitude', and 'Label'.


Burke-Lauenroth-Lab/rSOILWAT2 documentation built on Dec. 9, 2023, 1:46 a.m.