Ejemplo n.º 1
0
def connect_success(name='connect_success'):
    return Struct(
        name, VLQ('client_id'), HexAdapter(Field('server_uuid', 16)),
        Struct('celestial_data', SBInt32('planet_orbital_levels'),
               SBInt32('satellite_orbital_levels'), SBInt32('chunk_size'),
               SBInt32('xy_min'), SBInt32('xy_max'), SBInt32('z_min'),
               SBInt32('z_max')))
Ejemplo n.º 2
0
def warp_action(name='warp_action'):
    return Struct(
        name, Byte('warp_type'),
        Switch('warp_action_type',
               lambda ctx: ctx['warp_type'], {
                   1: LazyBound('next', lambda: WARP_WORLD),
                   2: HexAdapter(Field('uuid', 16)),
                   3: SBInt32('alias')
               },
               default=Pass))
Ejemplo n.º 3
0
    def get_mds_parser(self):

        self.timestamp = Struct("utc_timestamp", SBInt32("day"),
                                UBInt32("sec"), UBInt32("msec"))

        self.waveform_data = Struct(
            "wfm", Array(128, Per2048(UBInt16("average_wfm_if_corr_ku"))),
            Padding(172))

        self.mds_record = Struct("mds_record", self.timestamp,
                                 SBInt8("quality_indicator"), Padding(3),
                                 UBInt32("source_packet_counter"), Padding(8),
                                 Array(20, self.waveform_data))

        self.mds = Array(self.n_records, self.mds_record)
        return self.mds
Ejemplo n.º 4
0
    def get_mds_parser(self):

        self.timestamp = Struct("utc_timestamp", SBInt32("day"),
                                UBInt32("sec"), UBInt32("msec"))

        self.waveform_data = Struct(
            "wfm", Array(128, Per2048(UBInt16("average_wfm_if_corr_ku"))),
            Array(2, Per2048(UBInt16("central_filters_if_corr_ku"))),
            Array(64, Per8096(UBInt16("average_wfm_if_corr_s"))),
            Array(2, SBInt16("indexes_of_2_dft_samples")),
            Per256(SBInt16("delta_offset_fft_filter_units")), Padding(18),
            Per2048(SBInt16("noise_power_measurement")),
            OneHundredth(SBInt16("agc_of_noise_power_measurement")),
            OneHundredthDecibel(UBInt16("reference_power_value")), Padding(10))

        self.mds_record = Struct("mds_record", self.timestamp,
                                 SBInt8("quality_indicator"), Padding(3),
                                 UBInt32("source_packet_counter"), Padding(8),
                                 Array(20, self.waveform_data))

        self.mds = Array(self.n_records, self.mds_record)
        return self.mds
