pyart.util#

Description

Miscellaneous utility functions.

The location and names of these functions within Py-ART may change between versions without depreciation, use with caution.

Circular Statistics#

angular_mean(angles)

Compute the mean of a distribution of angles in radians.

angular_std(angles)

Compute the standard deviation of a distribution of angles in radians.

angular_mean_deg(angles)

Compute the mean of a distribution of angles in degrees.

angular_std_deg(angles)

Compute the standard deviation of a distribution of angles in degrees.

interval_mean(dist, interval_min, interval_max)

Compute the mean of a distribution within an interval.

interval_std(dist, interval_min, interval_max)

Compute the standard deviation of a distribution within an interval.

mean_of_two_angles(angles1, angles2)

Compute the element by element mean of two sets of angles.

mean_of_two_angles_deg(angle1, angle2)

Compute the element by element mean of two sets of angles in degrees.

compute_directional_stats(field[, avg_type, ...])

Computes the mean or the median along one of the axis (ray or range)

Datetime Utilities#

datetime_from_radar(radar[, epoch])

Return a datetime for the first ray in a Radar.

datetimes_from_radar(radar[, epoch])

Return an array of datetimes for the rays in a Radar.

datetime_from_dataset(dataset[, epoch])

Return a datetime for the first time in a netCDF Dataset.

datetimes_from_dataset(dataset[, epoch])

Return an array of datetimes for the times in a netCDF Dataset.

datetime_from_grid(grid[, epoch])

Return a datetime for the volume start in a Grid.

EPOCH_UNITS

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Column Section#

for_azimuth(radar_latitude, target_latitude, ...)

Calculation of inital bearing alongitudeg a great-circle arc Known as Forward Azimuth Angle.

get_column_rays(radar, azimuth)

Given the location (in latitude,longitude) of a target, return the rays that correspond to radar column above the target.

get_field_location(radar, latitude, longitude)

Given the location (in latitude, longitude) of a target, extract the radar column above that point for further analysis.

sphere_distance(radar_latitude, ...)

Calculated of the great circle distance between radar and target

Cross Section#

cross_section_ppi(radar, target_azimuths[, ...])

Extract cross sections from a PPI volume along one or more azimuth angles. :Parameters: * radar (Radar) -- Radar volume containing PPI sweeps from which azimuthal cross sections will be extracted. * target_azimuth (list) -- Azimuthal angles in degrees where cross sections will be taken. * az_tol (float, optional) -- Azimuth angle tolerance in degrees. If none the nearest angle is used. If valid only angles within the tolerance distance are considered.

cross_section_rhi(radar, target_elevations)

Extract cross sections from an RHI volume along one or more elevation angles. :Parameters: * radar (Radar) -- Radar volume containing RHI sweeps from which azimuthal cross sections will be extracted. * target_elevations (list) -- Elevation angles in degrees where cross sections will be taken. * el_tol (float, optional) -- Elevation angle tolerance in degrees. If none the nearest angle is used. If valid only angles within the tolerance distance are considered.

get_target_elevations(radar)

Gets RHI target elevations :Parameters: radar (Radar object) -- radar object

colocated_gates(radar1, radar2[, h_tol, ...])

Flags radar gates of radar1 colocated with radar2 :Parameters: * radar1 (Radar) -- radar object that is going to be flagged * radar2 (Radar) -- radar object * h_tol (float) -- tolerance in altitude [m] * latlon_tol (float) -- tolerance in latitude/longitude [deg] * coloc_gates_field (string) -- Name of the field to retrieve the data

colocated_gates2(radar1, radar2[, ...])

Flags radar gates of radar1 co-located with radar2. Uses nearest neighbour calculation with cKDTree :Parameters: * radar1 (Radar) -- radar object that is going to be flagged * radar2 (Radar) -- radar object * distance_upper_bound (float) -- upper bound of the distance between neighbours (m) * coloc_gates_field (string) -- Name of the field to retrieve the data.

intersection(radar1, radar2[, h_tol, ...])

