#' Create an ODF v2.0 list of all the required information
#'
#' @description Create a list of Ocean Data Format (ODF) v2.0 mandatory and
#' optional information so that an ODF or NetCDF file can be created with all
#' of the required information.
#'
#'
#' @param datetime_format a character string that is either `iso8601`
#' (preferred) or `ODF v2.0` (for submission to ODIS). ODF files require an
#' older representation of time that does not follow modern international
#' standards.
#'
#' @returns a list of lists with all of the information required to create an
#' ODF v2.0 compliant file
#' @export
#'
#' @examples x <- odf_create()
#'
odf_create <- function(datetime_format = "iso8601") {
if (datetime_format == "ODF v2.0") {
datetime_format = "%d-%b-%Y %H:%M:%OS2"
}
if (datetime_format == "iso8601") {
datetime_format = "%Y-%m-%dT%H:%M:%OS2%z"
}
odf <- list()
odf[['odf_header']] <- list(file_specification = NA_character_)
odf[['cruise_header']] <- list(
country_institute_code = NA_integer_,
cruise_number = NA_character_,
organization = NA_character_,
chief_scientist = NA_character_,
start_date = toupper(format(NA_POSIXct_, format = datetime_format)),
end_date = toupper(format(NA_POSIXct_, format = datetime_format)),
platform = NA_character_,
cruise_name = NA_character_,
cruise_description = NA_character_
)
odf[['event_header']] <- list(
data_type = NA_character_,
event_number = NA_integer_,
event_qualifier1 = NA_character_,
event_qualifier2 = NA_character_,
creation_date = toupper(format(Sys.time(), format = datetime_format)),
orig_creation_date = NA_POSIXct_,
start_date_time = NA_POSIXct_,
end_date_time = NA_POSIXct_,
initial_latitude = NA_real_,
initial_longitude = NA_real_,
end_latitude = NA_real_,
end_longitude = NA_real_,
min_depth = NA_real_,
max_depth = NA_real_,
sampling_interval = NA_real_,
sounding = NA_real_,
depth_off_bottom = NA_real_,
event_comments = list()
)
odf[['instrument_header']] <- list(
inst_type = NA_character_,
model = NA_character_,
serial_number = NA_character_,
description = NA_character_
)
odf[['history_header']] <- list(creation_date = toupper(format(Sys.time(), format = datetime_format)))
odf[['parameter_header']] <- list()
odf[['record_header']] <- list()
return(odf)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.