{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# FAC_TMS_2F (dual spacecraft)\n", "\n", "> Abstract: Access to the field aligned currents evaluated by the dual satellite method (level 2 product). We also show an orbit-by-orbit plot using a periodic axis to display (centred over both poles) an overview of the FAC estimates over two weeks." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "See also:\n", "\n", " - https://github.com/smithara/viresclient_examples/blob/master/basic_FAC.ipynb\n", " - https://github.com/pacesm/jupyter_notebooks/blob/master/Periodic%20Axis.ipynb" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2024-01-24T17:44:19.885109Z", "iopub.status.busy": "2024-01-24T17:44:19.884635Z", "iopub.status.idle": "2024-01-24T17:44:20.939735Z", "shell.execute_reply": "2024-01-24T17:44:20.939158Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Python implementation: CPython\n", "Python version : 3.11.6\n", "IPython version : 8.18.0\n", "\n", "viresclient: 0.11.6\n", "pandas : 2.1.3\n", "xarray : 2023.12.0\n", "matplotlib : 3.8.2\n", "\n" ] } ], "source": [ "%load_ext watermark\n", "%watermark -i -v -p viresclient,pandas,xarray,matplotlib" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2024-01-24T17:44:20.941873Z", "iopub.status.busy": "2024-01-24T17:44:20.941506Z", "iopub.status.idle": "2024-01-24T17:44:21.565572Z", "shell.execute_reply": "2024-01-24T17:44:21.565017Z" } }, "outputs": [], "source": [ "from viresclient import SwarmRequest\n", "import datetime as dt\n", "import numpy as np\n", "import pandas as pd\n", "import matplotlib.pyplot as plt\n", "import matplotlib.dates as mdates\n", "\n", "request = SwarmRequest()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## FAC_TMS_2F product information\n", "\n", "This is derived from data from both Swarm Alpha and Charlie by the Ampère's integral method\n", "\n", "Documentation:\n", "- https://earth.esa.int/web/guest/missions/esa-eo-missions/swarm/data-handbook/level-2-product-definitions#FAC_TMS_2F\n", "- https://earth.esa.int/documents/10174/1514862/Swarm-L2-FAC-Dual-Product-Description" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Check what \"FAC\" data variables are available\n", "\n", "NB: these are the same as in the `FACxTMS_2F` single-satellite FAC product" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2024-01-24T17:44:21.568228Z", "iopub.status.busy": "2024-01-24T17:44:21.568056Z", "iopub.status.idle": "2024-01-24T17:44:21.573317Z", "shell.execute_reply": "2024-01-24T17:44:21.572846Z" } }, "outputs": [ { "data": { "text/plain": [ "{'FAC': ['SW_OPER_FACATMS_2F',\n", " 'SW_OPER_FACBTMS_2F',\n", " 'SW_OPER_FACCTMS_2F',\n", " 'SW_OPER_FAC_TMS_2F']}" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "request.available_collections(\"FAC\", details=False)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "execution": { "iopub.execute_input": "2024-01-24T17:44:21.574951Z", "iopub.status.busy": "2024-01-24T17:44:21.574791Z", "iopub.status.idle": "2024-01-24T17:44:21.578454Z", "shell.execute_reply": "2024-01-24T17:44:21.578013Z" } }, "outputs": [ { "data": { "text/plain": [ "['IRC',\n", " 'IRC_Error',\n", " 'FAC',\n", " 'FAC_Error',\n", " 'Flags',\n", " 'Flags_F',\n", " 'Flags_B',\n", " 'Flags_q']" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "request.available_measurements(\"FAC\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Fetch one day\n", "\n", "Also fetch the quasidipole (QD) coordinates at the same time." ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "execution": { "iopub.execute_input": "2024-01-24T17:44:21.580289Z", "iopub.status.busy": "2024-01-24T17:44:21.579975Z", "iopub.status.idle": "2024-01-24T17:44:25.197955Z", "shell.execute_reply": "2024-01-24T17:44:25.197520Z" } }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "818865ae89fc4949ba17821c65584636", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Processing: 0%| | [ Elapsed: 00:00, Remaining: ? ] [1/1] " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "00d9754f59b844e09c820b946de46cd5", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Downloading: 0%| | [ Elapsed: 00:00, Remaining: ? ] (7.005MB)" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "request.set_collection(\"SW_OPER_FAC_TMS_2F\")\n", "request.set_products(\n", " measurements=[\"FAC\", \"FAC_Error\", \n", " \"Flags\", \"Flags_F\", \"Flags_B\", \"Flags_q\"],\n", " auxiliaries=[\"QDLat\", \"QDLon\"],\n", ")\n", "data = request.get_between(\n", " dt.datetime(2016,1,1),\n", " dt.datetime(2016,1,2)\n", ")" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "execution": { "iopub.execute_input": "2024-01-24T17:44:25.199856Z", "iopub.status.busy": "2024-01-24T17:44:25.199688Z", "iopub.status.idle": "2024-01-24T17:44:25.205607Z", "shell.execute_reply": "2024-01-24T17:44:25.205180Z" } }, "outputs": [ { "data": { "text/plain": [ "['SW_OPER_FAC_TMS_2F_20160101T000000_20160101T235959_0401']" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data.sources" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Load as a pandas dataframe:" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "execution": { "iopub.execute_input": "2024-01-24T17:44:25.207449Z", "iopub.status.busy": "2024-01-24T17:44:25.207170Z", "iopub.status.idle": "2024-01-24T17:44:27.291754Z", "shell.execute_reply": "2024-01-24T17:44:27.291194Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", " | Longitude | \n", "FAC_Error | \n", "Radius | \n", "Flags_F | \n", "QDLat | \n", "Spacecraft | \n", "Latitude | \n", "Flags_q | \n", "QDLon | \n", "Flags | \n", "FAC | \n", "Flags_B | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|
Timestamp | \n", "\n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " |
2016-01-01 00:00:00.500 | \n", "93.510970 | \n", "0.039584 | \n", "6.833866e+06 | \n", "22222224 | \n", "-81.264999 | \n", "- | \n", "-72.499886 | \n", "404 | \n", "104.167931 | \n", "0 | \n", "0.044131 | \n", "2002 | \n", "
2016-01-01 00:00:01.500 | \n", "93.539666 | \n", "0.039720 | \n", "6.833867e+06 | \n", "22222224 | \n", "-81.299614 | \n", "- | \n", "-72.563053 | \n", "404 | \n", "103.828697 | \n", "0 | \n", "0.034081 | \n", "2002 | \n", "
2016-01-01 00:00:02.500 | \n", "93.568594 | \n", "0.039856 | \n", "6.833868e+06 | \n", "22222224 | \n", "-81.333939 | \n", "- | \n", "-72.626215 | \n", "404 | \n", "103.486877 | \n", "0 | \n", "0.025312 | \n", "2002 | \n", "
2016-01-01 00:00:03.500 | \n", "93.597756 | \n", "0.039993 | \n", "6.833870e+06 | \n", "22222224 | \n", "-81.367966 | \n", "- | \n", "-72.689371 | \n", "404 | \n", "103.142395 | \n", "0 | \n", "0.019080 | \n", "2002 | \n", "
2016-01-01 00:00:04.500 | \n", "93.627155 | \n", "0.040132 | \n", "6.833871e+06 | \n", "22222224 | \n", "-81.401688 | \n", "- | \n", "-72.752521 | \n", "404 | \n", "102.795349 | \n", "0 | \n", "0.014609 | \n", "2002 | \n", "
<xarray.Dataset>\n", "Dimensions: (Timestamp: 86400)\n", "Coordinates:\n", " * Timestamp (Timestamp) datetime64[ns] 2016-01-01T00:00:00.500000 ... 201...\n", "Data variables:\n", " Spacecraft (Timestamp) object '-' '-' '-' '-' '-' ... '-' '-' '-' '-' '-'\n", " Longitude (Timestamp) float64 93.51 93.54 93.57 ... -94.65 -94.65 -94.65\n", " FAC_Error (Timestamp) float64 0.03958 0.03972 0.03986 ... 0.01702 0.01702\n", " Radius (Timestamp) float64 6.834e+06 6.834e+06 ... 6.823e+06 6.823e+06\n", " Flags_F (Timestamp) uint32 22222224 22222224 ... 22222224 22222224\n", " QDLat (Timestamp) float64 -81.26 -81.3 -81.33 ... 41.33 41.39 41.45\n", " Latitude (Timestamp) float64 -72.5 -72.56 -72.63 ... 31.55 31.61 31.68\n", " Flags_q (Timestamp) uint32 404 404 404 404 404 404 404 ... 0 0 0 0 0 0 0\n", " QDLon (Timestamp) float64 104.2 103.8 103.5 ... -24.03 -24.03 -24.03\n", " Flags (Timestamp) uint32 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0\n", " FAC (Timestamp) float64 0.04413 0.03408 ... -0.009214 -0.008928\n", " Flags_B (Timestamp) uint32 2002 2002 2002 2002 ... 2002 2002 2002 2002\n", "Attributes:\n", " Sources: ['SW_OPER_FAC_TMS_2F_20160101T000000_20160101T235959_0401']\n", " MagneticModels: []\n", " AppliedFilters: []