rca package

Submodules

rca.baseline module

rca.baseline.baseline(radar_config_file, filters=False)[source]

baseline loops through a day’s worth of radar files (specify PPI or HSRHI), calculates the median daily 95th percentile clutter area reflectivity, and saves the value to a netCDF as the baseline 95th percentile clutter area reflectivity.

Parameters
  • radar_config_file (str) – path to JSON file containing specifications: data directory, file extension, clutter map directory, output directory for baseline netCDF, baseline date, scan type, polarization, site, instrument, range limit

  • filters (boolean) – Include IAH and RH filters

rca.calculate_dbz95 module

rca.calculate_dbz95.calculate_dbz95_ppi(variable_dictionary, polarization, range_limit, radar_band, clutter_mask_h, clutter_mask_v=None)[source]

calculate_dbz95_ppi calculates the 95th percentile reflectivity for a given radar PPI file using the input PPI cluter map masks (H and/or V). Returns the date and time of the file, 95th percentile reflectivity value for Zh and/or Zv, and dictionaries of statistics, including number of points, histogram/PDF, bins, CDF.

Parameters
  • variable_dictionary (dict) – dictionary with values, strings, and arrays of relevant radar data i.e. ‘reflectivity_h’, ‘reflectivity_v’, ‘azimuth’, ‘range’, ‘date_time’

  • polarization (str) – specifies for which polarization user wants to create clutter flag array ‘dual’: calculate for both H and V ‘horizontal’: calculate only for H

  • range_limit (int) – value of desired radar gate range limit

  • radar_band (str) – one or two letter code for radar band

  • clutter_mask_h (MaskedArray) – masked array denotes which elements are considered clutter used to extract reflectivity values from overlapping radar gates for H polarization

  • clutter_mask_h – masked array denotes which elements are considered clutter used to extract reflectivity values from overlapping radar gates for V polarization default is None, array must be provided if calculating for V polarization

Returns

  • date_time (str) – date and time of the file

  • dbz95_h (float (or array?)) – value of the 95th percentile clutter area reflectivity for H polarization

  • stats_h (dict) – contains statistics from the PDF and CDF of the clutter area reflectivity in H polarization num_pts_h: number of points hn: number of histogram bins hbins: bin edges of histogram hp: CDF dbz95_h: 95th percentile reflectivity

  • dbz95_v (float (or array?)) – value of the 95th percentile clutter area reflectivity for V polarization

  • stats_v (dict) – contains statistics from the PDF and CDF of the clutter area reflectivity in V polarization num_pts_v: number of points vn: number of histogram bins vbins: bin edges of histogram vp: CDF dbz95_v: 95th percentile reflectivity

rca.calculate_dbz95.calculate_dbz95_rhi(variable_dictionary, polarization, range_limit, radar_band, clutter_mask_h, clutter_mask_v=None)[source]

calculate_dbz95_rhi calculates the 95th percentile reflectivity for a given radar HSRHI file using the input HSRHI cluter map masks (H and/or V). Returns the date and time of the file, 95th percentile reflectivity value for Zh and/or Zv, and dictionaries of statistics, including number of points, histogram/PDF, bins, CDF.

Parameters
  • variable_dictionary (dict) – dictionary with values, strings, and arrays of relevant radar data i.e. ‘reflectivity_h’, ‘reflectivity_v’, ‘azimuth’, ‘range’, ‘date_time’, ‘elevation’

  • polarization (str) – specifies for which polarization user wants to create clutter flag array ‘dual’: calculate for both H and V ‘horizontal’: calculate only for H

  • range_limit (int) – value of desired radar gate range limit

  • radar_band (str) – one or two letter code for radar band

  • clutter_mask_h (MaskedArray) – masked array denotes which elements are considered clutter used to extract reflectivity values from overlapping radar gates for H polarization

  • clutter_mask_h – masked array denotes which elements are considered clutter used to extract reflectivity values from overlapping radar gates for V polarization default is None, array must be provided if calculating for V polarization

