def get_radar_collection(): # type: () -> RadarCollectionType tx_pols = [] chan_params = [] for i, bdname in enumerate(band_dict): if 'Polarisation' in band_dict[bdname]: pol = band_dict[bdname]['Polarisation'] elif 'Polarization' in h5_dict: pol = h5_dict['Polarization'] else: raise ValueError( 'Failed finding polarization for file {}\nmission id {}' .format(self._file_name, self._mission_id)) tx_pols.append(pol[0]) chan_params.append( ChanParametersType(TxRcvPolarization=self._parse_pol(pol), index=i)) if len(tx_pols) == 1: return RadarCollectionType(RcvChannels=chan_params, TxPolarization=tx_pols[0]) else: return RadarCollectionType(RcvChannels=chan_params, TxPolarization='SEQUENCE', TxSequence=[ TxStepType(TxPolarization=pol, index=i + 1) for i, pol in enumerate(tx_pols) ])
def get_radar_collection(): # type: () -> RadarCollectionType tx_pols = [] chan_params = [] if self.mission_id == 'CSG' and len(band_dict) == 1 and \ h5_dict['Acquisition Mode'].upper() == 'QUADPOL': # it seems like 2nd generation files only contain one polarization pols = ['HH', 'HV', 'VH', 'VV'] tx_pols.extend([pol[0] for pol in pols]) chan_params.extend([ ChanParametersType(TxRcvPolarization=self._parse_pol(pol), index=i + 1) for i, pol in enumerate(pols) ]) else: for i, bdname in enumerate(band_dict): pol = self._get_polarization(h5_dict, band_dict, bdname) tx_pols.append(pol[0]) chan_params.append( ChanParametersType( TxRcvPolarization=self._parse_pol(pol), index=i + 1)) if len(tx_pols) == 1: return RadarCollectionType(RcvChannels=chan_params, TxPolarization=tx_pols[0]) else: return RadarCollectionType(RcvChannels=chan_params, TxPolarization='SEQUENCE', TxSequence=[ TxStepType(TxPolarization=pol, index=i + 1) for i, pol in enumerate(tx_pols) ])
def define_radar_collection(): tx_rcv_pol_t = [] tx_pol = [] for entry in pols: tx_rcv_pol_t.append('{}:{}'.format(entry[0], entry[1])) if entry[0] not in tx_pol: tx_pol.append(entry[0]) center_freq_t = gp['acquiredCenterFrequency'][()] bw = gp['acquiredRangeBandwidth'][()] tx_freq = TxFrequencyType(Min=center_freq_t - 0.5 * bw, Max=center_freq_t + 0.5 * bw) rcv_chans = [ ChanParametersType(TxRcvPolarization=pol) for pol in tx_rcv_pol_t ] if len(tx_pol) == 1: tx_sequence = None tx_pol = tx_pol[0] else: tx_sequence = [ TxStepType(WFIndex=j + 1, TxPolarization=pol) for j, pol in enumerate(tx_pol) ] tx_pol = 'SEQUENCE' t_sicd.RadarCollection = RadarCollectionType( TxFrequency=tx_freq, RcvChannels=rcv_chans, TxPolarization=tx_pol, TxSequence=tx_sequence) return tx_rcv_pol_t
def _get_radar_collection(self): """ Gets the RadarCollection. Returns ------- RadarCollectionType """ radar_params = self._get_radar_params() center_freq = self._get_center_frequency() # Ultrafine and spotlight modes have t pulses, otherwise just one. bandwidth_elements = sorted(radar_params.findall('pulseBandwidth'), key=lambda x: x.get('pulse')) pulse_length_elements = sorted(radar_params.findall('pulseLength'), key=lambda x: x.get('pulse')) adc_elements = sorted(radar_params.findall('adcSamplingRate'), key=lambda x: x.get('pulse')) samples_per_echo = float(radar_params.find('samplesPerEchoLine').text) wf_params = [] bandwidths = numpy.empty((len(bandwidth_elements), ), dtype=numpy.float64) for i, (bwe, ple, adce) in enumerate( zip(bandwidth_elements, pulse_length_elements, adc_elements)): bandwidths[i] = float(bwe.text) samp_rate = float(adce.text) wf_params.append( WaveformParametersType(index=i, TxRFBandwidth=float(bwe.text), TxPulseLength=float(ple.text), ADCSampleRate=samp_rate, RcvWindowLength=samples_per_echo / samp_rate, RcvDemodType='CHIRP', RcvFMRate=0)) tot_bw = numpy.sum(bandwidths) tx_freq = TxFrequencyType(Min=center_freq - 0.5 * tot_bw, Max=center_freq + 0.5 * tot_bw) radar_collection = RadarCollectionType(TxFrequency=tx_freq, Waveform=wf_params) radar_collection.Waveform[0].TxFreqStart = tx_freq.Min for i in range(1, len(bandwidth_elements)): radar_collection.Waveform[i].TxFreqStart = radar_collection.Waveform[i-1].TxFreqStart + \ radar_collection.Waveform[i-1].TxRFBandwidth tx_pols, tx_rcv_polarizations = self._get_polarizations( radar_params=radar_params) radar_collection.RcvChannels = [ ChanParametersType(TxRcvPolarization=entry, index=i) for i, entry in enumerate(tx_rcv_polarizations) ] if len(tx_pols) == 1: radar_collection.TxPolarization = tx_pols[0] else: radar_collection.TxPolarization = 'SEQUENCE' radar_collection.TxSequence = [ TxStepType(TxPolarization=entry, index=i) for i, entry in enumerate(tx_pols) ] return radar_collection
def get_radar_collection(): # type: () -> RadarCollectionType tx_pols = [] chan_params = [] for i, bdname in enumerate(band_dict): pol = band_dict[bdname]['Polarisation'] tx_pols.append(pol[0]) chan_params.append(ChanParametersType(TxRcvPolarization=self._parse_pol(pol), index=i)) if len(tx_pols) == 1: return RadarCollectionType(RcvChannels=chan_params, TxPolarization=tx_pols[0]) else: return RadarCollectionType(RcvChannels=chan_params, TxPolarization='SEQUENCE', TxSequence=[TxStepType(TxPolarization=pol, index=i+1) for i, pol in enumerate(tx_pols)])