def calc_sigma_units(time_vector: np.ndarray, range_los: np.ndarray) -> Tuple[float, float]: """Calculates Gaussian peak std parameters. The amount of smoothing is hard coded. This function calculates how many steps in time and height corresponds to this smoothing. Args: time_vector: 1D vector (fraction hour). range_los: 1D vector (m). Returns: tuple: Two element tuple containing number of steps in time and height to achieve wanted smoothing. """ if len(time_vector) == 0 or np.max(time_vector) > 24: raise ValueError("Invalid time vector") minutes_in_hour = 60 sigma_minutes = 2 sigma_metres = 5 time_step = utils.mdiff(time_vector) * minutes_in_hour alt_step = utils.mdiff(range_los) x_std = sigma_minutes / time_step y_std = sigma_metres / alt_step return x_std, y_std
def __init__(self, categorize_file): super().__init__(categorize_file) self.mie = self._read_mie_lut() self.dheight = utils.mdiff(self.getvar('height')) self.z = self._convert_z_units() self.beta = self.getvar('beta') self.v = self.getvar('v')
def __init__(self, categorize_file: str): super().__init__(categorize_file) self.mie = self._read_mie_lut() self.dheight = utils.mdiff(self.getvar("height")) self.z = self._convert_z_units() self.beta = self.getvar("beta") self.v = self.getvar("v")
def __init__(self, categorize_file): super().__init__(categorize_file) self.lwp = self.getvar('lwp') self.lwp_error = self.getvar('lwp_error') self.is_rain = self.getvar('is_rain') self.dheight = utils.mdiff(self.getvar('height')) self.atmosphere = self._get_atmosphere(categorize_file) self.categorize_bits = CategorizeBits(categorize_file)
def __init__(self, categorize_file: str): super().__init__(categorize_file) self.lwp = self.getvar("lwp") self.lwp[self.lwp < 0] = 0 self.lwp_error = self.getvar("lwp_error") self.is_rain = get_is_rain(categorize_file) self.dheight = utils.mdiff(self.getvar("height")) self.atmosphere = self._get_atmosphere(categorize_file) self.categorize_bits = CategorizeBits(categorize_file)
def _number_of_independent_pulses() -> float: seconds_in_hour = 3600 dwell_time = utils.mdiff(self.time) * seconds_in_hour return ( dwell_time * self.radar_frequency * 1e9 * 4 * np.sqrt(math.pi) * self.data["width"][:] / 3e8 )
def _calc_sigma_units(time, range_instru): """Calculates Gaussian peak std parameters. The amount of smoothing is hard coded. This function calculates how many steps in time and height corresponds to this smoothing. Args: time (ndarray): 1D vector (fraction hour). range_instru (ndarray): 1D vector (m). Returns: tuple: Two element tuple containing number of steps in time and height to achieve wanted smoothing. """ minutes_in_hour = 60 sigma_minutes = 2 sigma_metres = 5 time_step = utils.mdiff(time) * minutes_in_hour alt_step = utils.mdiff(range_instru) x_std = sigma_minutes / time_step y_std = sigma_metres / alt_step return x_std, y_std
def test_mdiff(input, output): assert utils.mdiff(input) == output
def _calc_range(self): """Assumes 'range' means the upper limit of range gate.""" ceilo_range = self._getvar('range') return ceilo_range - utils.mdiff(ceilo_range) / 2
def _estimate_snr_gain(time_sparse: np.ndarray, time_dense: np.ndarray) -> float: """Returns factor for SNR (dB) increase when data is binned.""" binning_ratio = utils.mdiff(time_sparse) / utils.mdiff(time_dense) return np.sqrt(binning_ratio)
def __init__(self, model: Model, classification: ClassificationResult): self._dheight = utils.mdiff(model.height) self._model = model.data_dense self._liquid_in_pixel = utils.isbit(classification.category_bits, 0) self.classification = classification
def _number_of_pulses(): """Returns number of independent pulses.""" seconds_in_hour = 3600 dwell_time = utils.mdiff(self.time) * seconds_in_hour return (dwell_time * self.radar_frequency * 1e9 * 4 * np.sqrt(math.pi) * self.data['width'][:] / 3e8)