pyrad.util#

Description

Utilities (pyrad.util)#

Functions to read and write data and configuration files.

Radar Utilities#

time_avg_range(timeinfo, avg_starttime, ...)

finds the new start and end time of an averaging

get_closest_solar_flux(hit_datetime_list, ...)

finds the solar flux measurement closest to the sun hit

create_sun_hits_field(rad_el, rad_az, ...)

creates a sun hits field from the position and power of the sun hits

create_sun_retrieval_field(par, field_name, ...)

creates a sun retrieval field from the retrieval parameters

compute_histogram(field, field_name[, ...])

computes histogram of the data

compute_histogram_sweep(field, ray_start, ...)

computes histogram of the data in a particular sweep

compute_quantiles(field[, quantiles])

computes quantiles

compute_quantiles_sweep(field, ray_start, ...)

computes quantiles of a particular sweep

compute_quantiles_from_hist(bin_centers, hist)

computes quantiles from histograms

get_range_bins_to_avg(rad1_rng, rad2_rng)

Compares the resolution of two radars and determines if and which radar has to be averaged and the length of the averaging window

find_ray_index(ele_vec, azi_vec, ele, azi[, ...])

Find the ray index corresponding to a particular elevation and azimuth

find_rng_index(rng_vec, rng[, rng_tol])

Find the range index corresponding to a particular range

find_nearest_gate(radar, lat, lon[, latlon_tol])

Find the radar gate closest to a lat,lon point

find_colocated_indexes(radar1, radar2, ...)

Given the theoretical elevation, azimuth and range of the co-located gates of two radars and a given tolerance returns the indices of the gates for the current radars

find_contiguous_times(times[, step])

Given and array of ordered times, find those contiguous according to a maximum time step

compute_2d_hist(field1, field2, field_name1, ...)

computes a 2D histogram of the data

compute_1d_stats(field1, field2)

returns statistics of data

compute_2d_stats(field1, field2, ...[, ...])

computes a 2D histogram and statistics of the data

time_series_statistics(t_in_vec, val_in_vec)

Computes statistics over a time-averaged series.

join_time_series(t1, val1, t2, val2[, dropnan])

joins time_series.

rainfall_accumulation(t_in_vec, val_in_vec)

Computes the rainfall accumulation of a time series over a given period

get_ROI(radar, fieldname, sector)

filter out any data outside the region of interest defined by sector

belongs_roi_indices(lat, lon, roi[, use_latlon])

Get the indices of points that belong to roi in a list of points

project_to_vertical(data_in, data_height, ...)

Projects radar data to a regular vertical grid

get_data_along_rng(radar, field_name, ...[, ...])

Get data at particular (azimuths, elevations)

get_data_along_azi(radar, field_name, ...[, ...])

Get data at particular (ranges, elevations)

get_data_along_ele(radar, field_name, ...[, ...])

Get data at particular (ranges, azimuths)

get_fixed_rng_data(radar, field_names, fixed_rng)

Creates a 2D-grid with (azi, ele) data at a fixed range

get_cercle_coords(x_centre, y_centre[, ...])

Get the points defining a cercle from the position of its centre and the radius

get_box_coords(x_point, y_point[, ...])

Get the points defining a rectangle from the position of its centre and the radius

compute_profile_stats(field, gate_altitude, ...)

Compute statistics of vertical profile

compute_average_vad(radar_list, z_want, ...)

Computes a profile of horizontal wind by averaging the VAD profiles of multiple radars

Statistical Utilities#

quantiles_weighted(values[, weight_vector, ...])

Given a set of values and weights, compute the weighted quantile(s) and average.

ratio_bootstrapping(nominator, denominator)

Computes a set of samples obtained as sum(nominator)/sum(denominator) where the nominator and the denominator are randomly sampled with replacement.

Data Retrieval Utilities#

retrieve_hzt_prod(folder_out, start_time, ...)

Retrieves the preprocessed HZT products from the CSCS repository for a specified time range, unzips them and places them in a specified folder

retrieve_hzt_RT(tstep)

Retrieves the preprocessed HZT products

retrieve_mch_prod(folder_out, start_time, ...)

Retrieves radar data from the CSCS repository for a specified time range, unzips them and places them in a specified folder

retrieve_mch_prod_RT(time, product_name[, ...])

Adapted function from rainforest.common.retrieve_data

retrieve_CPCCV(time, stations)

Retrieves cross-validation CPC data for a set of stations from the xls files prepared by Yanni

retrieve_AQC_XLS(time, stations)

