diff --git a/notebooks/api/10_spice.kernels.ipynb b/notebooks/api/10_spice.kernels.ipynb index f36adc8..6990037 100644 --- a/notebooks/api/10_spice.kernels.ipynb +++ b/notebooks/api/10_spice.kernels.ipynb @@ -7,7 +7,7 @@ "metadata": {}, "outputs": [], "source": [ - "#| default_exp spice.kernels" + "# | default_exp spice.kernels" ] }, { @@ -43,26 +43,25 @@ "metadata": {}, "outputs": [], "source": [ - "#| export\n", - "import warnings\n", + "# | export\n", "import zipfile\n", "from datetime import timedelta\n", "from io import BytesIO\n", "from itertools import repeat\n", - "from multiprocessing import Pool, cpu_count\n", + "from multiprocessing import cpu_count\n", "from pathlib import Path\n", "\n", + "import pandas as pd\n", "import requests\n", "import spiceypy as spice\n", "from astropy.time import Time\n", "from dask.distributed import Client\n", + "from fastcore.test import test_fail\n", + "from fastcore.utils import store_attr\n", "from tqdm.auto import tqdm\n", "from tqdm.contrib.concurrent import process_map\n", "from yarl import URL\n", "\n", - "import pandas as pd\n", - "from fastcore.test import test_fail\n", - "from fastcore.utils import store_attr\n", "from planetarypy.config import config\n", "from planetarypy.utils import nasa_time_to_iso, url_retrieve" ] @@ -74,7 +73,7 @@ "metadata": {}, "outputs": [], "source": [ - "#| hide\n", + "# | hide\n", "from nbdev.showdoc import show_doc" ] }, @@ -85,7 +84,7 @@ "metadata": {}, "outputs": [], "source": [ - "#| export\n", + "# | export\n", "KERNEL_STORAGE = config.storage_root / \"spice_kernels\"\n", "KERNEL_STORAGE.mkdir(exist_ok=True, parents=True)" ] @@ -100,61 +99,29 @@ "One repeating task for SPICE calculations is the identification and retrieval of all SPICE kernels for a mission for a given time interval.\n", "\n", "The folks at NAIF offer a \"Subset\" feature at their servers.\n", - "Here we set up a table of the currently supported datasets:" + "Here we set up a table of the currently supported datasets." ] }, { "cell_type": "code", "execution_count": null, - "id": "468c03f8-2058-4eef-9753-fce1342295dc", + "id": "8207fc31", "metadata": {}, "outputs": [], "source": [ - "#| export\n", - "dataset_ids = {\n", - " \"bc\": \"bc/bc_spice\",\n", - " \"cassini\": \"co-s_j_e_v-spice-6-v1.0/cosp_1000\",\n", - " \"clementine\": \"clem1-l-spice-6-v1.0/clsp_1000\",\n", - " \"dart\": \"dart/dart_spice\",\n", - " \"dawn\": \"dawn-m_a-spice-6-v1.0/dawnsp_1000\",\n", - " \"di\": \"di-c-spice-6-v1.0/disp_1000\",\n", - " \"ds1\": \"ds1-a_c-spice-6-v1.0/ds1sp_1000\",\n", - " \"epoxi\": \"dif-c_e_x-spice-6-v1.0/epxsp_1000\",\n", - " \"em16\": \"em16/em16_spice\",\n", - " \"grail\": \"grail-l-spice-6-v1.0/grlsp_1000\",\n", - " \"hayabusa\": \"hay-a-spice-6-v1.0/haysp_1000\",\n", - " \"insight\": \"insight/insight_spice\",\n", - " \"juno\": \"jno-j_e_ss-spice-6-v1.0/jnosp_1000\",\n", - " \"ladee\": \"ladee/ladee_spice\",\n", - " \"lro\": \"lro-l-spice-6-v1.0/lrosp_1000\",\n", - " \"maven\": \"maven/maven_spice\",\n", - " \"opportunity\": \"mer1-m-spice-6-v1.0/mer1sp_1000\",\n", - " \"spirit\": \"mer2-m-spice-6-v1.0/mer2sp_1000\",\n", - " \"messenger\": \"mess-e_v_h-spice-6-v1.0/messsp_1000\",\n", - " \"mars2020\": \"mars2020/mars2020_spice\",\n", - " \"mex\": \"mex-e_m-spice-6-v2.0/mexsp_2000\",\n", - " \"mgs\": \"mgs-m-spice-6-v1.0/mgsp_1000\",\n", - " \"ody\": \"ody-m-spice-6-v1.0/odsp_1000\",\n", - " \"mro\": \"mro-m-spice-6-v1.0/mrosp_1000\",\n", - " \"msl\": \"msl-m-spice-6-v1.0/mslsp_1000\",\n", - " \"near\": \"near-a-spice-6-v1.0/nearsp_1000\",\n", - " \"nh\": \"nh-j_p_ss-spice-6-v1.0/nhsp_1000\",\n", - " \"orex\": \"orex/orex_spice\",\n", - " \"rosetta\": \"ro_rl-e_m_a_c-spice-6-v1.0/rossp_1000\",\n", - " \"stardust\": \"sdu-c-spice-6-v1.0/sdsp_1000\",\n", - " \"venus_climate_orbiter\": \"vco/vco_spice\",\n", - " \"vex\": \"vex-e_v-spice-6-v2.0/vexsp_2000\",\n", - " \"vo\": \"vo1_vo2-m-spice-6-v1.0/vosp_1000\",\n", - "}\n", - "\n", - "df = pd.DataFrame({\"shorthand\": dataset_ids.keys(), \"path\": dataset_ids.values()})\n", - "\n", - "df2 = pd.read_html(\"https://naif.jpl.nasa.gov/naif/data_archived.html\")[6]\n", - "df2.columns = df2.iloc[0]\n", - "df2 = df2.drop(0).reset_index(drop=True)\n", - "df2 = df2.drop([\"Archive Readme\", \"Archive Link\", \"Subset Link\"], axis=1)\n", - "df = df.join(df2)\n", - "datasets = df.set_index(\"shorthand\")" + "# export\n", + "datasets_url = \"https://raw.githubusercontent.com/planetarypy/planetarypy_configs/main/archived_spice_kernel_sets.csv\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4f97d14e", + "metadata": {}, + "outputs": [], + "source": [ + "# export\n", + "datasets = pd.read_csv(datasets_url).set_index(\"shorthand\")" ] }, { @@ -207,16 +174,16 @@ " bc/bc_spice\n", " BepiColombo\n", " 4\n", - " 1.1\n", + " 2.6\n", " 2018-10-20\n", - " 2023-01-01\n", + " 2024-01-01\n", " \n", " \n", " cassini\n", " co-s_j_e_v-spice-6-v1.0/cosp_1000\n", " Cassini Orbiter\n", " 3\n", - " 62.5\n", + " 73.5\n", " 1997-10-15\n", " 2017-09-15\n", " \n", @@ -234,7 +201,7 @@ " dart/dart_spice\n", " DART\n", " 4\n", - " 9.1\n", + " 10.1\n", " 2021-11-09\n", " 2050-01-01\n", " \n", @@ -279,9 +246,9 @@ " em16/em16_spice\n", " ExoMars TGO 2016\n", " 4\n", - " 9.4\n", + " 11.0\n", " 2016-03-14\n", - " 2023-01-01\n", + " 2024-01-01\n", " \n", " \n", " grail\n", @@ -315,9 +282,9 @@ " jno-j_e_ss-spice-6-v1.0/jnosp_1000\n", " JUNO\n", " 3\n", - " 46.9\n", + " 48.9\n", " 2011-08-05\n", - " 2022-08-17\n", + " 2023-07-31\n", " \n", " \n", " ladee\n", @@ -333,18 +300,18 @@ " lro-l-spice-6-v1.0/lrosp_1000\n", " Lunar Reconnaissance Orbiter\n", " 3\n", - " 595.7\n", + " 627.5\n", " 2009-06-18\n", - " 2023-03-15\n", + " 2023-12-15\n", " \n", " \n", " maven\n", " maven/maven_spice\n", " MAVEN\n", " 4\n", - " 54.4\n", + " 57.6\n", " 2013-11-18\n", - " 2023-04-01\n", + " 2024-01-01\n", " \n", " \n", " opportunity\n", @@ -378,18 +345,18 @@ " mars2020/mars2020_spice\n", " Mars 2020\n", " 4\n", - " 0.6\n", + " 0.7\n", " 2020-07-30\n", - " 2022-12-28\n", + " 2024-01-02\n", " \n", " \n", " mex\n", " mex-e_m-spice-6-v2.0/mexsp_2000\n", " Mars Express\n", " 3\n", - " 8.5\n", + " 11.0\n", " 2003-06-02\n", - " 2022-11-30\n", + " 2023-12-31\n", " \n", " \n", " mgs\n", @@ -405,27 +372,27 @@ " ody-m-spice-6-v1.0/odsp_1000\n", " Mars Odyssey\n", " 3\n", - " 33.2\n", + " 35.8\n", " 2001-04-07\n", - " 2022-10-01\n", + " 2023-10-01\n", " \n", " \n", " mro\n", " mro-m-spice-6-v1.0/mrosp_1000\n", " Mars Reconnaissance Orbiter\n", " 3\n", - " 314.9\n", + " 329.2\n", " 2005-08-12\n", - " 2023-04-01\n", + " 2024-01-01\n", " \n", " \n", " msl\n", " msl-m-spice-6-v1.0/mslsp_1000\n", " Mars Science Laboratory\n", " 3\n", - " 0.6\n", + " 0.7\n", " 2011-11-26\n", - " 2022-11-06\n", + " 2023-11-06\n", " \n", " \n", " near\n", @@ -441,18 +408,18 @@ " nh-j_p_ss-spice-6-v1.0/nhsp_1000\n", " New Horizons\n", " 3\n", - " 1.6\n", + " 1.7\n", " 2006-01-19\n", - " 2019-12-30\n", + " 2022-06-01\n", " \n", " \n", " orex\n", " orex/orex_spice\n", " OSIRIS-REx\n", " 4\n", - " 418.4\n", + " 424.7\n", " 2016-09-08\n", - " 2021-02-22\n", + " 2023-10-02\n", " \n", " \n", " rosetta\n", @@ -477,9 +444,9 @@ " vco/vco_spice\n", " Venus Climate Orbiter\n", " 4\n", - " 1.7\n", + " 2.0\n", " 2010-05-21\n", - " 2022-01-01\n", + " 2024-01-01\n", " \n", " \n", " vex\n", @@ -540,77 +507,77 @@ "vex vex-e_v-spice-6-v2.0/vexsp_2000 \n", "vo vo1_vo2-m-spice-6-v1.0/vosp_1000 \n", "\n", - " Mission Name PDS3 or PDS4 \\\n", - "shorthand \n", - "bc BepiColombo 4 \n", - "cassini Cassini Orbiter 3 \n", - "clementine Clementine 3 \n", - "dart DART 4 \n", - "dawn DAWN 3 \n", - "di Deep Impact 3 \n", - "ds1 Deep Space 1 3 \n", - "epoxi EPOXI 3 \n", - "em16 ExoMars TGO 2016 4 \n", - "grail GRAIL 3 \n", - "hayabusa Hayabusa 3 \n", - "insight InSight 4 \n", - "juno JUNO 3 \n", - "ladee LADEE 4 \n", - "lro Lunar Reconnaissance Orbiter 3 \n", - "maven MAVEN 4 \n", - "opportunity MER 1 (Opportunity) 3 \n", - "spirit MER 2 (Spirit) 3 \n", - "messenger MESSENGER 3 \n", - "mars2020 Mars 2020 4 \n", - "mex Mars Express 3 \n", - "mgs Mars Global Surveyor 3 \n", - "ody Mars Odyssey 3 \n", - "mro Mars Reconnaissance Orbiter 3 \n", - "msl Mars Science Laboratory 3 \n", - "near NEAR 3 \n", - "nh New Horizons 3 \n", - "orex OSIRIS-REx 4 \n", - "rosetta Rosetta 3 \n", - "stardust Stardust 3 \n", - "venus_climate_orbiter Venus Climate Orbiter 4 \n", - "vex Venus Express 3 \n", - "vo Viking Orbiter 3 \n", + " Mission Name PDS3 or PDS4 \\\n", + "shorthand \n", + "bc BepiColombo 4 \n", + "cassini Cassini Orbiter 3 \n", + "clementine Clementine 3 \n", + "dart DART 4 \n", + "dawn DAWN 3 \n", + "di Deep Impact 3 \n", + "ds1 Deep Space 1 3 \n", + "epoxi EPOXI 3 \n", + "em16 ExoMars TGO 2016 4 \n", + "grail GRAIL 3 \n", + "hayabusa Hayabusa 3 \n", + "insight InSight 4 \n", + "juno JUNO 3 \n", + "ladee LADEE 4 \n", + "lro Lunar Reconnaissance Orbiter 3 \n", + "maven MAVEN 4 \n", + "opportunity MER 1 (Opportunity) 3 \n", + "spirit MER 2 (Spirit) 3 \n", + "messenger MESSENGER 3 \n", + "mars2020 Mars 2020 4 \n", + "mex Mars Express 3 \n", + "mgs Mars Global Surveyor 3 \n", + "ody Mars Odyssey 3 \n", + "mro Mars Reconnaissance Orbiter 3 \n", + "msl Mars Science Laboratory 3 \n", + "near NEAR 3 \n", + "nh New Horizons 3 \n", + "orex OSIRIS-REx 4 \n", + "rosetta Rosetta 3 \n", + "stardust Stardust 3 \n", + "venus_climate_orbiter Venus Climate Orbiter 4 \n", + "vex Venus Express 3 \n", + "vo Viking Orbiter 3 \n", "\n", - " Data Size (GB) Start Time Stop Time \n", - "shorthand \n", - "bc 1.1 2018-10-20 2023-01-01 \n", - "cassini 62.5 1997-10-15 2017-09-15 \n", - "clementine 0.8 1994-01-26 1994-05-07 \n", - "dart 9.1 2021-11-09 2050-01-01 \n", - "dawn 86.4 2007-09-27 2018-10-31 \n", - "di 0.7 2005-01-12 2005-08-09 \n", - "ds1 0.9 1998-10-24 2001-12-18 \n", - "epoxi 1.0 2005-08-23 2011-03-01 \n", - "em16 9.4 2016-03-14 2023-01-01 \n", - "grail 4.3 2011-09-10 2012-12-17 \n", - "hayabusa 0.3 2005-09-11 2005-11-19 \n", - "insight 0.9 2018-05-05 2022-12-15 \n", - "juno 46.9 2011-08-05 2022-08-17 \n", - "ladee 0.6 2013-09-07 2050-01-01 \n", - "lro 595.7 2009-06-18 2023-03-15 \n", - "maven 54.4 2013-11-18 2023-04-01 \n", - "opportunity 4.1 2003-07-07 2018-06-10 \n", - "spirit 2.6 2003-06-10 2010-05-03 \n", - "messenger 44.8 2004-08-03 2015-04-30 \n", - "mars2020 0.6 2020-07-30 2022-12-28 \n", - "mex 8.5 2003-06-02 2022-11-30 \n", - "mgs 15.4 1996-11-06 2006-11-02 \n", - "ody 33.2 2001-04-07 2022-10-01 \n", - "mro 314.9 2005-08-12 2023-04-01 \n", - "msl 0.6 2011-11-26 2022-11-06 \n", - "near 2.4 1996-05-30 2001-02-28 \n", - "nh 1.6 2006-01-19 2019-12-30 \n", - "orex 418.4 2016-09-08 2021-02-22 \n", - "rosetta 5.9 2004-03-02 2017-01-01 \n", - "stardust 1.9 1999-02-07 2011-05-01 \n", - "venus_climate_orbiter 1.7 2010-05-21 2022-01-01 \n", - "vex 5.0 2005-11-09 2015-02-06 \n", - "vo 0.1 1976-06-16 1980-07-30 " + " Data Size (GB) Start Time Stop Time \n", + "shorthand \n", + "bc 2.6 2018-10-20 2024-01-01 \n", + "cassini 73.5 1997-10-15 2017-09-15 \n", + "clementine 0.8 1994-01-26 1994-05-07 \n", + "dart 10.1 2021-11-09 2050-01-01 \n", + "dawn 86.4 2007-09-27 2018-10-31 \n", + "di 0.7 2005-01-12 2005-08-09 \n", + "ds1 0.9 1998-10-24 2001-12-18 \n", + "epoxi 1.0 2005-08-23 2011-03-01 \n", + "em16 11.0 2016-03-14 2024-01-01 \n", + "grail 4.3 2011-09-10 2012-12-17 \n", + "hayabusa 0.3 2005-09-11 2005-11-19 \n", + "insight 0.9 2018-05-05 2022-12-15 \n", + "juno 48.9 2011-08-05 2023-07-31 \n", + "ladee 0.6 2013-09-07 2050-01-01 \n", + "lro 627.5 2009-06-18 2023-12-15 \n", + "maven 57.6 2013-11-18 2024-01-01 \n", + "opportunity 4.1 2003-07-07 2018-06-10 \n", + "spirit 2.6 2003-06-10 2010-05-03 \n", + "messenger 44.8 2004-08-03 2015-04-30 \n", + "mars2020 0.7 2020-07-30 2024-01-02 \n", + "mex 11.0 2003-06-02 2023-12-31 \n", + "mgs 15.4 1996-11-06 2006-11-02 \n", + "ody 35.8 2001-04-07 2023-10-01 \n", + "mro 329.2 2005-08-12 2024-01-01 \n", + "msl 0.7 2011-11-26 2023-11-06 \n", + "near 2.4 1996-05-30 2001-02-28 \n", + "nh 1.7 2006-01-19 2022-06-01 \n", + "orex 424.7 2016-09-08 2023-10-02 \n", + "rosetta 5.9 2004-03-02 2017-01-01 \n", + "stardust 1.9 1999-02-07 2011-05-01 \n", + "venus_climate_orbiter 2.0 2010-05-21 2024-01-01 \n", + "vex 5.0 2005-11-09 2015-02-06 \n", + "vo 0.1 1976-06-16 1980-07-30 " ] }, "execution_count": null, @@ -642,17 +609,17 @@ "metadata": {}, "outputs": [], "source": [ - "#| export\n", + "# | export\n", "def is_start_valid(\n", - " mission: str, # mission shorthand label of datasets dataframe\n", - " start: Time, # start time in astropy.Time format\n", + " mission: str, # mission shorthand label of datasets dataframe\n", + " start: Time, # start time in astropy.Time format\n", "):\n", " return Time(datasets.at[mission, \"Start Time\"]) <= start\n", "\n", "\n", "def is_stop_valid(\n", - " mission: str, # mission shorthand label of datasets dataframe\n", - " stop: Time, # stop time in astropy.Time format\n", + " mission: str, # mission shorthand label of datasets dataframe\n", + " stop: Time, # stop time in astropy.Time format\n", "):\n", " return Time(datasets.at[mission, \"Stop Time\"]) >= stop" ] @@ -687,7 +654,7 @@ "metadata": {}, "outputs": [], "source": [ - "#| export\n", + "# | export\n", "NAIF_URL = URL(\"https://naif.jpl.nasa.gov\")\n", "BASE_URL = NAIF_URL / \"cgi-bin/subsetds.pl\"" ] @@ -713,7 +680,7 @@ "metadata": {}, "outputs": [], "source": [ - "#| export\n", + "# | export\n", "\n", "\n", "def download_one_url(url, local_path, overwrite: bool = False):\n", @@ -732,11 +699,11 @@ " \"\"\"\n", "\n", " def __init__(\n", - " self,\n", - " mission: str, # mission shorthand in datasets dataframe\n", - " start: str, # start time in either ISO or yyyy-jjj format\n", - " stop=None, # stop time in either ISO or yyyy-jjj format\n", - " save_location=None, # overwrite default storing in planetarpy archive\n", + " self,\n", + " mission: str, # mission shorthand in datasets dataframe\n", + " start: str, # start time in either ISO or yyyy-jjj format\n", + " stop=None, # stop time in either ISO or yyyy-jjj format\n", + " save_location=None, # overwrite default storing in planetarpy archive\n", " ):\n", " store_attr()\n", " self.initialize()\n", @@ -792,10 +759,15 @@ " Time-unsupported yyyy-jjj format, which can be converted by `nasa_time_to_iso`\n", " from `planetarypy.utils`.\n", " \"\"\"\n", - " if not (is_start_valid(self.mission, self.start) and is_stop_valid(self.mission, self.stop)):\n", - " raise ValueError(\"One of start/stop is outside the supported date-range. See `datasets`.\")\n", + " if not (\n", + " is_start_valid(self.mission, self.start)\n", + " and is_stop_valid(self.mission, self.stop)\n", + " ):\n", + " raise ValueError(\n", + " \"One of start/stop is outside the supported date-range. See `datasets`.\"\n", + " )\n", " p = {\n", - " \"dataset\": dataset_ids[self.mission],\n", + " \"dataset\": datasets.loc[self.mission, \"path\"],\n", " \"start\": self.start.iso,\n", " \"stop\": self.stop.iso,\n", " \"action\": \"Subset\",\n", @@ -805,18 +777,24 @@ " @property\n", " def kernel_names(self):\n", " \"Return list of names of kernels for the given time range.\"\n", - " return [str(Path(URL(url).parent.name) / URL(url).name) for url in self.kernel_urls]\n", + " return [\n", + " str(Path(URL(url).parent.name) / URL(url).name) for url in self.kernel_urls\n", + " ]\n", "\n", " def get_local_path(\n", - " self,\n", - " url, # kernel url to determine local storage path\n", + " self,\n", + " url, # kernel url to determine local storage path\n", " ) -> Path: # full local path where kernel in URL will be stored\n", " \"\"\"Calculate local storage path from Kernel URL, using `save_location` if given.\n", "\n", " If self.save_location is None, the `planetarypy` archive is being used.\n", " \"\"\"\n", " u = URL(url)\n", - " basepath = (KERNEL_STORAGE / self.mission if not self.save_location else self.save_location)\n", + " basepath = (\n", + " KERNEL_STORAGE / self.mission\n", + " if not self.save_location\n", + " else self.save_location\n", + " )\n", " return basepath / u.parent.name / u.name\n", "\n", " def _non_blocking_download(self, overwrite: bool = False):\n", @@ -859,9 +837,15 @@ "\n", " Use `save_location` if given, otherwise `planetarypy` archive.\n", " \"\"\"\n", - " basepath = (KERNEL_STORAGE / self.mission if not self.save_location else self.save_location)\n", + " basepath = (\n", + " KERNEL_STORAGE / self.mission\n", + " if not self.save_location\n", + " else self.save_location\n", + " )\n", " savepath = basepath / self.metakernel_file\n", - " with open(savepath, \"w\") as outfile, self.z.open(self.metakernel_file) as infile:\n", + " with open(savepath, \"w\") as outfile, self.z.open(\n", + " self.metakernel_file\n", + " ) as infile:\n", " for line in infile:\n", " linestr = line.decode()\n", " if \"'./data'\" in linestr:\n", @@ -894,13 +878,14 @@ " 'ck/14268_14273ra.bc',\n", " 'ck/cas_cda_20150318.bc',\n", " 'ck/cas_lemms_05109_20001_v2.bc',\n", + " 'dsk/cas_enceladus_ssd_spc_0128icq_v1.bds',\n", " 'fk/cas_dyn_v03.tf',\n", " 'fk/cas_mimi_v202.tf',\n", " 'fk/cas_rocks_v18.tf',\n", - " 'fk/cas_v41.tf',\n", + " 'fk/cas_v43.tf',\n", " 'ik/cas_caps_v03.ti',\n", " 'ik/cas_cda_v01.ti',\n", - " 'ik/cas_cirs_v09.ti',\n", + " 'ik/cas_cirs_v10.ti',\n", " 'ik/cas_inms_v02.ti',\n", " 'ik/cas_iss_v10.ti',\n", " 'ik/cas_mag_v01.ti',\n", @@ -909,14 +894,16 @@ " 'ik/cas_rpws_v01.ti',\n", " 'ik/cas_rss_v03.ti',\n", " 'ik/cas_sru_v02.ti',\n", - " 'ik/cas_uvis_v06.ti',\n", + " 'ik/cas_uvis_v07.ti',\n", " 'ik/cas_vims_v06.ti',\n", " 'lsk/naif0012.tls',\n", + " 'pck/enceladus_ssd_230702_v1.tpc',\n", " 'pck/pck00010.tpc',\n", " 'sclk/cas00172.tsc',\n", " 'spk/140809BP_IRRE_00256_25017.bsp',\n", - " 'spk/150122R_SCPSE_14251_14283.bsp',\n", - " 'spk/180927AP_RE_90165_18018.bsp']" + " 'spk/180927AP_RE_90165_18018.bsp',\n", + " 'spk/200128RU_SCPSE_14251_14283.bsp',\n", + " 'spk/sat427.bsp']" ] }, "execution_count": null, @@ -983,7 +970,7 @@ { "data": { "text/plain": [ - "'cas_2011_v17_110213_110214.tm'" + "'cas_2011_v18_110213_110214.tm'" ] }, "execution_count": null, @@ -1006,7 +993,7 @@ "text/markdown": [ "---\n", "\n", - "[source](https://github.com/michaelaye/nbplanetary/blob/master/planetarypy/spice/kernels.py#L188){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", + "[source](https://github.com/michaelaye/nbplanetary/blob/master/planetarypy/spice/kernels.py#L146){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", "\n", "### Subsetter.kernel_names\n", "\n", @@ -1017,7 +1004,7 @@ "text/plain": [ "---\n", "\n", - "[source](https://github.com/michaelaye/nbplanetary/blob/master/planetarypy/spice/kernels.py#L188){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", + "[source](https://github.com/michaelaye/nbplanetary/blob/master/planetarypy/spice/kernels.py#L146){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", "\n", "### Subsetter.kernel_names\n", "\n", @@ -1047,15 +1034,17 @@ "['ck/11001_12001pa_gapfill_v14.bc',\n", " 'ck/11017_11066py_as_flown.bc',\n", " 'ck/11044_11049ra.bc',\n", + " 'ck/cas_caps_11032_11060_v2.bc',\n", " 'ck/cas_cda_20120517.bc',\n", " 'ck/cas_lemms_05109_20001_v2.bc',\n", + " 'dsk/cas_enceladus_ssd_spc_0128icq_v1.bds',\n", " 'fk/cas_dyn_v03.tf',\n", " 'fk/cas_mimi_v202.tf',\n", " 'fk/cas_rocks_v18.tf',\n", - " 'fk/cas_v41.tf',\n", + " 'fk/cas_v43.tf',\n", " 'ik/cas_caps_v03.ti',\n", " 'ik/cas_cda_v01.ti',\n", - " 'ik/cas_cirs_v09.ti',\n", + " 'ik/cas_cirs_v10.ti',\n", " 'ik/cas_inms_v02.ti',\n", " 'ik/cas_iss_v10.ti',\n", " 'ik/cas_mag_v01.ti',\n", @@ -1064,14 +1053,16 @@ " 'ik/cas_rpws_v01.ti',\n", " 'ik/cas_rss_v03.ti',\n", " 'ik/cas_sru_v02.ti',\n", - " 'ik/cas_uvis_v06.ti',\n", + " 'ik/cas_uvis_v07.ti',\n", " 'ik/cas_vims_v06.ti',\n", " 'lsk/naif0012.tls',\n", + " 'pck/enceladus_ssd_230702_v1.tpc',\n", " 'pck/pck00010.tpc',\n", " 'sclk/cas00172.tsc',\n", - " 'spk/110504R_SCPSE_11041_11093.bsp',\n", " 'spk/140809BP_IRRE_00256_25017.bsp',\n", - " 'spk/180927AP_RE_90165_18018.bsp']" + " 'spk/180927AP_RE_90165_18018.bsp',\n", + " 'spk/200128RU_SCPSE_11041_11093.bsp',\n", + " 'spk/sat427.bsp']" ] }, "execution_count": null, @@ -1095,15 +1086,17 @@ "['https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/ck/11001_12001pa_gapfill_v14.bc',\n", " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/ck/11017_11066py_as_flown.bc',\n", " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/ck/11044_11049ra.bc',\n", + " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/ck/cas_caps_11032_11060_v2.bc',\n", " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/ck/cas_cda_20120517.bc',\n", " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/ck/cas_lemms_05109_20001_v2.bc',\n", + " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/dsk/cas_enceladus_ssd_spc_0128icq_v1.bds',\n", " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/fk/cas_dyn_v03.tf',\n", " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/fk/cas_mimi_v202.tf',\n", " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/fk/cas_rocks_v18.tf',\n", - " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/fk/cas_v41.tf',\n", + " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/fk/cas_v43.tf',\n", " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/ik/cas_caps_v03.ti',\n", " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/ik/cas_cda_v01.ti',\n", - " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/ik/cas_cirs_v09.ti',\n", + " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/ik/cas_cirs_v10.ti',\n", " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/ik/cas_inms_v02.ti',\n", " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/ik/cas_iss_v10.ti',\n", " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/ik/cas_mag_v01.ti',\n", @@ -1112,14 +1105,16 @@ " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/ik/cas_rpws_v01.ti',\n", " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/ik/cas_rss_v03.ti',\n", " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/ik/cas_sru_v02.ti',\n", - " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/ik/cas_uvis_v06.ti',\n", + " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/ik/cas_uvis_v07.ti',\n", " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/ik/cas_vims_v06.ti',\n", " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/lsk/naif0012.tls',\n", + " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/pck/enceladus_ssd_230702_v1.tpc',\n", " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/pck/pck00010.tpc',\n", " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/sclk/cas00172.tsc',\n", - " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/spk/110504R_SCPSE_11041_11093.bsp',\n", " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/spk/140809BP_IRRE_00256_25017.bsp',\n", - " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/spk/180927AP_RE_90165_18018.bsp']" + " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/spk/180927AP_RE_90165_18018.bsp',\n", + " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/spk/200128RU_SCPSE_11041_11093.bsp',\n", + " 'https://naif.jpl.nasa.gov/pub/naif/pds/data/co-s_j_e_v-spice-6-v1.0/cosp_1000/data/spk/sat427.bsp']" ] }, "execution_count": null, @@ -1142,7 +1137,7 @@ "text/markdown": [ "---\n", "\n", - "[source](https://github.com/michaelaye/nbplanetary/blob/master/planetarypy/spice/kernels.py#L192){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", + "[source](https://github.com/michaelaye/nbplanetary/blob/master/planetarypy/spice/kernels.py#L152){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", "\n", "### Subsetter.get_local_path\n", "\n", @@ -1160,7 +1155,7 @@ "text/plain": [ "---\n", "\n", - "[source](https://github.com/michaelaye/nbplanetary/blob/master/planetarypy/spice/kernels.py#L192){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", + "[source](https://github.com/michaelaye/nbplanetary/blob/master/planetarypy/spice/kernels.py#L152){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", "\n", "### Subsetter.get_local_path\n", "\n", @@ -1194,7 +1189,7 @@ { "data": { "text/plain": [ - "Path('/home/ayek72/mnt/slowdata/planetarypy/spice_kernels/cassini/ck/11001_12001pa_gapfill_v14.bc')" + "Path('/media/ayek72/data/planetarypy/spice_kernels/cassini/ck/11001_12001pa_gapfill_v14.bc')" ] }, "execution_count": null, @@ -1248,32 +1243,34 @@ "text/markdown": [ "---\n", "\n", - "[source](https://github.com/michaelaye/nbplanetary/blob/master/planetarypy/spice/kernels.py#L220){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", + "[source](https://github.com/michaelaye/nbplanetary/blob/master/planetarypy/spice/kernels.py#L185){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", "\n", "### Subsetter.download_kernels\n", "\n", "> Subsetter.download_kernels (overwrite:bool=False,\n", - "> non_blocking:bool=False)\n", + "> non_blocking:bool=False, quiet:bool=False)\n", "\n", "| | **Type** | **Default** | **Details** |\n", "| -- | -------- | ----------- | ----------- |\n", "| overwrite | bool | False | switch to control if kernels should be downloaded over existing ones |\n", - "| non_blocking | bool | False | |" + "| non_blocking | bool | False | |\n", + "| quiet | bool | False | |" ], "text/plain": [ "---\n", "\n", - "[source](https://github.com/michaelaye/nbplanetary/blob/master/planetarypy/spice/kernels.py#L220){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", + "[source](https://github.com/michaelaye/nbplanetary/blob/master/planetarypy/spice/kernels.py#L185){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n", "\n", "### Subsetter.download_kernels\n", "\n", "> Subsetter.download_kernels (overwrite:bool=False,\n", - "> non_blocking:bool=False)\n", + "> non_blocking:bool=False, quiet:bool=False)\n", "\n", "| | **Type** | **Default** | **Details** |\n", "| -- | -------- | ----------- | ----------- |\n", "| overwrite | bool | False | switch to control if kernels should be downloaded over existing ones |\n", - "| non_blocking | bool | False | |" + "| non_blocking | bool | False | |\n", + "| quiet | bool | False | |" ] }, "execution_count": null, @@ -1305,12 +1302,12 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "7bf0f44a19c54b8ca60f8808c5ebdd6a", + "model_id": "f484351b990e44d1a3559ce38107983a", "version_major": 2, "version_minor": 0 }, "text/plain": [ - "Kernels downloaded: 0%| | 0/28 [00:00 Path: # pathlib.Path to metakernel file with corrected data path.\n", " \"For a given mission and start/stop times, download the kernels and get metakernel path\"\n", " subset = Subsetter(mission, start, stop, save_location)\n", @@ -1750,25 +1763,15 @@ "id": "68deb5da-5bd5-44d8-be01-edba72037ce9", "metadata": {}, "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/Users/maye/mambaforge/envs/py39/lib/python3.9/site-packages/distributed/node.py:182: UserWarning: Port 8787 is already in use.\n", - "Perhaps you already have a cluster running?\n", - "Hosting the HTTP server on port 57624 instead\n", - " warnings.warn(\n" - ] - }, { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "680c89484fe9447594f1d1ab0a819b77", + "model_id": "af778cdfdeaa416fa6d947862dfb47e2", "version_major": 2, "version_minor": 0 }, "text/plain": [ - "Kernels downloaded: 0%| | 0/28 [00:00 list: # list of kernel names\n", " subset = Subsetter(mission, start, stop)\n", " return subset.kernel_names" @@ -1888,35 +1895,33 @@ "metadata": {}, "outputs": [ { - "data": { - "text/plain": [ - "['ck/mvn_app_rel_161226_170101_v01.bc',\n", - " 'ck/mvn_app_rel_170102_170108_v01.bc',\n", - " 'ck/mvn_iuvs_rem_170101_170331_v03.bc',\n", - " 'ck/mvn_sc_rel_161226_170101_v01.bc',\n", - " 'ck/mvn_sc_rel_170102_170108_v02.bc',\n", - " 'ck/mvn_swea_nom_131118_300101_v02.bc',\n", - " 'fk/maven_v09.tf',\n", - " 'ik/maven_ant_v10.ti',\n", - " 'ik/maven_euv_v10.ti',\n", - " 'ik/maven_iuvs_v11.ti',\n", - " 'ik/maven_ngims_v10.ti',\n", - " 'ik/maven_sep_v12.ti',\n", - " 'ik/maven_static_v11.ti',\n", - " 'ik/maven_swea_v11.ti',\n", - " 'ik/maven_swia_v10.ti',\n", - " 'lsk/naif0012.tls',\n", - " 'pck/pck00010.tpc',\n", - " 'sclk/mvn_sclkscet_00072.tsc',\n", - " 'spk/de430s.bsp',\n", - " 'spk/mar097s.bsp',\n", - " 'spk/maven_orb_rec_170101_170401_v1.bsp',\n", - " 'spk/maven_struct_v01.bsp']" - ] - }, - "execution_count": null, - "metadata": {}, - "output_type": "execute_result" + "ename": "KeyboardInterrupt", + "evalue": "", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[41], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m# this always takes much longer than other requests!\u001b[39;00m\n\u001b[0;32m----> 2\u001b[0m \u001b[43mlist_kernels_for_day\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mmaven\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43m2017-01-01\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n", + "Cell \u001b[0;32mIn[39], line 7\u001b[0m, in \u001b[0;36mlist_kernels_for_day\u001b[0;34m(mission, start, stop)\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mlist_kernels_for_day\u001b[39m(\n\u001b[1;32m 3\u001b[0m mission: \u001b[38;5;28mstr\u001b[39m, \u001b[38;5;66;03m# mission shorthand from datasets dataframe\u001b[39;00m\n\u001b[1;32m 4\u001b[0m start: \u001b[38;5;28mstr\u001b[39m, \u001b[38;5;66;03m# start time as iso-string, or yyyy-jjj\u001b[39;00m\n\u001b[1;32m 5\u001b[0m stop: \u001b[38;5;28mstr\u001b[39m \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;66;03m# stop time as iso-string or yyyy-jjj\u001b[39;00m\n\u001b[1;32m 6\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[38;5;28mlist\u001b[39m: \u001b[38;5;66;03m# list of kernel names\u001b[39;00m\n\u001b[0;32m----> 7\u001b[0m subset \u001b[38;5;241m=\u001b[39m \u001b[43mSubsetter\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmission\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstart\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstop\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 8\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m subset\u001b[38;5;241m.\u001b[39mkernel_names\n", + "Cell \u001b[0;32mIn[11], line 27\u001b[0m, in \u001b[0;36mSubsetter.__init__\u001b[0;34m(self, mission, start, stop, save_location)\u001b[0m\n\u001b[1;32m 19\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__init__\u001b[39m(\n\u001b[1;32m 20\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 21\u001b[0m mission: \u001b[38;5;28mstr\u001b[39m, \u001b[38;5;66;03m# mission shorthand in datasets dataframe\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 24\u001b[0m save_location\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m, \u001b[38;5;66;03m# overwrite default storing in planetarpy archive\u001b[39;00m\n\u001b[1;32m 25\u001b[0m ):\n\u001b[1;32m 26\u001b[0m store_attr()\n\u001b[0;32m---> 27\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minitialize\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n", + "Cell \u001b[0;32mIn[11], line 30\u001b[0m, in \u001b[0;36mSubsetter.initialize\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 29\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21minitialize\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[0;32m---> 30\u001b[0m r \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mr\u001b[49m\n\u001b[1;32m 31\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m r\u001b[38;5;241m.\u001b[39mok:\n\u001b[1;32m 32\u001b[0m z \u001b[38;5;241m=\u001b[39m zipfile\u001b[38;5;241m.\u001b[39mZipFile(BytesIO(r\u001b[38;5;241m.\u001b[39mcontent))\n", + "Cell \u001b[0;32mIn[11], line 45\u001b[0m, in \u001b[0;36mSubsetter.r\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 43\u001b[0m \u001b[38;5;129m@property\u001b[39m\n\u001b[1;32m 44\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mr\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[0;32m---> 45\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mrequests\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[43mBASE_URL\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparams\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mpayload\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstream\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/miniforge3/envs/py311/lib/python3.11/site-packages/requests/api.py:73\u001b[0m, in \u001b[0;36mget\u001b[0;34m(url, params, **kwargs)\u001b[0m\n\u001b[1;32m 62\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mget\u001b[39m(url, params\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[1;32m 63\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124mr\u001b[39m\u001b[38;5;124;03m\"\"\"Sends a GET request.\u001b[39;00m\n\u001b[1;32m 64\u001b[0m \n\u001b[1;32m 65\u001b[0m \u001b[38;5;124;03m :param url: URL for the new :class:`Request` object.\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 70\u001b[0m \u001b[38;5;124;03m :rtype: requests.Response\u001b[39;00m\n\u001b[1;32m 71\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m---> 73\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mrequest\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mget\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparams\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mparams\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/miniforge3/envs/py311/lib/python3.11/site-packages/requests/api.py:59\u001b[0m, in \u001b[0;36mrequest\u001b[0;34m(method, url, **kwargs)\u001b[0m\n\u001b[1;32m 55\u001b[0m \u001b[38;5;66;03m# By using the 'with' statement we are sure the session is closed, thus we\u001b[39;00m\n\u001b[1;32m 56\u001b[0m \u001b[38;5;66;03m# avoid leaving sockets open which can trigger a ResourceWarning in some\u001b[39;00m\n\u001b[1;32m 57\u001b[0m \u001b[38;5;66;03m# cases, and look like a memory leak in others.\u001b[39;00m\n\u001b[1;32m 58\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m sessions\u001b[38;5;241m.\u001b[39mSession() \u001b[38;5;28;01mas\u001b[39;00m session:\n\u001b[0;32m---> 59\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43msession\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmethod\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/miniforge3/envs/py311/lib/python3.11/site-packages/requests/sessions.py:589\u001b[0m, in \u001b[0;36mSession.request\u001b[0;34m(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)\u001b[0m\n\u001b[1;32m 584\u001b[0m send_kwargs \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 585\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtimeout\u001b[39m\u001b[38;5;124m\"\u001b[39m: timeout,\n\u001b[1;32m 586\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mallow_redirects\u001b[39m\u001b[38;5;124m\"\u001b[39m: allow_redirects,\n\u001b[1;32m 587\u001b[0m }\n\u001b[1;32m 588\u001b[0m send_kwargs\u001b[38;5;241m.\u001b[39mupdate(settings)\n\u001b[0;32m--> 589\u001b[0m resp \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mprep\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43msend_kwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 591\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m resp\n", + "File \u001b[0;32m~/miniforge3/envs/py311/lib/python3.11/site-packages/requests/sessions.py:703\u001b[0m, in \u001b[0;36mSession.send\u001b[0;34m(self, request, **kwargs)\u001b[0m\n\u001b[1;32m 700\u001b[0m start \u001b[38;5;241m=\u001b[39m preferred_clock()\n\u001b[1;32m 702\u001b[0m \u001b[38;5;66;03m# Send the request\u001b[39;00m\n\u001b[0;32m--> 703\u001b[0m r \u001b[38;5;241m=\u001b[39m \u001b[43madapter\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 705\u001b[0m \u001b[38;5;66;03m# Total elapsed time of the request (approximately)\u001b[39;00m\n\u001b[1;32m 706\u001b[0m elapsed \u001b[38;5;241m=\u001b[39m preferred_clock() \u001b[38;5;241m-\u001b[39m start\n", + "File \u001b[0;32m~/miniforge3/envs/py311/lib/python3.11/site-packages/requests/adapters.py:486\u001b[0m, in \u001b[0;36mHTTPAdapter.send\u001b[0;34m(self, request, stream, timeout, verify, cert, proxies)\u001b[0m\n\u001b[1;32m 483\u001b[0m timeout \u001b[38;5;241m=\u001b[39m TimeoutSauce(connect\u001b[38;5;241m=\u001b[39mtimeout, read\u001b[38;5;241m=\u001b[39mtimeout)\n\u001b[1;32m 485\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 486\u001b[0m resp \u001b[38;5;241m=\u001b[39m \u001b[43mconn\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43murlopen\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 487\u001b[0m \u001b[43m \u001b[49m\u001b[43mmethod\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 488\u001b[0m \u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 489\u001b[0m \u001b[43m \u001b[49m\u001b[43mbody\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 490\u001b[0m \u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 491\u001b[0m \u001b[43m \u001b[49m\u001b[43mredirect\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 492\u001b[0m \u001b[43m \u001b[49m\u001b[43massert_same_host\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 493\u001b[0m \u001b[43m \u001b[49m\u001b[43mpreload_content\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 494\u001b[0m \u001b[43m \u001b[49m\u001b[43mdecode_content\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 495\u001b[0m \u001b[43m \u001b[49m\u001b[43mretries\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmax_retries\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 496\u001b[0m \u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 497\u001b[0m \u001b[43m \u001b[49m\u001b[43mchunked\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mchunked\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 498\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 500\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m (ProtocolError, \u001b[38;5;167;01mOSError\u001b[39;00m) \u001b[38;5;28;01mas\u001b[39;00m err:\n\u001b[1;32m 501\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mConnectionError\u001b[39;00m(err, request\u001b[38;5;241m=\u001b[39mrequest)\n", + "File \u001b[0;32m~/miniforge3/envs/py311/lib/python3.11/site-packages/urllib3/connectionpool.py:793\u001b[0m, in \u001b[0;36mHTTPConnectionPool.urlopen\u001b[0;34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, preload_content, decode_content, **response_kw)\u001b[0m\n\u001b[1;32m 790\u001b[0m response_conn \u001b[38;5;241m=\u001b[39m conn \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m release_conn \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 792\u001b[0m \u001b[38;5;66;03m# Make the request on the HTTPConnection object\u001b[39;00m\n\u001b[0;32m--> 793\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_make_request\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 794\u001b[0m \u001b[43m \u001b[49m\u001b[43mconn\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 795\u001b[0m \u001b[43m \u001b[49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 796\u001b[0m \u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 797\u001b[0m \u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtimeout_obj\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 798\u001b[0m \u001b[43m \u001b[49m\u001b[43mbody\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 799\u001b[0m \u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 800\u001b[0m \u001b[43m \u001b[49m\u001b[43mchunked\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mchunked\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 801\u001b[0m \u001b[43m \u001b[49m\u001b[43mretries\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mretries\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 802\u001b[0m \u001b[43m \u001b[49m\u001b[43mresponse_conn\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mresponse_conn\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 803\u001b[0m \u001b[43m \u001b[49m\u001b[43mpreload_content\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mpreload_content\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 804\u001b[0m \u001b[43m \u001b[49m\u001b[43mdecode_content\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdecode_content\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 805\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mresponse_kw\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 806\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 808\u001b[0m \u001b[38;5;66;03m# Everything went great!\u001b[39;00m\n\u001b[1;32m 809\u001b[0m clean_exit \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n", + "File \u001b[0;32m~/miniforge3/envs/py311/lib/python3.11/site-packages/urllib3/connectionpool.py:537\u001b[0m, in \u001b[0;36mHTTPConnectionPool._make_request\u001b[0;34m(self, conn, method, url, body, headers, retries, timeout, chunked, response_conn, preload_content, decode_content, enforce_content_length)\u001b[0m\n\u001b[1;32m 535\u001b[0m \u001b[38;5;66;03m# Receive the response from the server\u001b[39;00m\n\u001b[1;32m 536\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 537\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[43mconn\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetresponse\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 538\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m (BaseSSLError, \u001b[38;5;167;01mOSError\u001b[39;00m) \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m 539\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_raise_timeout(err\u001b[38;5;241m=\u001b[39me, url\u001b[38;5;241m=\u001b[39murl, timeout_value\u001b[38;5;241m=\u001b[39mread_timeout)\n", + "File \u001b[0;32m~/miniforge3/envs/py311/lib/python3.11/site-packages/urllib3/connection.py:466\u001b[0m, in \u001b[0;36mHTTPConnection.getresponse\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 463\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mresponse\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m HTTPResponse\n\u001b[1;32m 465\u001b[0m \u001b[38;5;66;03m# Get the response from http.client.HTTPConnection\u001b[39;00m\n\u001b[0;32m--> 466\u001b[0m httplib_response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetresponse\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 468\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 469\u001b[0m assert_header_parsing(httplib_response\u001b[38;5;241m.\u001b[39mmsg)\n", + "File \u001b[0;32m~/miniforge3/envs/py311/lib/python3.11/http/client.py:1395\u001b[0m, in \u001b[0;36mHTTPConnection.getresponse\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 1393\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1394\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m-> 1395\u001b[0m \u001b[43mresponse\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbegin\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1396\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mConnectionError\u001b[39;00m:\n\u001b[1;32m 1397\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mclose()\n", + "File \u001b[0;32m~/miniforge3/envs/py311/lib/python3.11/http/client.py:325\u001b[0m, in \u001b[0;36mHTTPResponse.begin\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 323\u001b[0m \u001b[38;5;66;03m# read until we get a non-100 response\u001b[39;00m\n\u001b[1;32m 324\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[0;32m--> 325\u001b[0m version, status, reason \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_read_status\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 326\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m status \u001b[38;5;241m!=\u001b[39m CONTINUE:\n\u001b[1;32m 327\u001b[0m \u001b[38;5;28;01mbreak\u001b[39;00m\n", + "File \u001b[0;32m~/miniforge3/envs/py311/lib/python3.11/http/client.py:286\u001b[0m, in \u001b[0;36mHTTPResponse._read_status\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 285\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_read_status\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[0;32m--> 286\u001b[0m line \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mstr\u001b[39m(\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mreadline\u001b[49m\u001b[43m(\u001b[49m\u001b[43m_MAXLINE\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m+\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;241;43m1\u001b[39;49m\u001b[43m)\u001b[49m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124miso-8859-1\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 287\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(line) \u001b[38;5;241m>\u001b[39m _MAXLINE:\n\u001b[1;32m 288\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m LineTooLong(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mstatus line\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n", + "File \u001b[0;32m~/miniforge3/envs/py311/lib/python3.11/socket.py:706\u001b[0m, in \u001b[0;36mSocketIO.readinto\u001b[0;34m(self, b)\u001b[0m\n\u001b[1;32m 704\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[1;32m 705\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 706\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_sock\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrecv_into\u001b[49m\u001b[43m(\u001b[49m\u001b[43mb\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 707\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m timeout:\n\u001b[1;32m 708\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_timeout_occurred \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n", + "File \u001b[0;32m~/miniforge3/envs/py311/lib/python3.11/ssl.py:1314\u001b[0m, in \u001b[0;36mSSLSocket.recv_into\u001b[0;34m(self, buffer, nbytes, flags)\u001b[0m\n\u001b[1;32m 1310\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m flags \u001b[38;5;241m!=\u001b[39m \u001b[38;5;241m0\u001b[39m:\n\u001b[1;32m 1311\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\n\u001b[1;32m 1312\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mnon-zero flags not allowed in calls to recv_into() on \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;241m%\u001b[39m\n\u001b[1;32m 1313\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__class__\u001b[39m)\n\u001b[0;32m-> 1314\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mread\u001b[49m\u001b[43m(\u001b[49m\u001b[43mnbytes\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mbuffer\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1315\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 1316\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28msuper\u001b[39m()\u001b[38;5;241m.\u001b[39mrecv_into(buffer, nbytes, flags)\n", + "File \u001b[0;32m~/miniforge3/envs/py311/lib/python3.11/ssl.py:1166\u001b[0m, in \u001b[0;36mSSLSocket.read\u001b[0;34m(self, len, buffer)\u001b[0m\n\u001b[1;32m 1164\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1165\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m buffer \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m-> 1166\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_sslobj\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mread\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mlen\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mbuffer\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1167\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 1168\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_sslobj\u001b[38;5;241m.\u001b[39mread(\u001b[38;5;28mlen\u001b[39m)\n", + "\u001b[0;31mKeyboardInterrupt\u001b[0m: " + ] } ], "source": [ @@ -1929,42 +1934,7 @@ "execution_count": null, "id": "a36fcfff-6b13-4898-a375-dcf390099596", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "['ck/orx_sa_rel_181126_181202_v01.bc',\n", - " 'ck/orx_sc_rel_181126_181202_v01.bc',\n", - " 'ck/orx_struct_mapcam_v01.bc',\n", - " 'ck/orx_struct_polycam_v01.bc',\n", - " 'fk/orx_shape_v03.tf',\n", - " 'fk/orx_v14.tf',\n", - " 'ik/orx_lidar_v00.ti',\n", - " 'ik/orx_navcam_v02.ti',\n", - " 'ik/orx_ocams_v07.ti',\n", - " 'ik/orx_ola_v01.ti',\n", - " 'ik/orx_otes_v00.ti',\n", - " 'ik/orx_ovirs_v00.ti',\n", - " 'ik/orx_rexis_v01.ti',\n", - " 'ik/orx_stowcam_v00.ti',\n", - " 'ik/orx_struct_v00.ti',\n", - " 'lsk/naif0012.tls',\n", - " 'pck/bennu_v17.tpc',\n", - " 'pck/pck00010.tpc',\n", - " 'sclk/orx_sclkscet_00074.tsc',\n", - " 'spk/bennu_refdrmc_v1.bsp',\n", - " 'spk/de424.bsp',\n", - " 'spk/orx_180301_181201_180921_od044_v1.bsp',\n", - " 'spk/orx_180801_190302_181218_od077_v1.bsp',\n", - " 'spk/orx_181203_190302_190104_od085_v1.bsp',\n", - " 'spk/orx_struct_v04.bsp']" - ] - }, - "execution_count": null, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "# this always takes much longer than other requests!\n", "list_kernels_for_day(\"orex\", \"2018-11-30\")" @@ -1981,11 +1951,11 @@ "output_type": "stream", "text": [ "Doing bc\n", - "Half time: 2020-11-25 00:00:00.000\n", - "Found 41 kernels for bc\n", + "Half time: 2021-05-26 12:00:00.000\n", + "Found 43 kernels for bc\n", "Doing cassini\n", "Half time: 2007-09-30 12:00:01.000\n", - "Found 32 kernels for cassini\n", + "Found 36 kernels for cassini\n", "Doing clementine\n", "Half time: 1994-03-17 12:00:00.000\n", "Found 19 kernels for clementine\n", @@ -1997,14 +1967,14 @@ "name": "stderr", "output_type": "stream", "text": [ - "/home/ayek72/mambaforge/envs/py39/lib/python3.9/site-packages/erfa/core.py:154: ErfaWarning: ERFA function \"dtf2d\" yielded 1 of \"dubious year (Note 6)\"\n", - " warnings.warn('ERFA function \"{}\" yielded {}'.format(func_name, wmsg),\n", - "/home/ayek72/mambaforge/envs/py39/lib/python3.9/site-packages/erfa/core.py:154: ErfaWarning: ERFA function \"utctai\" yielded 1 of \"dubious year (Note 3)\"\n", - " warnings.warn('ERFA function \"{}\" yielded {}'.format(func_name, wmsg),\n", - "/home/ayek72/mambaforge/envs/py39/lib/python3.9/site-packages/erfa/core.py:154: ErfaWarning: ERFA function \"taiutc\" yielded 1 of \"dubious year (Note 4)\"\n", - " warnings.warn('ERFA function \"{}\" yielded {}'.format(func_name, wmsg),\n", - "/home/ayek72/mambaforge/envs/py39/lib/python3.9/site-packages/erfa/core.py:154: ErfaWarning: ERFA function \"d2dtf\" yielded 1 of \"dubious year (Note 5)\"\n", - " warnings.warn('ERFA function \"{}\" yielded {}'.format(func_name, wmsg),\n" + "/home/ayek72/miniforge3/envs/py311/lib/python3.11/site-packages/erfa/core.py:133: ErfaWarning: ERFA function \"dtf2d\" yielded 1 of \"dubious year (Note 6)\"\n", + " warn(f'ERFA function \"{func_name}\" yielded {wmsg}', ErfaWarning)\n", + "/home/ayek72/miniforge3/envs/py311/lib/python3.11/site-packages/erfa/core.py:133: ErfaWarning: ERFA function \"utctai\" yielded 1 of \"dubious year (Note 3)\"\n", + " warn(f'ERFA function \"{func_name}\" yielded {wmsg}', ErfaWarning)\n", + "/home/ayek72/miniforge3/envs/py311/lib/python3.11/site-packages/erfa/core.py:133: ErfaWarning: ERFA function \"taiutc\" yielded 1 of \"dubious year (Note 4)\"\n", + " warn(f'ERFA function \"{func_name}\" yielded {wmsg}', ErfaWarning)\n", + "/home/ayek72/miniforge3/envs/py311/lib/python3.11/site-packages/erfa/core.py:133: ErfaWarning: ERFA function \"d2dtf\" yielded 1 of \"dubious year (Note 5)\"\n", + " warn(f'ERFA function \"{func_name}\" yielded {wmsg}', ErfaWarning)\n" ] }, { @@ -2025,8 +1995,8 @@ "Half time: 2008-05-27 00:00:00.000\n", "Found 12 kernels for epoxi\n", "Doing em16\n", - "Half time: 2019-08-07 23:59:59.500\n", - "Found 27 kernels for em16\n", + "Half time: 2020-02-06 11:59:59.500\n", + "Found 29 kernels for em16\n", "Doing grail\n", "Half time: 2012-04-29 00:00:00.500\n", "Found 20 kernels for grail\n", @@ -2037,17 +2007,17 @@ "Half time: 2020-08-24 12:00:00.000\n", "Found 21 kernels for insight\n", "Doing juno\n", - "Half time: 2017-02-08 23:59:58.500\n", - "Found 25 kernels for juno\n", + "Half time: 2017-08-01 23:59:58.500\n", + "Found 23 kernels for juno\n", "Doing ladee\n", "Half time: 2031-11-04 11:59:59.000\n", "Found 12 kernels for ladee\n", "Doing lro\n", - "Half time: 2016-04-30 23:59:59.500\n", - "Found 24 kernels for lro\n", + "Half time: 2016-09-15 11:59:59.500\n", + "Found 20 kernels for lro\n", "Doing maven\n", - "Half time: 2018-07-25 11:59:59.000\n", - "Found 20 kernels for maven\n", + "Half time: 2018-12-09 23:59:59.000\n", + "Found 22 kernels for maven\n", "Doing opportunity\n", "Half time: 2010-12-23 00:00:00.500\n", "Found 23 kernels for opportunity\n", @@ -2058,31 +2028,31 @@ "Half time: 2009-12-15 23:59:59.500\n", "Found 18 kernels for messenger\n", "Doing mars2020\n", - "Half time: 2021-10-13 12:00:00.000\n", + "Half time: 2022-04-16 12:00:00.000\n", "Found 17 kernels for mars2020\n", "Doing mex\n", - "Half time: 2013-03-01 11:59:59.500\n", + "Half time: 2013-09-15 11:59:59.500\n", "Found 39 kernels for mex\n", "Doing mgs\n", "Half time: 2001-11-03 23:59:59.500\n", "Found 20 kernels for mgs\n", "Doing ody\n", - "Half time: 2012-01-03 12:00:00.500\n", + "Half time: 2012-07-03 23:59:59.500\n", "Found 14 kernels for ody\n", "Doing mro\n", - "Half time: 2014-06-06 11:59:59.500\n", + "Half time: 2014-10-21 23:59:59.500\n", "Found 20 kernels for mro\n", "Doing msl\n", - "Half time: 2017-05-16 23:59:58.500\n", - "Found 50 kernels for msl\n", + "Half time: 2017-11-15 11:59:58.500\n", + "Found 53 kernels for msl\n", "Doing near\n", "Half time: 1998-10-14 12:00:00.000\n", "Found 15 kernels for near\n", "Doing nh\n", - "Half time: 2013-01-08 12:00:00.000\n", - "Found 28 kernels for nh\n", + "Half time: 2014-03-26 12:00:00.000\n", + "Found 29 kernels for nh\n", "Doing orex\n", - "Half time: 2018-11-30 23:59:59.500\n" + "Half time: 2020-03-20 23:59:59.500\n" ] }, { @@ -2092,18 +2062,19 @@ "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mOSError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[0;32mIn[41], line 24\u001b[0m\n\u001b[1;32m 18\u001b[0m \u001b[38;5;66;03m# futures = []\u001b[39;00m\n\u001b[1;32m 19\u001b[0m \u001b[38;5;66;03m# with Client() as client:\u001b[39;00m\n\u001b[1;32m 20\u001b[0m \u001b[38;5;66;03m# for mission in datasets.index:\u001b[39;00m\n\u001b[1;32m 21\u001b[0m \u001b[38;5;66;03m# futures.append(client.submit(_test_mission_kernels_available, mission))\u001b[39;00m\n\u001b[1;32m 22\u001b[0m \u001b[38;5;66;03m# [f.result() for f in futures]\u001b[39;00m\n\u001b[1;32m 23\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m mission \u001b[38;5;129;01min\u001b[39;00m datasets\u001b[38;5;241m.\u001b[39mindex:\n\u001b[0;32m---> 24\u001b[0m \u001b[43m_test_mission_kernels_available\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmission\u001b[49m\u001b[43m)\u001b[49m\n", - "Cell \u001b[0;32mIn[41], line 11\u001b[0m, in \u001b[0;36m_test_mission_kernels_available\u001b[0;34m(mission)\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mHalf time:\u001b[39m\u001b[38;5;124m\"\u001b[39m, half)\n\u001b[1;32m 10\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m---> 11\u001b[0m found \u001b[38;5;241m=\u001b[39m \u001b[43mlist_kernels_for_day\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmission\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mhalf\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 12\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mIndexError\u001b[39;00m:\n\u001b[1;32m 13\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mProblem with\u001b[39m\u001b[38;5;124m\"\u001b[39m, mission)\n", - "Cell \u001b[0;32mIn[38], line 7\u001b[0m, in \u001b[0;36mlist_kernels_for_day\u001b[0;34m(mission, start, stop)\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mlist_kernels_for_day\u001b[39m(\n\u001b[1;32m 3\u001b[0m mission: \u001b[38;5;28mstr\u001b[39m, \u001b[38;5;66;03m# mission shorthand from datasets dataframe\u001b[39;00m\n\u001b[1;32m 4\u001b[0m start: \u001b[38;5;28mstr\u001b[39m, \u001b[38;5;66;03m# start time as iso-string, or yyyy-jjj\u001b[39;00m\n\u001b[1;32m 5\u001b[0m stop: \u001b[38;5;28mstr\u001b[39m \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;66;03m# stop time as iso-string or yyyy-jjj\u001b[39;00m\n\u001b[1;32m 6\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[38;5;28mlist\u001b[39m: \u001b[38;5;66;03m# list of kernel names\u001b[39;00m\n\u001b[0;32m----> 7\u001b[0m subset \u001b[38;5;241m=\u001b[39m \u001b[43mSubsetter\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmission\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstart\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstop\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 8\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m subset\u001b[38;5;241m.\u001b[39mkernel_names\n", - "Cell \u001b[0;32mIn[12], line 27\u001b[0m, in \u001b[0;36mSubsetter.__init__\u001b[0;34m(self, mission, start, stop, save_location)\u001b[0m\n\u001b[1;32m 19\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__init__\u001b[39m(\n\u001b[1;32m 20\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 21\u001b[0m mission: \u001b[38;5;28mstr\u001b[39m, \u001b[38;5;66;03m# mission shorthand in datasets dataframe\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 24\u001b[0m save_location\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m, \u001b[38;5;66;03m# overwrite default storing in planetarpy archive\u001b[39;00m\n\u001b[1;32m 25\u001b[0m ):\n\u001b[1;32m 26\u001b[0m store_attr()\n\u001b[0;32m---> 27\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minitialize\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n", - "Cell \u001b[0;32mIn[12], line 34\u001b[0m, in \u001b[0;36mSubsetter.initialize\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 32\u001b[0m z \u001b[38;5;241m=\u001b[39m zipfile\u001b[38;5;241m.\u001b[39mZipFile(BytesIO(r\u001b[38;5;241m.\u001b[39mcontent))\n\u001b[1;32m 33\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m---> 34\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mIOError\u001b[39;00m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mSPICE Server request returned status code: \u001b[39m\u001b[38;5;132;01m{r.status_code}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 35\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mz \u001b[38;5;241m=\u001b[39m z\n\u001b[1;32m 36\u001b[0m \u001b[38;5;66;03m# these files only exist \"virtually\" in the zip object, but are needed to\u001b[39;00m\n\u001b[1;32m 37\u001b[0m \u001b[38;5;66;03m# extract them:\u001b[39;00m\n", + "Cell \u001b[0;32mIn[41], line 20\u001b[0m\n\u001b[1;32m 16\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mFound \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mlen\u001b[39m(found)\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m kernels for \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mmission\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 19\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m mission \u001b[38;5;129;01min\u001b[39;00m datasets\u001b[38;5;241m.\u001b[39mindex:\n\u001b[0;32m---> 20\u001b[0m \u001b[43m_test_mission_kernels_available\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmission\u001b[49m\u001b[43m)\u001b[49m\n", + "Cell \u001b[0;32mIn[41], line 12\u001b[0m, in \u001b[0;36m_test_mission_kernels_available\u001b[0;34m(mission)\u001b[0m\n\u001b[1;32m 10\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mHalf time:\u001b[39m\u001b[38;5;124m\"\u001b[39m, half)\n\u001b[1;32m 11\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m---> 12\u001b[0m found \u001b[38;5;241m=\u001b[39m \u001b[43mlist_kernels_for_day\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmission\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mhalf\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 13\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mIndexError\u001b[39;00m:\n\u001b[1;32m 14\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mProblem with\u001b[39m\u001b[38;5;124m\"\u001b[39m, mission)\n", + "Cell \u001b[0;32mIn[36], line 7\u001b[0m, in \u001b[0;36mlist_kernels_for_day\u001b[0;34m(mission, start, stop)\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mlist_kernels_for_day\u001b[39m(\n\u001b[1;32m 3\u001b[0m mission: \u001b[38;5;28mstr\u001b[39m, \u001b[38;5;66;03m# mission shorthand from datasets dataframe\u001b[39;00m\n\u001b[1;32m 4\u001b[0m start: \u001b[38;5;28mstr\u001b[39m, \u001b[38;5;66;03m# start time as iso-string, or yyyy-jjj\u001b[39;00m\n\u001b[1;32m 5\u001b[0m stop: \u001b[38;5;28mstr\u001b[39m \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;66;03m# stop time as iso-string or yyyy-jjj\u001b[39;00m\n\u001b[1;32m 6\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m \u001b[38;5;28mlist\u001b[39m: \u001b[38;5;66;03m# list of kernel names\u001b[39;00m\n\u001b[0;32m----> 7\u001b[0m subset \u001b[38;5;241m=\u001b[39m \u001b[43mSubsetter\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmission\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstart\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstop\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 8\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m subset\u001b[38;5;241m.\u001b[39mkernel_names\n", + "Cell \u001b[0;32mIn[11], line 27\u001b[0m, in \u001b[0;36mSubsetter.__init__\u001b[0;34m(self, mission, start, stop, save_location)\u001b[0m\n\u001b[1;32m 19\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__init__\u001b[39m(\n\u001b[1;32m 20\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 21\u001b[0m mission: \u001b[38;5;28mstr\u001b[39m, \u001b[38;5;66;03m# mission shorthand in datasets dataframe\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 24\u001b[0m save_location\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m, \u001b[38;5;66;03m# overwrite default storing in planetarpy archive\u001b[39;00m\n\u001b[1;32m 25\u001b[0m ):\n\u001b[1;32m 26\u001b[0m store_attr()\n\u001b[0;32m---> 27\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minitialize\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n", + "Cell \u001b[0;32mIn[11], line 34\u001b[0m, in \u001b[0;36mSubsetter.initialize\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 32\u001b[0m z \u001b[38;5;241m=\u001b[39m zipfile\u001b[38;5;241m.\u001b[39mZipFile(BytesIO(r\u001b[38;5;241m.\u001b[39mcontent))\n\u001b[1;32m 33\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m---> 34\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mIOError\u001b[39;00m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mSPICE Server request returned status code: \u001b[39m\u001b[38;5;132;01m{r.status_code}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 35\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mz \u001b[38;5;241m=\u001b[39m z\n\u001b[1;32m 36\u001b[0m \u001b[38;5;66;03m# these files only exist \"virtually\" in the zip object, but are needed to\u001b[39;00m\n\u001b[1;32m 37\u001b[0m \u001b[38;5;66;03m# extract them:\u001b[39;00m\n", "\u001b[0;31mOSError\u001b[0m: SPICE Server request returned status code: {r.status_code}" ] } ], "source": [ - "#|filter_stream ErfaWarning\n", - "#|eval: false\n", + "# |filter_stream ErfaWarning\n", + "# |eval: false\n", + "\n", "\n", "def _test_mission_kernels_available(mission):\n", " print(\"Doing\", mission)\n", @@ -2118,6 +2089,7 @@ " else:\n", " print(f\"Found {len(found)} kernels for {mission}\")\n", "\n", + "\n", "for mission in datasets.index:\n", " _test_mission_kernels_available(mission)" ] @@ -2147,7 +2119,7 @@ "metadata": {}, "outputs": [], "source": [ - "#| export\n", + "# | export\n", "GENERIC_STORAGE = KERNEL_STORAGE / \"generic\"\n", "GENERIC_STORAGE.mkdir(exist_ok=True, parents=True)\n", "GENERIC_URL = NAIF_URL / \"pub/naif/generic_kernels/\"\n", @@ -2169,7 +2141,7 @@ "metadata": {}, "outputs": [], "source": [ - "#| export\n", + "# | export\n", "\n", "\n", "def download_generic_kernels(overwrite=False):\n", @@ -2177,7 +2149,10 @@ " dl_urls = [GENERIC_URL / i for i in generic_kernel_names]\n", " for dl_url, savepath in zip(dl_urls, generic_kernel_paths):\n", " if savepath.exists() and not overwrite:\n", - " print(savepath.name, \"already downloaded. Use `overwrite=True` to download again.\")\n", + " print(\n", + " savepath.name,\n", + " \"already downloaded. Use `overwrite=True` to download again.\",\n", + " )\n", " continue\n", " savepath.parent.mkdir(exist_ok=True, parents=True)\n", " url_retrieve(dl_url, savepath)" @@ -2188,7 +2163,19 @@ "execution_count": null, "id": "ebe088f9-33e3-4d43-bc24-a82846974d9b", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "naif0012.tls already downloaded. Use `overwrite=True` to download again.\n", + "pck00010.tpc already downloaded. Use `overwrite=True` to download again.\n", + "de-403-masses.tpc already downloaded. Use `overwrite=True` to download again.\n", + "de430.bsp already downloaded. Use `overwrite=True` to download again.\n", + "mar097.bsp already downloaded. Use `overwrite=True` to download again.\n" + ] + } + ], "source": [ "download_generic_kernels()" ] @@ -2200,7 +2187,7 @@ "metadata": {}, "outputs": [], "source": [ - "#| export\n", + "# | export\n", "\n", "\n", "def load_generic_kernels():\n", @@ -2243,7 +2230,7 @@ "metadata": {}, "outputs": [], "source": [ - "#| export\n", + "# | export\n", "\n", "\n", "def show_loaded_kernels():\n", @@ -2269,7 +2256,42 @@ "execution_count": null, "id": "5eeb3c4c-cf5f-467d-9b2e-0e0abc4476dd", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The loaded files are:\n", + "(paths relative to kernels.KERNEL_STORAGE)\n", + "\n", + "Position: 0\n", + "Path generic/lsk/naif0012.tls\n", + "Type: TEXT\n", + "Source: \n", + "Handle: 0\n", + "Position: 1\n", + "Path generic/pck/pck00010.tpc\n", + "Type: TEXT\n", + "Source: \n", + "Handle: 0\n", + "Position: 2\n", + "Path generic/pck/de-403-masses.tpc\n", + "Type: TEXT\n", + "Source: \n", + "Handle: 0\n", + "Position: 3\n", + "Path generic/spk/planets/de430.bsp\n", + "Type: SPK\n", + "Source: \n", + "Handle: 12\n", + "Position: 4\n", + "Path generic/spk/satellites/mar097.bsp\n", + "Type: SPK\n", + "Source: \n", + "Handle: 13\n" + ] + } + ], "source": [ "show_loaded_kernels()" ] @@ -2297,9 +2319,9 @@ ], "metadata": { "kernelspec": { - "display_name": "conda-env-py39-py", + "display_name": "Python 3 (ipykernel)", "language": "python", - "name": "conda-env-py39-py" + "name": "python3" } }, "nbformat": 4, diff --git a/planetarypy/spice/kernels.py b/planetarypy/spice/kernels.py index 87fd1e2..d327b82 100644 --- a/planetarypy/spice/kernels.py +++ b/planetarypy/spice/kernels.py @@ -1,31 +1,30 @@ # AUTOGENERATED! DO NOT EDIT! File to edit: ../../notebooks/api/10_spice.kernels.ipynb. # %% auto 0 -__all__ = ['KERNEL_STORAGE', 'dataset_ids', 'df', 'df2', 'datasets', 'NAIF_URL', 'BASE_URL', 'GENERIC_STORAGE', 'GENERIC_URL', - 'generic_kernel_names', 'generic_kernel_paths', 'is_start_valid', 'is_stop_valid', 'download_one_url', - 'Subsetter', 'get_metakernel_and_files', 'list_kernels_for_day', 'download_generic_kernels', - 'load_generic_kernels', 'show_loaded_kernels'] +__all__ = ['KERNEL_STORAGE', 'NAIF_URL', 'BASE_URL', 'GENERIC_STORAGE', 'GENERIC_URL', 'generic_kernel_names', + 'generic_kernel_paths', 'is_start_valid', 'is_stop_valid', 'download_one_url', 'Subsetter', + 'get_metakernel_and_files', 'list_kernels_for_day', 'download_generic_kernels', 'load_generic_kernels', + 'show_loaded_kernels'] # %% ../../notebooks/api/10_spice.kernels.ipynb 3 -import warnings import zipfile from datetime import timedelta from io import BytesIO from itertools import repeat -from multiprocessing import Pool, cpu_count +from multiprocessing import cpu_count from pathlib import Path +import pandas as pd import requests import spiceypy as spice from astropy.time import Time from dask.distributed import Client +from fastcore.test import test_fail +from fastcore.utils import store_attr from tqdm.auto import tqdm from tqdm.contrib.concurrent import process_map from yarl import URL -import pandas as pd -from fastcore.test import test_fail -from fastcore.utils import store_attr from ..config import config from ..utils import nasa_time_to_iso, url_retrieve @@ -33,71 +32,25 @@ KERNEL_STORAGE = config.storage_root / "spice_kernels" KERNEL_STORAGE.mkdir(exist_ok=True, parents=True) -# %% ../../notebooks/api/10_spice.kernels.ipynb 7 -dataset_ids = { - "bc": "bc/bc_spice", - "cassini": "co-s_j_e_v-spice-6-v1.0/cosp_1000", - "clementine": "clem1-l-spice-6-v1.0/clsp_1000", - "dart": "dart/dart_spice", - "dawn": "dawn-m_a-spice-6-v1.0/dawnsp_1000", - "di": "di-c-spice-6-v1.0/disp_1000", - "ds1": "ds1-a_c-spice-6-v1.0/ds1sp_1000", - "epoxi": "dif-c_e_x-spice-6-v1.0/epxsp_1000", - "em16": "em16/em16_spice", - "grail": "grail-l-spice-6-v1.0/grlsp_1000", - "hayabusa": "hay-a-spice-6-v1.0/haysp_1000", - "insight": "insight/insight_spice", - "juno": "jno-j_e_ss-spice-6-v1.0/jnosp_1000", - "ladee": "ladee/ladee_spice", - "lro": "lro-l-spice-6-v1.0/lrosp_1000", - "maven": "maven/maven_spice", - "opportunity": "mer1-m-spice-6-v1.0/mer1sp_1000", - "spirit": "mer2-m-spice-6-v1.0/mer2sp_1000", - "messenger": "mess-e_v_h-spice-6-v1.0/messsp_1000", - "mars2020": "mars2020/mars2020_spice", - "mex": "mex-e_m-spice-6-v2.0/mexsp_2000", - "mgs": "mgs-m-spice-6-v1.0/mgsp_1000", - "ody": "ody-m-spice-6-v1.0/odsp_1000", - "mro": "mro-m-spice-6-v1.0/mrosp_1000", - "msl": "msl-m-spice-6-v1.0/mslsp_1000", - "near": "near-a-spice-6-v1.0/nearsp_1000", - "nh": "nh-j_p_ss-spice-6-v1.0/nhsp_1000", - "orex": "orex/orex_spice", - "rosetta": "ro_rl-e_m_a_c-spice-6-v1.0/rossp_1000", - "stardust": "sdu-c-spice-6-v1.0/sdsp_1000", - "venus_climate_orbiter": "vco/vco_spice", - "vex": "vex-e_v-spice-6-v2.0/vexsp_2000", - "vo": "vo1_vo2-m-spice-6-v1.0/vosp_1000", -} - -df = pd.DataFrame({"shorthand": dataset_ids.keys(), "path": dataset_ids.values()}) - -df2 = pd.read_html("https://naif.jpl.nasa.gov/naif/data_archived.html")[6] -df2.columns = df2.iloc[0] -df2 = df2.drop(0).reset_index(drop=True) -df2 = df2.drop(["Archive Readme", "Archive Link", "Subset Link"], axis=1) -df = df.join(df2) -datasets = df.set_index("shorthand") - -# %% ../../notebooks/api/10_spice.kernels.ipynb 10 +# %% ../../notebooks/api/10_spice.kernels.ipynb 11 def is_start_valid( - mission: str, # mission shorthand label of datasets dataframe - start: Time, # start time in astropy.Time format + mission: str, # mission shorthand label of datasets dataframe + start: Time, # start time in astropy.Time format ): return Time(datasets.at[mission, "Start Time"]) <= start def is_stop_valid( - mission: str, # mission shorthand label of datasets dataframe - stop: Time, # stop time in astropy.Time format + mission: str, # mission shorthand label of datasets dataframe + stop: Time, # stop time in astropy.Time format ): return Time(datasets.at[mission, "Stop Time"]) >= stop -# %% ../../notebooks/api/10_spice.kernels.ipynb 13 +# %% ../../notebooks/api/10_spice.kernels.ipynb 14 NAIF_URL = URL("https://naif.jpl.nasa.gov") BASE_URL = NAIF_URL / "cgi-bin/subsetds.pl" -# %% ../../notebooks/api/10_spice.kernels.ipynb 15 +# %% ../../notebooks/api/10_spice.kernels.ipynb 16 def download_one_url(url, local_path, overwrite: bool = False): if local_path.exists() and not overwrite: return @@ -114,11 +67,11 @@ class Subsetter: """ def __init__( - self, - mission: str, # mission shorthand in datasets dataframe - start: str, # start time in either ISO or yyyy-jjj format - stop=None, # stop time in either ISO or yyyy-jjj format - save_location=None, # overwrite default storing in planetarpy archive + self, + mission: str, # mission shorthand in datasets dataframe + start: str, # start time in either ISO or yyyy-jjj format + stop=None, # stop time in either ISO or yyyy-jjj format + save_location=None, # overwrite default storing in planetarpy archive ): store_attr() self.initialize() @@ -174,10 +127,15 @@ def payload(self): Time-unsupported yyyy-jjj format, which can be converted by `nasa_time_to_iso` from `planetarypy.utils`. """ - if not (is_start_valid(self.mission, self.start) and is_stop_valid(self.mission, self.stop)): - raise ValueError("One of start/stop is outside the supported date-range. See `datasets`.") + if not ( + is_start_valid(self.mission, self.start) + and is_stop_valid(self.mission, self.stop) + ): + raise ValueError( + "One of start/stop is outside the supported date-range. See `datasets`." + ) p = { - "dataset": dataset_ids[self.mission], + "dataset": datasets.loc[self.mission, "path"], "start": self.start.iso, "stop": self.stop.iso, "action": "Subset", @@ -187,18 +145,24 @@ def payload(self): @property def kernel_names(self): "Return list of names of kernels for the given time range." - return [str(Path(URL(url).parent.name) / URL(url).name) for url in self.kernel_urls] + return [ + str(Path(URL(url).parent.name) / URL(url).name) for url in self.kernel_urls + ] def get_local_path( - self, - url, # kernel url to determine local storage path + self, + url, # kernel url to determine local storage path ) -> Path: # full local path where kernel in URL will be stored """Calculate local storage path from Kernel URL, using `save_location` if given. If self.save_location is None, the `planetarypy` archive is being used. """ u = URL(url) - basepath = (KERNEL_STORAGE / self.mission if not self.save_location else self.save_location) + basepath = ( + KERNEL_STORAGE / self.mission + if not self.save_location + else self.save_location + ) return basepath / u.parent.name / u.name def _non_blocking_download(self, overwrite: bool = False): @@ -241,9 +205,15 @@ def get_metakernel(self) -> Path: # return path to metakernel file Use `save_location` if given, otherwise `planetarypy` archive. """ - basepath = (KERNEL_STORAGE / self.mission if not self.save_location else self.save_location) + basepath = ( + KERNEL_STORAGE / self.mission + if not self.save_location + else self.save_location + ) savepath = basepath / self.metakernel_file - with open(savepath, "w") as outfile, self.z.open(self.metakernel_file) as infile: + with open(savepath, "w") as outfile, self.z.open( + self.metakernel_file + ) as infile: for line in infile: linestr = line.decode() if "'./data'" in linestr: @@ -251,29 +221,29 @@ def get_metakernel(self) -> Path: # return path to metakernel file outfile.write(linestr) return savepath -# %% ../../notebooks/api/10_spice.kernels.ipynb 43 +# %% ../../notebooks/api/10_spice.kernels.ipynb 44 def get_metakernel_and_files( - mission: str, # mission shorthand from datasets dataframe - start: str, # start time as iso-string, or yyyy-jjj - stop: str, # stop time as iso-string or yyyy-jjj - save_location: str = None, # override storage into planetarypy archive - quiet: bool = False, # suppress kernel-wise feedback + mission: str, # mission shorthand from datasets dataframe + start: str, # start time as iso-string, or yyyy-jjj + stop: str, # stop time as iso-string or yyyy-jjj + save_location: str = None, # override storage into planetarypy archive + quiet: bool = False, # suppress kernel-wise feedback ) -> Path: # pathlib.Path to metakernel file with corrected data path. "For a given mission and start/stop times, download the kernels and get metakernel path" subset = Subsetter(mission, start, stop, save_location) subset.download_kernels(non_blocking=True, quiet=quiet) return subset.get_metakernel() -# %% ../../notebooks/api/10_spice.kernels.ipynb 45 +# %% ../../notebooks/api/10_spice.kernels.ipynb 46 def list_kernels_for_day( - mission: str, # mission shorthand from datasets dataframe - start: str, # start time as iso-string, or yyyy-jjj - stop: str = "", # stop time as iso-string or yyyy-jjj + mission: str, # mission shorthand from datasets dataframe + start: str, # start time as iso-string, or yyyy-jjj + stop: str = "", # stop time as iso-string or yyyy-jjj ) -> list: # list of kernel names subset = Subsetter(mission, start, stop) return subset.kernel_names -# %% ../../notebooks/api/10_spice.kernels.ipynb 52 +# %% ../../notebooks/api/10_spice.kernels.ipynb 53 GENERIC_STORAGE = KERNEL_STORAGE / "generic" GENERIC_STORAGE.mkdir(exist_ok=True, parents=True) GENERIC_URL = NAIF_URL / "pub/naif/generic_kernels/" @@ -287,18 +257,21 @@ def list_kernels_for_day( ] generic_kernel_paths = [GENERIC_STORAGE.joinpath(i) for i in generic_kernel_names] -# %% ../../notebooks/api/10_spice.kernels.ipynb 53 +# %% ../../notebooks/api/10_spice.kernels.ipynb 54 def download_generic_kernels(overwrite=False): "Download all kernels as required by generic_kernel_list." dl_urls = [GENERIC_URL / i for i in generic_kernel_names] for dl_url, savepath in zip(dl_urls, generic_kernel_paths): if savepath.exists() and not overwrite: - print(savepath.name, "already downloaded. Use `overwrite=True` to download again.") + print( + savepath.name, + "already downloaded. Use `overwrite=True` to download again.", + ) continue savepath.parent.mkdir(exist_ok=True, parents=True) url_retrieve(dl_url, savepath) -# %% ../../notebooks/api/10_spice.kernels.ipynb 55 +# %% ../../notebooks/api/10_spice.kernels.ipynb 56 def load_generic_kernels(): """Load all kernels in generic_kernels list. @@ -311,7 +284,7 @@ def load_generic_kernels(): for kernel in generic_kernel_paths: spice.furnsh(str(kernel)) -# %% ../../notebooks/api/10_spice.kernels.ipynb 58 +# %% ../../notebooks/api/10_spice.kernels.ipynb 59 def show_loaded_kernels(): "Print overview of loaded kernels." count = spice.ktotal("all")