Skip to content

Commit 2e01094

Browse files
committed
Documentation update
1 parent 37d9906 commit 2e01094

21 files changed

+63
-62
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Description: Support for all calendars as specified in the Climate and Forecast
1111
Climate Change (IPCC). This package specifically allows the user to work
1212
with any of the CF-compliant calendars (many of which are not compliant with
1313
POSIXt). The CF time coordinate is formally defined in the CF Metadata
14-
Conventions document available at <https://cfconventions.org/Data/cf-conventions/cf-conventions-1.10/cf-conventions.html#time-coordinate>.
14+
Conventions document available at <https://cfconventions.org/Data/cf-conventions/cf-conventions-1.11/cf-conventions.html#time-coordinate>.
1515
License: MIT + file LICENSE
1616
Encoding: UTF-8
1717
Roxygen: list(markdown = TRUE)

NAMESPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export(CFtimestamp)
1111
export(calendar)
1212
export(definition)
1313
export(indexOf)
14-
export(is.complete)
14+
export(is_complete)
1515
export(offsets)
1616
export(origin)
1717
export(resolution)

NEWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ limited to month names and no weekday information can be generated. The `CFrange
2525
function has a new "format" parameter to support the same functionality.
2626
* `as.character()` and `length()` methods added that return a vector of timestamps
2727
or the number of offsets in a CFtime instance, respectively.
28-
* Several methods have been renamed (most notably `CFcomplete()` to `is.complete()`
28+
* Several methods have been renamed (most notably `CFcomplete()` to `is_complete()`
2929
and `CFsubset()` to `slab()`) to be more consistent with the R universe. Some
3030
datum methods (deep down where regular mortals do not dwell) have been deleted.
3131
* Minor code fixes, see GitHub commits.

R/CFdatum.R

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,21 @@ setClass("CFdatum",
4040
#' instance is read-only. The parameters to the call are typically read from a
4141
#' CF-compliant data file with climatological observations or predictions.
4242
#'
43-
#' @param definition character. An atomic string describing the time coordinate
43+
#' @param definition character. A character string describing the time coordinate
4444
#' of a CF-compliant data file.
45-
#' @param calendar character. An atomic string describing the calendar to use
45+
#' @param calendar character. A character string describing the calendar to use
4646
#' with the time dimension definition string.
4747
#'
4848
#' @returns An object of the `CFdatum` class.
4949
#' @noRd
5050
CFdatum <- function(definition, calendar) {
5151
stopifnot(length(definition) == 1L, length(calendar) == 1L)
52-
definition <- tolower(definition)
5352
calendar <- tolower(calendar)
5453

5554
parts <- strsplit(definition, " ")[[1L]]
56-
if ((length(parts) < 3L) || !(parts[2L] %in% c("since", "after", "from", "ref", "per")))
55+
if ((length(parts) < 3L) || !(tolower(parts[2L]) %in% c("since", "after", "from", "ref", "per")))
5756
stop("Definition string does not appear to be a CF-compliant time coordinate description")
58-
u <- which(CFt$CFunits$unit == parts[1L])
57+
u <- which(CFt$CFunits$unit == tolower(parts[1L]))
5958
if (length(u) == 0L) stop("Unsupported unit: ", parts[1L])
6059

6160
cal <- CFt$calendars$id[which(calendar == CFt$calendars$name)]

R/CFfactor.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@
6565
#' dimension of the result of, say, `apply(A, 1:2, tapply, Af, FUN)`. The
6666
#' 'CFtime' attribute is `NULL` for epoch factors.
6767
#'
68-
#' @param cf CFtime. An atomic instance of the `CFtime` class whose offsets will
68+
#' @param cf CFtime. An instance of the `CFtime` class whose offsets will
6969
#' be used to construct the factor.
70-
#' @param period character. An atomic character string with one of the values
70+
#' @param period character. A character string with one of the values
7171
#' "year", "season", "quarter", "month" (the default), "dekad" or "day".
7272
#' @param epoch numeric or list, optional. Vector of years for which to
7373
#' construct the factor, or a list whose elements are each a vector of years.
@@ -104,7 +104,7 @@ CFfactor <- function(cf, period = "month", epoch = NULL) {
104104

105105
period <- tolower(period)
106106
if (!((length(period) == 1L) && (period %in% CFt$factor_periods)))
107-
stop("Period specifier must be an atomic value of a supported period")
107+
stop("Period specifier must be a single value of a supported period")
108108

109109
# No fine-grained period factors for coarse source data
110110
timestep <- CFt$units$seconds[cf@datum@unit] * cf@resolution;
@@ -396,7 +396,7 @@ CFfactor_coverage <- function(cf, f, coverage = "absolute") {
396396
stop("Argument `f` must be a factor generated by the function `CFfactor()`")
397397

398398
if (!(is.character(coverage) && coverage %in% c("absolute", "relative")))
399-
stop("Argument `coverage` must be an atomic string with a value of \"absolute\" or \"relative\"")
399+
stop("Argument `coverage` must be a chaarcter string with a value of \"absolute\" or \"relative\"")
400400

401401
if (coverage == "relative") {
402402
cal <- cf@datum@cal_id

R/CFformat.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#' `asPOSIX = TRUE`.
1414
#'
1515
#' @param cf CFtime. The `CFtime` instance that contains the offsets to use.
16-
#' @param format character. An atomic string with either of the values "date" or
16+
#' @param format character. A character string with either of the values "date" or
1717
#' "timestamp". If the argument is not specified, the format used is
1818
#' "timestamp" if there is time information, "date" otherwise.
1919
#' @param asPOSIX logical. If `TRUE`, for "standard", "gregorian" and
@@ -94,10 +94,10 @@ CFtimestamp <- function(cf, format = NULL, asPOSIX = FALSE) {
9494
#'
9595
#' Internal function
9696
#'
97-
#' @param ts data.frame of decomposed offsets
98-
#' @param tz character. Atomic time zone string
99-
#' @param format character. Atomic character string with the format specifiers
100-
#' @returns Character vector of formatted timestamps
97+
#' @param ts data.frame of decomposed offsets.
98+
#' @param tz character. Time zone character string.
99+
#' @param format character. A character string with the format specifiers.
100+
#' @returns Character vector of formatted timestamps.
101101
#' @noRd
102102
.format_format <- function(ts, tz, format) {
103103
# Expand any composite specifiers

R/CFparse.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ CFparse <- function(cf, x) {
122122
"(?::([0-5][0-9]))?",
123123
"(?:\\.([0-9]*))?",
124124
")?",
125-
"(?:([Z+-])([01][0-9]|2[0-3])?(?::(00|15|30|45))?", ## FIXME: Z, smaller number of captures
125+
"(?:([Z+-])([01][0-9]|2[0-3])?(?::(00|15|30|45))?", ## FIXME: Z?, smaller number of captures
126126
")?$"
127127
)
128128

R/CFtime-package.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#' Climate Change (IPCC). This package specifically allows the user to work
99
#' with any of the CF-compliant calendars (many of which are not compliant with
1010
#' POSIXt). The CF time coordinate is formally defined in the
11-
#' [CF Metadata Conventions document](https://cfconventions.org/Data/cf-conventions/cf-conventions-1.10/cf-conventions.html#time-coordinate).
11+
#' [CF Metadata Conventions document](https://cfconventions.org/Data/cf-conventions/cf-conventions-1.11/cf-conventions.html#time-coordinate).
1212
#'
1313
#' The package can create a `CFtime` instance from scratch or, more commonly, it
1414
#' can use the dimension attributes and dimension variable values from a NetCDF
@@ -26,7 +26,7 @@
2626
#' * [`Append`][CFtime-append] additional time steps to a CFtime instance
2727
#' * [CFtimestamp()] and [format()]: Generate a vector of character or `POSIXct` timestamps from a CFtime instance
2828
#' * [CFrange()]: Timestamps of the two endpoints in the time series
29-
#' * [is.complete()]: Does the CFtime instance have a complete time series between endpoints?
29+
#' * [is_complete()]: Does the CFtime instance have a complete time series between endpoints?
3030
#' * [CFmonth_days()]: How many days are there in a month using the CFtime calendar?
3131
#'
3232
#' **Factors and coverage**
@@ -36,7 +36,7 @@
3636
#'
3737
#' **Filtering and selection**
3838
#' * [slab()]: Logical vector of time steps between two extreme points.
39-
#' * [indexOf()]: Index values of time steps in the time series, possibly with
39+
#' * [indexOf()]: Index values in the time series of given timestamps, possibly with
4040
#' fractional part for interpolation.
4141
#' @keywords internal
4242
#' @aliases CFtime-package

R/CFtime.R

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#' CF Metadata Conventions time representation
22
#'
3-
#' @slot datum CFdatum. The atomic origin upon which the `offsets` are based.
3+
#' @slot datum CFdatum. The origin upon which the `offsets` are based.
44
#' @slot resolution numeric. The average number of time units between offsets.
55
#' @slot offsets numeric. A vector of offsets from the datum.
66
#' @slot bounds Optional, the bounds for the offsets. If not set, it is the
@@ -27,13 +27,13 @@ setClass("CFtime",
2727
#' observations or climate projections. Specification of arguments can also be
2828
#' made manually in a variety of combinations.
2929
#'
30-
#' @param definition character. An atomic string describing the time coordinate
30+
#' @param definition character. A character string describing the time coordinate
3131
#' of a CF-compliant data file.
32-
#' @param calendar character. An atomic string describing the calendar to use
32+
#' @param calendar character. A character string describing the calendar to use
3333
#' with the time dimension definition string. Default value is "standard".
3434
#' @param offsets numeric or character, optional. When numeric, a vector of
3535
#' offsets from the origin in the time series. When a character vector,
36-
#' timestamps in ISO8601 or UDUNITS format. When an atomic character string, a
36+
#' timestamps in ISO8601 or UDUNITS format. When a character string, a
3737
#' timestamp in ISO8601 or UDUNITS format and then a time series will be
3838
#' generated with a separation between steps equal to the unit of measure in
3939
#' the definition, inclusive of the definition timestamp. The unit of measure
@@ -87,9 +87,9 @@ CFtime <- function(definition, calendar = "standard", offsets = NULL) {
8787
#'
8888
#' @param cf CFtime. An instance of `CFtime`.
8989
#'
90-
#' @returns `calendar()` and `unit()` return an atomic character string.
90+
#' @returns `calendar()` and `unit()` return a character string.
9191
#' `origin()` returns a data frame of timestamp elements with a single row
92-
#' of data. `timezone()` returns the datum time zone as an atomic character
92+
#' of data. `timezone()` returns the datum time zone as a character
9393
#' string. `offsets()` returns a vector of offsets or `NULL` if no offsets
9494
#' have been set.
9595
#'
@@ -251,7 +251,7 @@ setMethod("show", "CFtime", function(object) {
251251
#'
252252
#' @param x CFtime. A CFtime instance whose offsets will be returned as
253253
#' timestamps.
254-
#' @param format character. An atomic character string with strptime format
254+
#' @param format character. A character string with strptime format
255255
#' specifiers.
256256
#'
257257
#' @returns A vector of character strings with a properly formatted timestamp.
@@ -270,7 +270,7 @@ setMethod("format", "CFtime", function(x, format) {
270270
stop("package `stringr` is required - please install it first") # nocov
271271

272272
if (missing(format) || !is.character(format) || length(format) != 1)
273-
stop("`format` argument must be an atomic string with formatting specifiers")
273+
stop("`format` argument must be a character string with formatting specifiers")
274274

275275
ts <- .offsets2time(x@offsets, x@datum)
276276
if (nrow(ts) == 0L) return()
@@ -313,6 +313,7 @@ setMethod("format", "CFtime", function(x, format) {
313313
#' `breaks` is a character vector of timestamps, attribute 'CFtime' holds an
314314
#' instance of CFtime that has the same definition as `x`, but with (ordered)
315315
#' offsets generated from the `breaks`. Attribute 'epoch' is always -1.
316+
#' @aliases cut
316317
#' @seealso [CFfactor()] produces a factor for several fixed periods, including
317318
#' for epochs.
318319
#' @export
@@ -432,7 +433,7 @@ setMethod("indexOf", c("ANY", "CFtime"), function(x, cf, method = "constant") {
432433
method %in% c("constant", "linear"))
433434

434435
if (is.numeric(x)) {
435-
if (!(all(x < 0) || all(x > 0)))
436+
if (!(all(x < 0, na.rm = TRUE) || all(x > 0, na.rm = TRUE)))
436437
stop("Cannot mix positive and negative index values")
437438

438439
intv <- (1:length(cf))[x]
@@ -462,8 +463,8 @@ setMethod("indexOf", c("ANY", "CFtime"), function(x, cf, method = "constant") {
462463
#'
463464
#' @description Character representation of the extreme values in the time series
464465
#'
465-
#' @param x An instance of the `CFtime` class
466-
#' @param format Atomic character string with format specifiers, optional
466+
#' @param x An instance of the `CFtime` class.
467+
#' @param format A character string with format specifiers, optional.
467468
#'
468469
#' @returns character. Vector of two character representations of the extremes of the time series.
469470
#' @export
@@ -501,8 +502,8 @@ setMethod("CFrange", "CFtime", function(x, format = "") .ts_extremes(x, format))
501502
#' @export
502503
#' @examples
503504
#' cf <- CFtime("days since 1850-01-01", "julian", 0:364)
504-
#' is.complete(cf)
505-
is.complete <- function(x) {
505+
#' is_complete(cf)
506+
is_complete <- function(x) {
506507
if (!methods::is(x, "CFtime")) stop("Argument must be an instance of CFtime")
507508
if (length(x@offsets) == 0L) NA
508509
else .ts_equidistant(x)
@@ -685,7 +686,7 @@ setMethod("+", c("CFtime", "numeric"), function(e1, e2) {
685686
#' package.
686687
#'
687688
#' @param x CFtime. The time series to operate on.
688-
#' @param format character. Optional atomic character string that specifies
689+
#' @param format character. Optional character string that specifies
689690
#' alternate format.
690691
#'
691692
#' @returns Vector of two character strings that represent the starting and
@@ -698,7 +699,7 @@ setMethod("+", c("CFtime", "numeric"), function(e1, e2) {
698699
.ts_extremes <- function(x, format = "") {
699700
if (length(x@offsets) == 0L) return(c(NA_character_, NA_character_))
700701
if (!missing(format) && ((!is.character(format)) || length(format) != 1))
701-
stop("`format` parameter, when present, must be an atomic string with formatting specifiers")
702+
stop("`format` parameter, when present, must be a character string with formatting specifiers")
702703

703704
time <- .offsets2time(range(x@offsets), x@datum)
704705

man/CFfactor.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/CFrange.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/CFtime-class.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/CFtime-package.Rd

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/CFtime.Rd

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/CFtimestamp.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/cut-CFtime-method.Rd

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/format-CFtime-method.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/is.complete.Rd renamed to man/is_complete.Rd

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/properties.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)