diff --git a/Lessons/L03_UsingArgoData/Chapter24_ArgoDatabyFloat_ArgoPy.ipynb b/Lessons/L03_UsingArgoData/Chapter24_ArgoDatabyFloat_ArgoPy.ipynb index d8951c0e..59a58483 100755 --- a/Lessons/L03_UsingArgoData/Chapter24_ArgoDatabyFloat_ArgoPy.ipynb +++ b/Lessons/L03_UsingArgoData/Chapter24_ArgoDatabyFloat_ArgoPy.ipynb @@ -7,6 +7,13 @@ "# Accessing Argo data by float using Argopy" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Import the usual suspects:" + ] + }, { "cell_type": "code", "execution_count": 1, @@ -14,22 +21,42 @@ "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", - "from argopy import DataFetcher as ArgoDataFetcher\n", - "plt.style.use('default')\n", - "\n", - "argo_loader = ArgoDataFetcher()\n", - "argo_loader = ArgoDataFetcher(backend='erddap')\n", - "argo_loader = ArgoDataFetcher(cachedir='tmp')" + "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": [], + "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": [ - "apDS=argo_loader.float(6901254).to_xarray()" + "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:" ] }, { @@ -38,13 +65,30 @@ "metadata": {}, "outputs": [], "source": [ - "apDS2=argo_loader.profile(6901254,1).to_xarray()" + "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": { @@ -92,7 +136,7 @@ "}\n", "\n", ".xr-wrap {\n", - " display: block;\n", + " display: block !important;\n", " min-width: 300px;\n", " max-width: 700px;\n", "}\n", @@ -422,21 +466,13 @@ " 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:\n", - " DATA_ID: ARGO\n", - " DOI: http://doi.org/10.17882/42182\n", - " Fetched_from: https://www.ifremer.fr/erddap\n", - " Fetched_by: pvb\n", - " Fetched_date: 2021/08/31\n", - " Fetched_constraints: phy;WMO6901254_CYC1\n", - " Fetched_uri: ['https://www.ifremer.fr/erddap/tabledap/ArgoFloats...\n", - " history: Variables filtered according to DATA_MODE; Variable...
array([0, 1])
array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n", + "Attributes: (8)
array([1, 1])
array([1, 1])
<xarray.Dataset>\n", + "Dimensions: (N_POINTS: 339177)\n", + "Coordinates:\n", + " * N_POINTS (N_POINTS) int64 0 1 2 3 4 ... 339173 339174 339175 339176\n", + " TIME (N_POINTS) datetime64[ns] 2020-11-11T00:08:20 ... 2020-1...\n", + " LATITUDE (N_POINTS) float64 35.14 35.14 35.14 ... -15.29 -15.29\n", + " LONGITUDE (N_POINTS) float64 15.69 15.69 15.69 ... -135.0 -135.0\n", + "Data variables:\n", + " CYCLE_NUMBER (N_POINTS) float64 103.0 103.0 103.0 ... 189.0 189.0 189.0\n", + " DATA_MODE (N_POINTS) object 'R' 'R' 'R' 'R' 'R' ... 'A' 'A' 'A' 'A'\n", + " DIRECTION (N_POINTS) object 'A' 'A' 'A' 'A' 'A' ... 'A' 'A' 'A' 'A'\n", + " PLATFORM_NUMBER (N_POINTS) float64 6.904e+06 6.904e+06 ... 5.902e+06\n", + " POSITION_QC (N_POINTS) float64 1.0 1.0 1.0 1.0 1.0 ... 1.0 1.0 1.0 1.0\n", + " PRES (N_POINTS) float64 2.9 3.9 5.1 ... 1.124e+03 1.126e+03\n", + " PSAL (N_POINTS) float64 38.03 38.03 38.03 38.03 ... nan nan nan\n", + " TEMP (N_POINTS) float64 22.01 22.02 22.01 ... 3.764 3.752 3.74\n", + " TIME_QC (N_POINTS) float64 1.0 1.0 1.0 1.0 1.0 ... 1.0 1.0 1.0 1.0\n", + "Attributes: (7)
<xarray.DataArray 'TEMP' (N_POINTS: 339177)>\n", + "array([22.014, 22.017, 22.012, ..., nan, nan, nan])\n", + "Coordinates:\n", + " * N_POINTS (N_POINTS) int64 0 1 2 3 4 ... 339172 339173 339174 339175 339176\n", + " TIME (N_POINTS) datetime64[ns] 2020-11-11T00:08:20 ... 2020-11-11T2...\n", + " LATITUDE (N_POINTS) float64 35.14 35.14 35.14 ... -15.29 -15.29 -15.29\n", + " LONGITUDE (N_POINTS) float64 15.69 15.69 15.69 ... -135.0 -135.0 -135.0\n", + "Attributes: (6)