Robin subwindow density/quality calculations

From ecology
Revision as of 13:01, 9 May 2008 by Bart (talk | contribs)
Jump to: navigation, search

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


Function NewDensity(denQual, land_cl_perc, rain_cl_perc, total_mass_density, land_mass_density,  bird_echo_density, echo_mass, nr_of_tracks, land_clutter_mode, window)
'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)
'denQual            Parse through density (denQual = 0) or quality parameter (denQual = 1)
'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 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
'window             Name of selected subwindow
'Normal clutter in a subwindow is assumed to be zero. This is not always true and is the reason
'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
'GLONS_B1       15.05%  18.65%
'GLONS_B2        1.28%   5.33%
'RPN_B1          0.06%   0.07%
'RPN_B2          0.00%   0.00%
'MIL_B1          0.00%   0.00%
'MIL_B2          0.00%   0.00%
  
clutPerc = 25       'Clutter percentage threshold for bird_density calculation
defClut = 0         'Default clutter percentage
contentC = 1        'Quality parameter for radar data availability (0 if no data)
highBDC = 1         'Quality parameter for high bird density correction
largeFlockC = 1     'Quality parameter for large flocks
maxBDC = 1          'Quality parameter for high bird density, but image is saturated (no   bird_echo_density calculated)
defC = 1            'Quality parameter in standard situations, but land_cl_perc reduces value
   If (window = "GLONS_B1_SE-window") Then
       defClut = 18.65
   ElseIf (window = "GLONS_B1_NW-window") Then
       defClut = 15.05
   ElseIf (window = "GLONS_B2_SE-window") Then
       defClut = 5.33
   ElseIf (window = "GLONS_B2_NW-window") Then
       defClut = 1.28
   End If
   clutPerc = clutPerc + defClut
  
  
   If total_mass_density < 10 And land_cl_perc = 0 And nr_of_tracks = 0 Then
       'Image does exist, but no data, density is NOT calculated, quality parameter set to zero
       contentC = 0
   ElseIf (land_clutter_mode = "ALWAYS_OFF") Then
       'During long period of time land_clutter_mode was set to "ALWAYS_OFF" in Milligen B2 image.
       'Therefore landclutter mask is not calculated. But, the following rules do expect a landclutter mask!
       'Since quality check and calculation of expected density could not be performed, these
       'measurements are expected as Robin-algoritme works well and quality parameter is OK
       NewDensity = bird_echo_density
   ElseIf (land_cl_perc < clutPerc And bird_echo_density > 1) Then
       'High bird densities are partly masked as rain. New density is calculated expecting total_mass_density
       'are all birds, except for that part marked as landclutter. Quality parameter is decreasing, see function
       NewDensity = (total_mass_density - land_mass_density) / echo_mass
       highBDC = (100 - land_cl_perc) / (100 - defClut)
   ElseIf (land_cl_perc < clutPerc And rain_cl_perc > 99 And nr_or_tracks > 0) Then
       'Under exceptional situations all birds are masked as rain and can only be recalculated
       'using expected echo_masses. Since these situations only occur during the night the mean echo_mass
       'was calculated from historic data (1-15 nov 2007: RPN (mainly night), B1: 553; B2: 413,
       'MIL (only day), B1: 676, B2: 676. Therefore for the moment a value of 500 is used for mean echo_mass
       NewDensity = (total_mass_density - land_mass_density) / 500
       maxBDC = ((100 - land_cl_perc) / (100 - defClut)) ^ 2 'Same method as highBDC, but by taking square quality-param lowered
  ElseIf (rain_cl_perc > 90 And (rain_cl_perc - land_cl_perc) > clutPerc * 1.5 And bird_echo_density > 0) Then
       'Special cases as above, with higher land_cl_percentages. Also these images are probably birds,
       'but the quality parameter is decreasing stronger
       NewDensity = (total_mass_density - land_mass_density) / echo_mass
       maxBDC = ((100 - land_cl_perc) / (100 - defClut)) ^ 2 'Same method as highBDC, but by taking square quality-param lowered
  ElseIf (land_cl_perc < clutPerc And bird_echo_density > 0.25 And echo_mass > 800) Then
       'Large bird echoes are wrongly marked as rain by the ROBIN rain_mask algoritme. Correction of density
       'according 'high bird density rule'. Quality parameter is decreasing due to rain_clutter_percentage.
       NewDensity = (total_mass_density - land_mass_density) / echo_mass
       largeFlockC = Sqr((100 - rain_cl_perc) / (100 - defClut))  'Rain is removing echo's, therefore this should be in quality param
  Else
      'Everything seems OK, bird_echo_density is taken and quality parameter is set as square root of clutter percentage.
      NewDensity = bird_echo_density
      defC = Sqr((100 - land_cl_perc) / (100 - defClut))
  End If
  If denQual = 1 Then
      'Quality parameter is passed through
      NewDensity = contentC * highBDC * largeFlockC * maxBDC * defC
  End If
End Function