Difference between revisions of "Robin subwindow density/quality calculations"

From ecology
Jump to: navigation, search
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
The ROBIN_CORRECTED_DENSITY and ROBIN_CORRECTED_QUALITY are calculated according to the following function :
  
Calculate density and quality parameter based on measurement conditions, i.e. influence of Robin
 
algoritme. Robin-algoritme is influencing density calculations when (1) bird density is high
 
(rain mask is removing birds), (2) birds fly in large flocks (rain mask is removing birds).
 
Rules have been designed and tested for Wier, Milligen and Glons to overcome the above problems
 
The quality parameter is decreasing from 1 (optimal functionality) to 0 (no radar video)
 
  
* land_cl_perc      Percentage landclutter in image
 
* rain_cl_perc      Percentage rainclutter in image
 
* total_mass_density Total mass per window before Robin processing
 
* land_mass_density  Total mass per window within the land clutter mask
 
* bird_echo_density  Calculated bird density per km2, taking measurement area into account (% clutter)
 
* echo_mass          Mean mass per bird echo (re-scaled number is bird_mass_density / bird_echo_density if bird_echo_density  > 0 and 0 otherwise)
 
* nr_of_tracks      Number of tracks in the whole image
 
* land_clutter_mode  Type of landclutter filtering
 
* radar_name       
 
* beam_name
 
* window            Name of selected subwindow
 
  
Normal clutter in a subwindow is assumed to be zero. This is not always true and is the reason
+
  sub Quantify_ROBIN
