NIEHS / beethoven

BEETHOVEN is: Building an Extensible, rEproducible, Test-driven, Harmonized, Open-source, Versioned, ENsemble model for air quality
https://niehs.github.io/beethoven/
Other
5 stars 0 forks source link

Final Model Output Unit Test - Stats Test - SI units #45

Open kyle-messier opened 1 year ago

kyle-messier commented 1 year ago

related to "reasonable mean" - the value should be within the expected for the SI unit. Could also have a field/variable name that specifies the SI units

sigmafelix commented 1 year ago

As briefly discussed in #44 , the inclusion of SI units into field/variable names needs to be considered in relation to other discussion points including:

  1. If we keep the full covariate list with SI units as a RDS file in the package, short names will be fine for the covariate data frame.
  2. We can include a separate slot for metadata inside NetCDF files.
  3. units package, which leverages udunit2 and is usually used with sf, is a good tool to keep units with the covariate values
library(units)
#> udunits database from /Users/songi2/Library/R/arm64/4.3/library/units/share/udunits/udunits2.xml
# length
(distance_km = set_units(15, "km"))
#> 15 [km]
(distance_mi = set_units(distance_km, "mi"))
#> 9.320568 [mi]

# complex units
(thermal_kj = set_units(1e4, "kJ*km^-2"))
#> 10000 [kJ/km^2]
(thermal_calories = set_units(thermal_kj, "kcal*mi^-2"))
#> 6186.08 [kcal/mi^2]

# basically dimensionless; but we can keep this unit with values
(moisture_kgkg = set_units(0.25, "kg*kg^-1"))
#> 0.25 [kg/kg]
is.numeric(moisture_kgkg)
#> [1] TRUE

Created on 2023-09-19 with reprex v2.0.2