Flags region of radar1 that is intersecting with radar2 and complies with criteria regarding visibility, altitude, range, elevation angle and azimuth angle :Parameters: * radar1 (Radar) -- radar object that is going to be flagged * radar2 (Radar) -- radar object checked for intersecting region * h_tol (float) -- tolerance in altitude [m] * latlon_tol (float) -- latitude and longitude tolerance [decimal deg] * vol_d_tol (float) -- pulse volume diameter tolerance [m] * vismin (float) -- minimum visibility [percentage] * hmin, hmax (floats) -- min and max altitude [m MSL] * rmin, rmax (floats) -- min and max range from radar [m] * elmin, elmax (floats) -- min and max elevation angle [deg] * azmin, azmax (floats) -- min and max azimuth angle [deg]

Noise estimation#

estimate_noise_hs74(spectrum[, navg, nnoise_min])

Estimate noise parameters of a Doppler spectrum.

estimate_noise_ivic13(pwr_w_ray[, pct, ...])

Estimate noise parameters of a ray

get_ivic_pct(npulses[, pct, prob_thr])

Get the point clutter threshold (PCT)

get_ivic_flat_reg_var_max(npulses, flat_reg_wlen)

Get the threshold for maximum local variance of noise [dB]

get_ivic_snr_thr(npulses[, pfa_thr])

Get the threshold for steps 3 and 6 of ivic

ivic_pct_table(npulses)

Get the point clutter threshold (PCT) of Ivic from a look up table.

ivic_snr_thr_table(npulses)

Get the threshold for steps 3 and 6 of ivic from a look up table The thresholds are computed for between 1 and 200 pulses.

ivic_flat_reg_var_max_table(npulses)

Get maximum variance of noise of Ivic from a look up table.

ivic_flat_reg_wind_len_table(npulses)

Get the size of the flat region window length as a function of the number of pulses.

Radar Utilities#

is_vpt(radar[, offset])

Determine if a Radar appears to be a vertical pointing scan.

to_vpt(radar[, single_scan])

Convert an existing Radar object to represent a vertical pointing scan.

join_radar(radar1, radar2[, coerce_angles])

Combine two radar instances into one.

join_spectra(spectra1, spectra2)

Combine two spectra instances into one.

subset_radar(radar, field_names[, rng_min, ...])

Cuts the radar object into new dimensions

subset_radar_spectra(radar, field_names[, ...])

Cuts the radar spectra object into new dimensions

radar_from_spectra(psr)

obtain a Radar object from a RadarSpectra object

interpol_spectra(psr[, kind, fill_value])

Interpolates the spectra so that it has a uniform grid

find_neighbour_gates(radar, azi, rng[, ...])

Find the neighbouring gates within +-delta_azi and +-delta_rng

compute_azimuthal_average(radar, field_names)

Computes the azimuthal average

ma_broadcast_to(array, tup)

Is used to guarantee that a masked array can be broadcasted without loosing the mask

image_mute_radar(radar, field, mute_field, ...)

This function will split a field based on thresholds from another field.

determine_sweeps(radar[, max_offset, ...])

Determine the number of sweeps using elevation data (PPI scans) or azimuth data (RHI scans) and update the input radar object

Simulated Velocity#

simulated_vel_from_profile(radar, profile[, ...])

Create simulated radial velocities from a profile of horizontal winds.

Signal Mathematics#

texture_along_ray(radar, var[, wind_size])

Compute field texture along ray using a user specified window size.

rolling_window(a, window)

create a rolling window object for application of functions eg: result=np.ma.std(array, 11), 1)

texture(radar, var)

Determine a texture field using an 11pt stdev texarray=texture(pyradarobj, field).

angular_texture_2d(image, N, interval)

Compute the angular texture of an image.

grid_texture_2d(field[, xwind, ywind])

Compute the local standard deviation of a gridded field

compute_nse(obs_data, mod_data)

Computes the Nash-Sutcliff model efficiency coefficient between observed and modeled profiles

