
Standardise meteorological variable names and units for AEME
Source:R/standardise_met.R
standardise_met.RdAttempts to match column names in a meteorological data frame to AEME
standard variable names using guess_aeme_vars(), then detects the
likely input units of each variable from its values and converts to the
units expected by the package.
Arguments
- met
data.frame; meteorological data with a
Datecolumn and one or more meteorological variable columns.- verbose
logical; if
TRUE(default), emitcli_informmessages describing each detected unit conversion applied. Set toFALSEfor quiet operation inside pipelines.- precip_accum
logical; how to interpret
MET_pprain/MET_ppsnowwhen the data is sub-daily.TRUE(default) treats them as the depth accumulated within each step (the ERA5 / AWS convention) and rescales to the mm/day rate the rest of AEME expects;FALSEtakes the values to be a mm/day rate already and leaves them untouched. Ignored for daily data, where the two are identical.- tz
character; Olson timezone in which a naive/character
Datecolumn is expressed. Sub-daily timestamps are converted to UTC; daily data is treated as calendar dates and never shifted. A column that already carries a timezone (including"UTC") is taken at face value here – reinterpreting a"UTC"-tagged column against a declared local zone happens once, upstream, inadd_met/aeme_constructor. Default"UTC";build_aemepasses the object'stime$tz.- longitude
numeric; lake longitude in decimal degrees (east positive). When supplied and the data is sub-daily, the hour at which
MET_radswdpeaks each day is compared against astronomical solar noon for that longitude; a warning is emitted if they differ by more than 3 h, which usually means the timestamps are in local time rather than UTC.NULL(default) skips the check.build_aemepasses the lake longitude.
Value
The input data frame with column names remapped to AEME standard
names and values converted to AEME standard units where a conversion
was necessary. Columns that could not be matched are retained unchanged
with a warning. A warning is also emitted if any required variable
(MET_radswd, MET_tmpair, MET_wndspd,
MET_pprain) is absent after renaming.
AEME standard variables and units
| Variable | Name | Unit | Required |
| Shortwave radiation | MET_radswd | W/m² | Yes |
| Air temperature | MET_tmpair | °C | Yes |
| Wind speed | MET_wndspd | m/s | Yes |
| Rainfall | MET_pprain | mm/day | Yes |
| Snowfall | MET_ppsnow | mm/day | No (defaults to 0) |
| u wind component | MET_wnduvu | m/s | No (derivable) |
| v wind component | MET_wnduvv | m/s | No (derivable) |
| Sea-level pressure | MET_prmslp | Pa | No (derivable) |
| Station pressure | MET_prsttn | Pa | No (derivable) |
| Cloud cover | MET_cldcvr | 1 (fraction) | No (derivable) |
| Longwave radiation | MET_radlwd | W/m² | No (derivable) |
| Dew point temp. | MET_tmpdew | °C | No (derivable) |
| Vapour pressure | MET_prvapr | hPa | No (derivable) |
| Relative humidity | MET_humrel | \ Wind direction | MET_wnddir |