Difference between revisions of "Variable Naming Convention"

From HiveTool
Jump to: navigation, search
Line 11: Line 11:
  
 
Data can come from three sources:
 
Data can come from three sources:
 
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 27: Line 26:
 
|}
 
|}
  
Variables that start with hive or ambient are 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, the variable names are not consistent.  precip_today_in is reported in inches, while precip_today_metric is reported in what? Millimeters? No. Centimeters
+
Variables that start with hive or ambient are 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.
 
 
 
 
 
 
  
 
{| class="wikitable"
 
{| class="wikitable"

Revision as of 06:54, 26 December 2014

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 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.

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_c |ambient_humidity |ambient_luminance |ambient_precip_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








$DATE $HIVE_WEIGHT $HIVE_TEMP $HIVE_HUMIDITY $AMBIENT_TEMP $AMBIENT_TEMP $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