Exemplo n.º 1
0
 def _classify_ocean(self, options):
     opt = options.ocean
     parameter = self._classifier
     ocean = ANDCondition()
     # Ice Concentration
     ocean.add(parameter.sic < opt.ice_concentration_min)
     # Done, add flag
     self._surface_type.add_flag(ocean.flag, "ocean")
Exemplo n.º 2
0
 def _classify_ocean(self, options):
     """ Ocean classification based on sea ice concentration only
     since land will be excluded anyway """
     opt = options.ocean
     parameter = self._classifier
     ocean = ANDCondition()
     # Ice Concentration
     ocean.add(parameter.sic < opt.ice_concentration_min)
     # Done, add flag
     self._surface_type.add_flag(ocean.flag, "ocean")
Exemplo n.º 3
0
 def _classify_sea_ice(self, options):
     opt = options.sea_ice
     parameter = self._classifier
     ice = ANDCondition()
     # Mandatory radar mode flag
     ice.add(self._is_radar_mode)
     # Stack (Beam) parameters
     ice.add(parameter.peakiness_r <= opt.peakiness_r_max)
     ice.add(parameter.peakiness_l <= opt.peakiness_l_max)
     ice.add(parameter.peakiness <= opt.peakiness_max)
     ice.add(parameter.stack_kurtosis < opt.stack_kurtosis_max)
     # Ice Concentration
     ice.add(parameter.sic > opt.ice_concentration_min)
     # Done, add flag
     self._surface_type.add_flag(ice.flag, "sea_ice")
Exemplo n.º 4
0
 def _transfer_waveform_collection(self):
     """ Transfers the waveform data (power & range for each range bin) """
     from pysiral.flag import ANDCondition
     # Transfer the reformed 18Hz waveforms
     self.l1b.waveform.set_waveform_data(self.sgdr.mds_18hz.power,
                                         self.sgdr.mds_18hz.range,
                                         self.sgdr.radar_mode)
     # This is from SICCI-1 processor, check of mcd flags
     valid = ANDCondition()
     valid.add(np.logical_not(self.sgdr.mds_18hz.flag_packet_length_error))
     valid.add(np.logical_not(self.sgdr.mds_18hz.flag_obdh_invalid))
     valid.add(np.logical_not(self.sgdr.mds_18hz.flag_agc_fault))
     valid.add(np.logical_not(self.sgdr.mds_18hz.flag_rx_delay_fault))
     valid.add(np.logical_not(self.sgdr.mds_18hz.flag_waveform_fault))
     # ku_chirp_band_id (0 -> 320Mhz)
     valid.add(self.sgdr.mds_18hz.ku_chirp_band_id == 0)
     self.l1b.waveform.set_valid_flag(valid.flag)
Exemplo n.º 5
0
 def _classify_ocean(self, options):
     opt = options.ocean
     parameter = self._classifier
     ocean = ANDCondition()
     # Mandatory radar mode flag
     ocean.add(self._is_radar_mode)
     # Peakiness Thresholds
     ocean.add(parameter.peakiness >= opt.peakiness_min)
     ocean.add(parameter.peakiness <= opt.peakiness_max)
     # Stack Standard Deviation
     ssd_threshold = opt.stack_standard_deviation_min
     ocean.add(parameter.stack_standard_deviation >= ssd_threshold)
     # Ice Concentration
     ocean.add(parameter.sic < opt.ice_concentration_min)
     # OCOG Width
     ocean.add(parameter.ocog_width >= opt.ocog_width_min)
     # Done, add flag
     self._surface_type.add_flag(ocean.flag, "ocean")
Exemplo n.º 6
0
    def _classify_sea_ice(self, options):
        """
        Classify waveforms as sea ice
        :param options: The option attribute dictionary
        :return:
        """

        # Pointer
        opt = options.sea_ice
        month_num = self._month
        parameter = self._classifier

        # All conditions must be fulfilled
        ice = ANDCondition()

        # Mandatory radar mode flag
        ice.add(self._is_radar_mode)

        # Sigma0
        sea_ice_backscatter_min = self.get_threshold_value(
            opt, "sea_ice_backscatter_min", month_num)
        sea_ice_backscatter_max = self.get_threshold_value(
            opt, "sea_ice_backscatter_max", month_num)
        ice.add(parameter.sigma0 >= sea_ice_backscatter_min)
        ice.add(parameter.sigma0 <= sea_ice_backscatter_max)

        # Leading Edge Width
        leading_edge_width_min = self.get_threshold_value(
            opt, "leading_edge_width_min", month_num)
        leading_edge_width = parameter.leading_edge_width_first_half + parameter.leading_edge_width_second_half
        ice.add(leading_edge_width >= leading_edge_width_min)

        # Pulse Peakiness
        peakiness_max = self.get_threshold_value(opt, "peakiness_max",
                                                 month_num)
        ice.add(parameter.peakiness <= peakiness_max)

        # Ice Concentration
        ice_concentration_min = self.get_threshold_value(
            opt, "ice_concentration_min", month_num)
        ice.add(parameter.sic > ice_concentration_min)

        # Done, add flag
        self._surface_type.add_flag(ice.flag, "sea_ice")