Returns

  • date_time (str) – date and time of the file

  • dbz95_h (float (or array?)) – value of the 95th percentile clutter area reflectivity for H polarization

  • stats_h (dict) – contains statistics from the PDF and CDF of the clutter area reflectivity in H polarization num_pts_h: number of points hn: number of histogram bins hbins: bin edges of histogram hp: CDF dbz95_h: 95th percentile reflectivity

  • dbz95_v (float (or array?)) – value of the 95th percentile clutter area reflectivity for V polarization

  • stats_v (dict) – contains statistics from the PDF and CDF of the clutter area reflectivity in V polarization num_pts_v: number of points vn: number of histogram bins vbins: bin edges of histogram vp: CDF dbz95_v: 95th percentile reflectivity

rca.clutter_map module

rca.clutter_map.clutter_map(radar_config_file, date)[source]

clutter_map loops through a day’s worth of radar files (specify PPI or HSRHI, dual or horizontal polarization) utilizes the create_clutter_flag function to flag clutter points for each scan. If more than 50% of the day’s scans have a gate identified, it is considered a clutter point and saved to the resulting clutter map. The clutter map (array) is written to a netCDF.

Parameters
  • radar_config_file (str) – path to JSON file containing specifications: data directory, file extension, output directory for clutter map, date of clutter map, scan type, polarization, site, instrument, range limit, reflectivity threshold

  • date (str) – date used for clutter map day in YYYYMMDD format (overrides what’s in config file)

rca.composite_clutter_map module

rca.composite_clutter_map.composite_clutter_map(radar_config_file)[source]

composite_clutter_map combines all daily clutter maps available or specified into a single composite clutter map for use in baseline and RCA calculation later. If more than 80% of the daily clutter points occur for all the daily clutter maps, that is considered a composite clutter point. The composite clutter map (array) is written to a netCDF.

Parameters

radar_config_file (str) – path to JSON file containing specifications: data directory, file extension, daily clutter map directory, scan type, polarization, site, instrument

rca.create_clutter_flag module

rca.create_clutter_flag.create_clutter_flag_ppi(variable_dictionary, polarization, range_limit, z_thresh, radar_band)[source]

create_clutter_flag_ppi creates a clutter flag array for a particular PPI radar file (using a precipitation-free day) that will be used for clutter map creation. It returns the datetime of the file and the clutter flag arrays for reflectivity in the chosen polarizations (H and V or just H)

Parameters
  • variable_dictionary (dict) – dictionary with values, strings, and arrays of relevant radar data i.e. ‘reflectivity_h’, ‘reflectivity_v’, ‘azimuth’, ‘range’, ‘date_time’

  • polarization (str) – specifies for which polarization user wants to create clutter flag array ‘dual’: calculate for both H and V ‘horizontal’: calculate only for H

  • range_limit (int) – value of desired radar gate range limit

  • z_thresh (float) – reflectivity threshold for clutter cut off i.e. gate reflectivity must be greater than z_thresh to be considered clutter

  • radar_band (str) – specify which band of radar is used (i.e. c, x, ka)

Returns

  • date_time (str) – date and time of the file

  • clutter_flag_h (array) – array of shape (azimuth, elevation, range) noting elements where clutter is flagged in the H polarization clutter present: 1 no clutter present: 0

  • clutter_flag_v (array) – array of shape (azimuth, elevation, range) noting elements where clutter is flagged in the V polarization clutter present: 1 no clutter present: 0

rca.create_clutter_flag.create_clutter_flag_rhi(variable_dictionary, polarization, range_limit, z_thresh, radar_band, modified=False)[source]

create_clutter_flag_rhi creates a clutter flag array for a particular HSRHI radar file (using a precipitation-free day) that will be used for clutter map creation. It returns the datetime of the file and the clutter flag arrays for reflectivity in the chosen polarizations (H and V or just H)