Ejemplo n.º 5
0
    def get_mds_parser(self):

        self.timestamp = Struct("utc_timestamp", SBInt32("day"),
                                UBInt32("sec"), UBInt32("msec"))

        self.time_orbit = Struct(
            "time_orbit", self.timestamp, SBInt8("quality_indicator"),
            Padding(3), MicroDeg(SBInt32("latitude")),
            MicroDeg(SBInt32("longitude")), UBInt32("source_packet_counter"),
            UBInt32("instrument_mode_id"),
            BitStruct("measurement_confidence_data", Array(32, Bit("flag"))),
            MilliMeter(UBInt32("altitude")),
            Array(20, MilliMeter(SBInt16("18hz_altitude_differences"))),
            MilliMeter(SBInt16("instantaneous_altitude_rate")), Padding(50))

        self.range_information = Struct(
            "range_information",
            Array(20, MilliMeter(UBInt32("18hz_tracker_range_no_doppler_ku"))),
            Padding(80), UBInt32("map_valid_points_tracker_ku"), Padding(4),
            MilliMeter(UBInt32("ocean_range_ku")), Padding(580),
            Array(20, TenMicroDeg(SBInt16("18hz_latitude_differences"))),
            Array(20, TenMicroDeg(SBInt16("18hz_longitude_differences"))))

        self.range_correction = Struct(
            "range_correction",
            Array(20, MilliMeter(SBInt16("18Hz_ku_range_instrumental"))),
            Padding(40), Array(20,
                               MilliMeter(SBInt16("18Hz_ku_range_doppler"))),
            Padding(40),
            Array(20, MilliMeter(SBInt16("18Hz_ku_range_doppler_slope"))),
            Padding(40), MilliMeter(SBInt16("dry_troposphere")),
            MilliMeter(SBInt16("inverse_barometric")),
            MilliMeter(SBInt16("wet_troposphere_model")),
            MilliMeter(SBInt16("wet_troposphere_mwr")),
            MilliMeter(SBInt16("ra2_ionosphere_ku")), Padding(2),
            MilliMeter(SBInt16("doris_ionosphere_ku")), Padding(2),
            MilliMeter(SBInt16("model_ionosphere_ku")), Padding(2),
            MilliMeter(SBInt16("sea_state_bias_ku")), Padding(2),
            MilliMeter(SBInt16("dib_hf")), Padding(10))

        self.significant_wave_height = Padding(268)

        self.backscatter = Struct(
            "backscatter", Padding(340),
            Array(20, OneHundredthDecibel(SBInt16("18hz_sea_ice_sigma_ku"))),
            Padding(40))

        self.backscatter_correction = Padding(12)

        self.off_nadir_information = Padding(364)

        self.geophysical_information = Struct(
            "geophysical_information",
            MilliMeter(SBInt32("mean_sea_surface_height")),
            MilliMeter(SBInt32("geoid_height")),
            MilliMeter(SBInt32("ocean_depth_land_elevation")),
            MilliMeter(SBInt16("total_geocentric_ocean_tide_1")),
            MilliMeter(SBInt16("total_geocentric_ocean_tide_2")),
            MilliMeter(SBInt16("ocean_tide_long_period")),
            MilliMeter(SBInt16("ocean_loading_tide_2")),
            MilliMeter(SBInt16("solid_earth_tide")),
            MilliMeter(SBInt16("geocentric_polar_tide")),
            TenPascal(SBInt16("model_surface_atmospheric_pressure")),
            OneHundredth(SBInt16("mwr_water_vapour_content")),
            OneHundredth(SBInt16("mwr_liquid_water_content")),
            OneTenths(SBInt16("ra2_total_electron_content")),
            MilliMeter(SBInt16("ra2_wind_speed")),
            MilliMeter(SBInt16("model_wind_vector_u")),
            MilliMeter(SBInt16("model_wind_vector_v")),
            MilliMeter(SBInt16("ocean_loading_tide_1")), Padding(8))

        self.mwr_information = Padding(10)

        self.flags = Struct("flag", UBInt16("average_ku_chirp_band"),
                            Padding(112), UBInt16("altimeter_surface_type"),
                            UBInt16("radiometer_land_ocean"), Padding(6),
                            UBInt8("sea_ice"), Padding(5))

        self.mds_record = Struct("mds_record", self.time_orbit,
                                 self.range_information, self.range_correction,
                                 self.significant_wave_height,
                                 self.backscatter, self.backscatter_correction,
                                 self.off_nadir_information,
                                 self.geophysical_information,
                                 self.mwr_information, self.flags)

        self.mds = Array(self.n_records, self.mds_record)

        return self.mds