Exemplo n.º 7
0
    def _classify_leads(self, options):
        """
        Classify leads in sea ice
        :param options:
        :return:
        """

        # Pointer
        opt = options.lead
        month_num = self._month
        parameter = self._classifier

        # All conditions must be fulfilled
        lead = ANDCondition()

        # Mandatory radar mode flag
        lead.add(self._is_radar_mode)

        # Sigma0
        sea_ice_backscatter_min = self.get_threshold_value(
            opt, "sea_ice_backscatter_min", month_num)
        lead.add(parameter.sigma0 >= sea_ice_backscatter_min)

        # Leading Edge Width
        leading_edge_width_max = self.get_threshold_value(
            opt, "leading_edge_width_max", month_num)
        leading_edge_width = parameter.leading_edge_width_first_half + parameter.leading_edge_width_second_half
        lead.add(leading_edge_width <= leading_edge_width_max)

        # Pulse Peakiness
        peakiness_min = self.get_threshold_value(opt, "leading_edge_width_max",
                                                 month_num)
        lead.add(parameter.peakiness >= peakiness_min)

        # Ice Concentration
        ice_concentration_min = self.get_threshold_value(
            opt, "ice_concentration_min", month_num)
        lead.add(parameter.sic > ice_concentration_min)

        # Done, add flag
        self._surface_type.add_flag(lead.flag, "lead")
Exemplo n.º 8
0
 def _classify_leads(self, options):
     opt = options.lead
     parameter = self._classifier
     lead = ANDCondition()
     # Mandatory radar mode flag
     lead.add(self._is_radar_mode)
     # Reflectivity
     lead.add(parameter.reflectivity <= opt.reflectivity_max)
     # Echo Gain
     lead.add(parameter.echo_gain <= opt.echo_gain_max)
     lead.add(parameter.echo_gain >= opt.echo_gain_min)
     #         lead.add(parameter.echo_gain >= 150.)
     # Ice Concentration
     lead.add(parameter.sic > opt.ice_concentration_min)
     # Done, add flag
     self._surface_type.add_flag(lead.flag, "lead")
Exemplo n.º 9
0
    def _classify_leads(self, options):

        opt = options.lead
        parameter = self._classifier
        lead = ANDCondition()

        # Mandatory radar mode flag
        lead.add(self._is_radar_mode)

        # Check for monthly thresholds and pick index
        if type(opt.sea_ice_backscatter_min) is list:
            index = self._month - 1
            n = len(opt.sea_ice_backscatter_min)
        else:
            n = 1
            index = 0

        # Sigma0
        sea_ice_backscatter_min = np.full(n, opt.sea_ice_backscatter_min)
        lead.add(parameter.sigma0 >= sea_ice_backscatter_min[index])

        # Leading Edge Width
        leading_edge_width_max = np.full(n, opt.leading_edge_width_max)
        leading_edge_width = parameter.leading_edge_width_first_half + \
            parameter.leading_edge_width_second_half
        lead.add(leading_edge_width <= leading_edge_width_max[index])

        # Pulse Peakiness
        peakiness_min = np.full(n, opt.peakiness_min)
        lead.add(parameter.peakiness >= peakiness_min[index])

        # Ice Concentration
        lead.add(parameter.sic > opt.ice_concentration_min)

        # Done, add flag
        self._surface_type.add_flag(lead.flag, "lead")
Exemplo n.º 10
0
    def _classify_sea_ice(self, options):
        opt = options.sea_ice
        parameter = self._classifier
        ice = ANDCondition()
        # Mandatory radar mode flag
        ice.add(self._is_radar_mode)
        # Reflectivity min
        #        reflectivity = np.array(parameter.reflectivity)
        #        reflectivity[np.isnan(reflectivity)] = 999.
        ice.add(parameter.reflectivity > opt.reflectivity_min)

        ice.add(parameter.echo_gain <= opt.echo_gain_max)

        #        ice.add(parameter.echo_gain < 100.)
        # Ice Concentration
        ice.add(parameter.sic > opt.ice_concentration_min)
        # Done, add flag
        self._surface_type.add_flag(ice.flag, "sea_ice")
Exemplo n.º 11
0
 def _classify_ocean(self, options):
     opt = options.ocean
     parameter = self._classifier
     ocean = ANDCondition()
     # Mandatory radar mode flag
     ocean.add(self._is_radar_mode)
     # Peakiness Thresholds
     ocean.add(parameter.peakiness_old < opt.pulse_peakiness_max)
     # Ice Concentration
     ocean.add(parameter.sic < opt.ice_concentration_min)
     # Done, add flag
     self._surface_type.add_flag(ocean.flag, "ocean")
Exemplo n.º 12
0
 def _classify_leads(self, options):
     opt = options.lead
     parameter = self._classifier
     lead = ANDCondition()
     # Mandatory radar mode flag
     lead.add(self._is_radar_mode)
     # Stack (Beam) parameters
     lead.add(parameter.peakiness_old > opt.pulse_peakiness_min)
     # Ice Concentration
     lead.add(parameter.sic > opt.ice_concentration_min)
     # Done, add flag
     self._surface_type.add_flag(lead.flag, "lead")
