コード例 #1
0
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
コード例 #2
0
 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')
コード例 #3
0
 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")
コード例 #4
0
ファイル: lwc.py プロジェクト: bpospichal/cloudnetpy
 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)
コード例 #5
0
 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)
コード例 #6
0
 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
     )
コード例 #7
0
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
コード例 #8
0
def test_mdiff(input, output):
    assert utils.mdiff(input) == output
コード例 #9
0
 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
コード例 #10
0
ファイル: mira.py プロジェクト: actris-cloudnet/cloudnetpy
 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)
コード例 #11
0
 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
コード例 #12
0
 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)