Parameters
  • variable_dictionary (dict) – dictionary with values, strings, and arrays of relevant radar data i.e. ‘reflectivity_h’, ‘reflectivity_v’, ‘azimuth’, ‘range’, ‘date_time’

  • polarization (str) – specifies for which polarization user wants to create clutter flag array ‘dual’: calculate for both H and V ‘horizontal’: calculate only for H

  • range_limit (int) – value of desired radar gate range limit

  • z_thresh (float) – reflectivity threshold for clutter cut off i.e. gate reflectivity must be greater than z_thresh to be considered clutter

  • radar_band (str) – specify which band of radar is used (i.e. c, x, ka)i

  • modified (keyword specifying use of modified HSRHI strategy) –

Returns

  • date_time (str) – date and time of the file

  • clutter_flag_h (array) – array of shape (azimuth, elevation, range) noting elements where clutter is flagged in the H polarization clutter present: 1 no clutter present: 0

  • clutter_flag_v (array) – array of shape (azimuth, elevation, range) noting elements where clutter is flagged in the V polarization clutter present: 1 no clutter present: 0

rca.daily_rca module

rca.daily_rca.daily_rca(radar_config_file, date, filters=False)[source]

daily_rca loops through a day’s worth of radar files (specify PPI or HSRHI, dual or horizontal polarization), calculates the median daily 95th percentile clutter area reflectivity, computes the RCA value using the established baseline 95h percentile clutter area reflectivity.

A running CSV is ammended to include the daily median RCA values.

Parameters
  • radar_config_file (str) – path to JSON file containing specifications: data directory, file extension, clutter map directory, baseline directory, baseline date, daily CSV directory, scan type, polarization, site, instrument, range limit

  • date (str) – YYYYMMDD specifying date of interest

  • filters (boolean) – Include IAH and RH filters

rca.filters module

rca.get_closest_time module

rca.get_closest_time.get_closest_time(time_array, target_time)[source]

rca.get_pct_on_clutter_map module

rca.get_pct_on_clutter_map.get_pct_on_clutter_map_ppi(filename, polarization)[source]

get_pct_on_clutter_map_ppi grabs and returns clutter map point percentage occurrences and clutter map masks from daily PPI clutter maps (in either H or H and V polarizations).

Parameters
  • filename (str) – full path to daily clutter map file

  • polarization (str) – specifies for which polarization user wants to create clutter flag array ‘dual’: calculate for both H and V ‘horizontal’: calculate only for H

Returns

  • clutter_map_mask_h (array) – array of shape (azimuth, range) noting elements where clutter is flagged in the H polarization #clutter present: 1 #no clutter present: 0

  • clutter_map_mask_v (array) – array of shape (azimuth, range) noting elements where clutter is flagged in the V polarization #clutter present: 1 #no clutter present: 0

  • clutter_map_pcts_h (array) – array of shape (azimuth, range) percentage occurrence values of clutter map elements in the H polarization

  • clutter_map_pcts_v (array) – array of shape (azimuth, range) percentage occurrence values of clutter map elements in the V polarization

rca.get_pct_on_clutter_map.get_pct_on_clutter_map_rhi(filename, polarization)[source]

get_pct_on_clutter_map_rhi grabs and returns clutter map point percentage occurrences and clutter map masks from daily HSRHI clutter maps (in either H or H and V polarizations).

Parameters
  • filename (str) – full path to daily clutter map file

  • polarization (str) – specifies for which polarization user wants to create clutter flag array ‘dual’: calculate for both H and V ‘horizontal’: calculate only for H

