From e778a991b9519cdf5fcc49cdeeea9f314cf3cb55 Mon Sep 17 00:00:00 2001 From: Gokul Prathin Date: Fri, 30 Jun 2023 02:42:49 -0400 Subject: [PATCH 1/2] added plot code --- SEA_SURFACE_HEIGHT_PLOT.ipynb | 55 +++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 SEA_SURFACE_HEIGHT_PLOT.ipynb diff --git a/SEA_SURFACE_HEIGHT_PLOT.ipynb b/SEA_SURFACE_HEIGHT_PLOT.ipynb new file mode 100644 index 0000000..6e5740e --- /dev/null +++ b/SEA_SURFACE_HEIGHT_PLOT.ipynb @@ -0,0 +1,55 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "9bc56f4f-544d-4993-8f3c-ebd1004b36ff", + "metadata": {}, + "outputs": [], + "source": [ + "import earthaccess\n", + "import xarray as xr\n", + "import matplotlib as mpl\n", + "import matplotlib.pyplot as plt\n", + "\n", + "years = ['1993', '2000', '2010', '2022']\n", + "\n", + "auth = earthaccess.login()\n", + "# Are we authenticated?\n", + "if not auth.authenticated:\n", + " # Ask for credentials and persist them in a .netrc file\n", + " auth.login(strategy=\"interactive\", persist=True)\n", + "\n", + "mpl.rcParams.update({'font.size': 24})\n", + "\n", + "for year in years:\n", + " granules = earthaccess.granule_query().short_name(\"SEA_SURFACE_HEIGHT_ALT_GRIDS_L4_2SATS_5DAY_6THDEG_V_JPL2205\").temporal(f\"{year}-01\", f\"{year}-2\").get()\n", + " ds = xr.open_mfdataset(earthaccess.open(granules), chunks={})\n", + " plot = ds.SLA.where((ds.SLA >= 0) & (ds.SLA < 10)).std('Time').plot(figsize=(12, 6), x='Longitude', y='Latitude', cmap='viridis')\n", + " plt.title(f\"Year - {year}\")\n", + " plt.show()\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.16" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} From 58862a7c3418eff0ccf2fed057caccd10df6ac66 Mon Sep 17 00:00:00 2001 From: Gokul Prathin Date: Fri, 30 Jun 2023 02:43:52 -0400 Subject: [PATCH 2/2] added plot code --- SEA_SURFACE_HEIGHT_PLOT.ipynb | 286 +++++++++++++++++++++++++++++++++- 1 file changed, 283 insertions(+), 3 deletions(-) diff --git a/SEA_SURFACE_HEIGHT_PLOT.ipynb b/SEA_SURFACE_HEIGHT_PLOT.ipynb index 6e5740e..888fcd7 100644 --- a/SEA_SURFACE_HEIGHT_PLOT.ipynb +++ b/SEA_SURFACE_HEIGHT_PLOT.ipynb @@ -2,10 +2,282 @@ "cells": [ { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "9bc56f4f-544d-4993-8f3c-ebd1004b36ff", - "metadata": {}, - "outputs": [], + "metadata": { + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "We are already authenticated with NASA EDL\n", + " Opening 6 granules, approx size: 0.0 GB\n" + ] + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "36190c32da7049efa7a6da5c7e04ec7e", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "SUBMITTING | : 0%| | 0/6 [00:00" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Opening 7 granules, approx size: 0.0 GB\n" + ] + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "0a4bcd20618f433e8643221bfc2d24b9", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "SUBMITTING | : 0%| | 0/7 [00:00" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Opening 6 granules, approx size: 0.0 GB\n" + ] + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "150b5a8b3b2141a9a269dcbf33bda4f3", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "SUBMITTING | : 0%| | 0/6 [00:00" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Opening 7 granules, approx size: 0.0 GB\n" + ] + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "1a0e5acd64fc4c4c8b23487ae60d184d", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "SUBMITTING | : 0%| | 0/7 [00:00" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "import earthaccess\n", "import xarray as xr\n", @@ -29,6 +301,14 @@ " plt.title(f\"Year - {year}\")\n", " plt.show()\n" ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "93f2deb6-fd67-4186-b46d-7ff7cee16c90", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": {