spinifex.ionospheric.tomion_parser

Module to parse the UPC-Ionsat tomion data format

Attributes

Classes

TomionData

Object containing all necessary information from Tomion data

Functions

_download_tomion_file(→ pathlib.Path)

download and convert tomion file to readable nefull text file or if the file already exists

_extract_nefull(→ pathlib.Path)

helper function to get the relevant information from the large tomion file.

_read_tomion(→ TomionData)

reads a tomion format file and returns a TomionData object

_tomion_format(→ tuple[str, str])

helper function to get the url of the tomion data

get_density_dual_layer(...)

extracts electron densities for the two TOMION_HEIGHTS for all times in ipp. The returned array

get_tomion_paths_coro(→ list[pathlib.Path])

download tomion data for all unique days

interpolate_tomion(→ numpy.typing.NDArray[numpy.float64])

Interpolate tomion data to the requested lons/lats/times

Module Contents

class spinifex.ionospheric.tomion_parser.TomionData[source]

Bases: NamedTuple

Object containing all necessary information from Tomion data

available_times: astropy.time.Time[source]

array with unique times

h: numpy.typing.NDArray[numpy.float64][source]

heights (km)

h_idx: numpy.typing.NDArray[numpy.int128][source]

array with index of height

lats: numpy.typing.NDArray[numpy.float64][source]

array with latitude values (degrees)

lons: numpy.typing.NDArray[numpy.float64][source]

array with longitude values (degrees)

stddev: numpy.typing.NDArray[numpy.float64][source]

array with voxel stddev values(TECU)

tec: numpy.typing.NDArray[numpy.float64][source]

array with voxel tecvalues(TECU)

times: astropy.time.Time[source]

times

async spinifex.ionospheric.tomion_parser._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[source]

download and convert tomion file to readable nefull text file or if the file already exists just return a pointer to the file

Parameters

urlstr

url of the file to download

nefull_namestr

name of the extracted nefull file

tomion_optionsTomionOptions | None, optional

options for the ionospheric model, by default None

timeout_secondsint, optional

time out for downloading, by default 30

chunk_sizeint, optional

chunksize for downloading, by default 1000

Returns

Path

pointer to the nefull file

Raises

IonexError

error if the download times out

async spinifex.ionospheric.tomion_parser._extract_nefull(tomion_file: pathlib.Path, output_file: pathlib.Path, search_term: str = 'NeFull') pathlib.Path[source]

helper function to get the relevant information from the large tomion file. Deletes the tomion file if the extraction was successful

Parameters

tomion_filePath

pointer to the tomion file

output_filePath

name of the nefull file

search_termstr, optional

the indicator for useful data in the tomion file, by default “NeFull”

Returns

Path

pointer to the nefull file

spinifex.ionospheric.tomion_parser._read_tomion(fname: pathlib.Path) TomionData[source]

reads a tomion format file and returns a TomionData object

Parameters

fnamePath

filename

Returns

TomionData

object with data and axes of the data

spinifex.ionospheric.tomion_parser._tomion_format(time: astropy.time.Time) tuple[str, str][source]

helper function to get the url of the tomion data

Parameters

timeTime

day for which to get the url

Returns

tuple[Any, Any]

url and the name how the data will be stored on disc

spinifex.ionospheric.tomion_parser.get_density_dual_layer(ipp: spinifex.geometry.IPP, tomion_options: spinifex.ionospheric.tec_data.TomionOptions | None = None) spinifex.ionospheric.tec_data.ElectronDensity[source]

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

ippIPP

input piercepoint locations

tomion_optionsTomionOptions | 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

async spinifex.ionospheric.tomion_parser.get_tomion_paths_coro(unique_days: astropy.time.Time, tomion_options: spinifex.ionospheric.tec_data.TomionOptions | None = None) list[pathlib.Path][source]

download tomion data for all unique days

Parameters

unique_daysTime

days for which to download data

tomion_optionsTomionOptions | None, optional

options for the tomion model, by default None

Returns

list[Any]

list of paths to the files

spinifex.ionospheric.tomion_parser.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][source]

Interpolate tomion data to the requested lons/lats/times

Parameters

tomionTomionData

data object

lonsNDArray[np.float64]

array of longitudes at the two TOMION_HEIGHTS, shape (2,)

latsNDArray[np.float64]

array of latitudes at the two TOMION_HEIGHTS, shape (2,)

timesTime

time

apply_earth_rotationfloat, 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_rmsbool, optional

use rms values instead of tec values

Returns

NDArray[np.float64]

electron density values at two TOMION_HEIGHTS, shape (2,)

spinifex.ionospheric.tomion_parser.MAX_INTERPOL_POINTS: int = 8[source]
spinifex.ionospheric.tomion_parser.TOMION_HEIGHTS: astropy.units.Quantity[source]
spinifex.ionospheric.tomion_parser.TOMOION_FORMAT_DICT: dict[str, Any][source]
spinifex.ionospheric.tomion_parser.get_tomion_paths[source]