Returns

  • clutter_map_mask_h (array) – array of shape (azimuth, elevation, range) noting elements where clutter is flagged in the H polarization #clutter present: 1 #no clutter present: 0

  • clutter_map_mask_v (array) – array of shape (azimuth, elevation, range) noting elements where clutter is flagged in the V polarization #clutter present: 1 #no clutter present: 0

  • clutter_map_pcts_h (array) – array of shape (azimuth, elevation, range) percentage occurrence values of clutter map elements in the H polarization

  • clutter_map_pcts_v (array) – array of shape (azimuth, elevation, range) percentage occurrence values of clutter map elements in the V polarization

rca.iah_filter module

rca.iah_filter.iah_filter_ppi(variable_dictionary, polarization, range_limit, radar_band, clutter_mask_h, clutter_mask_v=None)[source]

iah_filter_ppi uses a previously generated clutter map to 1) identify clutter gates; 2) blank out identified clutter gates; 3) calculate integrated attentuation along each ray; 4) threshold for integrated attentuation; 5) return a 1 or 0 for passing or not passing IAH filter

Parameters
  • variable_dictionary (dict) – dictionary with values, strings, and arrays of relevant radar data i.e. ‘reflectivity_h’, ‘reflectivity_v’, ‘azimuth’, ‘range’, ‘date_time’

  • polarization (str) – specifies for which polarization user wants to create clutter flag array ‘dual’: calculate for both H and V ‘horizontal’: calculate only for H

  • range_limit (int) – value of desired radar gate range limit

  • radar_band (str) – one or two letter code for radar band

  • clutter_mask_h (MaskedArray) – masked array denotes which elements are considered clutter used to extract reflectivity values from overlapping radar gates for H polarization

  • clutter_mask_h – masked array denotes which elements are considered clutter used to extract reflectivity values from overlapping radar gates for V polarization default is None, array must be provided if calculating for V polarization

Returns

  • date_time (str) – date and time of the file

  • pass_filter (int) – 0 or 1 (0=no, 1=yes)

rca.iah_filter.iah_filter_rhi(variable_dictionary, polarization, range_limit, radar_band, clutter_mask_h, clutter_mask_v=None)[source]

iah_filter_rhi uses a previously generated clutter map to 1) identify clutter gates; 2) blank out identified clutter gates; 3) calculate integrated attentuation along each ray; 4) threshold for integrated attentuation; 5) return a 1 or 0 for passing or not passing IAH filter

Parameters
  • variable_dictionary (dict) – dictionary with values, strings, and arrays of relevant radar data i.e. ‘reflectivity_h’, ‘reflectivity_v’, ‘azimuth’, ‘range’, ‘date_time’

  • polarization (str) – specifies for which polarization user wants to create clutter flag array ‘dual’: calculate for both H and V ‘horizontal’: calculate only for H

  • range_limit (int) – value of desired radar gate range limit

  • radar_band (str) – one or two letter code for radar band

  • clutter_mask_h (MaskedArray) – masked array denotes which elements are considered clutter used to extract reflectivity values from overlapping radar gates for H polarization

  • clutter_mask_h – masked array denotes which elements are considered clutter used to extract reflectivity values from overlapping radar gates for V polarization default is None, array must be provided if calculating for V polarization

Returns

  • date_time (str) – date and time of the file

  • pass_filter (int) – 0 or 1 (0=no, 1=yes)

rca.rh_filter module

rca.rh_filter.rh_filter(date, variable_dictionary, met_dataframe, rh_thresh)[source]

rh_filter uses TODO: FILL IN

Parameters
  • date (str) – YYYYMMDD

  • variable_dictionary (dict) – dictionary with values, strings, and arrays of relevant radar data i.e. ‘reflectivity_h’, ‘reflectivity_v’, ‘azimuth’, ‘range’, ‘date_time’

  • met_path (str) – path to met station files

  • rh_thresh (int) – threshold of relative humidity (%) for passing the RH filter

Returns

pass_filter – 0 or 1 (0=no, 1=yes)

Return type

int

Module contents

Mapping (rca)

Py-ART has a robust function for mapping radar data from the collected radar coordinates to Cartesian coordinates. .. autosummary:

:toctree: generated/
plot