why rules are not appicable to all subwindows without modification. Therefore modus of standard clutter percentage is added for each subwindow to default clutPerc
+
  {
 
+
                NW      SE
+
    my ($whole_window, $sub_window, $correction_level, $radar_name, $beam_name, $window, $log) = @_;
GLONS_B1      15.05%  18.65%
+
    my $ROB_density = 0;
GLONS_B2        1.28%   5.33%
+
    my $ROB_quality = 0;
  RPN_B1          0.06%   0.07%
+
    my $ROB_cor_level = undef;
  RPN_B2          0.00%   0.00%
+
    my $ClutPerc = 25;
MIL_B1          0.00%   0.00%
+
MIL_B2          0.00%   0.00%
+
    my ($radar) = $radar_name =~ /RP-(\w{3})/;
 +
    my ($beam) = $beam_name =~ /BEAM_(\d+)/;
 +
    $beam = 'B' . $beam;
 +
    my $key = $radar . '_' . $beam . '_' . $window;
 +
   
 +
    my %DEFAULT_VALUES = (
 +
    GLO_B1_SE => { cthresh        => 1864,
 +
                  defReflectivity => 3033,
 +
                  defClut        => 18.65,
 +
                  CP              => 15
 +
                },
 +
    GLO_B1_NW => { cthresh        => 1864,
 +
                  defReflectivity => 901,
 +
                  defClut        => 15.05,
 +
                  CP              => 15
 +
                },
 +
    GLO_B2_SE => { cthresh        => 1804,
 +
                  defReflectivity => 527,
 +
                  defClut        => 3.33,
 +
                  CP              => 15
 +
                },
 +
    GLO_B2_NW => { cthresh        => 1804,
 +
                  defReflectivity => 44,
 +
                  defClut        => 1.28,
 +
                  CP              => 15
 +
                },
 +
 +
    WIE_B1_SE => { cthresh        => 310,
 +
                  defReflectivity => 0,
 +
                  defClut        => 0,
 +
                  CP              => 15
 +
                },
 +
    WIE_B1_NW => { cthresh        => 310,
 +
                  defReflectivity => 0,
 +
                  defClut        => 0,
 +
                  CP              => 15
 +
                },
 +
    WIE_B2_SE => { cthresh        => 594,
 +
                  defReflectivity => 0,
 +
                  defClut        => 0,
 +
                  CP              => 15
 +
                },
 +
    WIE_B2_NW => { cthresh        => 594,
 +
                  defReflectivity => 0,
 +
                  defClut        => 0,
 +
                  CP              => 15
 +
                },
 +
   );
 +
   
 +
  my $cthresh        = 0;
 +
  my $defReflectivity = 0;
 +
  my $defClut        = 0;
 +
  my $CP              = 0;
 +
 +
  if(exists($DEFAULT_VALUES{$key})) {
 +
    $cthresh        = $DEFAULT_VALUES{$key}->{cthresh};
 +
    $defReflectivity = $DEFAULT_VALUES{$key}->{defReflectivity};
 +
    $defClut        = $DEFAULT_VALUES{$key}->{defClut};
 +
    $CP              = $DEFAULT_VALUES{$key}->{CP};
 +
  }
 +
 +
  # Calculate echo mass. If subwindow is saturated, echo_mass is extracted
 +
   # from the whole window (radar.subwindow_result.subwindow_id = 0).
 +
 
 +
  my $echo_mass;
 +
  if($sub_window->{bird_echo_density} > 0) {
 +
    $echo_mass = $sub_window->{bird_mass_density} / $sub_window->{bird_echo_density};
 +
  } elsif($whole_window->{bird_echo_density} > 0) {
 +
    $echo_mass = $whole_window->{bird_mass_density} / $whole_window->{bird_echo_density};
 +
  } else {
 +
    $echo_mass = 400;
 +
  }
 +
   
 +
  # Calculate adjusted density (#/km²), quality parameter (0..1) and
 +
  # correction level for peak adjustments (1..3)
 +
  if ($whole_window->{total_mass_density} < 10 and
 +
      $whole_window->{land_cl_perc} == 0 and
 +
      $whole_window->{n} == 0)  {
 +
    # No data in image: total_mass<10, land_cl_perc=0, n=0
 +
    $ROB_density = undef;
 +
    $ROB_quality = 0;
 +
  } elsif($sub_window->{rain_cl_perc} == 100 and $sub_window->{land_cl_perc} == 100) {
 +
    $ROB_density = undef;
 +
    $ROB_quality = 0;
 +
  } elsif($correction_level > $cthresh) { # S/N ratio is above threshold, measurement removed
 +
    $ROB_density = undef;
 +
    $ROB_quality = 0;
 +
  } elsif ($sub_window->{rain_cl_perc} > 90 and
 +
          ($sub_window->{rain_cl_perc}-$sub_window->{land_cl_perc}) >= $CP and $echo_mass > 0) {
 +
    $ROB_density = ($sub_window->{total_mass_density} - $defReflectivity) / $echo_mass;
 +
    $ROB_quality = sqrt( (100 - $sub_window->{land_cl_perc}) / (100 - $defClut) );
 +
    $ROB_cor_level = 3;
 +
   } elsif ($sub_window->{rain_cl_perc}-$sub_window->{land_cl_perc} >= ($ClutPerc - $defClut) * 1.5 and $echo_mass > 0) {
 +
    $ROB_quality = (100 - $sub_window->{land_cl_perc}) / (100 - $defClut);
 +
    $ROB_density = ($sub_window->{total_mass_density} - $sub_window->{land_mass_density}) / $echo_mass;
 +
    if($ROB_quality > 0.8) {
 +
      $ROB_cor_level = 1;
 +
    } elsif($ROB_quality > 0.5) {
 +
      $ROB_cor_level = 2;
 +
    }
 +
   } elsif ($sub_window->{bird_echo_density} > 0.05 and $echo_mass > 800) {
 +
    $ROB_quality = sqrt((100 - $sub_window->{rain_cl_perc}) / (100 - $defClut));
 +
    $ROB_density = ($sub_window->{total_mass_density} - $sub_window->{land_mass_density}) / $echo_mass;
 +
    if($ROB_quality > 0.8) {
 +
      $ROB_cor_level = 1;
 +
    } elsif($ROB_quality > 0.5) {
 +
      $ROB_cor_level = 2;
 +
    }
 +
   } else {
 +
    $ROB_quality = sqrt((100 - $sub_window->{land_cl_perc}) / (100 - $defClut));
 +
    $ROB_density = $sub_window->{bird_echo_density};
 +
    if($ROB_quality > 0.8) {
 +
      $ROB_cor_level = 1;
 +
    } elsif($ROB_quality > 0.5) {
 +
      $ROB_cor_level = 2;
 +
    }
 +
  }
 +
  return ( $ROB_density, $ROB_quality, $ROB_cor_level);
 +
  }

Latest revision as of 11:15, 24 June 2009

