Difference between revisions of "Variable Naming Convention"

From HiveTool
Jump to: navigation, search
 
Line 1: Line 1:
 +
If you wish to dig in to the code, you might want to start with the Variable Naming Convention guide.
 +
 
The general philosophy is to  capture the data in native units of the sensor.
 
The general philosophy is to  capture the data in native units of the sensor.
  

Latest revision as of 02:26, 28 December 2014

If you wish to dig in to the code, you might want to start with the Variable Naming Convention guide.

The general philosophy is to capture the data in native units of the sensor.

Variable names have three parts that describe the source of the data, type of sensor (what is being measured), and the native calibration units of the sensor, separated by the underscore ( _ ) character: source_type_units. Conversion to other units (e.g. Celsius to Fahrenheit) is done at the database level.

Examples:
hive_weight_lbs
hive_weight_kgs
hive_temp_c
ambient_temp_c
wx_temp_f

Data can come from three sources:

Source Prefix
The Hive hive
Around the Hive ambient
Weather Station wx

Variables that start with hive or ambient are from sensors read by the hive computer. Sensors that are part of another system, such as a Personal Weather Station, start with wx, even if the PWS is located at the hive. The PWS variable names are the same as Weather Underground's XML download. Unfortunately, Weather Underground's variable names are not consistent. precip_today_in is reported in inches, while precip_today_metric is reported in what? Millimeters? No. Centimeters. (To be consistent, this should have been precip_today_cm.)

-
Bash Scripts XML tag Database column Perl variable
$DATE <hive_observation_time_local> hive_observation_time_local $date
$HIVE_WEIGHT <hive_weight_lbs> hive_weight_lbs $hive_weight
$HIVE_TEMP <hive_temp_c> hive_temp_c $hive_temp_c
$HIVE_HUMIDITY <hive_humidity> hive_humidity $hive_humidity
$AMBIENT_TEMP <ambient_temp_c> ambient_temp_c $ambient_temp_c
$AMBIENT_HUMIDITY <ambient_humidity> ambient_humidity $ambient_humidity
$AMBIENT_LUMINANCE <ambient_luminance> ambient_luminance $ambient_luminance
$AMBIENT_PRECIP <ambient_precip_in> ambient_precip_in $ambient_precip_in
$WX_TEMP_F
$WX_WIND_DEGREES
$WX_WIND_MPH

$WX_WIND_GUST_MHP $WX_DEWPOINT_F $WX_RELATIVE_HUMIDITY $WX_PRESSURE_MB $WX_PRECIP_TODAY_IN


| | |wx_station_id |wx_observation_time_rfc822 |wx_temp_f |wx_temp_c |wx_relative_humidity |wx_wind_dir |wx_wind_degrees |wx_wind_mph |wx_wind_gust_mph |wx_pressure_mb |wx_pressure_in |wx_dewpoint_f |wx_dewpoint_c |wx_solar_radiation |wx_precip_1hr_in |wx_precip_1hr_metric |wx_precip_today_in |wx_precip_today_metric |quality