Difference between revisions of "Robin subwindow density/quality calculations"
From ecology
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
− | The ROBIN_CORRECTED_DENSITY and ROBIN_CORRECTED_QUALITY are | + | 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 | |
− | + | }, | |
− | defClut | + | 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); }