The ROBIN_CORRECTED_DENSITY and ROBIN_CORRECTED_QUALITY are calculated according to the following function :


 sub Quantify_ROBIN
 {

   my ($whole_window, $sub_window, $correction_level, $radar_name, $beam_name, $window, $log) = @_;
   my $ROB_density = 0;
   my $ROB_quality = 0;
   my $ROB_cor_level = undef;
   my $ClutPerc = 25;

   my ($radar) = $radar_name =~ /RP-(\w{3})/;
   my ($beam) = $beam_name =~ /BEAM_(\d+)/; 
   $beam = 'B' . $beam;
   my $key = $radar . '_' . $beam . '_' . $window;

   my %DEFAULT_VALUES = (
   GLO_B1_SE => { cthresh         => 1864,
                  defReflectivity => 3033,
                  defClut         => 18.65,
                  CP              => 15
                },
   GLO_B1_NW => { cthresh         => 1864,
                  defReflectivity => 901,
                  defClut         => 15.05,
                  CP              => 15
                },
   GLO_B2_SE => { cthresh         => 1804,
                  defReflectivity => 527,
                  defClut         => 3.33,
                  CP              => 15
                },
   GLO_B2_NW => { cthresh         => 1804,
                  defReflectivity => 44,
                  defClut         => 1.28,
                  CP              => 15
                },

   WIE_B1_SE => { cthresh         => 310,
                  defReflectivity => 0,
                  defClut         => 0,
                  CP              => 15
                },
   WIE_B1_NW => { cthresh         => 310,
                  defReflectivity => 0,
                  defClut         => 0,
                  CP              => 15
                },
   WIE_B2_SE => { cthresh         => 594,
                  defReflectivity => 0,
                  defClut         => 0,
                  CP              => 15
                },
   WIE_B2_NW => { cthresh         => 594,
                  defReflectivity => 0,
                  defClut         => 0,
                  CP              => 15
                },
 );

 my $cthresh         = 0;
 my $defReflectivity = 0;
 my $defClut         = 0;
 my $CP              = 0;

 if(exists($DEFAULT_VALUES{$key})) {
   $cthresh         = $DEFAULT_VALUES{$key}->{cthresh};
   $defReflectivity = $DEFAULT_VALUES{$key}->{defReflectivity};
   $defClut         = $DEFAULT_VALUES{$key}->{defClut};
   $CP              = $DEFAULT_VALUES{$key}->{CP};
 }

 # Calculate echo mass. If subwindow is saturated, echo_mass is extracted 
 # from the whole window (radar.subwindow_result.subwindow_id = 0).
  
 my $echo_mass;
 if($sub_window->{bird_echo_density} > 0) {
   $echo_mass = $sub_window->{bird_mass_density} / $sub_window->{bird_echo_density};
 } elsif($whole_window->{bird_echo_density} > 0) {
   $echo_mass = $whole_window->{bird_mass_density} / $whole_window->{bird_echo_density};
 } else {
   $echo_mass = 400;
 }

 # Calculate adjusted density (#/km²), quality parameter (0..1) and 
 # correction level for peak adjustments (1..3)
 if ($whole_window->{total_mass_density} < 10 and 
     $whole_window->{land_cl_perc} == 0 and 
     $whole_window->{n} == 0)  {
   # No data in image: total_mass<10, land_cl_perc=0, n=0
   $ROB_density = undef;
   $ROB_quality = 0;
 } elsif($sub_window->{rain_cl_perc} == 100 and $sub_window->{land_cl_perc} == 100) {
   $ROB_density = undef;
   $ROB_quality = 0;
 } elsif($correction_level > $cthresh) { # S/N ratio is above threshold, measurement removed
   $ROB_density = undef;
   $ROB_quality = 0;
 } elsif ($sub_window->{rain_cl_perc} > 90 and 
          ($sub_window->{rain_cl_perc}-$sub_window->{land_cl_perc}) >= $CP and $echo_mass > 0) {
   $ROB_density = ($sub_window->{total_mass_density} - $defReflectivity) / $echo_mass;
   $ROB_quality = sqrt( (100 - $sub_window->{land_cl_perc}) / (100 - $defClut) );
   $ROB_cor_level = 3;
 } elsif ($sub_window->{rain_cl_perc}-$sub_window->{land_cl_perc} >= ($ClutPerc - $defClut) * 1.5 and $echo_mass > 0) {
   $ROB_quality = (100 - $sub_window->{land_cl_perc}) / (100 - $defClut);
   $ROB_density = ($sub_window->{total_mass_density} - $sub_window->{land_mass_density}) / $echo_mass;
   if($ROB_quality > 0.8) {
     $ROB_cor_level = 1;
   } elsif($ROB_quality > 0.5) {
     $ROB_cor_level = 2;
   }
 } elsif ($sub_window->{bird_echo_density} > 0.05 and $echo_mass > 800) {
   $ROB_quality = sqrt((100 - $sub_window->{rain_cl_perc}) / (100 - $defClut));
   $ROB_density = ($sub_window->{total_mass_density} - $sub_window->{land_mass_density}) / $echo_mass;
   if($ROB_quality > 0.8) {
     $ROB_cor_level = 1;
   } elsif($ROB_quality > 0.5) {
     $ROB_cor_level = 2;
   }
 } else {
   $ROB_quality = sqrt((100 - $sub_window->{land_cl_perc}) / (100 - $defClut));
   $ROB_density = $sub_window->{bird_echo_density};
   if($ROB_quality > 0.8) {
     $ROB_cor_level = 1;
   } elsif($ROB_quality > 0.5) {
     $ROB_cor_level = 2;
   }
 }
 return ( $ROB_density, $ROB_quality, $ROB_cor_level);
 }