Ejemplo n.º 6
0
    def get_mds_parser(self):

        self.timestamp = Struct("utc_timestamp", SBInt32("day"),
                                UBInt32("sec"), UBInt32("msec"))

        self.time_orbit = Struct(
            "time_orbit", self.timestamp, SBInt8("quality_indicator"),
            Padding(3), MicroDeg(SBInt32("latitude")),
            MicroDeg(SBInt32("longitude")), UBInt32("source_packet_counter"),
            UBInt32("instrument_mode_id"),
            BitStruct("measurement_confidence_data", Array(32, Bit("flag"))),
            MilliMeter(UBInt32("altitude")),
            Array(20, MilliMeter(SBInt16("18hz_altitude_differences"))),
            MilliMeter(SBInt16("instantaneous_altitude_rate")), Padding(50))

        self.range_information = Struct(
            "range_information",
            Array(20, MilliMeter(UBInt32("18hz_tracker_range_no_doppler_ku"))),
            Array(20, MilliMeter(UBInt32("18hz_tracker_range_no_doppler_s"))),
            UBInt32("map_valid_points_tracker_ku"), Padding(4),
            MilliMeter(UBInt32("ocean_range_ku")),
            MilliMeter(UBInt32("band_ocean_range_s")),
            Array(20, MilliMeter(UBInt32("18hz_ocean_range_ku"))),
            Array(20, MilliMeter(UBInt32("18hz_ocean_range_s"))),
            MilliMeter(UBInt16("sd_18hz_ocean_range_ku")),
            MilliMeter(UBInt16("sd_18hz_ocean_range_s")),
            UBInt16("18hz_n_valid_ocean_ku"), UBInt16("18hz_n_valid_ocean_s"),
            BitStruct("18hz_valid_points_ocean_ku", Array(32, Bit("flag"))),
            BitStruct("18hz_valid_points_ocean_s", Array(32, Bit("flag"))),
            Array(20, MilliMeter(UBInt32("18Hz_ice1_range_ku"))),
            Array(20, MilliMeter(UBInt32("18Hz_ice1_range_s"))),
            Array(20, MilliMeter(UBInt32("18Hz_ice2_range_ku"))),
            Array(20, MilliMeter(UBInt32("18Hz_ice2_range_s"))),
            Array(20, MilliMeter(UBInt32("18Hz_sea_ice_range_ku"))),
            Array(20, TenMicroDeg(SBInt16("18hz_latitude_differences"))),
            Array(20, TenMicroDeg(SBInt16("18hz_longitude_differences"))))

        self.range_correction = Struct(
            "range_correction",
            Array(20, MilliMeter(SBInt16("18Hz_ku_range_instrumental"))),
            Array(20, MilliMeter(SBInt16("18Hz_s_range_instrumental"))),
            Array(20, MilliMeter(SBInt16("18Hz_ku_range_doppler"))),
            Array(20, MilliMeter(SBInt16("18Hz_s_range_doppler"))),
            Array(20, MilliMeter(SBInt16("18Hz_ku_range_doppler_slope"))),
            Array(20, MilliMeter(SBInt16("18Hz_s_range_doppler_slope"))),
            MilliMeter(SBInt16("dry_troposphere")),
            MilliMeter(SBInt16("inverse_barometric")),
            MilliMeter(SBInt16("wet_troposphere_model")),
            MilliMeter(SBInt16("wet_troposphere_mwr")),
            MilliMeter(SBInt16("ra2_ionosphere_ku")),
            MilliMeter(SBInt16("ra2_ionosphere_s")),
            MilliMeter(SBInt16("doris_ionosphere_ku")),
            MilliMeter(SBInt16("doris_ionosphere_s")),
            MilliMeter(SBInt16("model_ionosphere_ku")),
            MilliMeter(SBInt16("model_ionosphere_s")),
            MilliMeter(SBInt16("sea_state_bias_ku")),
            MilliMeter(SBInt16("sea_state_bias_s")),
            MilliMeter(SBInt16("dib_hf")), Padding(10))

        self.significant_wave_height = Struct(
            "significant_wave_height", MilliMeter(SBInt32("swh_square_ku")),
            MilliMeter(SBInt32("swh_square_s")), MilliMeter(SBInt16("swh_ku")),
            MilliMeter(SBInt16("swh_s")),
            MilliMeter(SBInt16("swh_sd_18hz_ku")),
            MilliMeter(SBInt16("swh_sd_18hz_s")),
            UBInt16("shw_18hz_n_valid_ku"), UBInt16("shw_18hz_n_valid_s"),
            BitStruct("slope_model_present", Array(32, Bit("flag"))),
            Centimeter(SBInt32("1hz_elevation_echo_point")),
            Array(20, Centimeter(SBInt16("18hz_elevation_difference"))),
            Array(20, TenMicroDeg(SBInt16("18hz_slope_latitude_diff"))),
            Array(20, TenMicroDeg(SBInt16("18hz_slope_longitude_diff"))),
            Array(20, MilliMeter(SBInt16("18hz_ice2_leading_edge_width_ku"))),
            Array(20, MilliMeter(SBInt16("18hz_ice2_leading_edge_width_s"))),
            Padding(40))

        self.backscatter = Struct(
            "backscatter",
            Array(20, OneHundredthDecibel(SBInt16("18hz_ku_k_cal_ku"))),
            Array(20, OneHundredthDecibel(SBInt16("18hz_s_k_cal_s"))),
            BitStruct("map_valid_k_cal_ku", Array(32, Bit("flag"))),
            Padding(4), OneHundredthDecibel(SBInt16("ocean_sigma_corr_ku")),
            OneHundredthDecibel(SBInt16("ocean_sigma_corr_s")),
            OneHundredthDecibel(SBInt16("sd_18hz_ocean_sigma_ku")),
            OneHundredthDecibel(SBInt16("sd_18hz_ocean_sigma_s")),
            UBInt16("n_valid_18hz_ocean_sigma_ku"),
            UBInt16("n_valid_18hz_ocean_sigma_s"),
            Array(20, OneHundredthDecibel(SBInt16("18hz_ice1_sigma_ku"))),
            Array(20, OneHundredthDecibel(SBInt16("18hz_ice1_sigma_s"))),
            Array(20, OneHundredthDecibel(SBInt16("18hz_ice2_le_sigma_ku"))),
            Array(20, OneHundredthDecibel(SBInt16("18hz_ice2_le_sigma_s"))),
            Array(20, OneHundredthDecibel(SBInt16("18hz_ice2_sigma_ku"))),
            Array(20, OneHundredthDecibel(SBInt16("18hz_ice2_sigma_s"))),
            Array(20, OneHundredthDecibel(SBInt16("18hz_sea_ice_sigma_ku"))),
            Padding(40))

        self.backscatter_correction = Struct(
            "backscatter_correction",
            OneHundredthDecibel(SBInt16("agc_net_instrumental_ku")),
            OneHundredthDecibel(SBInt16("agc_net_instrumental_s")),
            OneHundredthDecibel(SBInt16("atmospheric_attenuation_ku")),
            OneHundredthDecibel(SBInt16("atmospheric_attenuation_s")),
            OneHundredthDecibel(SBInt32("rain_attenuation_ku")))

        self.off_nadir_information = Struct(
            "off_nadir_angle",
            TenThousands(SBInt16("square_angle_from_platform_data")),
            TenThousands(SBInt16("square_angle_from_waveform_data")),
            Array(20, SBInt32("slope_ice2_first_trailing_edge_ku")),
            Array(20, SBInt32("slope_ice2_first_trailing_edge_s")),
            Array(20, SBInt32("slope_ice2_second_trailing_edge_ku")),
            Array(20, SBInt32("slope_ice2_second_trailing_edge_s")),
            Padding(40))

        self.geophysical_information = Struct(
            "geophysical_information",
            MilliMeter(SBInt32("mean_sea_surface_height")),
            MilliMeter(SBInt32("geoid_height")),
            MilliMeter(SBInt32("ocean_depth_land_elevation")),
            MilliMeter(SBInt16("total_geocentric_ocean_tide_1")),
            MilliMeter(SBInt16("total_geocentric_ocean_tide_2")),
            MilliMeter(SBInt16("ocean_tide_long_period")),
            MilliMeter(SBInt16("ocean_loading_tide_2")),
            MilliMeter(SBInt16("solid_earth_tide")),
            MilliMeter(SBInt16("geocentric_polar_tide")),
            TenPascal(SBInt16("model_surface_atmospheric_pressure")),
            OneHundredth(SBInt16("mwr_water_vapour_content")),
            OneHundredth(SBInt16("mwr_liquid_water_content")),
            OneTenths(SBInt16("ra2_total_electron_content")),
            MilliMeter(SBInt16("ra2_wind_speed")),
            MilliMeter(SBInt16("model_wind_vector_u")),
            MilliMeter(SBInt16("model_wind_vector_v")),
            MilliMeter(SBInt16("ocean_loading_tide_1")), Padding(8))

        self.mwr_information = Struct(
            "mwr_information",
            OneHundredth(SBInt16("mwr_brightness_temp_23_8ghz")),
            OneHundredth(SBInt16("mwr_brightness_temp_36_5ghz")),
            OneHundredth(SBInt16("mwr_sd_brightness_temp_23_8ghz")),
            OneHundredth(SBInt16("mwr_sd_brightness_temp_36_5ghz")),
            Padding(2))

        self.flags = Struct(
            "flag", UBInt16("average_ku_chirp_band"),
            BitStruct("ku_chirp_band_id", Array(64, Bit("flag"))),
            BitStruct("error_chirp_band_id", Array(32, Bit("flag"))),
            BitStruct("instrument", Array(32, Bit("flag"))),
            BitStruct("fault_identifier", Array(64, Bit("flag"))), Padding(8),
            BitStruct("waveform_fault_identifier", Array(64, Bit("flag"))),
            BitStruct("instrument_mode_id", Array(96, Bit("flag"))),
            UBInt16("n_measures_flight_calibration_s"),
            UBInt16("n_measures_flight_calibration_ku"),
            BitStruct("mwr_instrument_quality", Array(16, Bit("flag"))),
            Padding(6), Padding(8), Padding(8),
            BitStruct("ocean_retracking_quality_ku", Array(32, Bit("flag"))),
            BitStruct("ocean_retracking_quality_s", Array(32, Bit("flag"))),
            BitStruct("ice1_retracking_quality_ku", Array(32, Bit("flag"))),
            BitStruct("ice1_retracking_quality_s", Array(32, Bit("flag"))),
            BitStruct("ice2_retracking_quality_ku", Array(32, Bit("flag"))),
            BitStruct("ice2_retracking_quality_s", Array(32, Bit("flag"))),
            BitStruct("sea_ice_retracking_quality_ku", Array(32, Bit("flag"))),
            OneThousands(UBInt16("1hz_pulse_peakiness_ku")),
            OneThousands(UBInt16("1hz_pulse_peakiness_s")),
            UBInt16("altimeter_surface_type"),
            UBInt16("radiometer_land_ocean"),
            UBInt16("mwr_quality_interpolation"), UBInt16("altimeter_rain"),
            UBInt16("interpolation"), UBInt8("sea_ice"),
            BitStruct("membership_01", Array(8, Bit("flag"))),
            BitStruct("membership_02", Array(8, Bit("flag"))),
            BitStruct("membership_03", Array(8, Bit("flag"))),
            BitStruct("membership_04", Array(8, Bit("flag"))), Padding(1))

        self.mds_record = Struct("mds_record", self.time_orbit,
                                 self.range_information, self.range_correction,
                                 self.significant_wave_height,
                                 self.backscatter, self.backscatter_correction,
                                 self.off_nadir_information,
                                 self.geophysical_information,
                                 self.mwr_information, self.flags)

        self.mds = Array(self.n_records, self.mds_record)

        return self.mds