Retrieves cross-validation CPC data for a set of stations from the xls files prepared by Yanni

Functions

belongs_roi_indices(lat, lon, roi[, use_latlon])

Get the indices of points that belong to roi in a list of points

compute_1d_stats(field1, field2)

returns statistics of data

compute_2d_hist(field1, field2, field_name1, ...)

computes a 2D histogram of the data

compute_2d_stats(field1, field2, ...[, ...])

computes a 2D histogram and statistics of the data

compute_average_vad(radar_list, z_want, ...)

Computes a profile of horizontal wind by averaging the VAD profiles of multiple radars

compute_histogram(field, field_name[, ...])

computes histogram of the data

compute_histogram_sweep(field, ray_start, ...)

computes histogram of the data in a particular sweep

compute_profile_stats(field, gate_altitude, ...)

Compute statistics of vertical profile

compute_quantiles(field[, quantiles])

computes quantiles

compute_quantiles_from_hist(bin_centers, hist)

computes quantiles from histograms

compute_quantiles_sweep(field, ray_start, ...)

computes quantiles of a particular sweep

create_sun_hits_field(rad_el, rad_az, ...)

creates a sun hits field from the position and power of the sun hits

create_sun_retrieval_field(par, field_name, ...)

creates a sun retrieval field from the retrieval parameters

find_colocated_indexes(radar1, radar2, ...)

Given the theoretical elevation, azimuth and range of the co-located gates of two radars and a given tolerance returns the indices of the gates for the current radars

find_contiguous_times(times[, step])

Given and array of ordered times, find those contiguous according to a maximum time step

find_nearest_gate(radar, lat, lon[, latlon_tol])

Find the radar gate closest to a lat,lon point

find_ray_index(ele_vec, azi_vec, ele, azi[, ...])

Find the ray index corresponding to a particular elevation and azimuth

find_rng_index(rng_vec, rng[, rng_tol])

Find the range index corresponding to a particular range

get_ROI(radar, fieldname, sector)

filter out any data outside the region of interest defined by sector

get_box_coords(x_point, y_point[, ...])

Get the points defining a rectangle from the position of its centre and the radius

get_cercle_coords(x_centre, y_centre[, ...])

Get the points defining a cercle from the position of its centre and the radius

get_closest_solar_flux(hit_datetime_list, ...)

finds the solar flux measurement closest to the sun hit

get_data_along_azi(radar, field_name, ...[, ...])

Get data at particular (ranges, elevations)

get_data_along_ele(radar, field_name, ...[, ...])

Get data at particular (ranges, azimuths)

get_data_along_rng(radar, field_name, ...[, ...])

Get data at particular (azimuths, elevations)

get_fixed_rng_data(radar, field_names, fixed_rng)

Creates a 2D-grid with (azi, ele) data at a fixed range

get_range_bins_to_avg(rad1_rng, rad2_rng)

Compares the resolution of two radars and determines if and which radar has to be averaged and the length of the averaging window

join_time_series(t1, val1, t2, val2[, dropnan])

joins time_series.

project_to_vertical(data_in, data_height, ...)

Projects radar data to a regular vertical grid

quantiles_weighted(values[, weight_vector, ...])

Given a set of values and weights, compute the weighted quantile(s) and average.

rainfall_accumulation(t_in_vec, val_in_vec)

Computes the rainfall accumulation of a time series over a given period

ratio_bootstrapping(nominator, denominator)

Computes a set of samples obtained as sum(nominator)/sum(denominator) where the nominator and the denominator are randomly sampled with replacement.

retrieve_AQC_XLS(time, stations)

Retrieves cross-validation CPC data for a set of stations from the xls files prepared by Yanni

retrieve_CPCCV(time, stations)

Retrieves cross-validation CPC data for a set of stations from the xls files prepared by Yanni

retrieve_hzt_RT(tstep)

Retrieves the preprocessed HZT products

retrieve_hzt_prod(folder_out, start_time, ...)

Retrieves the preprocessed HZT products from the CSCS repository for a specified time range, unzips them and places them in a specified folder

retrieve_mch_prod(folder_out, start_time, ...)

Retrieves radar data from the CSCS repository for a specified time range, unzips them and places them in a specified folder

retrieve_mch_prod_RT(time, product_name[, ...])

Adapted function from rainforest.common.retrieve_data

time_avg_range(timeinfo, avg_starttime, ...)

finds the new start and end time of an averaging

time_series_statistics(t_in_vec, val_in_vec)

Computes statistics over a time-averaged series.