compute_corr(vec1, vec2)

Computes the Pearson correlation coefficient between two arrays

compute_mse(arr1, arr2)

Computes the mean square error between two arrays

Functions

angular_mean(angles)

Compute the mean of a distribution of angles in radians.

angular_mean_deg(angles)

Compute the mean of a distribution of angles in degrees.

angular_std(angles)

Compute the standard deviation of a distribution of angles in radians.

angular_std_deg(angles)

Compute the standard deviation of a distribution of angles in degrees.

angular_texture_2d(image, N, interval)

Compute the angular texture of an image.

colocated_gates(radar1, radar2[, h_tol, ...])

Flags radar gates of radar1 colocated with radar2 :Parameters: * radar1 (Radar) -- radar object that is going to be flagged * radar2 (Radar) -- radar object * h_tol (float) -- tolerance in altitude [m] * latlon_tol (float) -- tolerance in latitude/longitude [deg] * coloc_gates_field (string) -- Name of the field to retrieve the data

colocated_gates2(radar1, radar2[, ...])

Flags radar gates of radar1 co-located with radar2. Uses nearest neighbour calculation with cKDTree :Parameters: * radar1 (Radar) -- radar object that is going to be flagged * radar2 (Radar) -- radar object * distance_upper_bound (float) -- upper bound of the distance between neighbours (m) * coloc_gates_field (string) -- Name of the field to retrieve the data.

compute_azimuthal_average(radar, field_names)

Computes the azimuthal average

compute_corr(vec1, vec2)

Computes the Pearson correlation coefficient between two arrays

compute_directional_stats(field[, avg_type, ...])

Computes the mean or the median along one of the axis (ray or range)

compute_mse(arr1, arr2)

Computes the mean square error between two arrays

compute_nse(obs_data, mod_data)

Computes the Nash-Sutcliff model efficiency coefficient between observed and modeled profiles

cross_section_ppi(radar, target_azimuths[, ...])

Extract cross sections from a PPI volume along one or more azimuth angles. :Parameters: * radar (Radar) -- Radar volume containing PPI sweeps from which azimuthal cross sections will be extracted. * target_azimuth (list) -- Azimuthal angles in degrees where cross sections will be taken. * az_tol (float, optional) -- Azimuth angle tolerance in degrees. If none the nearest angle is used. If valid only angles within the tolerance distance are considered.

cross_section_rhi(radar, target_elevations)

Extract cross sections from an RHI volume along one or more elevation angles. :Parameters: * radar (Radar) -- Radar volume containing RHI sweeps from which azimuthal cross sections will be extracted. * target_elevations (list) -- Elevation angles in degrees where cross sections will be taken. * el_tol (float, optional) -- Elevation angle tolerance in degrees. If none the nearest angle is used. If valid only angles within the tolerance distance are considered.

datetime_from_dataset(dataset[, epoch])

Return a datetime for the first time in a netCDF Dataset.

datetime_from_grid(grid[, epoch])

Return a datetime for the volume start in a Grid.

datetime_from_radar(radar[, epoch])

Return a datetime for the first ray in a Radar.

datetimes_from_dataset(dataset[, epoch])

Return an array of datetimes for the times in a netCDF Dataset.

datetimes_from_radar(radar[, epoch])

Return an array of datetimes for the rays in a Radar.

determine_sweeps(radar[, max_offset, ...])

Determine the number of sweeps using elevation data (PPI scans) or azimuth data (RHI scans) and update the input radar object

estimate_noise_hs74(spectrum[, navg, nnoise_min])

Estimate noise parameters of a Doppler spectrum.

estimate_noise_ivic13(pwr_w_ray[, pct, ...])

Estimate noise parameters of a ray

find_neighbour_gates(radar, azi, rng[, ...])

Find the neighbouring gates within +-delta_azi and +-delta_rng

for_azimuth(radar_latitude, target_latitude, ...)

Calculation of inital bearing alongitudeg a great-circle arc Known as Forward Azimuth Angle.