Exemplo n.º 13
0
    def _classify_sea_ice(self, options):
        """ Sea ice is essentially the valid rest (not-ocean & not lead) """
        opt = options.sea_ice
        parameter = self._classifier
        ice = ANDCondition()

        # Mandatory radar mode flag
        ice.add(self._is_radar_mode)

        # Should not be a lead
        ice.add(np.logical_not(self._surface_type.lead.flag))

        # High gain value indicates low SNR
        ice.add(parameter.echo_gain <= opt.echo_gain_max)

        # Ice Concentration
        ice.add(parameter.sic > opt.ice_concentration_min)

        # Done, add flag
        self._surface_type.add_flag(ice.flag, "sea_ice")
Exemplo n.º 14
0
    def _classify_leads(self, options):
        """ Follow the procedure proposed by Kirill: Identification of
        colocated dips in local elevation & reflectivity """

        # Aliases
        opt = options.lead
        parameter = self._classifier

        # Translate window size in km to indices
        window_size = self.get_filter_width(opt.filter_width_m,
                                            opt.footprint_spacing_m)

        # get local dips in elevation
        elevation = parameter.sea_ice_surface_elevation_corrected
        elevation -= parameter.mss
        hr, hr_mean, hr_sigma, index_list = self.get_elevation_parameters(
            elevation, window_size)

        # get local dips in reflectivity
        delta_r = self.get_delta_r(parameter.reflectivity, window_size,
                                   opt.reflectivity_offset_sdev_factor,
                                   index_list)

        # All criterias needs to be fullfilled
        lead = ANDCondition()

        # Mandatory radar mode flag
        lead.add(self._is_radar_mode)

        # Local Reflectivity Minimum
        lead.add(delta_r >= opt.reflectivity_diff_min)

        # Local Elevation Minimum
        hr_max = hr_mean - opt.elevation_offset_sdev_factor * hr_sigma
        lead.add(hr < hr_max)

        # Obligatory Ice Concentration
        lead.add(parameter.sic > opt.ice_concentration_min)

        # Done, add flag
        self._surface_type.add_flag(lead.flag, "lead")
Exemplo n.º 15
0
    def _filter_results(self):
        """ These threshold are based on the SICCI code"""
        thrs = self._options.filter

        valid = ANDCondition()
        valid.add(self.leading_edge_width < thrs.maximum_leading_edge_width)
        valid.add(self.tail_shape < thrs.maximum_echo_tail_line_deviation)
        valid.add(self.retracked_bin > thrs.sensible_seaice_retracked_bin[0])
        valid.add(self.retracked_bin < thrs.sensible_seaice_retracked_bin[1])

        # Error flag is also computed for other surface types, do not
        # overide those
        error_flag = self._flag
        error_flag[self.indices] = np.logical_not(valid.flag[self.indices])
        self._flag = error_flag
Exemplo n.º 16
0
    def _filter_results(self):
        """ Filter the lead results based on threshold defined in SICCI """

        thrs = self._options.filter
        clf = self._classifier

        valid = ANDCondition()
        valid.add(self.sigma < thrs.maximum_std_of_gaussion_rise)
        valid.add(self.maximum_power_bin > thrs.minimum_bin_count_maxpower)

        # sea ice backscatter not available for ERS?
        if thrs.minimum_echo_backscatter is not None:
            valid.add(clf.sigma0 > thrs.minimum_echo_backscatter)

        bin_seperation = np.abs(self.retracked_bin - self.maximum_power_bin)
        valid.add(bin_seperation < thrs.maximum_retracker_maxpower_binsep)

        valid.add(self.power_in_echo_tail < thrs.maximum_power_in_echo_tail)
        valid.add(self.rms_echo_and_model < thrs.maximum_rms_echo_model_diff)
        valid.add(self.retracked_bin > thrs.sensible_lead_retracked_bin[0])
        valid.add(self.retracked_bin < thrs.sensible_lead_retracked_bin[1])

        # Error flag is also computed for other surface types, do not
        # overide those
        error_flag = self._flag
        error_flag[self.indices] = np.logical_not(valid.flag[self.indices])
        self._flag = error_flag
Exemplo n.º 17
0
 def _classify_leads(self, options):
     opt = options.lead
     parameter = self._classifier
     lead = ANDCondition()
     # Mandatory radar mode flag
     lead.add(self._is_radar_mode)
     # Stack (Beam) parameters
     lead.add(parameter.peakiness_l >= opt.peakiness_l_min)
     lead.add(parameter.peakiness_r >= opt.peakiness_r_min)
     lead.add(parameter.peakiness >= opt.peakiness_min)
     lead.add(parameter.stack_kurtosis >= opt.stack_kurtosis_min)
     ssd_threshold = opt.stack_standard_deviation_max
     lead.add(parameter.stack_standard_deviation < ssd_threshold)
     # Ice Concentration
     lead.add(parameter.sic > opt.ice_concentration_min)
     # Done, add flag
     self._surface_type.add_flag(lead.flag, "lead")