spinifex.ionospheric.tomion_parser ================================== .. py:module:: spinifex.ionospheric.tomion_parser .. autoapi-nested-parse:: Module to parse the UPC-Ionsat tomion data format Attributes ---------- .. autoapisummary:: spinifex.ionospheric.tomion_parser.MAX_INTERPOL_POINTS spinifex.ionospheric.tomion_parser.TOMION_HEIGHTS spinifex.ionospheric.tomion_parser.TOMOION_FORMAT_DICT spinifex.ionospheric.tomion_parser.get_tomion_paths Classes ------- .. autoapisummary:: spinifex.ionospheric.tomion_parser.TomionData Functions --------- .. autoapisummary:: spinifex.ionospheric.tomion_parser._download_tomion_file spinifex.ionospheric.tomion_parser._extract_nefull spinifex.ionospheric.tomion_parser._read_tomion spinifex.ionospheric.tomion_parser._tomion_format spinifex.ionospheric.tomion_parser.get_density_dual_layer spinifex.ionospheric.tomion_parser.get_tomion_paths_coro spinifex.ionospheric.tomion_parser.interpolate_tomion Module Contents --------------- .. py:class:: TomionData Bases: :py:obj:`NamedTuple` Object containing all necessary information from Tomion data .. py:attribute:: available_times :type: astropy.time.Time array with unique times .. py:attribute:: h :type: numpy.typing.NDArray[numpy.float64] heights (km) .. py:attribute:: h_idx :type: numpy.typing.NDArray[numpy.int128] array with index of height .. py:attribute:: lats :type: numpy.typing.NDArray[numpy.float64] array with latitude values (degrees) .. py:attribute:: lons :type: numpy.typing.NDArray[numpy.float64] array with longitude values (degrees) .. py:attribute:: stddev :type: numpy.typing.NDArray[numpy.float64] array with voxel stddev values(TECU) .. py:attribute:: tec :type: numpy.typing.NDArray[numpy.float64] array with voxel tecvalues(TECU) .. py:attribute:: times :type: astropy.time.Time times .. py:function:: _download_tomion_file(url: str, nefull_name: str, tomion_options: spinifex.ionospheric.tec_data.TomionOptions | None = None, timeout_seconds: int = 30, chunk_size: int = 1000) -> pathlib.Path :async: download and convert tomion file to readable nefull text file or if the file already exists just return a pointer to the file Parameters ---------- url : str url of the file to download nefull_name : str name of the extracted nefull file tomion_options : TomionOptions | None, optional options for the ionospheric model, by default None timeout_seconds : int, optional time out for downloading, by default 30 chunk_size : int, optional chunksize for downloading, by default 1000 Returns ------- Path pointer to the nefull file Raises ------ IonexError error if the download times out .. py:function:: _extract_nefull(tomion_file: pathlib.Path, output_file: pathlib.Path, search_term: str = 'NeFull') -> pathlib.Path :async: helper function to get the relevant information from the large tomion file. Deletes the tomion file if the extraction was successful Parameters ---------- tomion_file : Path pointer to the tomion file output_file : Path name of the nefull file search_term : str, optional the indicator for useful data in the tomion file, by default "NeFull" Returns ------- Path pointer to the nefull file .. py:function:: _read_tomion(fname: pathlib.Path) -> TomionData reads a tomion format file and returns a TomionData object Parameters ---------- fname : Path filename Returns ------- TomionData object with data and axes of the data .. py:function:: _tomion_format(time: astropy.time.Time) -> tuple[str, str] helper function to get the url of the tomion data Parameters ---------- time : Time day for which to get the url Returns ------- tuple[Any, Any] url and the name how the data will be stored on disc .. py:function:: get_density_dual_layer(ipp: spinifex.geometry.IPP, tomion_options: spinifex.ionospheric.tec_data.TomionOptions | None = None) -> spinifex.ionospheric.tec_data.ElectronDensity extracts electron densities for the two TOMION_HEIGHTS for all times in ipp. The returned array will have zeros every where apart from the two altitudes closest to TOMION_HEIGHTS Parameters ---------- ipp : IPP input piercepoint locations tomion_options : TomionOptions | None, optional optional ionospheric model options, by default None Returns ------- ElectronDensity object with arrays of tec and tec_rms values for every entry in ipp Raises ------ FileNotFoundError error if the tomion files are not available locally nor online .. py:function:: get_tomion_paths_coro(unique_days: astropy.time.Time, tomion_options: spinifex.ionospheric.tec_data.TomionOptions | None = None) -> list[pathlib.Path] :async: download tomion data for all unique days Parameters ---------- unique_days : Time days for which to download data tomion_options : TomionOptions | None, optional options for the tomion model, by default None Returns ------- list[Any] list of paths to the files .. py:function:: interpolate_tomion(tomion: TomionData, lons: numpy.typing.NDArray[numpy.float64], lats: numpy.typing.NDArray[numpy.float64], times: astropy.time.Time, apply_earth_rotation: float = 1, get_rms: bool = False) -> numpy.typing.NDArray[numpy.float64] Interpolate tomion data to the requested lons/lats/times Parameters ---------- tomion : TomionData data object lons : NDArray[np.float64] array of longitudes at the two TOMION_HEIGHTS, shape (2,) lats : NDArray[np.float64] array of latitudes at the two TOMION_HEIGHTS, shape (2,) times : Time time apply_earth_rotation : float, optional specify (with a number between 0 and 1) how much of the earth rotation is taken in to account in the interpolation step., by default 1 get_rms : bool, optional use rms values instead of tec values Returns ------- NDArray[np.float64] electron density values at two TOMION_HEIGHTS, shape (2,) .. py:data:: MAX_INTERPOL_POINTS :type: int :value: 8 .. py:data:: TOMION_HEIGHTS :type: astropy.units.Quantity .. py:data:: TOMOION_FORMAT_DICT :type: dict[str, Any] .. py:data:: get_tomion_paths