{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from __future__ import annotations" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# How to download 'IONEX' files\n", "\n", "In `spinifex` we provide an interface for obtaining ionospheric model data from online sources that host IONEX files. Most users won't need to interact with these interfaces directly, as they will be called 'under the hood' by higher-level functions such as `spinifex.get_rm.get_rm_from_skycoord`.\n", "\n", "## Non-IONEX models\n", "\n", "We note here that `spinifex` also supports models of the ionosphere that do not actually require IONEX files. For example, you can swap the `iono_model` value to one of the other supported models, such as the International Reference Ionosphere (IRI). The available models can be enumerated as follows (we typically default to `spinifex.ionospheric.ionospheric_models.ionex`):" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from pprint import pprint\n", "\n", "from spinifex.ionospheric import ionospheric_models\n", "\n", "pprint(ionospheric_models)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Obtaining IONEX files\n", "\n", "### IONEX file servers\n", "\n", "Assuming you have elected to use an IONEX-based model, there are few options for obtaining the required files. Spinifex supports three hosts of IONEX data:\n", "\n", "- NASA CDDIS - `\"cddis\"`: https://cddis.nasa.gov/archive/gnss/products/ionex,\n", "- Barcelona Tech UPC 'Champan' - `\"chapman\"`: http://chapman.upc.es/tomion/rapid,\n", "- IGS Ionosphere Working Group - `\"igsiono\"`: ftp://igs-final.man.olsztyn.pl\",\n", "\n", "These services have their own unique ways of naming and storing files, which we have encoded in `spinifex`. These have also historically changed over time. If you find an issue on obtaining a file with `spinifex` which exists on one of these servers, please raise an issue.\n", "\n", "#### CDDIS\n", "\n", "The CDDIS has a large archive of IONEX data back to the 90's, but now requires authentication to access their data. To use this service you must register a NASA EARTHDATA Account [here](https://urs.earthdata.nasa.gov/). Then you need to create a `~/.netrc` file with the following text\n", "```\n", "machine urs.earthdata.nasa.gov login password \n", "```\n", "where `` and `` should be replaced with the appropriate values matching your account. If using CDDIS, Spinifex will search for this file and raise an error if it does not exist.\n", "\n", "#### Chapman and IGSiono\n", "\n", "The other IONEX servers have less historical data, but do not require an account to access them. For simplicity we default to using the Chapman service.\n", "\n", "### Types of IONEX files\n", "\n", "There are various types of IONEX files available. If in doubt, we have attempted to use sensible defaults throughout `spinifex`. Of note, there are various centres around the world the provide their own processing of GPS data. Further, there are different time resolutions available depending on the centre, the date, and the IONEX server.\n", "\n", "The supported processing centres and default time resolutions are as follows:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from spinifex.ionospheric import ionex_download\n", "\n", "print(\"Supported IONEX centres:\")\n", "pprint(ionex_download.CENTER_NAMES)\n", "print(\"Default IONEX time resolutions:\")\n", "pprint(ionex_download.DEFAULT_TIME_RESOLUTIONS)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Our main API for downloading IONEX files is `download_ionex`. The user is required to specify the required time as an `astropy.time.Time` object. The user can then optionally chose the a host server name (e.g. `\"chapman\"`), the IONEX centre prefix (e.g. `\"uqr`\"), the URL of the host server (more on that below), the time resolution as an `astropy.time.Time` object, the IONEX solution type (i.e. `\"final\"` or `\"rapid\"`), and the output directory for IONEX files as a `pathlib.Path`." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "help(ionex_download.download_ionex)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Offline use\n", "\n", "Before downloading, we check the `output_directory` Path for the required files. If located, we skip re-downloading and just point to the existing files.\n", "\n", "Additionally, the `server` argument effectively sets the filename formatting to match the given IONEX host, whereas the `url_stem` sets where the file will actually be retrieved from. This can be useful to take advantage of in cases where internet access is not guaranteed, such as HPC environments. For example, users may wish to make a local offline mirror of a host server. We could do this by:\n", "\n", "```bash\n", "cd /path/to/our/disk/\n", "wget --recursive --no-parent http://chapman.upc.es/tomion/rapid/\n", "```\n", "\n", "We could then point `download_ionex` call to our local files by setting `url_stem` as:\n", "\n", "```python\n", "download_ionex(\n", " ...\n", " server=\"chapman\",\n", " url_stem=\"file:///path/to/our/disk/chapman.upc.es/tomion/rapid\"\n", " ...\n", ")\n", "```" ] } ], "metadata": { "kernelspec": { "display_name": "spinifex", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.9" } }, "nbformat": 4, "nbformat_minor": 2 }