From 86f15e33fce645996789c396e878e6c6518f6348 Mon Sep 17 00:00:00 2001 From: Ashley Smith Date: Tue, 21 Aug 2018 15:30:54 +0200 Subject: [PATCH] Minor doc adjustments for v0.2 --- docs/api.rst | 16 +- docs/conf.py | 3 +- docs/readme.rst | 52 ++-- notebooks/simple_example.ipynb | 467 +++++++++++++++++++++++---------- 4 files changed, 361 insertions(+), 177 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index ce048df..a3f6499 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -3,12 +3,26 @@ viresclient .. automodule:: viresclient -.. autoclass:: viresclient.ClientRequest +SwarmRequest +============ + +.. autoclass:: viresclient.SwarmRequest :members: :undoc-members: :show-inheritance: + :inherited-members: + +ReturnedData +============ .. autoclass:: viresclient.ReturnedData :members: :undoc-members: :show-inheritance: + :inherited-members: + +.. autoclass:: viresclient.ReturnedDataGroup + :members: + :undoc-members: + :show-inheritance: + :inherited-members: diff --git a/docs/conf.py b/docs/conf.py index 7be04dc..a6f2bea 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -46,7 +46,8 @@ # ones. extensions = ['sphinx.ext.autodoc', 'sphinx.ext.napoleon', - 'nbsphinx' + 'nbsphinx', + 'sphinx.ext.imgmath' ] # Add any paths that contain templates here, relative to this directory. diff --git a/docs/readme.rst b/docs/readme.rst index 614dad1..8285fd1 100644 --- a/docs/readme.rst +++ b/docs/readme.rst @@ -17,6 +17,7 @@ Dependencies:: cdflib tables tqdm + xarray Example usage ------------- @@ -24,42 +25,36 @@ Import the package and set up the connection to the server: .. code-block:: python - from viresclient import ClientRequest + from viresclient import SwarmRequest import datetime as dt - url = "https://staging.viresdisc.vires.services/openows" - username = "" - password = "" - - request = ClientRequest(url, username, password) + request = SwarmRequest(url="https://staging.viresdisc.vires.services/openows", + username="your username", + password="your password") Choose which collection to access: .. code-block:: python - collection = "SW_OPER_MAGA_LR_1B" - - request.set_collection(collection) + request.set_collection("SW_OPER_MAGA_LR_1B") -Choose measurements and models to evaluate: +Choose a combination of variables to retrieve. ``measurements`` are measured by the satellite and members of the specified ``collection``; ``models`` are evaluated on the server at the positions of the satellite; ``auxiliaries`` are additional parameters not unique to the ``collection``. If ``residuals`` is set to ``True`` then only data-model residuals are returned. Optionally specify a resampling of the original time series with ``sampling_step`` (an `ISO-8601 duration `_). .. code-block:: python - measurements = ["F","B_NEC"] - models = ["MCO_SHA_2C","MMA_SHA_2C-Primary"] - auxiliaries = ["OrbitNumber","SunZenithAngle","QDLat","QDLon","MLT"] - - request.set_products(measurements, models, auxiliaries, residuals=False, subsample="PT10S") + request.set_products(measurements=["F","B_NEC"], + models=["MCO_SHA_2C", "MMA_SHA_2C-Primary", "MMA_SHA_2C-Secondary"], + auxiliaries=["QDLat", "QDLon", "MLT", "OrbitNumber", "SunZenithAngle"], + residuals=False, + sampling_step="PT10S") Set a parameter range filter to apply. You can add multiple filters in sequence .. code-block:: python - parameter = "Latitude" - minimum = 0 - maximum = 90 - - request.set_range_filter(parameter, minimum, maximum) + request.set_range_filter(parameter="Latitude", + minimum=0, + maximum=90) request.set_range_filter("Longitude", 0, 90) @@ -67,10 +62,10 @@ Specify the time range from which to retrieve data, make the request to the serv .. code-block:: python - start_time = dt.datetime(2016,1,1) - end_time = dt.datetime(2016,1,2) - - data = request.get_between(start_time, end_time, filetype="cdf", asynchronous=True) + data = request.get_between(start_time=dt.datetime(2016,1,1), + end_time=dt.datetime(2016,1,2), + filetype="cdf", + asynchronous=True) Transfer your data to a (``pandas``) dataframe or save it: @@ -79,15 +74,6 @@ Transfer your data to a (``pandas``) dataframe or save it: df = data.as_dataframe() data.to_file('outfile.cdf', overwrite=False) -Convert to an HDF5 file: - -.. code-block:: python - - data.to_file('outfile.h5', hdf=True, overwrite=False) - - import pandas as pd - df = pd.read_hdf('outfile.h5') - The returned data has columns for: - ``Spacecraft, Timestamp, Latitude, Longitude, Radius`` - those specified in ``measurements`` and ``auxiliaries`` above diff --git a/notebooks/simple_example.ipynb b/notebooks/simple_example.ipynb index aff13cb..b49aae9 100644 --- a/notebooks/simple_example.ipynb +++ b/notebooks/simple_example.ipynb @@ -4,14 +4,18 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Simple example" + "# Example Usage" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "### Choose and download data" + "### Choose and download data\n", + "\n", + "Select a combination of variables and fetch data from one day.\n", + "\n", + "Resample to one measurement per 10s; filter for the Northern Hemisphere." ] }, { @@ -23,49 +27,72 @@ "name": "stderr", "output_type": "stream", "text": [ - "Processing: 100%|██████████| [ Elapsed: 00:03, Remaining: 00:00 ]\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Downloading...\n" + "[1/1] Processing: 100%|██████████| [ Elapsed: 00:02, Remaining: 00:00 ]\n", + " Downloading: 100%|██████████| [ Elapsed: 00:00, Remaining: 00:00 ] (0.766MB)\n" ] } ], "source": [ - "from viresclient import ClientRequest\n", + "from viresclient import SwarmRequest\n", "import datetime as dt\n", "\n", - "url = \"https://staging.viresdisc.vires.services/openows\"\n", - "username = \"\"\n", - "password = \"\"\n", - "request = ClientRequest(url,username,password)\n", + "request = SwarmRequest(url=\"https://staging.viresdisc.vires.services/openows\",\n", + " username=\"your username\",\n", + " password=\"your password\")\n", "\n", "request.set_collection(\"SW_OPER_MAGA_LR_1B\")\n", "\n", - "measurements = [\"F\",\"B_NEC\"]\n", - "models = [\"MCO_SHA_2C\", \"MMA_SHA_2C-Primary\"]\n", - "auxiliaries = [\"QDLat\", \"QDLon\"]\n", - "request.set_products(measurements, models, auxiliaries, residuals=False, subsample=\"PT10S\")\n", + "request.set_products(measurements=[\"F\",\"B_NEC\"],\n", + " models=[\"MCO_SHA_2C\", \"MMA_SHA_2C-Primary\", \"MMA_SHA_2C-Secondary\"],\n", + " auxiliaries=[\"QDLat\", \"QDLon\"],\n", + " residuals=False,\n", + " sampling_step=\"PT10S\")\n", "\n", - "start_time = dt.datetime(2016,1,1)\n", - "end_time = dt.datetime(2016,1,2)\n", - "data = request.get_between(start_time, end_time, filetype=\"csv\")" + "request.set_range_filter(parameter=\"Latitude\",\n", + " minimum=0,\n", + " maximum=90)\n", + "\n", + "data = request.get_between(start_time=dt.datetime(2016,1,1),\n", + " end_time=dt.datetime(2016,1,2))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "### Convert to a dataframe" + "### Save the data directly\n", + "\n", + "You can save the generated data file directly then open it using other software." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Data written to testfile.cdf\n" + ] + } + ], + "source": [ + "data.to_file('testfile.cdf')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Convert to a pandas DataFrame" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, "outputs": [ { "data": { @@ -88,18 +115,20 @@ " \n", " \n", " \n", - " Spacecraft\n", - " Latitude\n", - " Longitude\n", - " Radius\n", - " F\n", " B_NEC\n", - " F_MCO_SHA_2C\n", " B_NEC_MCO_SHA_2C\n", - " F_MMA_SHA_2C-Primary\n", " B_NEC_MMA_SHA_2C-Primary\n", + " B_NEC_MMA_SHA_2C-Secondary\n", + " F\n", + " F_MCO_SHA_2C\n", + " F_MMA_SHA_2C-Primary\n", + " F_MMA_SHA_2C-Secondary\n", + " Latitude\n", + " Longitude\n", " QDLat\n", " QDLon\n", + " Radius\n", + " Spacecraft\n", " \n", " \n", " Timestamp\n", @@ -115,139 +144,159 @@ " \n", " \n", " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", - " 2016-01-01 00:00:00\n", + " 2016-01-01 00:28:00\n", + " [23432.0698, 2929.1195000000002, 7001.0706]\n", + " [23605.90473830581, 2931.6376573093767, 7003.2...\n", + " [-126.91532798907662, -5.6198964252082355, 17....\n", + " [-33.09016927969169, -1.7093996086641592, -6.8...\n", + " 24630.6298\n", + " 24796.748750\n", + " 128.250015\n", + " 33.843027\n", + " 0.197610\n", + " -102.681841\n", + " 8.425159\n", + " -30.812750\n", + " 6828390.61\n", " A\n", - " -72.499225\n", - " 92.793968\n", - " 6833853.10\n", - " 46935.8090\n", - " [-1580.9623, -10494.5508, -45720.5906]\n", - " 46816.7997\n", - " [-1576.64944, -10311.6502, -45639.8596]\n", - " 85.199162\n", - " [-34.2109781, 8.16203091, -77.6008215]\n", - " -81.095398\n", - " 103.605850\n", " \n", " \n", - " 2016-01-01 00:00:10\n", + " 2016-01-01 00:28:10\n", + " [23450.916100000002, 2900.0733, 7554.7711]\n", + " [23624.47275153368, 2902.82041629198, 7556.563...\n", + " [-126.72131580143507, -5.5793404901198125, 19....\n", + " [-33.089430547649556, -1.6811466971580775, -7....\n", + " 24808.1068\n", + " 24972.859780\n", + " 128.305090\n", + " 34.025930\n", + " 0.838157\n", + " -102.693946\n", + " 9.068963\n", + " -30.902256\n", + " 6828288.87\n", " A\n", - " -73.130685\n", - " 93.091639\n", - " 6833864.75\n", - " 46908.3142\n", - " [-1841.6017, -10472.1489, -45687.7453]\n", - " 46793.1098\n", - " [-1839.74991, -10289.1642, -45610.7832]\n", - " 85.531435\n", - " [-33.426937, 8.26854044, -78.2936615]\n", - " -81.428322\n", - " 100.168869\n", " \n", " \n", - " 2016-01-01 00:00:20\n", + " 2016-01-01 00:28:20\n", + " [23465.5579, 2872.2875000000004, 8110.08480000...\n", + " [23638.81245985172, 2874.59744914569, 8111.724...\n", + " [-126.50108249657657, -5.538713843992417, 21.0...\n", + " [-33.08040682359359, -1.653116949429096, -8.60...\n", + " 24993.3690\n", + " 25156.646166\n", + " 128.357507\n", + " 34.221683\n", + " 1.478724\n", + " -102.706041\n", + " 9.713511\n", + " -30.990784\n", + " 6828186.32\n", " A\n", - " -73.761537\n", - " 93.414903\n", - " 6833875.99\n", - " 46878.3766\n", - " [-2108.2513, -10439.0711, -45653.0421]\n", - " 46767.1747\n", - " [-2106.46241, -10260.3687, -45579.1211]\n", - " 85.864048\n", - " [-32.6252043, 8.37835667, -78.9812248]\n", - " -81.729675\n", - " 96.476830\n", " \n", " \n", - " 2016-01-01 00:00:30\n", + " 2016-01-01 00:28:30\n", + " [23476.096100000002, 2844.6195000000002, 8666....\n", + " [23648.85230986529, 2846.960888233475, 8668.59...\n", + " [-126.2546612277731, -5.4980200665725025, 22.7...\n", + " [-33.06303949938177, -1.6253091491888805, -9.4...\n", + " 25186.2222\n", + " 25347.936846\n", + " 128.407260\n", + " 34.430033\n", + " 2.119308\n", + " -102.718118\n", + " 10.358768\n", + " -31.078363\n", + " 6828082.97\n", " A\n", - " -74.391708\n", - " 93.766833\n", - " 6833886.83\n", - " 46846.0580\n", - " [-2381.3929, -10403.5121, -45614.5157]\n", - " 46738.9996\n", - " [-2377.3128, -10224.8, -45544.8783]\n", - " 86.196966\n", - " [-31.8053057, 8.49185654, -79.6632156]\n", - " -81.995933\n", - " 92.530456\n", " \n", " \n", - " 2016-01-01 00:00:40\n", + " 2016-01-01 00:28:40\n", + " [23482.2611, 2817.4788000000003, 9225.42960000...\n", + " [23654.524148541142, 2819.9042242487117, 9227....\n", + " [-125.98209353284206, -5.457262630766026, 24.4...\n", + " [-33.03727353768437, -1.5977218864183431, -10....\n", + " 25386.4754\n", + " 25546.550658\n", + " 128.454343\n", + " 34.650704\n", + " 2.759911\n", + " -102.730169\n", + " 11.004701\n", + " -31.165012\n", + " 6827978.83\n", " A\n", - " -75.021114\n", - " 94.151014\n", - " 6833897.26\n", - " 46811.5557\n", - " [-2657.3877, -10359.9614, -45573.7641]\n", - " 46708.5872\n", - " [-2652.89398, -10181.9109, -45508.0539]\n", - " 86.530156\n", - " [-30.9666901, 8.60947127, -80.3393361]\n", - " -82.223518\n", - " 88.339935\n", " \n", " \n", "\n", "" ], "text/plain": [ - " Spacecraft Latitude Longitude Radius F \\\n", - "Timestamp \n", - "2016-01-01 00:00:00 A -72.499225 92.793968 6833853.10 46935.8090 \n", - "2016-01-01 00:00:10 A -73.130685 93.091639 6833864.75 46908.3142 \n", - "2016-01-01 00:00:20 A -73.761537 93.414903 6833875.99 46878.3766 \n", - "2016-01-01 00:00:30 A -74.391708 93.766833 6833886.83 46846.0580 \n", - "2016-01-01 00:00:40 A -75.021114 94.151014 6833897.26 46811.5557 \n", - "\n", - " B_NEC F_MCO_SHA_2C \\\n", - "Timestamp \n", - "2016-01-01 00:00:00 [-1580.9623, -10494.5508, -45720.5906] 46816.7997 \n", - "2016-01-01 00:00:10 [-1841.6017, -10472.1489, -45687.7453] 46793.1098 \n", - "2016-01-01 00:00:20 [-2108.2513, -10439.0711, -45653.0421] 46767.1747 \n", - "2016-01-01 00:00:30 [-2381.3929, -10403.5121, -45614.5157] 46738.9996 \n", - "2016-01-01 00:00:40 [-2657.3877, -10359.9614, -45573.7641] 46708.5872 \n", + " B_NEC \\\n", + "Timestamp \n", + "2016-01-01 00:28:00 [23432.0698, 2929.1195000000002, 7001.0706] \n", + "2016-01-01 00:28:10 [23450.916100000002, 2900.0733, 7554.7711] \n", + "2016-01-01 00:28:20 [23465.5579, 2872.2875000000004, 8110.08480000... \n", + "2016-01-01 00:28:30 [23476.096100000002, 2844.6195000000002, 8666.... \n", + "2016-01-01 00:28:40 [23482.2611, 2817.4788000000003, 9225.42960000... \n", "\n", - " B_NEC_MCO_SHA_2C \\\n", - "Timestamp \n", - "2016-01-01 00:00:00 [-1576.64944, -10311.6502, -45639.8596] \n", - "2016-01-01 00:00:10 [-1839.74991, -10289.1642, -45610.7832] \n", - "2016-01-01 00:00:20 [-2106.46241, -10260.3687, -45579.1211] \n", - "2016-01-01 00:00:30 [-2377.3128, -10224.8, -45544.8783] \n", - "2016-01-01 00:00:40 [-2652.89398, -10181.9109, -45508.0539] \n", + " B_NEC_MCO_SHA_2C \\\n", + "Timestamp \n", + "2016-01-01 00:28:00 [23605.90473830581, 2931.6376573093767, 7003.2... \n", + "2016-01-01 00:28:10 [23624.47275153368, 2902.82041629198, 7556.563... \n", + "2016-01-01 00:28:20 [23638.81245985172, 2874.59744914569, 8111.724... \n", + "2016-01-01 00:28:30 [23648.85230986529, 2846.960888233475, 8668.59... \n", + "2016-01-01 00:28:40 [23654.524148541142, 2819.9042242487117, 9227.... \n", "\n", - " F_MMA_SHA_2C-Primary \\\n", - "Timestamp \n", - "2016-01-01 00:00:00 85.199162 \n", - "2016-01-01 00:00:10 85.531435 \n", - "2016-01-01 00:00:20 85.864048 \n", - "2016-01-01 00:00:30 86.196966 \n", - "2016-01-01 00:00:40 86.530156 \n", + " B_NEC_MMA_SHA_2C-Primary \\\n", + "Timestamp \n", + "2016-01-01 00:28:00 [-126.91532798907662, -5.6198964252082355, 17.... \n", + "2016-01-01 00:28:10 [-126.72131580143507, -5.5793404901198125, 19.... \n", + "2016-01-01 00:28:20 [-126.50108249657657, -5.538713843992417, 21.0... \n", + "2016-01-01 00:28:30 [-126.2546612277731, -5.4980200665725025, 22.7... \n", + "2016-01-01 00:28:40 [-125.98209353284206, -5.457262630766026, 24.4... \n", "\n", - " B_NEC_MMA_SHA_2C-Primary QDLat \\\n", + " B_NEC_MMA_SHA_2C-Secondary \\\n", "Timestamp \n", - "2016-01-01 00:00:00 [-34.2109781, 8.16203091, -77.6008215] -81.095398 \n", - "2016-01-01 00:00:10 [-33.426937, 8.26854044, -78.2936615] -81.428322 \n", - "2016-01-01 00:00:20 [-32.6252043, 8.37835667, -78.9812248] -81.729675 \n", - "2016-01-01 00:00:30 [-31.8053057, 8.49185654, -79.6632156] -81.995933 \n", - "2016-01-01 00:00:40 [-30.9666901, 8.60947127, -80.3393361] -82.223518 \n", + "2016-01-01 00:28:00 [-33.09016927969169, -1.7093996086641592, -6.8... \n", + "2016-01-01 00:28:10 [-33.089430547649556, -1.6811466971580775, -7.... \n", + "2016-01-01 00:28:20 [-33.08040682359359, -1.653116949429096, -8.60... \n", + "2016-01-01 00:28:30 [-33.06303949938177, -1.6253091491888805, -9.4... \n", + "2016-01-01 00:28:40 [-33.03727353768437, -1.5977218864183431, -10.... \n", "\n", - " QDLon \n", - "Timestamp \n", - "2016-01-01 00:00:00 103.605850 \n", - "2016-01-01 00:00:10 100.168869 \n", - "2016-01-01 00:00:20 96.476830 \n", - "2016-01-01 00:00:30 92.530456 \n", - "2016-01-01 00:00:40 88.339935 " + " F F_MCO_SHA_2C F_MMA_SHA_2C-Primary \\\n", + "Timestamp \n", + "2016-01-01 00:28:00 24630.6298 24796.748750 128.250015 \n", + "2016-01-01 00:28:10 24808.1068 24972.859780 128.305090 \n", + "2016-01-01 00:28:20 24993.3690 25156.646166 128.357507 \n", + "2016-01-01 00:28:30 25186.2222 25347.936846 128.407260 \n", + "2016-01-01 00:28:40 25386.4754 25546.550658 128.454343 \n", + "\n", + " F_MMA_SHA_2C-Secondary Latitude Longitude QDLat \\\n", + "Timestamp \n", + "2016-01-01 00:28:00 33.843027 0.197610 -102.681841 8.425159 \n", + "2016-01-01 00:28:10 34.025930 0.838157 -102.693946 9.068963 \n", + "2016-01-01 00:28:20 34.221683 1.478724 -102.706041 9.713511 \n", + "2016-01-01 00:28:30 34.430033 2.119308 -102.718118 10.358768 \n", + "2016-01-01 00:28:40 34.650704 2.759911 -102.730169 11.004701 \n", + "\n", + " QDLon Radius Spacecraft \n", + "Timestamp \n", + "2016-01-01 00:28:00 -30.812750 6828390.61 A \n", + "2016-01-01 00:28:10 -30.902256 6828288.87 A \n", + "2016-01-01 00:28:20 -30.990784 6828186.32 A \n", + "2016-01-01 00:28:30 -31.078363 6828082.97 A \n", + "2016-01-01 00:28:40 -31.165012 6827978.83 A " ] }, - "execution_count": 2, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -261,28 +310,28 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Extract numpy arrays\n", + "#### Extract numpy arrays\n", "\n", - "Individual entries (rows) in multi-dimensional variables (e.g. B_NEC) are currently stored as lists so they need to be as extracted as arrays to do array operations." + "Individual entries (rows) in multi-dimensional variables (e.g. B_NEC) are currently stored as lists so they need to be as extracted as arrays to do array operations. This behaviour will likely change in the future to provide \"flat\" dataframes instead (i.e. the B_NEC column expanded as three columns: B_N, B_E, B_C, etc)" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "(array([-1580.9623, -1841.6017, -2108.2513, ..., 19454.1593, 19270.8571,\n", + "(array([23432.0698, 23450.9161, 23465.5579, ..., 19454.1593, 19270.8571,\n", " 19083.8857]),\n", - " array([-10494.5508, -10472.1489, -10439.0711, ..., 825.3428,\n", - " 809.5323, 793.5203]),\n", - " array([-45720.5906, -45687.7453, -45653.0421, ..., 32625.3874,\n", - " 33094.8776, 33559.6071]))" + " array([2929.1195, 2900.0733, 2872.2875, ..., 825.3428, 809.5323,\n", + " 793.5203]),\n", + " array([ 7001.0706, 7554.7711, 8110.0848, ..., 32625.3874, 33094.8776,\n", + " 33559.6071]))" ] }, - "execution_count": 3, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -302,6 +351,140 @@ "Pandas dataframes are not so good when we have higher-dimensional data, hence the motivation to use xarray: " ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Convert to an xarray Dataset" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "\n", + "Dimensions: (dim: 3, time: 4256)\n", + "Coordinates:\n", + " * time (time) datetime64[ns] 2016-01-01T00:28:00 ...\n", + " * dim (dim) int64 0 1 2\n", + "Data variables:\n", + " QDLon (time) float64 -30.81 -30.9 -30.99 -31.08 ...\n", + " F_MCO_SHA_2C (time) float64 2.48e+04 2.497e+04 2.516e+04 ...\n", + " F_MMA_SHA_2C-Primary (time) float64 128.3 128.3 128.4 128.4 128.5 ...\n", + " F (time) float64 2.463e+04 2.481e+04 2.499e+04 ...\n", + " Longitude (time) float64 -102.7 -102.7 -102.7 -102.7 ...\n", + " Latitude (time) float64 0.1976 0.8382 1.479 2.119 ...\n", + " B_NEC_MCO_SHA_2C (time, dim) float64 2.361e+04 2.932e+03 ...\n", + " QDLat (time) float64 8.425 9.069 9.714 10.36 11.0 ...\n", + " B_NEC (time, dim) float64 2.343e+04 2.929e+03 ...\n", + " B_NEC_MMA_SHA_2C-Primary (time, dim) float64 -126.9 -5.62 17.58 ...\n", + " B_NEC_MMA_SHA_2C-Secondary (time, dim) float64 -33.09 -1.709 -6.89 ...\n", + " F_MMA_SHA_2C-Secondary (time) float64 33.84 34.03 34.22 34.43 34.65 ...\n", + " Spacecraft (time) \n", + "array([[-13.829441, 4.811139, -12.867523],\n", + " [-13.745905, 4.513371, -13.351697],\n", + " [-13.673071, 4.881882, -14.067758],\n", + " ...,\n", + " [ 0.58677 , -1.772758, -4.235812],\n", + " [ 1.096503, -2.327229, -4.433677],\n", + " [ 2.135158, -3.167922, -4.39485 ]])\n", + "Coordinates:\n", + " * time (time) datetime64[ns] 2016-01-01T00:28:00 2016-01-01T00:28:10 ...\n", + " * dim (dim) int64 0 1 2" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "B_res = ds[\"B_NEC\"] - ds[\"B_NEC_MCO_SHA_2C\"]\\\n", + " - ds[\"B_NEC_MMA_SHA_2C-Primary\"]\\\n", + " - ds[\"B_NEC_MMA_SHA_2C-Secondary\"]\n", + "B_res" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "scrolled": true + }, + "outputs": [], + "source": [ + "%matplotlib inline\n", + "B_res[:,2].plot(x='time');" + ] + }, { "cell_type": "code", "execution_count": null,