def reform_waveform(self, mds_ra2, mds_wfm18hz): # Relevant field names wfm_tag = "average_wfm_if_corr_ku" tracker_range_tag = "18hz_tracker_range_no_doppler_ku" doppler_tag = "18Hz_ku_range_doppler" slope_tag = "18Hz_ku_range_doppler_slope" # First get the echo power n_range_bins = 128 n = self.n_records * self.n_blocks self.power = np.ndarray(shape=(n, n_range_bins), dtype=np.float32) for dsd in range(self.n_records): for block in range(self.n_blocks): i = dsd*self.n_blocks + block self.power[i, :] = mds_wfm18hz[dsd].wfm[block][wfm_tag] # Calculate the window delay for each 18hz waveform range_info = get_structarr_attr(mds_ra2, "range_information") range_corr = get_structarr_attr(mds_ra2, "range_correction") tracker_range = get_structarr_attr( range_info, tracker_range_tag, flat=True) doppler_correction = get_structarr_attr( range_corr, doppler_tag, flat=True) slope_correction = get_structarr_attr( range_corr, slope_tag, flat=True) # Compute the window delay (range to first range bin) # given in meter (not in seconds) # XXX: Add the instrumental range correction for ku? self.window_delay_m = get_envisat_window_delay( tracker_range, doppler_correction, slope_correction) # Compute the range value for each range bin of the 18hz waveform # XXX: Might want to set the range bins automatically self.range = get_envisat_wfm_range(self.window_delay_m, n_range_bins)
def _transfer_waveform_collection(self): """ Transfers the waveform data (power & range for each range bin) """ # Transfer the reformed 18Hz waveforms # "waveform samples (I2+Q2, 1/2048 FFT power unit): 18 Hz Ku band"; # "the echo is corrected for the intermediate frequency filter effect"; wfm_power = self.sgdr.waveform_fft_20_ku n_records, n_range_bins = wfm_power.shape # Compute the window delay and the range values window_delay_m = get_envisat_window_delay( self.sgdr.tracker_range_20_ku, self.sgdr.dop_cor_20_ku, self.sgdr.dop_slope_cor_20_ku, nominal_tracking_bin=self.cfg.nominal_tracking_bin, bin_width_meter=self.cfg.bin_width_meter) # Compute the range value for each range bin of the 18hz waveform wfm_range = get_envisat_wfm_range( window_delay_m, n_range_bins, bin_width_meter=self.cfg.bin_width_meter) # Transfer data to the waveform group self.l1.waveform.set_waveform_data(wfm_power, wfm_range, self.cfg.radar_mode) # Set valid flag to exclude calibration data # (see section 3.5 of Reaper handbook) valid_flag = np.logical_not(self.sgdr.waveform_fault_id_20.astype(bool)) self.l1.waveform.set_valid_flag(valid_flag)