Auxiliary input and output (pyart.aux_io
)¶
Additional classes and functions for reading and writing data from a number of file formats.
These auxiliary input/output routines are not as well polished as those in
pyart.io
. They may require addition dependencies beyond those required
for a standard Py-ART install, use non-standard function parameter and naming,
are not supported by the pyart.io.read()
function and are not fully
tested if tested at all. Please use these at your own risk.
Bugs in these function should be reported but fixing them may not be a priority.
Reading radar data¶
read_d3r_gcpex_nc (filename[, field_names, …]) |
Read a D3R GCPEX netCDF file. |
read_gamic (filename[, field_names, …]) |
Read a GAMIC hdf5 file. |
read_kazr (filename[, field_names, …]) |
Read K-band ARM Zenith Radar (KAZR) NetCDF ingest data. |
read_noxp_iphex_nc (filename[, field_names, …]) |
Read a NOXP IPHEX netCDF file. |
read_odim_h5 (filename[, field_names, …]) |
Read a ODIM_H5 file. |
read_pattern (filename, \*\*kwargs) |
Read a netCDF file from a PATTERN project X-band radar. |
read_radx (filename[, radx_dir]) |
Read a file by first converting it to Cf/Radial using RadxConvert. |
read_rainbow_wrl (filename[, field_names, …]) |
Read a RAINBOW file. |
read_metranet (filename[, field_names, rmax, …]) |
Read a METRANET file. |
read_cartesian_metranet (filename[, …]) |
Read a METRANET product file. |
read_gif (filename[, additional_metadata, …]) |
Read a MeteoSwiss operational radar data gif file. |
read_bin (filename[, additional_metadata, …]) |
Read a MeteoSwiss operational radar data binary file. |
read_iq (filename, filenames_iq[, …]) |
Read a rad4alp IQ file. |
read_rainbow_psr (filename, filenames_psr[, …]) |
Read a PSR file. |
read_rainbow_psr_spectra (filename, filenames_psr) |
Read a PSR file to get the complex spectra |
read_spectra (filename[, field_names, …]) |
Read a spectra netCDF file. |
read_cf1 (filename[, field_names, …]) |
Read a CF-1 netCDF file. |
Writing radar data¶
write_odim_h5 (filename, radar[, …]) |
Write a Radar object to a EUMETNET OPERA compliant HDF5 file. |
write_spectra (filename, radar[, format, …]) |
Write a Radar Spectra object to a netCDF file. |
-
pyart.aux_io.
convert_data
(values)[source]¶ Converts an string of values into the corresponding format
Parameters: - values: str
string containg the values to convert
Returns: - values : int, float, str or 1D array of int, float or str
The converted values
-
pyart.aux_io.
get_library
(verbose=False, momentms=True)[source]¶ return the link to C-shared library
Parameters: - verbose : Boolean
If true print out extra information
- momentsms : Boolean
If true returns the link to the MS library
Returns: - metranet_lib : link
loaded METRANET C-library
-
pyart.aux_io.
read_bin
(filename, additional_metadata=None, chy0=255.0, chx0=-160.0, xres=1.0, yres=1.0, nx=710, ny=640, nz=1, **kwargs)[source]¶ Read a MeteoSwiss operational radar data binary file.
Parameters: - filename : str
Name of the file to read.
- additional_metadata : dict of dicts, optional
Dictionary of dictionaries to retrieve metadata during this read. This metadata is not used during any successive file reads unless explicitly included. A value of None, the default, will not introduct any addition metadata and the file specific or default metadata as specified by the Py-ART configuration file will be used.
- chy0, chx0 : float
Swiss coordinates position of the south-western point in the grid
- xres, yres : float
resolution of each grid point [km]
- nx, ny, nz : int
dimensions of the grid
Returns: - grid : Grid
Grid object containing data the data.
-
pyart.aux_io.
read_cartesian_metranet
(filename, additional_metadata=None, chy0=255.0, chx0=-160.0, reader='C', **kwargs)[source]¶ Read a METRANET product file.
Parameters: - filename : str
Name of the METRANET file to read.
- additional_metadata : dict of dicts, optional
Dictionary of dictionaries to retrieve metadata during this read. This metadata is not used during any successive file reads unless explicitly included. A value of None, the default, will not introduct any addition metadata and the file specific or default metadata as specified by the Py-ART configuration file will be used.
- chy0, chx0 : float
Swiss coordinates position of the south-western point in the grid
- reader : str
The reader library to use. Can be either ‘C’ or ‘python’
Returns: - grid : Grid
Grid object containing data from METRANET file.
-
pyart.aux_io.
read_cf1
(filename, field_names=None, additional_metadata=None, file_field_names=False, exclude_fields=None, include_fields=None, delay_field_loading=False, **kwargs)[source]¶ Read a CF-1 netCDF file.
Parameters: - filename : str
Name of CF/Radial netCDF file to read data from.
- field_names : dict, optional
Dictionary mapping field names in the file names to radar field names. Unlike other read functions, fields not in this dictionary or having a value of None are still included in the radar.fields dictionary, to exclude them use the exclude_fields parameter. Fields which are mapped by this dictionary will be renamed from key to value.
- additional_metadata : dict of dicts, optional
This parameter is not used, it is included for uniformity.
- file_field_names : bool, optional
True to force the use of the field names from the file in which case the field_names parameter is ignored. False will use to field_names parameter to rename fields.
- exclude_fields : list or None, optional
List of fields to exclude from the radar object. This is applied after the file_field_names and field_names parameters. Set to None to include all fields specified by include_fields.
- include_fields : list or None, optional
List of fields to include from the radar object. This is applied after the file_field_names and field_names parameters. Set to None to include all fields not specified by exclude_fields.
- delay_field_loading : bool
True to delay loading of field data from the file until the ‘data’ key in a particular field dictionary is accessed. In this case the field attribute of the returned Radar object will contain LazyLoadDict objects not dict objects. Delayed field loading will not provide any speedup in file where the number of gates vary between rays (ngates_vary=True) and is not recommended.
Returns: - radar : Radar
Radar object.
Notes
This function has not been tested on “stream” Cfradial files.
-
pyart.aux_io.
read_d3r_gcpex_nc
(filename, field_names=None, additional_metadata=None, file_field_names=False, exclude_fields=None, include_fields=None, read_altitude_from_nc=False, **kwargs)[source]¶ Read a D3R GCPEX netCDF file.
Parameters: - filename : str
Name of the ODIM_H5 file to read.
- field_names : dict, optional
Dictionary mapping ODIM_H5 field names to radar field names. If a data type found in the file does not appear in this dictionary or has a value of None it will not be placed in the radar.fields dictionary. A value of None, the default, will use the mapping defined in the Py-ART configuration file.
- additional_metadata : dict of dicts, optional
Dictionary of dictionaries to retrieve metadata from during this read. This metadata is not used during any successive file reads unless explicitly included. A value of None, the default, will not introduct any addition metadata and the file specific or default metadata as specified by the Py-ART configuration file will be used.
- file_field_names : bool, optional
True to use the MDV data type names for the field names. If this case the field_names parameter is ignored. The field dictionary will likely only have a ‘data’ key, unless the fields are defined in additional_metadata.
- exclude_fields : list or None, optional
List of fields to exclude from the radar object. This is applied after the file_field_names and field_names parameters. Set to None to include all fields specified by include_fields.
- include_fields : list or None, optional
List of fields to include from the radar object. This is applied after the file_field_names and field_names parameters. Set to None to include all fields not specified by exclude_fields.
- read_altitude_from_nc : bool, optional
True if you want the altitude value to be read from the provider netCDF file. False will default to the value np.array([295.], dtype=’float64’)
Returns: - radar : Radar
Radar object containing data from ODIM_H5 file.
-
pyart.aux_io.
read_edge_netcdf
(filename, **kwargs)[source]¶ Read a EDGE NetCDF file.
Parameters: - filename : str
Name of EDGE NetCDF file to read data from.
Returns: - radar : Radar
Radar object.
-
pyart.aux_io.
read_file_c
(file, moment='ZH', physic_value=False, masked_array=False, verbose=False)¶ Reads a METRANET data file
Parameters: - file : str
file name
- moment : str
moment name
- physic_value : boolean
If true returns the physical value. Otherwise the digital value
- masked_array : boolean
If true returns a numpy masked array with NaN values masked. Otherwise returns a regular masked array with NaN values
- verbose : boolean
If true prints out extra information
Returns: - ret_data : RadarData object
An object containing the information read from the file
-
pyart.aux_io.
read_file_py
(file, moment='ZH', physic_value=False, masked_array=False, reorder_angles=True, verbose=False)¶ Reads a METRANET data file
Parameters: - file : str
file name
- moment : str
moment name
- physic_value : boolean
If true returns the physical value. Otherwise the digital value
- masked_array : boolean
If true returns a numpy masked array with NaN values masked. Otherwise returns a regular masked array with NaN values
- reorder_angles : boolean
If true angles are reordered
- verbose : boolean
If true prints out extra information
Returns: - ret_data : RadarData object
An object containing the information read from the file
-
pyart.aux_io.
read_gamic
(filename, field_names=None, additional_metadata=None, file_field_names=False, exclude_fields=None, include_fields=None, valid_range_from_file=True, units_from_file=True, pulse_width=None, **kwargs)[source]¶ Read a GAMIC hdf5 file.
Parameters: - filename : str
Name of GAMIC HDF5 file to read data from.
- field_names : dict, optional
Dictionary mapping field names in the file names to radar field names. Unlike other read functions, fields not in this dictionary or having a value of None are still included in the radar.fields dictionary, to exclude them use the exclude_fields parameter. Fields which are mapped by this dictionary will be renamed from key to value.
- additional_metadata : dict of dicts, optional
This parameter is not used, it is included for uniformity.
- file_field_names : bool, optional
True to force the use of the field names from the file in which case the field_names parameter is ignored. False will use to field_names parameter to rename fields.
- exclude_fields : list or None, optional
List of fields to exclude from the radar object. This is applied after the file_field_names and field_names parameters. Set to None to include all fields specified by include_fields.
- include_fields : list or None, optional
List of fields to include from the radar object. This is applied after the file_field_names and field_names parameters. Set to None to include all fields not specified by exclude_fields.
- valid_range_from_file : bool, optional
True to extract valid range (valid_min and valid_max) for all field from the file when they are present. False will not extract these parameters.
- units_from_file : bool, optional
True to extract the units for all fields from the file when available. False will not extract units using the default units for the fields.
- pulse_width : list or None,
Mandatory for gamic radar processors which have pulsewidth enums. pulse_width should contain the pulsewidth’ in us.
Returns: - radar : Radar
Radar object.
-
pyart.aux_io.
read_gif
(filename, additional_metadata=None, chy0=255.0, chx0=-160.0, xres=1.0, yres=1.0, nx=710, ny=640, nz=1, **kwargs)[source]¶ Read a MeteoSwiss operational radar data gif file.
Parameters: - filename : str
Name of the file to read.
- additional_metadata : dict of dicts, optional
Dictionary of dictionaries to retrieve metadata during this read. This metadata is not used during any successive file reads unless explicitly included. A value of None, the default, will not introduct any addition metadata and the file specific or default metadata as specified by the Py-ART configuration file will be used.
- chy0, chx0 : float
Swiss coordinates position of the south-western point in the grid
- xres, yres : float
resolution of each grid point [km]
- nx, ny, nz : int
dimensions of the grid
Returns: - grid : Grid
Grid object containing the data.
-
pyart.aux_io.
read_iq
(filename, filenames_iq, field_names=None, additional_metadata=None, file_field_names=False, exclude_fields=None, include_fields=None, reader='C', nbytes=4, prf=None, ang_tol=0.4, noise_h=None, noise_v=None, rconst_h=None, rconst_v=None, radconst_h=None, radconst_v=None, mfloss_h=1.0, mfloss_v=1.0, azi_min=None, azi_max=None, ele_min=None, ele_max=None, rng_min=None, rng_max=None, **kwargs)[source]¶ Read a rad4alp IQ file.
Parameters: - filename : str
Name of the METRANET file to be used as reference.
- filenames_iq : list of str
Name of the IQ files
- field_names : dict, optional
Dictionary mapping RAINBOW field names to radar field names. If a data type found in the file does not appear in this dictionary or has a value of None it will not be placed in the radar.fields dictionary. A value of None, the default, will use the mapping defined in the Py-ART configuration file.
- additional_metadata : dict of dicts, optional
Dictionary of dictionaries to retrieve metadata during this read. This metadata is not used during any successive file reads unless explicitly included. A value of None, the default, will not introduct any addition metadata and the file specific or default metadata as specified by the Py-ART configuration file will be used.
- file_field_names : bool, optional
True to use the MDV data type names for the field names. If this case the field_names parameter is ignored. The field dictionary will likely only have a ‘data’ key, unless the fields are defined in additional_metadata.
- exclude_fields : list or None, optional
List of fields to exclude from the radar object. This is applied after the file_field_names and field_names parameters. Set to None to include all fields specified by include_fields.
- include_fields : list or None, optional
List of fields to include from the radar object. This is applied after the file_field_names and field_names parameters. Set to None to include all fields not specified by exclude_fields.
- reader : str
The library used to read the METRANET reference file. Can be either ‘C’ or ‘python’
- nbytes : int
The number of bytes used to store the data in numpy arrays, e.g. if nbytes=4 then floats are going to be stored as np.float32
- prf : float
The PRF of the read scan
- ang_tol : float
Tolerated angle distance between nominal radar angle and angle in PSR files
- noise_h, noise_v : float
The estimated H(V) noise power (ADU) of the scan
- rconst_h, rconst_v : float
Dynamical factor used in the conversion from dBADU to dBm/dBZ
- radconst_h, radconst_v : float
The H(V) radar constant
- mfloss_h, mfloss_v : float
The H(V) matched filter losses in the receiver (dB)
- azi_min, azi_max, ele_min, ele_max : float or None
The minimum and maximum angles to keep (deg)
- rng_min, rng_max : float or None
The minimum and maximum ranges to keep (m)
Returns: - radar : Radar
Radar object containing data from PSR file.
-
pyart.aux_io.
read_kazr
(filename, field_names=None, additional_metadata=None, file_field_names=False, exclude_fields=None, include_fields=None)[source]¶ Read K-band ARM Zenith Radar (KAZR) NetCDF ingest data.
Parameters: - filename : str
Name of NetCDF file to read data from.
- field_names : dict, optional
Dictionary mapping field names in the file names to radar field names. Unlike other read functions, fields not in this dictionary or having a value of None are still included in the radar.fields dictionary, to exclude them use the exclude_fields parameter. Fields which are mapped by this dictionary will be renamed from key to value.
- additional_metadata : dict of dicts, optional
This parameter is not used, it is included for uniformity.
- file_field_names : bool, optional
True to force the use of the field names from the file in which case the field_names parameter is ignored. False will use to field_names parameter to rename fields.
- exclude_fields : list or None, optional
List of fields to exclude from the radar object. This is applied after the file_field_names and field_names parameters. Set to None to include all fields specified by include_fields.
- include_fields : list or None, optional
List of fields to include from the radar object. This is applied after the file_field_names and field_names parameters. Set to None to include all fields not specified by exclude_fields.
Returns: - radar : Radar
Radar object.
-
pyart.aux_io.
read_metranet
(filename, field_names=None, rmax=0.0, additional_metadata=None, file_field_names=False, exclude_fields=None, reader='C', nbytes=4, **kwargs)[source]¶ Read a METRANET file.
Parameters: - filename : str
Name of the METRANET file to read.
- field_names : dict, optional
Dictionary mapping METRANET field names to radar field names. If a data type found in the file does not appear in this dictionary or has a value of None it will not be placed in the radar.fields dictionary. A value of None, the default, will use the mapping defined in the Py-ART configuration file.
- rmax : float, optional
Maximum radar range to store in the radar object [m]. If 0 all data will be stored
- additional_metadata : dict of dicts, optional
Dictionary of dictionaries to retrieve metadata during this read. This metadata is not used during any successive file reads unless explicitly included. A value of None, the default, will not introduct any addition metadata and the file specific or default metadata as specified by the Py-ART configuration file will be used.
- file_field_names : bool, optional
True to use the MDV data type names for the field names. If this case the field_names parameter is ignored. The field dictionary will likely only have a ‘data’ key, unless the fields are defined in additional_metadata.
- exclude_fields : list or None, optional
List of fields to exclude from the radar object. This is applied after the file_field_names and field_names parameters.
- reader : str
The reader library to use. Can be either ‘C’ or ‘python’
- nbytes : int
The number of bytes used to store the data in numpy arrays, e.g. if nbytes=4 then floats are going to be stored as np.float32
Returns: - radar : Radar
Radar object containing data from METRANET file.
-
pyart.aux_io.
read_noxp_iphex_nc
(filename, field_names=None, additional_metadata=None, file_field_names=False, exclude_fields=None, **kwargs)[source]¶ Read a NOXP IPHEX netCDF file.
Parameters: - filename : str
Name of the netCDF file to read.
- field_names : dict, optional
Dictionary mapping netCDF field names to radar field names. If a data type found in the file does not appear in this dictionary or has a value of None it will not be placed in the radar.fields dictionary. A value of None, the default, will use the mapping defined in the Py-ART configuration file.
- additional_metadata : dict of dicts, optional
Dictionary of dictionaries to retrieve metadata from during this read. This metadata is not used during any successive file reads unless explicitly included. A value of None, the default, will not introduct any addition metadata and the file specific or default metadata as specified by the Py-ART configuration file will be used.
- file_field_names : bool, optional
True to use the netCDF data type names for the field names. If this case the field_names parameter is ignored. The field dictionary will likely only have a ‘data’ key, unless the fields are defined in additional_metadata.
- exclude_fields : list or None, optional
List of fields to exclude from the radar object. This is applied after the file_field_names and field_names parameters. Set to None to include all fields specified by include_fields.
- include_fields : list or None, optional
List of fields to include from the radar object. This is applied after the file_field_names and field_names parameters. Set to None to include all fields not specified by exclude_fields.
Returns: - radar : Radar
Radar object containing data from netCDF file.
-
pyart.aux_io.
read_odim_h5
(filename, field_names=None, additional_metadata=None, file_field_names=False, exclude_fields=None, include_fields=None, **kwargs)[source]¶ Read a ODIM_H5 file.
Parameters: - filename : str
Name of the ODIM_H5 file to read.
- field_names : dict, optional
Dictionary mapping ODIM_H5 field names to radar field names. If a data type found in the file does not appear in this dictionary or has a value of None it will not be placed in the radar.fields dictionary. A value of None, the default, will use the mapping defined in the Py-ART configuration file.
- additional_metadata : dict of dicts, optional
Dictionary of dictionaries to retrieve metadata from during this read. This metadata is not used during any successive file reads unless explicitly included. A value of None, the default, will not introduct any addition metadata and the file specific or default metadata as specified by the Py-ART configuration file will be used.
- file_field_names : bool, optional
True to use the MDV data type names for the field names. If this case the field_names parameter is ignored. The field dictionary will likely only have a ‘data’ key, unless the fields are defined in additional_metadata.
- exclude_fields : list or None, optional
List of fields to exclude from the radar object. This is applied after the file_field_names and field_names parameters. Set to None to include all fields specified by include_fields.
- include_fields : list or None, optional
List of fields to include from the radar object. This is applied after the file_field_names and field_names parameters. Set to None to include all fields not specified by exclude_fields.
Returns: - radar : Radar
Radar object containing data from ODIM_H5 file.
-
pyart.aux_io.
read_pattern
(filename, **kwargs)[source]¶ Read a netCDF file from a PATTERN project X-band radar.
Parameters: - filename : str
Name of netCDF file to read data from.
Returns: - radar : Radar
Radar object.
-
pyart.aux_io.
read_product_c
(radar_file, physic_value=False, masked_array=False, verbose=False)¶ Reads a METRANET cartesian data file
Parameters: - radar_file : str
file name
- physic_value : boolean
If true returns the physical value. Otherwise the digital value
- masked_array : boolean
If true returns a numpy masked array with NaN values masked. Otherwise returns a regular masked array with NaN values
- verbose : boolean
If true prints out extra information
Returns: - ret_data : RadarData object
An object containing the information read from the file. None if the file has not been properly read
-
pyart.aux_io.
read_product_py
(radar_file, physic_value=False, masked_array=False, verbose=False)¶ Reads a METRANET cartesian data file
Parameters: - radar_file : str
file name
- physic_value : boolean
If true returns the physical value. Otherwise the digital value
- masked_array : boolean
If true returns a numpy masked array with NaN values masked. Otherwise returns a regular masked array with NaN values
- verbose : boolean
If true prints out extra information
Returns: - ret_data : RadarData object
An object containing the information read from the file. None if the file has not been properly read
-
pyart.aux_io.
read_psr_cpi_header
(filename)[source]¶ Reads the CPI data headers contained in a PSR file
Parameters: - filename : str
Name of the PSR file
Returns: - cpi_header, header : dict
Dictionary containing the PSR header data and the CPI headers data
-
pyart.aux_io.
read_psr_header
(filename)[source]¶ Read a PSR file header.
Parameters: - filename : str
Name of the PSR file
Returns: - header : dict
Dictionary containing the PSR header data
-
pyart.aux_io.
read_psr_spectra
(filename)[source]¶ Reads the complex spectral data contained in a PSR file
Parameters: - filename : str
Name of the PSR file
Returns: - spectra : 3D complex ndArray
The complex spectra
-
pyart.aux_io.
read_radx
(filename, radx_dir=None, **kwargs)[source]¶ Read a file by first converting it to Cf/Radial using RadxConvert.
Parameters: - filename : str
Name of file to read using RadxConvert.
- radx_dir : str, optional
path to the radx install
Returns: - radar : Radar
Radar object.
-
pyart.aux_io.
read_rainbow_psr
(filename, filenames_psr, field_names=None, additional_metadata=None, file_field_names=False, exclude_fields=None, include_fields=None, undo_txcorr=True, cpi='mean', ang_tol=0.5, azi_min=None, azi_max=None, ele_min=None, ele_max=None, rng_min=None, rng_max=None, **kwargs)[source]¶ Read a PSR file.
Parameters: - filename : str
Name of the rainbow file to be used as reference.
- filenames_psr : list of str
Name of the PSR files
- field_names : dict, optional
Dictionary mapping RAINBOW field names to radar field names. If a data type found in the file does not appear in this dictionary or has a value of None it will not be placed in the radar.fields dictionary. A value of None, the default, will use the mapping defined in the Py-ART configuration file.
- additional_metadata : dict of dicts, optional
Dictionary of dictionaries to retrieve metadata during this read. This metadata is not used during any successive file reads unless explicitly included. A value of None, the default, will not introduct any addition metadata and the file specific or default metadata as specified by the Py-ART configuration file will be used.
- file_field_names : bool, optional
True to use the MDV data type names for the field names. If this case the field_names parameter is ignored. The field dictionary will likely only have a ‘data’ key, unless the fields are defined in additional_metadata.
- exclude_fields : list or None, optional
List of fields to exclude from the radar object. This is applied after the file_field_names and field_names parameters. Set to None to include all fields specified by include_fields.
- include_fields : list or None, optional
List of fields to include from the radar object. This is applied after the file_field_names and field_names parameters. Set to None to include all fields not specified by exclude_fields.
- undo_txcorr: Bool
If True the correction of the transmitted power is removed from the noise signal
- cpi : str
The CPI to use. Can be ‘low_prf’, ‘intermediate_prf’, ‘high_prf’, ‘mean’, ‘all’. If ‘mean’ the mean within the angle step is taken
- ang_tol : float
Tolerated angle distance between nominal radar angle and angle in PSR files
- azi_min, azi_max, ele_min, ele_max : float or None
The minimum and maximum angles to keep (deg)
- rng_min, rng_max : float or None
The minimum and maximum ranges to keep (m)
Returns: - radar : Radar
Radar object containing data from PSR file.
-
pyart.aux_io.
read_rainbow_psr_spectra
(filename, filenames_psr, field_names=None, additional_metadata=None, file_field_names=False, exclude_fields=None, include_fields=None, undo_txcorr=True, fold=True, positive_away=True, cpi='low_prf', ang_tol=0.5, azi_min=None, azi_max=None, ele_min=None, ele_max=None, rng_min=None, rng_max=None, **kwargs)[source]¶ Read a PSR file to get the complex spectra
Parameters: - filename : str
Name of the rainbow file to be used as reference.
- filenames_psr : list of str
list of PSR file names
- field_names : dict, optional
Dictionary mapping RAINBOW field names to radar field names. If a data type found in the file does not appear in this dictionary or has a value of None it will not be placed in the radar.fields dictionary. A value of None, the default, will use the mapping defined in the Py-ART configuration file.
- additional_metadata : dict of dicts, optional
Dictionary of dictionaries to retrieve metadata during this read. This metadata is not used during any successive file reads unless explicitly included. A value of None, the default, will not introduct any addition metadata and the file specific or default metadata as specified by the Py-ART configuration file will be used.
- file_field_names : bool, optional
True to use the MDV data type names for the field names. If this case the field_names parameter is ignored. The field dictionary will likely only have a ‘data’ key, unless the fields are defined in additional_metadata.
- exclude_fields : list or None, optional
List of fields to exclude from the radar object. This is applied after the file_field_names and field_names parameters. Set to None to include all fields specified by include_fields.
- include_fields : list or None, optional
List of fields to include from the radar object. This is applied after the file_field_names and field_names parameters. Set to None to include all fields not specified by exclude_fields.
- undo_txcorr: Bool
If True the correction of the transmitted power is removed from the noise signal
- fold: Bool
If True the spectra is folded so that 0-Doppler is in the middle
- positive_away: Bool
If True the spectra is reversed so that positive velocities are away from the radar
- cpi : str
The CPI to use. Can be ‘low_prf’, ‘intermediate_prf’, ‘high_prf’ or ‘all’
- ang_tol : float
Tolerated angle distance between nominal radar angle and angle in PSR files
- azi_min, azi_max, ele_min, ele_max : float or None
The minimum and maximum angles to keep (deg)
- rng_min, rng_max : float or None
The minimum and maximum ranges to keep (m)
Returns: - radar : Radar
Radar object containing data from PSR file.
-
pyart.aux_io.
read_rainbow_wrl
(filename, field_names=None, additional_metadata=None, file_field_names=False, exclude_fields=None, include_fields=None, nbytes=4, **kwargs)[source]¶ Read a RAINBOW file. This routine has been tested to read rainbow5 files version 5.22.3, 5.34.16 and 5.35.1. Since the rainbow file format is evolving constantly there is no guaranty that it can work with other versions. If necessary, the user should adapt to code according to its own file version and raise an issue upstream.
Data types read by this routine: Reflectivity: dBZ, dBuZ, dBZv, dBuZv Velocity: V, Vu, Vv, Vvu Spectrum width: W, Wu, Wv, Wvu Differential reflectivity: ZDR, ZDRu Co-polar correlation coefficient: RhoHV, RhoHVu Co-polar differential phase: PhiDP, uPhiDP, uPhiDPu Specific differential phase: KDP, uKDP, uKDPu Signal quality parameters: SQI, SQIu, SQIv, SQIvu Temperature: TEMP Position of the range bin respect to the ISO0: ISO0 radar visibility according to Digital Elevation Model (DEM): VIS
Parameters: - filename : str
Name of the RAINBOW file to read.
- field_names : dict, optional
Dictionary mapping RAINBOW field names to radar field names. If a data type found in the file does not appear in this dictionary or has a value of None it will not be placed in the radar.fields dictionary. A value of None, the default, will use the mapping defined in the Py-ART configuration file.
- additional_metadata : dict of dicts, optional
Dictionary of dictionaries to retrieve metadata during this read. This metadata is not used during any successive file reads unless explicitly included. A value of None, the default, will not introduct any addition metadata and the file specific or default metadata as specified by the Py-ART configuration file will be used.
- file_field_names : bool, optional
True to use the MDV data type names for the field names. If this case the field_names parameter is ignored. The field dictionary will likely only have a ‘data’ key, unless the fields are defined in additional_metadata.
- exclude_fields : list or None, optional
List of fields to exclude from the radar object. This is applied after the file_field_names and field_names parameters. Set to None to include all fields specified by include_fields.
- include_fields : list or None, optional
List of fields to include from the radar object. This is applied after the file_field_names and field_names parameters. Set to None to include all fields not specified by exclude_fields.
- nbytes : int
The number of bytes used to store the data in numpy arrays, e.g. if nbytes=4 then floats are going to be stored as np.float32
Returns: - radar : Radar
Radar object containing data from RAINBOW file.
-
pyart.aux_io.
read_sinarame_h5
(filename, field_names=None, additional_metadata=None, file_field_names=False, exclude_fields=None, include_fields=None, **kwargs)[source]¶ Read a SINARAME_H5 file.
Parameters: - filename : str
Name of the SINARAME_H5 file to read.
- field_names : dict, optional
Dictionary mapping SINARAME_H5 field names to radar field names. If a data type found in the file does not appear in this dictionary or has a value of None it will not be placed in the radar.fields dictionary. A value of None, the default, will use the mapping defined in the Py-ART configuration file.
- additional_metadata : dict of dicts, optional
Dictionary of dictionaries to retrieve metadata from during this read. This metadata is not used during any successive file reads unless explicitly included. A value of None, the default, will not introduct any addition metadata and the file specific or default metadata as specified by the Py-ART configuration file will be used.
- file_field_names : bool, optional
True to use the MDV data type names for the field names. If this case the field_names parameter is ignored. The field dictionary will likely only have a ‘data’ key, unless the fields are defined in additional_metadata.
- exclude_fields : list or None, optional
List of fields to exclude from the radar object. This is applied after the file_field_names and field_names parameters. Set to None to include all fields specified by include_fields.
- include_fields : list or None, optional
List of fields to include from the radar object. This is applied after the file_field_names and field_names parameters. Set to None to include all fields not specified by exclude_fields.
Returns: - radar : Radar
Radar object containing data from SINARAME_H5 file.
-
pyart.aux_io.
read_spectra
(filename, field_names=None, additional_metadata=None, file_field_names=False, exclude_fields=None, include_fields=None, delay_field_loading=False, **kwargs)[source]¶ Read a spectra netCDF file.
Parameters: - filename : str
Name of CF/Radial netCDF file to read data from.
- field_names : dict, optional
Dictionary mapping field names in the file names to radar field names. Unlike other read functions, fields not in this dictionary or having a value of None are still included in the radar.fields dictionary, to exclude them use the exclude_fields parameter. Fields which are mapped by this dictionary will be renamed from key to value.
- additional_metadata : dict of dicts, optional
This parameter is not used, it is included for uniformity.
- file_field_names : bool, optional
True to force the use of the field names from the file in which case the field_names parameter is ignored. False will use to field_names parameter to rename fields.
- exclude_fields : list or None, optional
List of fields to exclude from the radar object. This is applied after the file_field_names and field_names parameters. Set to None to include all fields specified by include_fields.
- include_fields : list or None, optional
List of fields to include from the radar object. This is applied after the file_field_names and field_names parameters. Set to None to include all fields not specified by exclude_fields.
- delay_field_loading : bool
True to delay loading of field data from the file until the ‘data’ key in a particular field dictionary is accessed. In this case the field attribute of the returned Radar object will contain LazyLoadDict objects not dict objects. Delayed field loading will not provide any speedup in file where the number of gates vary between rays (ngates_vary=True) and is not recommended.
Returns: - radar : Radar
Radar object.
Notes
This function has not been tested on “stream” Cfradial files.
-
pyart.aux_io.
write_odim_h5
(filename, radar, field_names=None, physical=True, compression='gzip', compression_opts=6)[source]¶ Write a Radar object to a EUMETNET OPERA compliant HDF5 file.
The files produced by this routine follow the EUMETNET OPERA information model: http://eumetnet.eu/wp-content/uploads/2017/01/OPERA_hdf_description_2014.pdf
- Supported features:
- Writing PPIs: PVOL and SCAN objects - Different sweeps are saved in different dataset groups
- Writing sectorized PPIs and SCANs: AZIM objects
- Writing RHIs: ELEV objects
- Not yet supported:
- Mixed datasets (how group always on top level)
- Single ray data (e.g. from fixed staring mode)
- Profiles
Parameters: - filename : str
Filename of file to create.
- radar : Radar
Radar object to process.
- field_names : list of str
The list of fields from the radar object to save. If none all fields in the radar object will be saved.
- physical : Bool
If true the physical values are stored. nodata parameter is equal to the _FillValue parameter in the field metadata or the default Py-ART fill value. If false the data is converted into binary values using a linear conversion. The gain and offset are either specified in the metadata of the field with keywords ‘scale_factor’ and ‘add_offset’ or calculated on the fly. keyword ‘_Write_as_dtype’ specifies the datatype. It can be either ‘uint8’ or ‘uint16’. The default datatype is uint8. The ‘undetect’ parameter is not used
- compression : str
The type of compression for the datasets. Typical are “gzip” and “lzf”.
- compression_opts : any
The compression options. In the case of gzip is the level between 0 to 9 (recomended 1 to 6). In the case of lzf there are not options.
-
pyart.aux_io.
write_sinarame_cfradial
(path)[source]¶ This function takes SINARAME_H5 files (where every file has only one field and one volume) from a folder and writes a CfRadial file for each volume including all fields.
Parameters: - path : str
Where the SINARAME_H5 files are.
-
pyart.aux_io.
write_spectra
(filename, radar, format='NETCDF4', time_reference=None, arm_time_variables=False, physical=True)[source]¶ Write a Radar Spectra object to a netCDF file.
The files produced by this routine follow the CF/Radial standard. Attempts are also made to to meet many of the standards outlined in the ARM Data File Standards.
To control how the netCDF variables are created, set any of the following keys in the radar attribute dictionaries.
- _Zlib
- _DeflateLevel
- _Shuffle
- _Fletcher32
- _Continguous
- _ChunkSizes
- _Endianness
- _Least_significant_digit
- _FillValue
See the netCDF4 documentation for details on these settings.
Parameters: - filename : str
Filename to create.
- radar : Radar
Radar object.
- format : str, optional
NetCDF format, one of ‘NETCDF4’, ‘NETCDF4_CLASSIC’, ‘NETCDF3_CLASSIC’ or ‘NETCDF3_64BIT’. See netCDF4 documentation for details.
- time_reference : bool
True to include a time_reference variable, False will not include this variable. The default, None, will include the time_reference variable when the first time value is non-zero.
- arm_time_variables : bool
True to create the ARM standard time variables base_time and time_offset, False will not create these variables.
- physical : bool
True to store the radar fields as physical numbers, False will store the radar fields as binary if the keyword ‘_Write_as_dtype’ is in the field metadata. The gain and offset can be specified in the keyword ‘scale_factor’ and ‘add_offset’ or calculated on the fly.