Ejemplo n.º 7
0
def warp_toalias_write(name='warp_toalias_write'):
    return Struct(name, Byte('warp_type'), SBInt32('alias'))
Ejemplo n.º 8
0
                MetaField("data", lambda ctx: ctx["length"] * 2),
            )),
        encoding="utf_16_be",
    )


def make_packet(packet_id, **kwargs):
    payload = parsers[packet_id].build(Container(**kwargs))
    return chr(packet_id) + payload


parsers = {
    0x01:
    Struct(
        'login_request',
        SBInt32('protocol_version'),
        BetaString('username'),
        BetaString('not_used1'),
        SBInt32('not_used2'),
        SBInt32('not_used3'),
        SBInt8('not_used4'),
        UBInt8('not_used5'),
        UBInt8('not_used6'),
    ),
    0x02:
    Struct('handshake', BetaString('username_and_host')),
    0xFE:
    Struct('server_list_ping'),
    0xFF:
    Struct('kick', BetaString('reason')),
}
Ejemplo n.º 9
0
def celestial_coordinate(name='celestial_coordinate'):
    return Struct(name, SBInt32('x'), SBInt32('y'), SBInt32('z'),
                  SBInt32('planet'), SBInt32('satellite'))
Ejemplo n.º 10
0
    def _decode(self, obj, context):
        return obj.encode('hex')


