Difference between revisions of "NASA weight filter"

From HiveTool
Jump to: navigation, search
(Created page with " if ( $last_weight ) { $delta_weight = $weight - $last_weight; $delta_time = ($time - $last_time)/3600; $delta_rain = $rain - $last_wx_rain; ...")
 
Line 3: Line 3:
 
         $delta_time = ($time - $last_time)/3600;
 
         $delta_time = ($time - $last_time)/3600;
 
         $delta_rain =  $rain - $last_wx_rain;
 
         $delta_rain =  $rain - $last_wx_rain;
 
+
       
 
         if ($delta_time) { $dwdt = $delta_weight/$delta_time; }
 
         if ($delta_time) { $dwdt = $delta_weight/$delta_time; }
 
+
       
# Begin NASA manipulation change filter
+
                                                                # Begin NASA manipulation change filter
 
 
 
         if ( ($weight_filter eq "NASA")  
 
         if ( ($weight_filter eq "NASA")  
           && (abs $dwdt > $max_dwdt_lbs_per_hour)             # if the change in weight exceeds the threshold
+
           && (abs $dwdt > $max_dwdt_lbs_per_hour)               # if the change in weight exceeds the threshold
           && ($start_zero_weight == 0)                       # and the data is not starting off with zeros
+
           && ($start_zero_weight == 0)                         # and the data is not starting off with zeros
           && ($quality != 6) )                               # and this record is not flagged as a swarm (Quality 6)
+
           && ($quality != 6) )                                 # and this record is not flagged as a swarm (Quality 6)
             {                                                 # then don't count the change as daily change,
+
             {                                                   # then don't count the change as daily change,
             $manipulation_change +=  $delta_weight;           # count it as manipulation change
+
             $manipulation_change +=  $delta_weight;             # count it as manipulation change
 
             }
 
             }
 
         else
 
         else
 
             {
 
             {
             $daily_change += $delta_weight;                   # otherwise, count it as part of the daily change
+
             $daily_change += $delta_weight;                     # otherwise, count it as part of the daily change
 
             }
 
             }
 
 
         }
 
         }
         else {                                               #first time through
+
         else {                                                 #first time through
 
               $daily_change = $weight;
 
               $daily_change = $weight;
 
               $first_graph_date = $row[0];
 
               $first_graph_date = $row[0];
#              $last_ambient = $ambient;
 
 
               $last_wx_rain = $row[10];
 
               $last_wx_rain = $row[10];
 
               $delta_rain = 0;
 
               $delta_rain = 0;
 
         }
 
         }
 
 
         $last_weight = $weight;
 
         $last_weight = $weight;
         $weight = $daily_change;
+
         $weight = $daily_change;  
 
+
                                                                  # end NASA filter
# end NASA filter
 
 
 
 
         $last_temperature = $temperature;
 
         $last_temperature = $temperature;
 
#          $abs_ambient = abs( $ambient - $last_ambient);
 
#          if ( $abs_ambient < $ambient_filter_threshold || $ambient_raw  )  { 
 
#                $last_ambient = $ambient;
 
#                }
 
#          else { $ambient = $last_ambient; }        # *1.8+32;
 
 
 
         $last_time = $time;
 
         $last_time = $time;

Revision as of 18:00, 29 November 2014

     if ( $last_weight ) {
        $delta_weight = $weight - $last_weight;
        $delta_time = ($time - $last_time)/3600;
        $delta_rain =  $rain - $last_wx_rain;
        
        if ($delta_time) { $dwdt = $delta_weight/$delta_time; }
        
                                                                # Begin NASA manipulation change filter
        if ( ($weight_filter eq "NASA") 
          && (abs $dwdt > $max_dwdt_lbs_per_hour)               # if the change in weight exceeds the threshold
          && ($start_zero_weight == 0)                          # and the data is not starting off with zeros
          && ($quality != 6) )                                  # and this record is not flagged as a swarm (Quality 6)
           {                                                    # then don't count the change as daily change,
           $manipulation_change +=  $delta_weight;              # count it as manipulation change
           }
        else
           {
           $daily_change += $delta_weight;                      # otherwise, count it as part of the daily change
           }
        }
        else {                                                  #first time through
             $daily_change = $weight;
             $first_graph_date = $row[0];
             $last_wx_rain = $row[10];
             $delta_rain = 0;
        }
        $last_weight = $weight;
        $weight = $daily_change; 
                                                                 # end NASA filter
        $last_temperature = $temperature;
        $last_time = $time;