Description Usage Arguments Value NOTES Examples
This function creates a climindvis object needed as input for all other functions of the package. The function performs several checks on the data and formats the data as it is needed by the other functions. For the different data types, see the parameter description below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
tmin |
Daily minimum temperature data in degrees C (see NOTES) |
tmax |
Daily maximum temperature data in degrees C (see NOTES) |
prec |
Daily total precipitation data in mm (see NOTES) |
tavg |
Daily average temperature data in degrees C (see NOTES) |
dates_tmin |
Dates for the daily minimum temperature data (see NOTES) |
dates_tmax |
Dates for the daily maximum temperature data (see NOTES) |
dates_prec |
Dates for the daily precipitation data (see NOTES) |
dates_tavg |
Dates for the daily average temperature data (see NOTES) |
lon |
Longitudes of input data (1 or 2dim array) |
lat |
Latitudes of input data (1 or 2dim array) |
data_range |
Vector with start and end year of calculation period (optional). If supplied, all data is cut to this period. If missing, a period from the earliest until the last date value is defined. |
data_info |
List of data-specific information with the following elements:
|
The function returns a climindvis object with the following entries:
data: Named list containing an array of data (tmin/tmax/prec/tavg) of dimension: spatial dimensions x (ensemble dimensions) x no of timesteps
time: Array of timesteps which are common for all input data.
lon: Array of longitudes common for all input data. For gridded data, longitudes need to be in ascending order.
lat: Array of latitudes common for all input data. For gridded data, latitudes need to be in ascending order.
data_info: data_info as assed to function.
time_factors: time factors used for calculation of temporal aggregation of indices.
mask: (only for gridded data) list containing a mask for each variable with mask=1 for gridpoints where all time steps are NA
The data input is an array where the dimensions depend on the type of data. Generally there are two possible ways to provide the data depending on the date_format. Currently, for hindcasts and forecasts, date_format has to be "t2d":
time series: In this case date_format="t1d" and the dimensions of the data are:
spatial dimensions x ensemble dimension (optional, applies to hindcasts or forecasts) x time
where time is a 1d array (but the time series does not have to be continous and gaps are allowed).
If providing data for a single station, it is a matrix with two dimensions; one for the station (the ensemble dimension in case of hindcasts/forecasts) and one for the time.
time slices: In this case date_format="t2d" and the dimensions of the data are:
#' spatial dimensions x ensemble dimension (optional, applies to hindcasts or forecasts) x forecast days x forecast years
and time is a named list of length years with each list element containing the dates for one time slice, the names of the list elements correspond to the year of the first entry of the time slice.
In case of forecast data, the array should have the last dimension as year dimension of length one (if the year dimension is missing it is set to one).
For date_format="t2d", all variables need to have the same time steps, i.e. dates_xxx need to be equal for all variables.
At least one of the 4 variables (and the respective dates) must be provided, otherwise the function gives an error.
For example data and example objects see example_data
example_climindvis_objects
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | # make climindvis object with station data
data(data_st)
data_info = list(type="p",date_format="t1d", data_name="test data station",
pnames=paste0("station",1:4))
climindvis_st <- make_object(
tmin = data_st$tmin, tmax = data_st$tmax, tavg = data_st$tvag, prec = data_st$prec,
dates_tmin = data_st$time, dates_tmax = data_st$time, dates_tavg = data_st$time, dates_prec = data_st$time,
lon = data_st$lon, lat = data_st$lat, data_info = data_info, data_range=c(1950,2000))
class(climindvis_st)
# make climindvis object with gridded data
data(data_grid)
data_info=list(type="grid",date_format="t1d", data_name="test data grid")
climindvis_grid <- make_object(
tmin = data_grid$tmin,tmax = data_grid$tmax, prec = data_grid$prec,
dates_tmin = data_grid$time, dates_tmax = data_grid$time, dates_prec = data_grid$time,
lon = data_grid$lon, lat = data_grid$lat, data_info = data_info)
class(climindvis_grid)
# make climindvis object with gridded hindcast data
data(data_hc_grid)
data_info=list(type="grid_hc",date_format="t2d", data_name="test data hc grid",fmon = "01")
climindvis_grid_hc <- make_object(
tmin = data_hc_grid$tmin, tmax = data_hc_grid$tmax, prec = data_hc_grid$prec,
dates_tmin = data_hc_grid$time, dates_tmax = data_hc_grid$time, dates_prec = data_hc_grid$time,
lon = data_hc_grid$lon, lat = data_hc_grid$lat, data_info = data_info)
class(climindvis_grid_hc)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.