{ "cells": [ { "cell_type": "markdown", "id": "b81404dc-3b08-4da4-b3dc-f9e4b6aaead0", "metadata": {}, "source": [ "## Objectives\n", "\n", "- This script shows how to use the TudatPy `mission_data_downloader` functionality to download:\n", " 1) **SPICE** (clock, frame, orientation, planetary) **Kernels**\n", " 2) **Closed Loop Doppler Data** (DSN and IFMS)\n", " 3) **Ancillary** Ionospheric and Tropospheric **Data**\n", "\n", " for some supported missions (see **NOTE 1** for a list of supported missions). \n", "\n", "- Moreover, we also show how to use the functionality to download the same type of files for a **custom, user-defined mission**.\n", "\n", "- Last but not least, we show how to use tudatpy to download:\n", " **all files listed in a given SPICE Meta-Kernel**.\n", "\n", " The mission archive is **cleaned up (namely, empty folders are removed)** at the end of each run.\n", "\n", "### NOTES\n", "**NOTE 1. (Supported Missions and Relative Downloaded Data).**\n", "\n", "The following spice kernels can be loaded automatically at the end of a run, if the `load_kernels` flag in the `get_mission_files` function is set to **True** (see MRO example in the next cells):\n", "\n", "1) **existing spice kernels** in the mission folder\n", "2) (new) **downloaded spice kernels**\n", "3) **standard TUDAT kernels** from [`spice.load_standard_kernels()`](https://py.api.tudat.space/en/latest/spice.html#tudatpy.interface.spice.load_standard_kernels) \n", "\n", "List of currently supported input_missions:\n", "- **Mars Reconnnaissance Orbiter (MRO)** [Available: Spice Kernels, Doppler Data, Ancillary]\n", "- **Mars Express (MEX)** [Available: Spice Kernels, Doppler Data, Ancillary]\n", "- **Jupiter Icy Moons Explorer (JUICE)** [Available: Spice Kernels, Not Available (yet): Doppler Data, Ancillary]\n", "- **Cassini** [Available: Spice Kernels, Doppler Data, Ancillary for all **Titan Flybys**]\n", "- **GRAIL (both Grail-A and Grail-B)** [Available: Spice Kernels, Doppler Data, Ancillary]\n", "\n", "Foreseen supported missions (in descending priority order, code yet to be developed):\n", "\n", "- Insight\n", "- VEX\n", "- LRO\n", "\n", "**NOTE 2. (Default and Custom Outputs)**\n", "\n", "The downloaded data for a given mission is stored (by default) in a folder named `_archive`. Subfolders are created automatically where Kernels, Radio Science Data and Ancillary Data are stored. \n", "The user can still define a custom output path passing the flag `custom_output` in the `get_mission_files` function. The output files will then be found in: `custom_path`\n", "\n", "**NOTE 3. (About DSN-TNF)**\n", "\n", "No DSN-TNF download functionality has been implemented (at least, not yet!)" ] }, { "cell_type": "markdown", "id": "38e125bc-7ae4-4c4d-9578-4aa7b0d5627d", "metadata": {}, "source": [ "## Load required standard modules\n", "The required modules and dependencies are taken from the `mission_data_downloader` class." ] }, { "cell_type": "code", "execution_count": 1, "id": "960740e6-2b3f-4816-96c4-7c292af8f9b0", "metadata": {}, "outputs": [], "source": [ "from tudatpy.data.mission_data_downloader import *" ] }, { "cell_type": "markdown", "id": "7c7d053f-a48e-4570-b828-a26b03d586fd", "metadata": {}, "source": [ "## Create the LoadPDS Object\n", "First, we create the LoadPDS() object." ] }, { "cell_type": "code", "execution_count": 2, "id": "5b389133-79f9-405d-8aab-451c8b08aec8", "metadata": {}, "outputs": [], "source": [ "object = LoadPDS()\n", "spice.clear_kernels() #lets clear the kernels to avoid duplicates,since we will load all standard + Downloaded + existing kernels" ] }, { "cell_type": "markdown", "id": "2f43bb56-edd9-44ac-a22b-1af763e51780", "metadata": {}, "source": [ "## MRO, MEX and JUICE Downloaders (Default Output)\n", "\n", "### Set Time Interval(s) for Downloading\n", "\n", "Then we select the `start_date` and `end_date`, and we do so for each mission we wish to download (Cassini will be an exception due to the peculiar mission concept, see **Cassini Downloader** below). Of course, each mission has to come with its own dates, as operations are carried out over different periods.\n", "\n", "### Download Mission Files (MRO, MEX, JUICE)\n", "\n", "\n", "Finally, we can call the function `get_mission_files`, specifying the above-defined start and end dates.\n", "\n", "Only for this first example, we set the `load_kernels` flag to **True**. This way, we allow for automatic loading of SPICE kernels. If you do not wish to load them, you can simply remove the flag.\n", "\n", "**NOTE 5. (About MEX and JUICE Files Download)**\n", "\n", "Here, we will only showcase the downloading of MRO files. However, **if you wish to download files for MEX or JUICE**, you can simply **uncomment the corresponding lines** in the cell below! We have included those **just for you**!\n" ] }, { "cell_type": "code", "execution_count": 3, "id": "92902ed5-e805-4028-a147-14df0ec6be58", "metadata": { "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "======================================= Downloading MRO Data ==============================================\n", "\n", "=========================================== Folder(s) Creation ==================================================\n", "Creating Local Folder: mro_archive/ and its subfolders (kernels and radio)...\n", "Folder: mro_archive/ already exists and will not be overwritten.\n", "===============================================================================================================\n", "\n", "===========================================================================================================\n", "Download MRO ODF files:\n", "Checking URL: https://pds-geosciences.wustl.edu/mro/mro-m-rss-1-magr-v1/mrors_0xxx/odf/\n", "Downloading: https://pds-geosciences.wustl.edu/mro/mro-m-rss-1-magr-v1/mrors_0xxx/odf/mromagr2007_003_0845xmmmv1.odf to: mro_archive/odf/mromagr2007_003_0845xmmmv1.odf\n", "Downloading: https://pds-geosciences.wustl.edu/mro/mro-m-rss-1-magr-v1/mrors_0xxx/odf/mromagr2007_004_1801xmmmv1.odf to: mro_archive/odf/mromagr2007_004_1801xmmmv1.odf\n", "...Done.\n", "===========================================================================================================\n", "Download MRO Clock Kernels:\n", "Downloading File: https://naif.jpl.nasa.gov/pub/naif/pds/data/mro-m-spice-6-v1.0/mrosp_1000/data/sclk/mro_sclkscet_00112_65536.tsc to: mro_archive/sclk/mro_sclkscet_00112_65536.tsc\n", "===========================================================================================================\n", "Download MRO Frame Kernels:\n", "Downloading File: https://naif.jpl.nasa.gov/pub/naif/pds/data/mro-m-spice-6-v1.0/mrosp_1000/data/fk/mro_v16.tf to: mro_archive/fk/mro_v16.tf\n", "===========================================================================================================\n", "Download MRO SPK Kernels:\n", "Downloading File: https://naif.jpl.nasa.gov/pub/naif/pds/data/mro-m-spice-6-v1.0/mrosp_1000/data/spk/mro_psp2.bsp to: mro_archive/spk/mro_psp2.bsp\n", "Downloading File: https://naif.jpl.nasa.gov/pub/naif/pds/data/mro-m-spice-6-v1.0/mrosp_1000/data/spk/mro_struct_v10.bsp to: mro_archive/spk/mro_struct_v10.bsp\n", "===========================================================================================================\n", "Download MRO Orientation Kernels:\n", "Checking URL: https://naif.jpl.nasa.gov/pub/naif/pds/data/mro-m-spice-6-v1.0/mrosp_1000/data/ck/\n", "Downloading: https://naif.jpl.nasa.gov/pub/naif/pds/data/mro-m-spice-6-v1.0/mrosp_1000/data/ck/mro_sc_psp_070102_070108.bc to: mro_archive/ck/mro_sc_psp_070102_070108.bc\n", "...Done.\n", "===========================================================================================================\n", "Download MRO Tropospheric Corrections Files\n", "Checking URL: https://pds-geosciences.wustl.edu/mro/mro-m-rss-1-magr-v1/mrors_0xxx/ancillary/tro/\n", "Downloading: https://pds-geosciences.wustl.edu/mro/mro-m-rss-1-magr-v1/mrors_0xxx/ancillary/tro/mromagr2007_001_2007_032.tro to: mro_archive/tro/mromagr2007_001_2007_032.tro\n", "...Done.\n", "===========================================================================================================\n", "Download MRO Ionospheric Corrections Files\n", "Checking URL: https://pds-geosciences.wustl.edu/mro/mro-m-rss-1-magr-v1/mrors_0xxx/ancillary/ion/\n", "Downloading: https://pds-geosciences.wustl.edu/mro/mro-m-rss-1-magr-v1/mrors_0xxx/ancillary/ion/mromagr2007_001_2007_032.ion to: mro_archive/ion/mromagr2007_001_2007_032.ion\n", "...Done.\n", "All kernels have been loaded.\n", "\n", "===============================================================================================================\n", "Number of Loaded Existing + Downloaded Kernels: 7\n", "Number of Loaded Standard Kernels: 13\n", "===============================================================================================================\n", "Cleaning Mission Archive...\n", "Done.\n", "Total number of loaded kernels: 20\n" ] } ], "source": [ "start_date_mro = datetime(2007, 1, 3)\n", "end_date_mro = datetime(2007, 1, 5)\n", "\n", "#start_date_mex = datetime(2004, 1, 3)\n", "#end_date_mex = datetime(2004,2, 7) \n", "\n", "#start_date_juice = datetime(2023, 7, 1)\n", "#end_date_juice = datetime(2023, 8, 10)\n", "\n", "# Download Mission Files with default output folder\n", "# (only MRO is shown here. Uncomment the corresponding lines to download data for MEX and JUICE!)\n", "\n", "kernel_files_mro, radio_science_files_mro, ancillary_files_mro = object.get_mission_files(\n", " input_mission = 'mro', \n", " start_date = start_date_mro, \n", " end_date = end_date_mro, \n", " custom_output = None,\n", " load_kernels = True) \n", "\n", "print(f'Total number of loaded kernels: {spice.get_total_count_of_kernels_loaded()}')\n", "\n", "#kernel_files_mex, radio_science_files_mex, ancillary_files_mex = object.get_mission_files(\n", "# input_mission = 'mex', \n", "# start_date = start_date_mex, \n", "# end_date = end_date_mex) \n", "#print(f'Total number of loaded kernels: {spice.get_total_count_of_kernels_loaded()}')\n", "\n", "#kernel_files_juice, radio_science_files_juice, ancillary_files_juice = object.get_mission_files(\n", "# input_mission = 'juice',\n", "# start_date = start_date_juice,\n", "# end_date = end_date_juice) \n", "#print(f'Total number of loaded kernels: {spice.get_total_count_of_kernels_loaded()}')" ] }, { "cell_type": "markdown", "id": "1901bd8e-1e40-4b50-b0d1-d55acb92d1eb", "metadata": {}, "source": [ "### Loaded Kernels for MRO, MEX and JUICE (Existing + Downloaded)\n", "Let's print the list of existing + downloaded files. " ] }, { "cell_type": "code", "execution_count": 4, "id": "848b1ea2-7800-439a-a463-601cc84f2e9b", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "MRO Kernels: {'sclk': ['mro_archive/sclk/mro_sclkscet_00112_65536.tsc'], 'fk': ['mro_archive/fk/mro_v16.tf'], 'spk': ['mro_archive/spk/mro_psp2.bsp', 'mro_archive/spk/mro_struct_v10.bsp'], 'ck': ['mro_archive/ck/mro_sc_psp_070102_070108.bc']}\n", "\n", "MRO Radio Science: {'odf': ['mro_archive/odf/mromagr2007_003_0845xmmmv1.odf', 'mro_archive/odf/mromagr2007_004_1801xmmmv1.odf']}\n", "\n", "MRO Ancillary: {'tro': ['mro_archive/tro/mromagr2007_001_2007_032.tro'], 'ion': ['mro_archive/ion/mromagr2007_001_2007_032.ion']}\n", "\n" ] } ], "source": [ "print(f'MRO Kernels: {kernel_files_mro}\\n')\n", "print(f'MRO Radio Science: {radio_science_files_mro}\\n')\n", "print(f'MRO Ancillary: {ancillary_files_mro}\\n')\n", "\n", "#print(f'MEX Kernels: {kernel_files_mex}\\n')\n", "#print(f'MEX Radio Science: {radio_science_files_mex}\\n')\n", "#print(f'MEX Ancillary: {ancillary_files_mex}\\n')\n", "\n", "#print(f'JUICE Kernels: {kernel_files_juice}\\n')\n", "#print(f'JUICE Radio Science: {radio_science_files_juice}\\n') # it will be empty for now... (no Radio Science yet available on the server)\n", "#print(f'JUICE Ancillary: {ancillary_files_juice}\\n') # it will be empty for now... (no Ancillary files yet available on the server)" ] }, { "cell_type": "markdown", "id": "747f7733-2c9f-4ad1-bf16-0d3cf2b29949", "metadata": {}, "source": [ "## Cassini Downloader (with Custom Output)\n", "\n", "### Set Flybys for Downloading\n", "\n", "The most valuable data collected for Cassini is probably the one related to the various flybys of the Moons of Saturn.\n", "For this reason, in order to retrieve Cassini data, we will require the **name of the flyby** data the user wishes to download, rather than a start and end date (see **Notes 5 and 6** for info on the supported flybys). \n", "\n", "### How to pick a Cassini flyby?\n", "- If you already know the name of the flyby you want to download (e.g. T011, T022, etc...), you can simply call the function `get_mission_files` with `input_mission = 'Cassini'`, also adding the flag `flyby_IDs = T011` (or `flyby_IDs = T022`, ec...). \n", "\n", "- Alternatively, calling `get_mission_files` with 'Cassini' as `input_mission` and no `flyby_IDs` flag **will print a comprehensive table of supported flybys to choose from**, and you will be asked to **manually input** the name of one (or more) of them. This table is constructed based on the [Cassini Titan Gravity Science Table](https://pds-atmospheres.nmsu.edu/data_and_services/atmospheres_data/Cassini/Cassini/RSS%20PDS%20page%202019-01-23/rss/TI_12.html).\n", "\n", "### Flyby Data Output Division\n", "\n", "The default output folder will be named `cassini_archive/MOON_NAME/FLYBY_ID/`, where `MOON_NAME` is the flyby moon, and `FLYBY_ID` is the denomination of each downloaded flyby (e.g. T011, T022). Each subfolder will contain kernel ancillary and radio science subdirectories. In this example, we will download files from the **flyby T011**, and we will store them in the custom path: `'CASSINI_CUSTOM_ARCHIVE/'`\n", "\n", "\n", "### NOTES\n", "**NOTE 5. Supported Flyby Moons**\n", "\n", "For now, only Titan Flybys are supported.\n", "\n", "**NOTE 6. All flyby_IDs types**\n", "\n", "`flyby_IDs` can be:\n", "1) a list made of single flybys like: `flyby_IDs = ['T011', 'T022']` or `flyby_IDs = ['T011']`\n", "2) a single string object like: `flyby_IDs = 'T011'` (not a list)\n", "3) a list made of all flybys performed at a given moon: `flyby_IDs = ['ALL_TITAN']`\n", "4) a single string object like: `flyby_IDs = 'ALL_TITAN'`\n", "5) a mixed list like: `flyby_IDs = ['T011', 'ALL_TITAN']`\n", "\n", "As mentioned above in *Download Cassini Flyby Files*, **you can also decide not to specify any flyby_ID**. \n", "In this case, **a table will be printed out** from which you will be able to interactively select the flyby you're interested in. \n", "\n", "**NOTE 7. Custom Output**\n", "\n", "As we mentioned above, the **default** output folder will be: `cassini_archive/MOON_NAME/FLYBY_ID/`\n", "The user can still define a custom output path using the flag `custom_output` in the `get_mission_files` function. The output files will then be found in: `custom_path/MOON_NAME/FLYBY_ID/`" ] }, { "cell_type": "code", "execution_count": 5, "id": "4a9fa913-5fba-4c05-b5eb-df19bb1eeb62", "metadata": { "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "======================================= Downloading CASSINI Data ==============================================\n", "\n", "=========================================== Folder(s) Creation ==================================================\n", "Creating Local Folder: CASSINI_CUSTOM_ARCHIVE/ and its subfolders (kernels and radio)...\n", "===============================================================================================================\n", "\n", "===========================================================================================================\n", "Download CASSINI Kernels (ck, spk) Ancillary Files (eop, ion, tro) and Radio Science (odf) files from PDS Atmosphere Node:\n", "Downloading: 'https://atmos.nmsu.edu/pdsd/archive/data/co-ssa-rss-1-tigr3-v10/cors_0133/tigr3_ancillary/ckf/s18tige2006_057_2006_062.ckf' to: CASSINI_CUSTOM_ARCHIVE/TITAN/T011/ck/S18TIGE2006_057_2006_062.CKF\n", "Downloading: 'https://atmos.nmsu.edu/pdsd/archive/data/co-ssa-rss-1-tigr3-v10/cors_0133/tigr3_ancillary/ckf/s19tige2006_075_2006_079.ckf' to: CASSINI_CUSTOM_ARCHIVE/TITAN/T011/ck/S19TIGE2006_075_2006_079.CKF\n", "Downloading: 'https://atmos.nmsu.edu/pdsd/archive/data/co-ssa-rss-1-tigr3-v10/cors_0133/tigr3_ancillary/eop/s18tige2005_141_2006_142.eop' to: CASSINI_CUSTOM_ARCHIVE/TITAN/T011/eop/S18TIGE2005_141_2006_142.EOP\n", "Downloading: 'https://atmos.nmsu.edu/pdsd/archive/data/co-ssa-rss-1-tigr3-v10/cors_0133/tigr3_ancillary/ion/s18tige2006_032_2006_059.ion' to: CASSINI_CUSTOM_ARCHIVE/TITAN/T011/ion/S18TIGE2006_032_2006_059.ION\n", "Downloading: 'https://atmos.nmsu.edu/pdsd/archive/data/co-ssa-rss-1-tigr3-v10/cors_0133/tigr3_ancillary/ion/s19tige2006_060_2006_090.ion' to: CASSINI_CUSTOM_ARCHIVE/TITAN/T011/ion/S19TIGE2006_060_2006_090.ION\n", "Downloading: 'https://atmos.nmsu.edu/pdsd/archive/data/co-ssa-rss-1-tigr3-v10/cors_0133/tigr3_ancillary/spk/s18tige2006_036_2006_068.spk' to: CASSINI_CUSTOM_ARCHIVE/TITAN/T011/spk/S18TIGE2006_036_2006_068.SPK\n", "Downloading: 'https://atmos.nmsu.edu/pdsd/archive/data/co-ssa-rss-1-tigr3-v10/cors_0133/tigr3_ancillary/spk/s19tige2006_068_2006_099.spk' to: CASSINI_CUSTOM_ARCHIVE/TITAN/T011/spk/S19TIGE2006_068_2006_099.SPK\n", "Downloading: 'https://atmos.nmsu.edu/pdsd/archive/data/co-ssa-rss-1-tigr3-v10/cors_0133/tigr3_ancillary/tro/s18tige2006_032_2006_059.tro' to: CASSINI_CUSTOM_ARCHIVE/TITAN/T011/tro/S18TIGE2006_032_2006_059.TRO\n", "Downloading: 'https://atmos.nmsu.edu/pdsd/archive/data/co-ssa-rss-1-tigr3-v10/cors_0133/tigr3_ancillary/tro/s18tige2006_060_2006_080.tro' to: CASSINI_CUSTOM_ARCHIVE/TITAN/T011/tro/S18TIGE2006_060_2006_080.TRO\n", "Downloading: 'https://atmos.nmsu.edu/pdsd/archive/data/co-ssa-rss-1-tigr3-v10/cors_0133/tigr3_058/odf/s18tigm2006_058_0005x25mv1.odf' to: CASSINI_CUSTOM_ARCHIVE/TITAN/T011/odf/S18TIGM2006_058_0005X25MV1.ODF\n", "===========================================================================================================\n", "Download CASSINI Frame Kernels from NAIF:\n", "Downloading File: https://naif.jpl.nasa.gov/pub/naif/CASSINI/kernels/fk/cas_v43.tf to: CASSINI_CUSTOM_ARCHIVE/TITAN/T011/fk/cas_v43.tf\n", "All kernels have been loaded.\n", "\n", "Number of Loaded Existing + Downloaded + Standard Kernels: 20\n", "===============================================================================================================\n", "Cleaning Mission Archive...\n", "Done.\n", "Total number of loaded kernels: 20\n" ] } ], "source": [ "# Download Cassini Titan Flyby T011 Files specifying './CASSINI_ARCHIVE/' as custom output\n", "flyby_IDs = 'T011'\n", "kernel_files_cassini, radio_science_files_cassini, ancillary_files_cassini = object.get_mission_files(\n", " input_mission = 'cassini', \n", " flyby_IDs = flyby_IDs, \n", " custom_output = 'CASSINI_CUSTOM_ARCHIVE/')\n", "print(f'Total number of loaded kernels: {spice.get_total_count_of_kernels_loaded()}')" ] }, { "cell_type": "markdown", "id": "1fc54783-62ed-4ab7-8ab1-d5637cecb2a3", "metadata": {}, "source": [ "### Loaded Kernels for Cassini Titan Flyby (Existing + Downloaded)\n", "Last, you can print the list of existing + downloaded files. " ] }, { "cell_type": "code", "execution_count": 6, "id": "b33344da-55e8-490d-a9d4-41a9754857d3", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "CASSINI Kernels: {'ck': ['CASSINI_CUSTOM_ARCHIVE/TITAN/T011/ck/S18TIGE2006_057_2006_062.ck', 'CASSINI_CUSTOM_ARCHIVE/TITAN/T011/ck/S19TIGE2006_075_2006_079.ck'], 'spk': ['CASSINI_CUSTOM_ARCHIVE/TITAN/T011/spk/S18TIGE2006_036_2006_068.bsp', 'CASSINI_CUSTOM_ARCHIVE/TITAN/T011/spk/S19TIGE2006_068_2006_099.bsp'], 'fk': ['CASSINI_CUSTOM_ARCHIVE/TITAN/T011/fk/cas_v43.tf']}\n", "\n", "CASSINI Radio Science: {'odf': ['CASSINI_CUSTOM_ARCHIVE/TITAN/T011/odf/S18TIGM2006_058_0005X25MV1.ODF']}\n", "\n", "CASSINI Ancillary: {'eop': ['CASSINI_CUSTOM_ARCHIVE/TITAN/T011/eop/S18TIGE2005_141_2006_142.EOP'], 'ion': ['CASSINI_CUSTOM_ARCHIVE/TITAN/T011/ion/S18TIGE2006_032_2006_059.ION', 'CASSINI_CUSTOM_ARCHIVE/TITAN/T011/ion/S19TIGE2006_060_2006_090.ION'], 'tro': ['CASSINI_CUSTOM_ARCHIVE/TITAN/T011/tro/S18TIGE2006_032_2006_059.TRO', 'CASSINI_CUSTOM_ARCHIVE/TITAN/T011/tro/S18TIGE2006_060_2006_080.TRO']}\n", "\n" ] } ], "source": [ "print(f'CASSINI Kernels: {kernel_files_cassini}\\n')\n", "print(f'CASSINI Radio Science: {radio_science_files_cassini}\\n')\n", "print(f'CASSINI Ancillary: {ancillary_files_cassini}\\n')" ] }, { "cell_type": "markdown", "id": "b07e4929-0064-4ec7-9b12-7f275394992a", "metadata": {}, "source": [ "## GRAIL-A and GRAIL-B Downloaders (Custom Output)\n", "You can also download **GRAIL data** for both **GRAIL-A and GRAIL-B** spacecraft. These can be downloaded as usual via the command: `get_mission_files`, specifying either: 'grail-a' or 'grail_b' as `input_mission` (we add the lines relative to **GRAIL-B as comments**, but users are definitely encouraged to **uncomment them and try them out!**) Two folders will be created by default: `grail_archive/grail-a` and `grail_archive/grail-b`. However, you can still choose your own custom output folder. Let's call it `'GRAIL_ARCHIVE'`." ] }, { "cell_type": "code", "execution_count": 7, "id": "593154f6-b13c-4ce7-b2f8-7ec2b4d9d54b", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "======================================= Downloading GRAIL-A Data ==============================================\n", "\n", "=========================================== Folder(s) Creation ==================================================\n", "Creating Local Folder: ./GRAIL_ARCHIVE/grail-a and its subfolders (kernels and radio)...\n", "Folder: ./GRAIL_ARCHIVE/grail-a already exists and will not be overwritten.\n", "===============================================================================================================\n", "\n", "===========================================================================================================\n", "Download GRAIL-A ODF files:\n", "Checking URL: https://pds-geosciences.wustl.edu/grail/grail-l-rss-2-edr-v1/grail_0201/odf/\n", "Downloading: https://pds-geosciences.wustl.edu/grail/grail-l-rss-2-edr-v1/grail_0201/odf/gralugf2012_097_0235smmmv1.odf to: ./GRAIL_ARCHIVE/grail-a/odf/gralugf2012_097_0235smmmv1.odf\n", "Downloading: https://pds-geosciences.wustl.edu/grail/grail-l-rss-2-edr-v1/grail_0201/odf/gralugf2012_099_0407smmmv1.odf to: ./GRAIL_ARCHIVE/grail-a/odf/gralugf2012_099_0407smmmv1.odf\n", "Downloading: https://pds-geosciences.wustl.edu/grail/grail-l-rss-2-edr-v1/grail_0201/odf/gralugf2012_100_0540smmmv1.odf to: ./GRAIL_ARCHIVE/grail-a/odf/gralugf2012_100_0540smmmv1.odf\n", "Downloading: https://pds-geosciences.wustl.edu/grail/grail-l-rss-2-edr-v1/grail_0201/odf/gralugf2012_101_0235smmmv1.odf to: ./GRAIL_ARCHIVE/grail-a/odf/gralugf2012_101_0235smmmv1.odf\n", "Downloading: https://pds-geosciences.wustl.edu/grail/grail-l-rss-2-edr-v1/grail_0201/odf/gralugf2012_102_0358smmmv1.odf to: ./GRAIL_ARCHIVE/grail-a/odf/gralugf2012_102_0358smmmv1.odf\n", "Downloading: https://pds-geosciences.wustl.edu/grail/grail-l-rss-2-edr-v1/grail_0201/odf/gralugf2012_103_0145smmmv1.odf to: ./GRAIL_ARCHIVE/grail-a/odf/gralugf2012_103_0145smmmv1.odf\n", "...Done.\n", "===========================================================================================================\n", "Download GRAIL-A Clock Kernels:\n", "Warning: Clock Kernel Ambiguity Found: ['https://naif.jpl.nasa.gov/pub/naif/pds/data/grail-l-spice-6-v1.0/grlsp_1000/data/sclk/gra_sclkscet_00013.tsc', 'https://naif.jpl.nasa.gov/pub/naif/pds/data/grail-l-spice-6-v1.0/grlsp_1000/data/sclk/grb_sclkscet_00020.tsc'].\n", "Warning: Clock Kernel Ambiguity Found: ['https://naif.jpl.nasa.gov/pub/naif/pds/data/grail-l-spice-6-v1.0/grlsp_1000/data/sclk/gra_sclkscet_00013.tsc', 'https://naif.jpl.nasa.gov/pub/naif/pds/data/grail-l-spice-6-v1.0/grlsp_1000/data/sclk/grb_sclkscet_00020.tsc'].\n", "Downloading File: https://naif.jpl.nasa.gov/pub/naif/pds/data/grail-l-spice-6-v1.0/grlsp_1000/data/sclk/gra_sclkscet_00013.tsc to: ./GRAIL_ARCHIVE/grail-a/grail-a/sclk/gra_sclkscet_00013.tsc\n", "Downloading File: https://naif.jpl.nasa.gov/pub/naif/pds/data/grail-l-spice-6-v1.0/grlsp_1000/data/sclk/grb_sclkscet_00020.tsc to: ./GRAIL_ARCHIVE/grail-a/grail-a/sclk/grb_sclkscet_00020.tsc\n", "===========================================================================================================\n", "Download GRAIL-A Frame Kernels:\n", "Downloading File: https://naif.jpl.nasa.gov/pub/naif/pds/data/grail-l-spice-6-v1.0/grlsp_1000/data/fk/grail_v07.tf to: ./GRAIL_ARCHIVE/grail-a/grail-a/fk/grail_v07.tf\n", "===========================================================================================================\n", "Download GRAIL-A Manoeuver Files:\n", "Downloading File: https://pds-geosciences.wustl.edu/grail/grail-l-lgrs-2-edr-v1/grail_0001/level_0/2012_04_06/mas00_2012_04_06_a_04.asc to: ./GRAIL_ARCHIVE/grail-a/grail-a/manoeuver/mas00_2012_04_06_a_04.asc\n", "===========================================================================================================\n", "Download GRAIL-A SPK Kernels:\n", "Checking URL: https://naif.jpl.nasa.gov/pub/naif/pds/data/grail-l-spice-6-v1.0/grlsp_1000/data/spk/\n", "Downloading: https://naif.jpl.nasa.gov/pub/naif/pds/data/grail-l-spice-6-v1.0/grlsp_1000/data/spk/grail_120301_120529_sci_v02.bsp to: ./GRAIL_ARCHIVE/grail-a/spk/grail_120301_120529_sci_v02.bsp\n", "...Done.\n", "===========================================================================================================\n", "Download GRAIL-A Orientation Kernels:\n", "Checking URL: https://naif.jpl.nasa.gov/pub/naif/pds/data/grail-l-spice-6-v1.0/grlsp_1000/data/ck/\n", "Downloading: https://naif.jpl.nasa.gov/pub/naif/pds/data/grail-l-spice-6-v1.0/grlsp_1000/data/ck/gra_rec_120402_120408.bc to: ./GRAIL_ARCHIVE/grail-a/ck/gra_rec_120402_120408.bc\n", "Downloading: https://naif.jpl.nasa.gov/pub/naif/pds/data/grail-l-spice-6-v1.0/grlsp_1000/data/ck/gra_rec_120409_120415.bc to: ./GRAIL_ARCHIVE/grail-a/ck/gra_rec_120409_120415.bc\n", "...Done.\n", "===========================================================================================================\n", "Download GRAIL-A Tropospheric Corrections Files\n", "Checking URL: https://pds-geosciences.wustl.edu/grail/grail-l-rss-2-edr-v1/grail_0201/ancillary/tro/\n", "Downloading: https://pds-geosciences.wustl.edu/grail/grail-l-rss-2-edr-v1/grail_0201/ancillary/tro/grxlugf2012_092_2012_122.tro to: ./GRAIL_ARCHIVE/grail-a/tro/grxlugf2012_092_2012_122.tro\n", "...Done.\n", "===========================================================================================================\n", "Download GRAIL-A Ionospheric Corrections Files\n", "Checking URL: https://pds-geosciences.wustl.edu/grail/grail-l-rss-2-edr-v1/grail_0201/ancillary/ion/\n", "Downloading: https://pds-geosciences.wustl.edu/grail/grail-l-rss-2-edr-v1/grail_0201/ancillary/ion/gralugf2012_092_2012_122.ion to: ./GRAIL_ARCHIVE/grail-a/ion/gralugf2012_092_2012_122.ion\n", "...Done.\n", "All kernels have been loaded.\n", "\n", "Number of Loaded Existing + Downloaded + Standard Kernels: 20\n", "===============================================================================================================\n", "Cleaning Mission Archive...\n", "Done.\n", "Total number of loaded kernels: 20\n", "\n", "\n", "GRAIL-A Kernels: {'sclk': ['./GRAIL_ARCHIVE/grail-a/grail-a/sclk/gra_sclkscet_00013.tsc', './GRAIL_ARCHIVE/grail-a/grail-a/sclk/grb_sclkscet_00020.tsc'], 'fk': ['./GRAIL_ARCHIVE/grail-a/grail-a/fk/grail_v07.tf'], 'ck': ['./GRAIL_ARCHIVE/grail-a/ck/gra_rec_120402_120408.bc', './GRAIL_ARCHIVE/grail-a/ck/gra_rec_120409_120415.bc']}\n", "\n", "GRAIL-A Radio Science: {'odf': ['./GRAIL_ARCHIVE/grail-a/odf/gralugf2012_097_0235smmmv1.odf', './GRAIL_ARCHIVE/grail-a/odf/gralugf2012_099_0407smmmv1.odf', './GRAIL_ARCHIVE/grail-a/odf/gralugf2012_100_0540smmmv1.odf', './GRAIL_ARCHIVE/grail-a/odf/gralugf2012_101_0235smmmv1.odf', './GRAIL_ARCHIVE/grail-a/odf/gralugf2012_102_0358smmmv1.odf', './GRAIL_ARCHIVE/grail-a/odf/gralugf2012_103_0145smmmv1.odf']}\n", "\n", "GRAIL-A Ancillary: {'manoeuver': ['./GRAIL_ARCHIVE/grail-a/grail-a/manoeuver/mas00_2012_04_06_a_04.asc'], 'tro': ['./GRAIL_ARCHIVE/grail-a/tro/grxlugf2012_092_2012_122.tro'], 'ion': ['./GRAIL_ARCHIVE/grail-a/ion/gralugf2012_092_2012_122.ion']}\n", "\n", "\n" ] } ], "source": [ "start_date_grail_a = datetime(2012, 4, 6)\n", "end_date_grail_a = datetime(2012, 4, 12)\n", "start_date_grail_b = datetime(2012, 5, 6)\n", "end_date_grail_b = datetime(2012, 6, 12)\n", "\n", "kernel_files_grail_a, radio_science_files_grail_a, ancillary_files_grail_a = object.get_mission_files(\n", " input_mission = 'grail-a', \n", " start_date = start_date_grail_a, \n", " end_date = end_date_grail_a, \n", " custom_output = './GRAIL_ARCHIVE'\n", ") \n", "print(f'Total number of loaded kernels: {spice.get_total_count_of_kernels_loaded()}\\n\\n')\n", "\n", "print(f'GRAIL-A Kernels: {kernel_files_grail_a}\\n')\n", "print(f'GRAIL-A Radio Science: {radio_science_files_grail_a}\\n')\n", "print(f'GRAIL-A Ancillary: {ancillary_files_grail_a}\\n\\n')\n", "\n", "#kernel_files_grail_b, radio_science_files_grail_b, ancillary_files_grail_b = object.get_mission_files(\n", "# input_mission = 'grail-b', start_date = start_date_grail_b, end_date = end_date_grail_b, custom_output = './GRAIL_ARCHIVE'\n", "#) \n", "#print(f'Total number of loaded kernels: {spice.get_total_count_of_kernels_loaded()}\\n\\n')\n", "\n", "#print(f'GRAIL-B Kernels: {kernel_files_grail_b}\\n')\n", "#print(f'GRAIL-B Radio Science: {radio_science_files_grail_b}\\n')\n", "#print(f'GRAIL-B Ancillary: {ancillary_files_grail_b}\\n')" ] }, { "cell_type": "markdown", "id": "1c3b09f6-6a3c-4605-b2de-54ed1dc4a7e0", "metadata": {}, "source": [ "## Downloading Kernels For Non-Supported Missions \n", "As we mentioned in the beginning, users can also download **SPICE kernels** and **Ancillary Data** for non-supported missions (**Doppler data download** for non-supported missions is **not supported yet**!). \n", "\n", "### Customizing URLs and Patterns\n", "The folllowing cell shows how to download SPICE Orientation Kernels (ck) for **LRO** (not supported mission) specifying **custom url** and **output folder**.\n", "\n", "The steps to be performed are:\n", "\n", "1) Define the name of your `custom_input_mission`;\n", "2) Add a `custom_ck_url` (namely, the NAIF link where ck kernels for the mission are stored);\n", "3) Define a `placeholders` list.\n", "\n", " ***IMPORTANT!***\n", " \n", " *`placeholders` is a list containing the single pieces that make up a \"template filename\", selected by the user.\n", " For instance, **let's suppose you want to download all files with the same structure as**: `lrodv_2012060_2012092_v01.bc`. This will then be considered as your **template filename**.*\n", " *The `placeholders` list defines the keys to a vocabulary, plus the underscores positions.*\n", " \n", " *In this case:*\n", " \n", " *mission = lro,*\n", " *instrument = dv,*\n", " *start_date = 2012060,*\n", " *end_date = 2012092,*\n", " *version = v01,*\n", " *extension = bc*\n", " \n", " *and corresponding placeholders list will be:*\n", " *placeholders = ['mission', 'instrument', '_', 'start_date_file', '_', 'end_date_file', '_', 'version', 'extension'],*\n", " \n", " *also encoding the underscores positions.*\n", " \n", "5) Create the pattern corresponding to the `placeholders` list;\n", "6) Add the corresponding pattern to the list of supported patterns;\n", "7) Define the `custom_local_path` where you want to store your data;\n", "8) Call the `get_mission_files` function as done for other missions already, and do not forget the **flag**: `all_meta_kernel_files`.\n", "9) Specify the start and end date\n", "10) Call the `dynamic_download_url_files_time_interval` function.\n", "\n", "**NOTE 8. About Start and End Dates** \n", "\n", "As it will be shown later in the example, you can also **[download all files of a certain type](#Download_all_Files_of_a_Certain_Type)** (ck, spk, fk, odf, etc...) present at a given url, **regardless of the start and end date**." ] }, { "cell_type": "code", "execution_count": 8, "id": "dfef35d6-8f7a-46ea-b374-5292470e29a9", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Checking URL: https://naif.jpl.nasa.gov/pub/naif/pds/data/lro-l-spice-6-v1.0/lrosp_1000/data/ck/\n", "Creating Local Folder: ./lro_archive\n", "Creating Local Subfolder: ./lro_archive/ck\n", "Downloading: https://naif.jpl.nasa.gov/pub/naif/pds/data/lro-l-spice-6-v1.0/lrosp_1000/data/ck/lrodv_2009186_2009213_v01.bc to: ./lro_archive/ck/lrodv_2009186_2009213_v01.bc\n", "Downloading: https://naif.jpl.nasa.gov/pub/naif/pds/data/lro-l-spice-6-v1.0/lrosp_1000/data/ck/lrosc_2009172_2009182_v01.bc to: ./lro_archive/ck/lrosc_2009172_2009182_v01.bc\n", "Downloading: https://naif.jpl.nasa.gov/pub/naif/pds/data/lro-l-spice-6-v1.0/lrosp_1000/data/ck/lrosc_2009182_2009192_v01.bc to: ./lro_archive/ck/lrosc_2009182_2009192_v01.bc\n", "...Done.\n", "Checking URL: https://naif.jpl.nasa.gov/pub/naif/pds/data/lro-l-spice-6-v1.0/lrosp_1000/data/spk/\n", "Creating Local Subfolder: ./lro_archive/spk\n", "Downloading: https://naif.jpl.nasa.gov/pub/naif/pds/data/lro-l-spice-6-v1.0/lrosp_1000/data/spk/lrorg_2009169_2010001_v01.bsp to: ./lro_archive/spk/lrorg_2009169_2010001_v01.bsp\n", "...Done.\n" ] }, { "data": { "text/plain": [ "['./lro_archive/spk/lrorg_2009169_2010001_v01.bsp']" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "custom_input_mission = 'lro'\n", "custom_ck_url = 'https://naif.jpl.nasa.gov/pub/naif/pds/data/lro-l-spice-6-v1.0/lrosp_1000/data/ck/'\n", "\n", "local_path = './lro_archive'\n", "start_date_lro = datetime(2009, 7, 1)\n", "end_date_lro = datetime(2009, 7, 10)\n", "\n", "object.add_custom_mission_kernel_url(custom_input_mission, custom_ck_url)\n", "\n", "placeholders_ck = ['mission', 'instrument', '_', 'start_date_file', '_', 'end_date_file', '_', 'version', 'extension']\n", "custom_ck_pattern = object.create_pattern(placeholders_ck)\n", "\n", "object.add_custom_mission_kernel_pattern(custom_input_mission, 'ck', custom_ck_pattern)\n", "object.dynamic_download_url_files_time_interval(custom_input_mission, local_path, start_date_lro, end_date_lro, custom_ck_url)\n", "\n", "custom_spk_url = 'https://naif.jpl.nasa.gov/pub/naif/pds/data/lro-l-spice-6-v1.0/lrosp_1000/data/spk/'\n", "placeholders_spk = ['mission', 'instrument', '_', 'start_date_file', '_', 'end_date_file', '_', 'version', 'extension']\n", "custom_spk_pattern = object.create_pattern(placeholders_spk)\n", "\n", "object.add_custom_mission_kernel_url(custom_input_mission, custom_spk_url)\n", "object.add_custom_mission_kernel_pattern(custom_input_mission, 'spk', custom_spk_pattern)\n", "object.dynamic_download_url_files_time_interval(custom_input_mission, local_path, start_date_lro, end_date_lro, custom_spk_url)" ] }, { "cell_type": "markdown", "id": "7234cb38-04f5-4f33-b657-930106493508", "metadata": {}, "source": [ "## Download all Files of a Certain Type\n", "\n", "Users might also be interested in downloaing all files of a certain type, say all frame kernels for lro, all starting in `lro` and ending in `*.tf`. \n", "Here's how it's done:\n", "\n", "1) Define the name of your `custom_input_mission`;\n", "2) Define a `custom_fk_url` (namely, the NAIF link where fk kernels for the mission are stored);\n", "3) call the `get_kernels` function.\n", " Its inputs are:\n", " - input_mission [required]\n", " - url (from which the files will be retrieved) [required]\n", " - wanted_files (list of files present at a given url for which you already know the name) [optional]\n", " - wanted_files_pattern (list of patterns of files to be downloaded, for instance: `wanted_files_patterns = ['lro*.tf']`) [optional]\n", " - custom_output [optional]\n", "" ] }, { "cell_type": "code", "execution_count": 9, "id": "cf846e0f-814d-49ac-b5a1-d6f2fbc9f207", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Downloading File: https://naif.jpl.nasa.gov/pub/naif/pds/data/lro-l-spice-6-v1.0/lrosp_1000/data/fk/lro_frames_2010214_v01.tf to: lro_archive/fk/lro_frames_2010214_v01.tf\n", "Downloading File: https://naif.jpl.nasa.gov/pub/naif/pds/data/lro-l-spice-6-v1.0/lrosp_1000/data/fk/lro_dlre_frames_2010132_v04.tf to: lro_archive/fk/lro_dlre_frames_2010132_v04.tf\n", "Downloading File: https://naif.jpl.nasa.gov/pub/naif/pds/data/lro-l-spice-6-v1.0/lrosp_1000/data/fk/lro_frames_2012255_v02.tf to: lro_archive/fk/lro_frames_2012255_v02.tf\n" ] }, { "data": { "text/plain": [ "['lro_archive/fk/lro_frames_2010214_v01.tf',\n", " 'lro_archive/fk/lro_dlre_frames_2010132_v04.tf',\n", " 'lro_archive/fk/lro_frames_2012255_v02.tf']" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "custom_fk_url = 'https://naif.jpl.nasa.gov/pub/naif/pds/data/lro-l-spice-6-v1.0/lrosp_1000/data/fk/'\n", "object.get_kernels(input_mission = 'lro', url = custom_fk_url, wanted_files_patterns = ['lro*.tf'])" ] }, { "cell_type": "markdown", "id": "32ea23ac-440f-4afc-86ac-bfa293ab8bcb", "metadata": {}, "source": [ "## Downloading Custom Meta-Kernel Files for Non-Supported Missions\n", "The following cell shows how to download all relevant files specified in a custom mission [Meta-Kernel](https://naif.jpl.nasa.gov/naif/furnsh_details.html#:~:text=A%20meta%2Dkernel%2C%20also%20known,one%20or%20more%20meta%2Dkernels.) using custom inputs.\n", "The steps to be performed are:\n", "\n", "1) Define the name of your `custom_input_mission`;\n", "2) Add a `custom_meta_kernel_url` associated to the `custom_input_mission`;\n", "3) Add a `custom_meta_kernel_pattern` (or name, if you already know what's the exact name of the **meta-kernel** to be downloaded!);\n", "4) Add the `custom_kernels_url` where kernels for your custom input mission are stored;\n", "5) Define the `custom_local_path` where you want to store your data;\n", "6) Call the `get_mission_files` function as done for other missions already, and do not forget the **flag**: `all_meta_kernel_files`;\n", "\n", "Get popcorns, it's gonna take a (long) while! 🍿\n", "\n", "**NOTE 9. About the Output of the Following Cell** \n", "\n", "As for the following cell, **we avoid plotting its output**, for two main reasons:\n", "- outputs are essentially the same as the previous ones, so it's easy to understand them;\n", "- the full downloading of all files listed in a Meta-Kernel typically takes a long time.\n", "\n", "Neverthless, we encourage users to play with this cool feature!" ] }, { "cell_type": "code", "execution_count": null, "id": "59da3282-d6df-4f9d-8257-2f78aeb25571", "metadata": {}, "outputs": [], "source": [ "custom_input_mission = 'lro'\n", "custom_meta_kernel_url = 'https://naif.jpl.nasa.gov/pub/naif/pds/data/lro-l-spice-6-v1.0/lrosp_1000/extras/mk/'\n", "custom_meta_kernel_pattern = 'lro_2024_v02.tm'\n", "custom_kernels_url = 'https://naif.jpl.nasa.gov/pub/naif/pds/data/lro-l-spice-6-v1.0/lrosp_1000/data/'\n", "\n", "object.add_custom_mission_meta_kernel_url(custom_input_mission , custom_meta_kernel_url)\n", "object.add_custom_mission_meta_kernel_pattern(custom_input_mission , custom_meta_kernel_pattern)\n", "object.add_custom_mission_kernel_url(custom_input_mission, custom_kernels_url)\n", "custom_local_path = './lro_archive'\n", "\n", "object.get_mission_files(\n", " input_mission = custom_input_mission, \n", " custom_output = custom_local_path, \n", " all_meta_kernel_files = True)" ] } ], "metadata": { "jupytext": { "cell_metadata_filter": "-all", "main_language": "python", "notebook_metadata_filter": "-all" }, "kernelspec": { "display_name": "Python (tudat-bundle)", "language": "python", "name": "tudat-bundle" }, "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.11.11" } }, "nbformat": 4, "nbformat_minor": 5 }