pyrad.io.Trajectory#

class pyrad.io.Trajectory(filename, starttime=None, endtime=None, trajtype='plane', flashnr=0)[source]#

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.

Variables:
  • time_in_flash (array of floats) – For ‘lightning’ only. Time within flash (sec)

  • flashnr_vec (array of ints) – For ‘lightning’ only. Flash number of each data sample

  • dBm (array of floats) – For ‘lightning’ only. Lightning power (dBm)

  • Methods

  • --------

  • add_radar (Add a radar)

  • calculate_velocities (Computes velocities)

  • get_start_time (Return time of first trajectory sample)

  • get_end_time (Return time of last trajectory sample)

  • get_samples_in_period (Get indices of samples within period)

  • _convert_traj_to_swissgrid (convert data from WGS84 to Swiss coordinates)

  • _read_traj (Read plane trajectory from file)

  • _read_traj_flores (Read FLORAKO plane trajectory from file)

  • _read_traj_trt (Read TRT trajectory from file)

  • _read_traj_lightning (Read lightning trajectory from file)

  • _get_total_seconds (Get the total time of the trajectory in seconds)

Initalize the object. :Parameters: * filename (str) – Filename containing the trajectory samples.

  • starttime (datetime) – Start time of trajectory processing. If not given, use the time of the first trajectory sample.

  • endtime (datetime) – End time of trajectory processing. If not given, use the time of the last trajectory sample.

  • trajtype (str) – type of trajectory. Can be plane or lightning

  • flashnr (int) – If type of trajectory is lightning, the flash number to check the trajectory. 0 means all flash numbers included

add_radar(radar)

Add the coordinates (WGS84 longitude, latitude and non WGS84 altitude) of a radar to the radar_list.

calculate_velocities(radar)

Calculate velocities.

get_end_time()

Get time of last trajectory sample.

get_samples_in_period([start, end])

get_start_time()

Get time of first trajectory sample.