Function to insert a file into the dbfiles table as an input
Usage
dbfile.input.insert(
in.path,
in.prefix,
siteid,
startdate,
enddate,
mimetype,
formatname,
parentid = NA,
con,
hostname = PEcAn.remote::fqdn(),
allow.conflicting.dates = FALSE,
ens = FALSE
)Arguments
- in.path
path to the directory containing the file to be inserted
- in.prefix
initial portion of the filename that does not vary by date. Does not include directory; specify that as part of in.path
- siteid
the id of the site that this data is applicable to
- startdate
the start date of the data stored in the file
- enddate
the end date of the data stored in the file
- mimetype
the mime-type of the file
- formatname
the name of the format to distinguish between simmilair mime-types
- parentid
the id of the parent of the input
- con
database connection object
- hostname
the name of the host where the file is stored, this will default to the name of the current machine
- allow.conflicting.dates
Whether to allow a new input record with same siteid, name, and format but different start/end dates
- ens
In case of ensembles we could let to have more than one file associated with one input.
Details
This will write into the dbfiles, inputs, machines and formats the required data to store the file
Examples
if (FALSE) { # \dontrun{
siteid <- 1
startdate <- as.Date("2000-01-01")
enddate <- as.Date("2001-01-01")
dbcon <- db.open(list(host = "postgres", user = "bety", password = "carya"))
dbfile.input.insert(
in.path = 'trait.data.Rdata',
in.prefix = 'trait.data',
siteid = siteid,
startdate = startdate,
enddate = enddate,
mimetype = 'application/x-RData',
formatname = 'traits',
con = dbcon
)
} # }