Beispiel #1
0
 def get_by_name(self, name):
     if name in self.SURFACE_TYPE_DICT.keys():
         type_id = self._get_type_id(name)
         return FlagContainer(self._surface_type == type_id)
     else:
         return FlagContainer(
             np.zeros(shape=(self._n_records), dtype=np.bool))
Beispiel #2
0
    def extract_polar_segments_from_halforbit(self, l1b):
        """
        specific method for mission which data sets are organized in
        half orbits (e.g. ERS-1/2, Envisat)

        Extract Arctic and Antarctic subsets and return both in
        the correct sequence. Returns always two segments, but entries
        might be None if no data for specific hemisphere is found.

        XXX: Do not use for full orbits
        """

        # The threshold is the same for arctic and antarctic (50°)
        lat_threshold = self._mdef.polar_threshold

        # Target hemisphere: north, south or global
        target_hemisphere = self._jobdef.hemisphere

        # Measurement position
        position = l1b.time_orbit

        log_entry = "- Extracted %s subset (%g records)"

        # Extract Arctic (if target hemisphere, else empty list)
        if target_hemisphere == "north" or target_hemisphere == "global":
            is_arctic = FlagContainer(position.latitude > lat_threshold)
            arctic_subset = l1b.extract_subset(is_arctic.indices)
            self.log.info(log_entry % ("Arctic", is_arctic.num))
        else:
            arctic_subset = None

        # Extract Antarctic (if target hemisphere, else empty list)
        if target_hemisphere == "south" or target_hemisphere == "global":
            is_antactic = FlagContainer(position.latitude < -1.*lat_threshold)
            antarctic_subset = l1b.extract_subset(is_antactic.indices)
            self.log.info(log_entry % ("Antarctic", is_antactic.num))
        else:
            antarctic_subset = None

        # Segments may be empty, test all cases
        arctic_is_valid = arctic_subset is not None
        antarctic_is_valid = antarctic_subset is not None

        # Return both unsorted, Empty segment will be discarded later
        if not arctic_is_valid or not antarctic_is_valid:
            return [arctic_subset, antarctic_subset]

        # Order in sequence depending on start time
        if arctic_subset.info.start_time < antarctic_subset.info.start_time:
            return [arctic_subset, antarctic_subset]
        else:
            return [antarctic_subset, arctic_subset]
Beispiel #3
0
 def _apply_filter(self, l2, target):
     parameter = getattr(l2, target)
     invalid = ORCondition()
     invalid.add(parameter < self._options.valid_minimum_point_value)
     invalid.add(parameter > self._options.valid_maximum_point_value)
     self._flag = FlagContainer(invalid.flag)
Beispiel #4
0
 def error_flag(self):
     return FlagContainer(self._flag)