{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Accessing Argo data by float using Argopy" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Import the usual suspects:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import xarray as xr\n", "xr.set_options(display_style=\"html\", display_expand_attrs=False);\n", "from matplotlib import pyplot as plt\n", "plt.style.use('default')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Import argopy and set-up a data fetcher:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/Users/gmaze/miniconda3/envs/aos/lib/python3.10/site-packages/pyproj/__init__.py:89: UserWarning: pyproj unable to set database path.\n", " _pyproj_global_context_initialize()\n" ] } ], "source": [ "from argopy import DataFetcher as ArgoDataFetcher\n", "argo_loader = ArgoDataFetcher(src='erddap', cache=True, cachedir='tmp')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You can load all profiles from a float:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "apDS = argo_loader.float(6901254).load().data" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "or a single cycle:" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "argo_loader = argo_loader.profile(6901254, 1).load()\n", "apDS2 = argo_loader.data" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
<xarray.Dataset>\n", "Dimensions: (N_PROF: 2, N_LEVELS: 97)\n", "Coordinates:\n", " * N_PROF (N_PROF) int64 0 1\n", " * N_LEVELS (N_LEVELS) int64 0 1 2 3 4 5 6 ... 91 92 93 94 95 96\n", " LATITUDE (N_PROF) float64 29.16 29.18\n", " LONGITUDE (N_PROF) float64 -15.49 -15.43\n", " TIME (N_PROF) datetime64[ns] 2018-10-23T20:54:00 2018-1...\n", "Data variables: (12/13)\n", " CONFIG_MISSION_NUMBER (N_PROF) int64 1 1\n", " CYCLE_NUMBER (N_PROF) int64 1 1\n", " DATA_MODE (N_PROF) <U1 'R' 'R'\n", " DIRECTION (N_PROF) <U1 'D' 'A'\n", " PLATFORM_NUMBER (N_PROF) int64 6901254 6901254\n", " POSITION_QC (N_PROF) int64 1 1\n", " ... ...\n", " PRES_QC (N_PROF) int64 1 1\n", " PSAL (N_PROF, N_LEVELS) float64 36.69 36.71 ... 35.14\n", " PSAL_QC (N_PROF) int64 1 1\n", " TEMP (N_PROF, N_LEVELS) float64 23.4 23.35 ... 4.559 4.474\n", " TEMP_QC (N_PROF) int64 1 1\n", " TIME_QC (N_PROF) int64 1 1\n", "Attributes: (8)