WARP_WORLD = Struct(
    'to_world', Byte('world_id'),
    Switch('world_type',
           lambda ctx: ctx['world_id'], {
               1: LazyBound('next', lambda: WARP_WORLD_CELESTIAL),
               2: LazyBound('next', lambda: WARP_WORLD_PLAYER),
               3: LazyBound('next', lambda: WARP_WORLD_MISSION)
           },
           default=Pass))

WARP_WORLD_CELESTIAL = Struct(
    'celestial_world', SBInt32('x'), SBInt32('y'), SBInt32('z'),
    SBInt32('planet'), SBInt32('satellite'), Optional(Byte('has_position')),
    If(lambda ctx: ctx['has_position'],
       Struct('position', SBInt32('x'), SBInt32('y'))))

WARP_WORLD_PLAYER = Struct(
    'player_world', HexAdapter(Field('uuid', 16)),
    Optional(Byte('has_position')),
    If(lambda ctx: ctx['has_position'],
       Struct('position', SBInt32('x'), SBInt32('y'))))

WARP_WORLD_MISSION = Struct(
    'mission_world', star_string('mission_world_name'), Byte('check'),
    If(lambda ctx: ctx['check'] == 1, HexAdapter(Field('instance', 16))))

Ejemplo n.º 11
0
        for k, v in obj.iteritems():
            t, value = v
            d = Container(id=Container(data_type=metadata_types.index(t),
                                       identifier=k),
                          value=value,
                          peeked=None)
            c.data.append(d)
        c.data[-1].peeked = 127
        return c