get_column_rays(radar, azimuth)

Given the location (in latitude,longitude) of a target, return the rays that correspond to radar column above the target.

get_field_location(radar, latitude, longitude)

Given the location (in latitude, longitude) of a target, extract the radar column above that point for further analysis.

get_ivic_flat_reg_var_max(npulses, flat_reg_wlen)

Get the threshold for maximum local variance of noise [dB]

get_ivic_pct(npulses[, pct, prob_thr])

Get the point clutter threshold (PCT)

get_ivic_snr_thr(npulses[, pfa_thr])

Get the threshold for steps 3 and 6 of ivic

get_target_elevations(radar)

Gets RHI target elevations :Parameters: radar (Radar object) -- radar object

grid_texture_2d(field[, xwind, ywind])

Compute the local standard deviation of a gridded field

image_mute_radar(radar, field, mute_field, ...)

This function will split a field based on thresholds from another field.

interpol_spectra(psr[, kind, fill_value])

Interpolates the spectra so that it has a uniform grid

intersection(radar1, radar2[, h_tol, ...])

Flags region of radar1 that is intersecting with radar2 and complies with criteria regarding visibility, altitude, range, elevation angle and azimuth angle :Parameters: * radar1 (Radar) -- radar object that is going to be flagged * radar2 (Radar) -- radar object checked for intersecting region * h_tol (float) -- tolerance in altitude [m] * latlon_tol (float) -- latitude and longitude tolerance [decimal deg] * vol_d_tol (float) -- pulse volume diameter tolerance [m] * vismin (float) -- minimum visibility [percentage] * hmin, hmax (floats) -- min and max altitude [m MSL] * rmin, rmax (floats) -- min and max range from radar [m] * elmin, elmax (floats) -- min and max elevation angle [deg] * azmin, azmax (floats) -- min and max azimuth angle [deg]

interval_mean(dist, interval_min, interval_max)

Compute the mean of a distribution within an interval.

interval_std(dist, interval_min, interval_max)

Compute the standard deviation of a distribution within an interval.

is_vpt(radar[, offset])

Determine if a Radar appears to be a vertical pointing scan.

ivic_flat_reg_var_max_table(npulses)

Get maximum variance of noise of Ivic from a look up table.

ivic_flat_reg_wind_len_table(npulses)

Get the size of the flat region window length as a function of the number of pulses.

ivic_pct_table(npulses)

Get the point clutter threshold (PCT) of Ivic from a look up table.

ivic_snr_thr_table(npulses)

Get the threshold for steps 3 and 6 of ivic from a look up table The thresholds are computed for between 1 and 200 pulses.

join_radar(radar1, radar2[, coerce_angles])

Combine two radar instances into one.

join_spectra(spectra1, spectra2)

Combine two spectra instances into one.

ma_broadcast_to(array, tup)

Is used to guarantee that a masked array can be broadcasted without loosing the mask

mean_of_two_angles(angles1, angles2)

Compute the element by element mean of two sets of angles.

mean_of_two_angles_deg(angle1, angle2)

Compute the element by element mean of two sets of angles in degrees.

radar_from_spectra(psr)

obtain a Radar object from a RadarSpectra object

rolling_window(a, window)

create a rolling window object for application of functions eg: result=np.ma.std(array, 11), 1)

simulated_vel_from_profile(radar, profile[, ...])

Create simulated radial velocities from a profile of horizontal winds.

sphere_distance(radar_latitude, ...)

Calculated of the great circle distance between radar and target

subset_radar(radar, field_names[, rng_min, ...])

Cuts the radar object into new dimensions

subset_radar_spectra(radar, field_names[, ...])

Cuts the radar spectra object into new dimensions

texture(radar, var)

Determine a texture field using an 11pt stdev texarray=texture(pyradarobj, field).

texture_along_ray(radar, var[, wind_size])

Compute field texture along ray using a user specified window size.

to_vpt(radar[, single_scan])

Convert an existing Radar object to represent a vertical pointing scan.