Changeset 0b489f2 in ammosreader


Ignore:
Timestamp:
08/14/23 13:35:49 (22 months ago)
Author:
Enrico Schwass <ennoausberlin@…>
Branches:
guix
Children:
7bc034f
Parents:
d2736bb
Message:

logger readded time check readded

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ammosreader/PDW.py

    rd2736bb r0b489f2  
    4949        is_valid = bool(int(fourth_entry_bit_string[0]))
    5050        is_pulse = bool(int(fourth_entry_bit_string[1]))
    51         level_unit = int(fourth_entry_bit_string[2])
     51        level_unit = bool(int(fourth_entry_bit_string[2]))
    5252        signal_start_missing = bool(int(fourth_entry_bit_string[3]))
    5353        signal_end_missing = bool(int(fourth_entry_bit_string[4]))
     
    7979        df_quality = int(seventh_entry_bit_string[2:9], 2)
    8080        # FIXME: You have to scale me from -90 to 90 in 0.1 degree steps
    81         elevation = int(seventh_entry_bit_string[9:20], 2)
     81        elevation = int(seventh_entry_bit_string[9:20], 2) / 10
    8282        # FIXME: You have to check me for a range from 0.0 to 359.9 in steps of 0.1
    8383        azimuth = 0.1 * (int(seventh_entry_bit_string[20:32], 2))
     
    216216        output += "DF quality: " + str(self.df_quality) + " %\n"
    217217
    218         if self.elevation == 1024:
     218        if self.elevation == 102.4:
    219219            output += "Elevation: Unknown\n"
    220220        else:
     
    232232    def is_valid(self):
    233233        return self.__is_valid
     234
     235    def to_datacrunch_json(self):
     236        import uuid
     237        return {'TOA': int(self.time_of_arrival),
     238                'FORMAT': self.pdw_format_identifier,
     239                'CENTER_FREQUENCY': self.center_frequency,
     240                'VALID_FLAG': self.__is_valid,
     241                'PULSE_FLAG': self.is_pulse,
     242                'LU_FLAG': self.level_unit,
     243                'SNS_FLAG': self.signal_start_missing,
     244                'SNE_FLAG': self.signal_end_missing,
     245                'LEVEL': self.pulse_level_or_pulse_field_strength,
     246                'PULSE_WIDTH': self.pulse_width,
     247                'BANDWIDTH': self.frequency_shift_or_bandwidth,
     248                'IN_OUT_FLAG': self.region_of_interest,
     249                'DF_CONFIDENCE': self.azimuth_confidence,
     250                'MODULATION': self.modulation,
     251                'SECTOR': self.sector,
     252                'POL': self.polarity,
     253                'DF_QUALITY': self.df_quality,
     254                'ELEVATION': self.elevation,
     255                'AZIMUTH': self.azimuth,
     256                'CHANNEL': self.channel
     257                'UUID': uuid.uuid4()
     258                }       
    234259
    235260    def to_json(self):
Note: See TracChangeset for help on using the changeset viewer.