# Metadata inner container.
metadata_switch = {
    0: SBInt8("value"),
    1: SBInt16("value"),
    2: SBInt32("value"),
    3: BFloat32("value"),
    4: AlphaString("value"),
    5: slotdata,
    6: Struct(
        "int_tup",
        SBInt32("x"),
        SBInt32("y"),
        SBInt32("z"),
    ),
}

# Metadata subconstruct.
entity_metadata = MetadataAdapter(
    Struct(
        "metadata",
Ejemplo n.º 12
0
     # Total Ticks
     UBInt64("timestamp"),
     # Time of day
     UBInt64("time"),
 ),
 0x05:
 Struct(
     "entity-equipment",
     UBInt32("eid"),
     UBInt16("slot"),
     Embed(items),
 ),
 0x06:
 Struct(
     "spawn",
     SBInt32("x"),
     SBInt32("y"),
     SBInt32("z"),
 ),
 0x07:
 Struct(
     "use",
     UBInt32("eid"),
     UBInt32("target"),
     UBInt8("button"),
 ),
 0x08:
 Struct(
     "health",
     BFloat32("hp"),
     UBInt16("fp"),
Ejemplo n.º 13
0
 3: Struct("chat",
     AlphaString("message"),
 ),
 4: Struct("time",
     # Total Ticks
     UBInt64("timestamp"),
     # Time of day
     UBInt64("time"),
 ),
 5: Struct("entity-equipment",
     UBInt32("eid"),
     UBInt16("slot"),
     Embed(items),
 ),
 6: Struct("spawn",
     SBInt32("x"),
     SBInt32("y"),
     SBInt32("z"),
 ),
 7: Struct("use",
     UBInt32("eid"),
     UBInt32("target"),
     UBInt8("button"),
 ),
 8: Struct("health",
     UBInt16("hp"),
     UBInt16("fp"),
     BFloat32("saturation"),
 ),
 9: Struct("respawn",
     dimension,
Ejemplo n.º 14
0
    def get_mds_parser(self):

        self.mdsr_timestamp = Struct(
            "tai_timestamp",
            SBInt32("day"),
            UBInt32("sec"),
            UBInt32("msec"))

        self.time_orbit_group = Struct(
            "time_orbit",
            self.mdsr_timestamp,
            UBInt16("uso_corr"),
            UBInt32("mode_id"),
            UBInt16("source_sequence_counter"),
            UBInt32("instrument_configuration"),
            UBInt32("burst_counter"),
            OneTenthMicroDeg(SBInt32("latitude")),
            OneTenthMicroDeg(SBInt32("longitude")),
            MilliMeter(SBInt32("altitude")),
            MilliMeter(SBInt32("altitude_rate")),
            Array(3, MilliMeter(SBInt32("satellite_velocity"))),
            Array(3, Micrometer(SBInt32("real_beam"))),
            Array(3, Micrometer(SBInt32("interferometry_baseline"))),
            UBInt16("star_tracker_usage"),
            OneTenthMicroDeg(SBInt32("antenna_roll")),
            OneTenthMicroDeg(SBInt32("antenna_pitch")),
            OneTenthMicroDeg(SBInt32("antenna_yaw")),
            UBInt32("fbr_confidence_flag"),
            Padding(4))

        self.measurement_group = Struct(
            "measurement",
            PicoSecond(SBInt64("window_delay")),
            SBInt32("h0"),
            SBInt32("cor2"),
            SBInt32("lai"),
            SBInt32("fai"),
            OneHundredthDecibel(SBInt32("agc_1")),
            OneHundredthDecibel(SBInt32("agc_2")),
            OneHundredthDecibel(SBInt32("fixed_gain_1")),
            OneHundredthDecibel(SBInt32("fixed_gain_2")),
            MicroWatts(SBInt32("tx_power")),
            MilliMeter(SBInt32("doppler_range_correction")),
            MilliMeter(SBInt32("instrument_range_correction_txrx")),
            MilliMeter(SBInt32("instrument_range_correction_rx")),
            OneHundredthDecibel(SBInt32("instrument_gain_correction_txrx")),
            OneHundredthDecibel(SBInt32("instrument_gain_correction_rx")),
            MicroRadians(SBInt32("phase_correction_internal")),
            MicroRadians(SBInt32("phase_correction_external")),
            OneHundredthDecibel(SBInt32("noise_power")),
            MicroRadians(SBInt32("phase_slope_correction")),
            Padding(4))

        self.corrections_group = Struct(
            "corrections",
            MilliMeter(SBInt32("dry_troposphere")),
            MilliMeter(SBInt32("wet_troposphere")),
            MilliMeter(SBInt32("inverse_barometric")),
            MilliMeter(SBInt32("dynamic_atmosphere")),
            MilliMeter(SBInt32("ionospheric_gim")),
            MilliMeter(SBInt32("ionospheric_mod")),
            MilliMeter(SBInt32("ocean_tide_elastic")),
            MilliMeter(SBInt32("ocean_tide_long_period")),
            MilliMeter(SBInt32("ocean_loading_tide")),
            MilliMeter(SBInt32("solid_earth_tide")),
            MilliMeter(SBInt32("geocentric_polar_tide")),
            UBInt32("surface_type"),
            Padding(4),
            UBInt32("correction_status"),
            UBInt32("correction_error"),
            Padding(4))

#        self.onehz_waveform_group = Struct(
#            "avg_waveform",
#            self.mdsr_timestamp,
#            OneTenthMicroDeg(SBInt32("latitude")),
#            OneTenthMicroDeg(SBInt32("longitude")),
#            MilliMeter(SBInt32("altitude")),
#            PicoSecond(UBInt64("window_delay")),
#            Array(512, UBInt16("wfm")),
#            SBInt32("linear_scale"),
#            SBInt32("power_scale"),
#            UBInt16("num_avg_echoes"),
#            UBInt16("flags"))
        self.onehz_waveform_group = Padding(1068)
        # stop

#        self.waveform_flag_group = BitStruct(
#            "flag",
#            Bit("approximate_beam_steering"),
#            Bit("exact_beam_steering"),
#            Bit("doppler_weighting_computed"),
#            Bit("dopple_weighting_applied_before_stack"),
#            Bit("multi_look_incomplete"),
#            Bit("beam_angle_steering_error"),
#            Bit("anti_aliased_power_echoes"),
#            Bit("auto_beam_steering"),
#            Padding(8))

        self.waveform_flag_group = Padding(2)

        self.waveform_beam_group = Struct(
            "beam",
            OneHundredth(UBInt16("stack_standard_deviation")),
            OneHundredth(UBInt16("stack_centre")),
            OneHundredthDecibel(SBInt16("stack_scaled_amplitude")),
            OneHundredth(SBInt16("stack_skewness")),
            OneHundredth(SBInt16("stack_kurtosis")),
            MicroRadians(SBInt16("stack_standard_deviation_boresight")),
            MicroRadians(SBInt16("stack_centre_angle")),
            OneTenthMicroRadians(SBInt32("doppler_angle_start")),
            OneTenthMicroRadians(SBInt32("doppler_angle_stop")),
            OneTenthMicroRadians(SBInt32("look_angle_start")),
            OneTenthMicroRadians(SBInt32("look_angle_stop")),
            UBInt16("n_beams_after_weighing"),
            UBInt16("n_beams_before_weighing"),
            Padding(66))

#        self.waveform_group = Struct(
#            "waveform",
#            Array(1024, UBInt16("wfm")),
#            SBInt32("linear_scale"),
#            SBInt32("power_scale"),
#            UBInt16("num_avg_echoes"),
#            self.waveform_flag_group,
#            self.waveform_beam_group,
#            Array(1024, UBInt16("coherence")),
#            Array(1024, SBInt32("phase_difference")))

        self.waveform_group = Struct(
            "waveform",
            Array(1024, UBInt16("wfm")),
            SBInt32("linear_scale"),
            SBInt32("power_scale"),
            UBInt16("num_avg_echoes"),
            self.waveform_flag_group,
            self.waveform_beam_group,
            Padding(6144))

        self.mds_record = Struct(
            "mds_record",
            Array(self.n_blocks, self.time_orbit_group),
            Array(self.n_blocks, self.measurement_group),
            self.corrections_group,
            self.onehz_waveform_group,
            Array(self.n_blocks, self.waveform_group))

        self.mds = Array(self.n_records, self.mds_record)

        return self.mds
Ejemplo n.º 15
0
 Struct(
     "time",
     UBInt64("timestamp"),
 ),
 5:
 Struct(
     "entity-equipment",
     UBInt32("eid"),
     UBInt16("slot"),
     UBInt16("primary"),
     UBInt16("secondary"),
 ),
 6:
 Struct(
     "spawn",
     SBInt32("x"),
     SBInt32("y"),
     SBInt32("z"),
 ),
 7:
 Struct(
     "use",
     UBInt32("eid"),
     UBInt32("target"),
     UBInt8("button"),
 ),
 8:
 Struct(
     "health",
     UBInt16("hp"),
 ),
Ejemplo n.º 16
0
from empower.core.resourcepool import CQM
from empower.core.resourcepool import ResourceBlock
from empower.core.resourcepool import ResourcePool
from empower.core.module import Module
from empower.lvapp import PT_VERSION

from empower.main import RUNTIME

PT_POLLER_REQ_MSG_TYPE = 0x27
PT_POLLER_RESP_MSG_TYPE = 0x28


POLLER_ENTRY_TYPE = Sequence("img_entries",
                             Bytes("addr", 6),
                             UBInt32("last_rssi_std"),
                             SBInt32("last_rssi_avg"),
                             UBInt32("last_packets"),
                             UBInt32("hist_packets"),
                             SBInt32("ewma_rssi"),
                             SBInt32("sma_rssi"))

POLLER_REQUEST = Struct("poller_request", UBInt8("version"),
                        UBInt8("type"),
                        UBInt16("length"),
                        UBInt32("seq"),
                        UBInt32("module_id"),
                        Bytes("addrs", 6),
                        Bytes("hwaddr", 6),
                        UBInt8("channel"),
                        UBInt8("band"))
Ejemplo n.º 17
0
 Struct(
     "time",
     UBInt64("timestamp"),
 ),
 5:
 Struct(
     "entity-equipment",
     UBInt32("eid"),
     UBInt16("slot"),
     UBInt16("primary"),
     UBInt16("secondary"),
 ),
 6:
 Struct(
     "spawn",
     SBInt32("x"),
     SBInt32("y"),
     SBInt32("z"),
 ),
 7:
 Struct(
     "use",
     UBInt32("eid"),
     UBInt32("target"),
     UBInt8("button"),
 ),
 8:
 Struct(
     "health",
     UBInt16("hp"),
     UBInt16("fp"),