This function allows you to add or modify locality metadata including locality names. See mc_LocalityMetadata. You can import metadata from named list or from data frame. See details.

mc_prep_meta_locality(data, values, param_name = NULL)

Arguments

data

myClim object see myClim-package

values

for localities can be named list or table

  • named list: metadata <- list(locality_id=value); param_name must be set

  • table with column locality_id and another columns named by metadata parameter name; to rename locality use new_locality_id. Parameter param_name must be NULL.

param_name

name of locality metadata parameter; Default names are locality_id, elevation, lat_wgs84, lon_wgs84, tz_offset. Another names are inserted to user_data list. see mc_LocalityMetadata

Value

myClim object in the same format as input, with updated metadata

Details

Locality metadata is critical e.g. for correctly handling time zones. By providing geographic coordinates in locality metadata, the user can later harmonize all data to the local solar time (midday) #' with mc_prep_solar_tz() or calculate temporal offset to the UTC base on local time-zone. Alternatively, the user can directly provide the offset (in minutes) for individual localities. This can be useful especially for heterogeneous data sets containing various localities with loggers recording in local time. By providing temporal offset for #' each locality separately, you can unify the whole dataset to UTC. Note that when tz_offset is set manually, than tz_type is set to user defined.

For minor metadata modification it is practical to use named list in combination with param_name specification. E.g. when you wish to modify only time zone offset, then set param_name="tz_offset" and provide named list with locality name and offset value list(A1E05=60). Similarly, you can modify other metadata slots mc_LocalityMetadata.

For batch or generally more complex metadata modification you can provide data.frame with columns specifying locality_id and one of new_locality_id, elevation, lat_wgs84, lon_wgs84, tz_offset. Provide locality_id (name) and the value in column of metadata you wish to update. In case of using data.frame use param_name = NULL

Examples

data <- mc_prep_meta_locality(mc_data_example_raw, list(A1E05=60), param_name="tz_offset")