pyrad.io#
Description
Input and output (pyrad.io
)#
Functions to read and write data and configuration files.
Reading configuration files#
|
Read a pyrad config file. |
Reading radar data#
|
Reads pyrad input data. |
Reading icon data#
|
get the icon value corresponding to each radar gate using nearest neighbour interpolation |
|
Given the radar coordinates find the nearest icon model pixel |
|
get the HZT value corresponding to each radar gate using nearest neighbour interpolation |
|
Given the radar coordinates find the nearest HZT pixel |
|
Get the icon data corresponding to each radar gate using a precomputed look up table of the nearest neighbour |
|
Get the height over iso0 data corresponding to each radar gate using a precomputed look up table of the nearest neighbour |
|
Reads icon data from a netcdf file |
|
Reads icon coordinates from a netcdf file |
|
Reads iso-0 degree data from an HZT file |
|
Reads iso-0 degree data from a MF NWP in text format |
|
Reads a 2D field of iso-0 degree data from a MF NWP in GRIB format |
|
get the iso0 value corresponding to each radar gate |
|
get the iso0 value corresponding to each radar gate |
|
gets the is0 that has to be taken as reference. |
Reading DEM data#
|
get the DEM value corresponding to each radar gate using nearest neighbour interpolation |
|
Reads DEM data from an IDRISI .rst file |
|
Reads DEM metadata from a IDRISI .rdc file |
Reading other data#
|
Reads an npz file containing data used in centroid computation |
|
Reads a file containing the centroids for the semi-supervised classification |
|
Reads a file containing the start and stop times of periods to process |
|
Reads a file containing the date of acquisition of the last volume processed |
|
Reads rad4alp xml status file. |
|
Reads rad4alp ICON data binary file. |
|
Reads rad4alp visibility data binary file. |
|
Reads a csv files containing the position of gates exceeding a given percentile of frequency of occurrence |
|
Reads a csv files containing the position of colocated gates |
|
Reads a csv files containing colocated data |
|
Reads a time series contained in a CSV file. |
|
Reads a time series of precipitation accumulation contained in a csv file |
|
Reads a monitoring time series contained in a csv file |
|
Reads a radar intercomparison scores csv file |
|
Gets data from a point measurement sensor (rain gauge or disdrometer) |
|
Reads SwissMetNet data contained in a csv or gzipped csv file. |
|
Reads SwissMetNet data contained in a csv file with format station,time,value |
|
Reads a file containing the coordinates of multiple sensors. |
|
Reads scattering parameters computed from disdrometer data contained in a text file |
|
Reads data collected by a parsivel disdrometer and stored in a csv file |
|
Reads a file containing precipitation data from sensors retrieved from the KNMI archive. |
|
Reads sun hits data contained in a csv file |
|
Reads sun hits data from multiple file sources |
|
Reads sun retrieval data contained in a csv file |
|
Reads solar flux data from the DRAO observatory in Canada |
|
Reads a self-consistency table with Zdr, Kdp/Zh columns |
|
Read antenna pattern from file |
|
Reads METEORAGE lightning data contained in a text file. The file has the following fields: date: date + time + time zone lon: longitude [degree] lat: latitude [degree] intens: amplitude [kilo amperes] ns: number of strokes of the flash mode: kind of localization [0,15] intra: 1 = intra-cloud , 0 = cloud-to-ground ax: length of the semi-major axis of the ellipse [km] ki2: standard deviation on the localization computation (Ki^2) ecc: eccentricity (major-axis / minor-axis) incl: ellipse inclination (angle with respect to the North, +90° is East) [degrees] sind: stroke index within the flash. |
|
Reads lightning data contained in a text file. The file has the following fields: flashnr: (0 is for noise) UTC seconds of the day Time within flash (in seconds) Latitude (decimal degrees) Longitude (decimal degrees) Altitude (m MSL) Power (dBm). |
|
Reads lightning trajectory data contained in a csv file. The file has the following fields: Date UTC [seconds since midnight] # Flash Flash Power (dBm) Value at flash Mean value in a 3x3x3 polar box Min value in a 3x3x3 polar box Max value in a 3x3x3 polar box # valid values in the polar box. |
|
Reads a file containing lightning data and co-located polarimetric data. fields: flashnr time data Time within flash (in seconds) Latitude (decimal degrees) Longitude (decimal degrees) Altitude (m MSL) Power (dBm) Polarimetric values at flash position. |
|
Reads the TRT scores contained in a text file. The file has the following fields: traj ID max flash density time max flash density rank max flash density max rank time max rank. |
|
Reads the TRT data contained in a text file. The file has the following fields: traj_ID yyyymmddHHMM. |
|
Reads the TRT cell data contained in a text file. The file has the following fields: traj_ID yyyymmddHHMM. |
Reads the TRT cell data contained in a text file. The file has the following fields: traj_ID scan_ordered_time scan_time azi rng yyyymmddHHMM. |
|
|
Reads the lightning data of a TRT cell. The file has the following fields: traj_ID yyyymmddHHMM lon lat area RANKr nflashes flash_dens. |
|
Reads all the TRT info files |
|
Reads all the TRT info files |
|
Reads the TRT info used for thundertracking and contained in a text file. |
|
Reads the TRT info used for thundertracking and contained in a text file. |
|
Reads the TRT info used for thundertracking |
|
Reads a monitoring time series contained in a csv file |
|
Reads the parameters defining a theoretical VPR profile from a csv file |
|
Reads a histogram contained in a csv file |
|
Reads quantiles contained in a csv file |
|
Reads a colection of profile data file and creates a time series |
|
Reads a colection of histogram data file and creates a time series |
|
Reads a colection of quantiles data file and creates a time series |
|
Reads a melting layer time series contained in a csv file |
|
Read the wind mills data csv file |
|
Download radiosounding data from the University of Wyoming website. |
|
Download radiosounding data from from the Integrated Global Radiosonde Archive (IGRA). |
|
Get an estimation of the freezing level height from the Integrated Global Radiosonde Archive (IGRA) |
Writing data#
|
Creates a kml file with the radar volume data |
|
Creates a kml file with the radar volume data |
|
writes the centroids of a semi-supervised hydrometeor classification |
|
writes an output file containing start and stop times of periods to process |
|
writes the LMA sources data and the value of the colocated polarimetric variables |
|
sends the content of a text file by email |
|
writes an alarm file |
|
writes SwissMetNet data in format datetime,avg_value, std_value |
|
writes SwissMetNet data in format datetime,avg_value, std_value |
|
writes TRT info of the thundertracking |
|
writes TRT cell data of the thundertracking scan |
|
writes TRT cell data |
|
writes TRT cells scores |
|
writes the lightning data for each TRT cell |
|
writes the rimed particles column data for a TRT cell |
|
writes the parameters defining a theoretical VPR profile into a csv file |
|
Writes a dictionary containing relevant parameters of the VPR profile retrieval into a text file |
|
writes the values of an RHI profile in a text file |
|
writes the quantiles of the coverage on a particular sector |
|
writes a cumulative distribution function |
|
writes a histogram |
|
writes quantiles |
|
write radar data obtained at multiple points |
|
write data obtained at multiple points from a grid |
|
writes time series of data |
|
writes time series of data |
|
writes time series accumulation of data |
|
writes time series of statistics |
|
writes time series of data |
|
Writes the position and values of gates that have a frequency of occurrence higher than a particular threshold |
|
writes time series of radar intercomparison scores |
|
Writes the position of gates colocated with two radars |
|
Writes the data of gates colocated with two radars |
|
Writes the time averaged data of gates colocated with two radars |
|
Writes sun hits data. |
|
Writes sun retrieval data. |
|
writes an output file with the fixed angle data |
Auxiliary functions#
|
Given a datatype find the corresponding start and termination of the METRANET product file name |
|
maps de config file radar data type name into the corresponding SKYECHO data type name and Py-ART field name |
|
maps the operational hydrometeor classification identifiers to the ones used by Py-ART |
|
maps the binary METRANET Doppler data to actual Doppler velocity |
|
obtains the path to a product directory and eventually creates it |
|
creates a product file name |
|
Generates a field name in a nice to read format. |
|
Maps the config file radar data type name into the corresponding Py-ART field name |
|
maps the Py-ART field name into the corresponding ICON variable name |
|
Return unit of datatype. |
|
gets the list of files within a time period |
|
gets the list of files within a time period from an s3 bucket |
|
gets the list of files to merge into a single radar object |
|
gets the list of files to merge into a single radar object |
|
gets the directory where rad4alp data is stored |
|
gets the directory where rad4alp grid data is stored |
|
gets the list of TRT files with a time period |
|
get the rainbow file name containing datatype from a master file name and data type |
|
splits the data type descriptor and provides each individual member |
|
splits the dataset type descriptor and provides each individual member |
|
Given a data descriptor gets date and time from file name |
|
Search a ICON file in netcdf format |
|
Search an ISO-0 degree file in HZT format |
|
Search an ISO-0 degree file in text format |
|
Search an ISO-0 degree file in text format |
|
Find a date with date format defined in date_format in a file name. |
|
Given a data group gets date and time from file name |
Trajectory#
|
A class for reading and handling trajectory data from a file. :ivar filename: Path and name of the trajectory definition file :vartype filename: str :ivar starttime: Start time of trajectory processing. :vartype starttime: datetime :ivar endtime: End time of trajectory processing. :vartype endtime: datetime :ivar trajtype: :vartype trajtype: str :ivar Type of trajectory. Can be 'plane' or 'lightning': :ivar time_vector: Array containing the trajectory time samples :vartype time_vector: Array of datetime objects :ivar wgs84_lat_deg: WGS84 latitude samples in deg :vartype wgs84_lat_deg: Array of floats :ivar wgs84_lon_deg: WGS84 longitude samples in deg :vartype wgs84_lon_deg: Array of floats :ivar wgs84_alt_m: WGS84 altitude samples in m :vartype wgs84_alt_m: Array of floats :ivar nsamples: :vartype nsamples: int :ivar Number of samples in the trajectory: :ivar _swiss_grid_done: Indicates that convertion to Swiss coordinates has been performed :vartype _swiss_grid_done: Bool :ivar swiss_chy, swiss_chx, swiss_chh: Swiss coordinates in m :vartype swiss_chy, swiss_chx, swiss_chh: Array of floats :ivar radar_list: List of radars for which trajectories are going to be computed :vartype radar_list: list :ivar flashnr: For 'lightning' only. Number of flash for which trajectory data is going to be computed. If 0 all all flashes are going to be considered. :vartype flashnr: int :ivar time_in_flash: For 'lightning' only. Time within flash (sec) :vartype time_in_flash: array of floats :ivar flashnr_vec: For 'lightning' only. Flash number of each data sample :vartype flashnr_vec: array of ints :ivar dBm: For 'lightning' only. Lightning power (dBm) :vartype dBm: array of floats :ivar Methods: :ivar --------: :ivar add_radar: :vartype add_radar: Add a radar :ivar calculate_velocities: :vartype calculate_velocities: Computes velocities :ivar get_start_time: :vartype get_start_time: Return time of first trajectory sample :ivar get_end_time: :vartype get_end_time: Return time of last trajectory sample :ivar get_samples_in_period: :vartype get_samples_in_period: Get indices of samples within period :ivar _convert_traj_to_swissgrid: :vartype _convert_traj_to_swissgrid: convert data from WGS84 to Swiss coordinates :ivar _read_traj: :vartype _read_traj: Read plane trajectory from file :ivar _read_traj_flores: :vartype _read_traj_flores: Read FLORAKO plane trajectory from file :ivar _read_traj_trt: :vartype _read_traj_trt: Read TRT trajectory from file :ivar _read_traj_lightning: :vartype _read_traj_lightning: Read lightning trajectory from file :ivar _get_total_seconds: :vartype _get_total_seconds: Get the total time of the trajectory in seconds. |
TimeSeries#
|
Holding timeseries data and metadata. |
Classes
|
Holding timeseries data and metadata. |
|
A class for reading and handling trajectory data from a file. :ivar filename: Path and name of the trajectory definition file :vartype filename: str :ivar starttime: Start time of trajectory processing. :vartype starttime: datetime :ivar endtime: End time of trajectory processing. :vartype endtime: datetime :ivar trajtype: :vartype trajtype: str :ivar Type of trajectory. Can be 'plane' or 'lightning': :ivar time_vector: Array containing the trajectory time samples :vartype time_vector: Array of datetime objects :ivar wgs84_lat_deg: WGS84 latitude samples in deg :vartype wgs84_lat_deg: Array of floats :ivar wgs84_lon_deg: WGS84 longitude samples in deg :vartype wgs84_lon_deg: Array of floats :ivar wgs84_alt_m: WGS84 altitude samples in m :vartype wgs84_alt_m: Array of floats :ivar nsamples: :vartype nsamples: int :ivar Number of samples in the trajectory: :ivar _swiss_grid_done: Indicates that convertion to Swiss coordinates has been performed :vartype _swiss_grid_done: Bool :ivar swiss_chy, swiss_chx, swiss_chh: Swiss coordinates in m :vartype swiss_chy, swiss_chx, swiss_chh: Array of floats :ivar radar_list: List of radars for which trajectories are going to be computed :vartype radar_list: list :ivar flashnr: For 'lightning' only. Number of flash for which trajectory data is going to be computed. If 0 all all flashes are going to be considered. :vartype flashnr: int :ivar time_in_flash: For 'lightning' only. Time within flash (sec) :vartype time_in_flash: array of floats :ivar flashnr_vec: For 'lightning' only. Flash number of each data sample :vartype flashnr_vec: array of ints :ivar dBm: For 'lightning' only. Lightning power (dBm) :vartype dBm: array of floats :ivar Methods: :ivar --------: :ivar add_radar: :vartype add_radar: Add a radar :ivar calculate_velocities: :vartype calculate_velocities: Computes velocities :ivar get_start_time: :vartype get_start_time: Return time of first trajectory sample :ivar get_end_time: :vartype get_end_time: Return time of last trajectory sample :ivar get_samples_in_period: :vartype get_samples_in_period: Get indices of samples within period :ivar _convert_traj_to_swissgrid: :vartype _convert_traj_to_swissgrid: convert data from WGS84 to Swiss coordinates :ivar _read_traj: :vartype _read_traj: Read plane trajectory from file :ivar _read_traj_flores: :vartype _read_traj_flores: Read FLORAKO plane trajectory from file :ivar _read_traj_trt: :vartype _read_traj_trt: Read TRT trajectory from file :ivar _read_traj_lightning: :vartype _read_traj_lightning: Read lightning trajectory from file :ivar _get_total_seconds: :vartype _get_total_seconds: Get the total time of the trajectory in seconds. |
Functions
|
adds the fields from orig radar into dest radar. |
|
get the DEM value corresponding to each radar gate using nearest neighbour interpolation |
|
Find a date with date format defined in date_format in a file name. |
|
Search an ISO-0 degree file in HZT format |
|
Search an ISO-0 degree file in text format |
|
Search an ISO-0 degree file in text format |
|
Search a ICON file in netcdf format |
|
Generates a field name in a nice to read format. |
|
Reads pyrad input data. |
|
splits the dataset type descriptor and provides each individual member |
|
splits the data type descriptor and provides each individual member |
|
maps de config file radar data type name into the corresponding SKYECHO data type name and Py-ART field name |
|
Given a data descriptor gets date and time from file name |
|
Return unit of datatype. |
|
maps the Py-ART field name into the corresponding ICON variable name |
|
Maps the config file radar data type name into the corresponding Py-ART field name |
|
gets the list of files within a time period |
|
gets the list of files within a time period from an s3 bucket |
|
Get the icon data corresponding to each radar gate using a precomputed look up table of the nearest neighbour |
|
Get the height over iso0 data corresponding to each radar gate using a precomputed look up table of the nearest neighbour |
|
gets the is0 that has to be taken as reference. |
|
get the rainbow file name containing datatype from a master file name and data type |
|
gets the directory where rad4alp data is stored |
|
gets the directory where rad4alp grid data is stored |
|
Given a datatype find the corresponding start and termination of the METRANET product file name |
|
obtains the path to a product directory and eventually creates it |
|
gets the list of files to merge into a single radar object |
|
gets the list of files to merge into a single radar object |
|
Gets data from a point measurement sensor (rain gauge or disdrometer) |
|
gets the list of TRT files with a time period |
|
get the iso0 value corresponding to each radar gate |
|
Given the radar coordinates find the nearest HZT pixel |
|
get the HZT value corresponding to each radar gate using nearest neighbour interpolation |
|
Given the radar coordinates find the nearest icon model pixel |
|
get the icon value corresponding to each radar gate using nearest neighbour interpolation |
|
interpolates field field_name contained in radar_orig to the grid in radar_dest |
|
get the iso0 value corresponding to each radar gate |
|
creates a product file name |
|
maps the binary METRANET Doppler data to actual Doppler velocity |
|
maps the operational hydrometeor classification identifiers to the ones used by Py-ART |
|
Read antenna pattern from file |
|
Reads a file containing the centroids for the semi-supervised classification |
|
Reads an npz file containing data used in centroid computation |
|
Reads a csv files containing colocated data |
|
Reads a csv files containing the position of colocated gates |
|
Read a pyrad config file. |
|
Reads a file containing the coordinates of multiple sensors. |
|
Reads data collected by a parsivel disdrometer and stored in a csv file |
|
Reads scattering parameters computed from disdrometer data contained in a text file |
|
Reads a csv files containing the position of gates exceeding a given percentile of frequency of occurrence |
|
Get an estimation of the freezing level height from the Integrated Global Radiosonde Archive (IGRA) |
|
Reads a histogram contained in a csv file |
|
Reads a colection of histogram data file and creates a time series |
|
Reads iso-0 degree data from an HZT file |
|
Reads icon coordinates from a netcdf file |
|
Reads icon data from a netcdf file |
|
Reads DEM data from an IDRISI .rst file |
|
Reads DEM metadata from a IDRISI .rdc file |
|
Reads a radar intercomparison scores csv file |
|
Reads a 2D field of iso-0 degree data from a MF NWP in GRIB format |
|
Reads iso-0 degree data from a MF NWP in text format |
|
Reads a file containing precipitation data from sensors retrieved from the KNMI archive. |
|
Reads a file containing the date of acquisition of the last volume processed |
|
Reads lightning data contained in a text file. The file has the following fields: flashnr: (0 is for noise) UTC seconds of the day Time within flash (in seconds) Latitude (decimal degrees) Longitude (decimal degrees) Altitude (m MSL) Power (dBm). |
|
Reads a file containing lightning data and co-located polarimetric data. fields: flashnr time data Time within flash (in seconds) Latitude (decimal degrees) Longitude (decimal degrees) Altitude (m MSL) Power (dBm) Polarimetric values at flash position. |
|
Reads lightning trajectory data contained in a csv file. The file has the following fields: Date UTC [seconds since midnight] # Flash Flash Power (dBm) Value at flash Mean value in a 3x3x3 polar box Min value in a 3x3x3 polar box Max value in a 3x3x3 polar box # valid values in the polar box. |
|
Reads a MeteoSwiss VAD file (VAx xml files) |
|
Reads METEORAGE lightning data contained in a text file. The file has the following fields: date: date + time + time zone lon: longitude [degree] lat: latitude [degree] intens: amplitude [kilo amperes] ns: number of strokes of the flash mode: kind of localization [0,15] intra: 1 = intra-cloud , 0 = cloud-to-ground ax: length of the semi-major axis of the ellipse [km] ki2: standard deviation on the localization computation (Ki^2) ecc: eccentricity (major-axis / minor-axis) incl: ellipse inclination (angle with respect to the North, +90° is East) [degrees] sind: stroke index within the flash. |
|
Reads Météo-France visibility data binary file. |
|
Reads a melting layer time series contained in a csv file |
|
Reads a monitoring time series contained in a csv file |
|
Reads a file containing the start and stop times of periods to process |
|
Reads a colection of profile data file and creates a time series |
|
Reads quantiles contained in a csv file |
|
Reads a colection of quantiles data file and creates a time series |
|
Reads rad4alp ICON data binary file. |
|
Reads rad4alp visibility data binary file. |
|
Download radiosounding data from from the Integrated Global Radiosonde Archive (IGRA). |
|
Download radiosounding data from the University of Wyoming website. |
|
Reads a monitoring time series contained in a csv file |
|
Reads a self-consistency table with Zdr, Kdp/Zh columns |
|
Reads SwissMetNet data contained in a csv or gzipped csv file. |
|
Reads SwissMetNet data contained in a csv file with format station,time,value |
|
Reads solar flux data from the DRAO observatory in Canada |
|
Reads rad4alp xml status file. |
|
Reads sun hits data contained in a csv file |
|
Reads sun hits data from multiple file sources |
|
Reads sun retrieval data contained in a csv file |
|
Reads the TRT info used for thundertracking |
|
Reads a time series contained in a CSV file. |
|
Reads the lightning data of a TRT cell. The file has the following fields: traj_ID yyyymmddHHMM lon lat area RANKr nflashes flash_dens. |
|
Reads the TRT data contained in a text file. The file has the following fields: traj_ID yyyymmddHHMM. |
|
Reads the TRT info used for thundertracking and contained in a text file. |
|
Reads the TRT info used for thundertracking and contained in a text file. |
|
Reads all the TRT info files |
|
Reads all the TRT info files |
|
Reads the TRT scores contained in a text file. The file has the following fields: traj ID max flash density time max flash density rank max flash density max rank time max rank. |
Reads the TRT cell data contained in a text file. The file has the following fields: traj_ID scan_ordered_time scan_time azi rng yyyymmddHHMM. |
|
|
Reads the TRT cell data contained in a text file. The file has the following fields: traj_ID yyyymmddHHMM. |
|
Reads a time series of precipitation accumulation contained in a csv file |
|
Reads the parameters defining a theoretical VPR profile from a csv file |
|
Read the wind mills data csv file |
|
sends the content of a text file by email |
|
writes an alarm file |
|
writes a cumulative distribution function |
|
writes the centroids of a semi-supervised hydrometeor classification |
|
Writes the data of gates colocated with two radars |
|
Writes the time averaged data of gates colocated with two radars |
|
Writes the position of gates colocated with two radars |
|
Writes the position and values of gates that have a frequency of occurrence higher than a particular threshold |
|
writes the quantiles of the coverage on a particular sector |
|
writes an output file with the fixed angle data |
|
writes a histogram |
|
writes time series of radar intercomparison scores |
|
writes SwissMetNet data in format datetime,avg_value, std_value |
|
writes time series of data |
|
write radar data obtained at multiple points |
|
write data obtained at multiple points from a grid |
|
writes an output file containing start and stop times of periods to process |
|
writes quantiles |
|
writes the values of an RHI profile in a text file |
|
writes SwissMetNet data in format datetime,avg_value, std_value |
|
Writes sun hits data. |
|
Writes sun retrieval data. |
|
writes TRT cell data |
|
writes the lightning data for each TRT cell |
|
writes TRT cells scores |
|
writes TRT info of the thundertracking |
|
writes the rimed particles column data for a TRT cell |
|
writes TRT cell data of the thundertracking scan |
|
writes time series accumulation of data |
|
writes time series of data |
|
writes the LMA sources data and the value of the colocated polarimetric variables |
|
writes time series of data |
|
writes time series of statistics |
|
Creates a kml file with the radar volume data |
|
Creates a kml file with the radar volume data |
|
Writes a dictionary containing relevant parameters of the VPR profile retrieval into a text file |
|
writes the parameters defining a theoretical VPR profile into a csv file |