From 8d34eedd50998ab99f636b1f838c5becd4a6fd39 Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Mon, 21 Oct 2024 11:03:19 -0600 Subject: [PATCH 1/5] address Xarray resample changes in notebook 4 --- notebooks/4-taylor-diagrams.ipynb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/notebooks/4-taylor-diagrams.ipynb b/notebooks/4-taylor-diagrams.ipynb index ec53e57f..9dfa4ae4 100644 --- a/notebooks/4-taylor-diagrams.ipynb +++ b/notebooks/4-taylor-diagrams.ipynb @@ -56,6 +56,7 @@ "source": [ "import matplotlib.pyplot as plt\n", "import numpy as np\n", + "import pandas as pd\n", "import xarray as xr\n", "\n", "import cftime\n", @@ -144,7 +145,9 @@ "source": [ "# Change hourly data to monthly\n", "era5 = era5.rename({'initial_time0_hours': 'time'}) # Changing dimension name for convenience\n", - "era5_resampled = era5.resample(time='MS', loffset='15D').mean() # loffsest to set resampling to the center of each month as in CMIP5 data\n", + "era5_resampled = era5.resample(time='MS').mean() # loffsest to set resampling to the center of each month as in CMIP5 data\n", + "offset = pd.tseries.frequencies.to_offset("15D")\n", + "era5_resampled["time"] = resampled_ds.get_index("time") + offset\n", "\n", "era5_resampled" ] From b2b6b782ed2967bc3d48913d61b125aefcf6d744 Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Mon, 21 Oct 2024 11:07:31 -0600 Subject: [PATCH 2/5] formatting --- notebooks/4-taylor-diagrams.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notebooks/4-taylor-diagrams.ipynb b/notebooks/4-taylor-diagrams.ipynb index 9dfa4ae4..41b92c79 100644 --- a/notebooks/4-taylor-diagrams.ipynb +++ b/notebooks/4-taylor-diagrams.ipynb @@ -145,8 +145,8 @@ "source": [ "# Change hourly data to monthly\n", "era5 = era5.rename({'initial_time0_hours': 'time'}) # Changing dimension name for convenience\n", - "era5_resampled = era5.resample(time='MS').mean() # loffsest to set resampling to the center of each month as in CMIP5 data\n", - "offset = pd.tseries.frequencies.to_offset("15D")\n", + "era5_resampled = era5.resample(time='MS').mean() \n", + "offset = pd.tseries.frequencies.to_offset("15D") # use offsest to adjust to the center of each month as in CMIP5 data\n", "era5_resampled["time"] = resampled_ds.get_index("time") + offset\n", "\n", "era5_resampled" From 5af94624f749776ef424a3de80877acd634f0e0b Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Mon, 21 Oct 2024 11:10:14 -0600 Subject: [PATCH 3/5] formatting --- notebooks/4-taylor-diagrams.ipynb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/notebooks/4-taylor-diagrams.ipynb b/notebooks/4-taylor-diagrams.ipynb index 41b92c79..06e3e0c2 100644 --- a/notebooks/4-taylor-diagrams.ipynb +++ b/notebooks/4-taylor-diagrams.ipynb @@ -145,9 +145,9 @@ "source": [ "# Change hourly data to monthly\n", "era5 = era5.rename({'initial_time0_hours': 'time'}) # Changing dimension name for convenience\n", - "era5_resampled = era5.resample(time='MS').mean() \n", - "offset = pd.tseries.frequencies.to_offset("15D") # use offsest to adjust to the center of each month as in CMIP5 data\n", - "era5_resampled["time"] = resampled_ds.get_index("time") + offset\n", + "era5_resampled = era5.resample(time='MS').mean()\n", + "offset = pd.tseries.frequencies.to_offset('15D') # use offsest to adjust to the center of each month as in CMIP5 data\n", + "era5_resampled['time'] = resampled_ds.get_index('time') + offset\n", "\n", "era5_resampled" ] From 6d7de40e75742de1fd4a6aecd783d6015dc48efc Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Mon, 21 Oct 2024 11:21:15 -0600 Subject: [PATCH 4/5] oops --- notebooks/4-taylor-diagrams.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebooks/4-taylor-diagrams.ipynb b/notebooks/4-taylor-diagrams.ipynb index 06e3e0c2..ec678ff7 100644 --- a/notebooks/4-taylor-diagrams.ipynb +++ b/notebooks/4-taylor-diagrams.ipynb @@ -147,7 +147,7 @@ "era5 = era5.rename({'initial_time0_hours': 'time'}) # Changing dimension name for convenience\n", "era5_resampled = era5.resample(time='MS').mean()\n", "offset = pd.tseries.frequencies.to_offset('15D') # use offsest to adjust to the center of each month as in CMIP5 data\n", - "era5_resampled['time'] = resampled_ds.get_index('time') + offset\n", + "era5_resampled['time'] = era5_resampled.get_index('time') + offset\n", "\n", "era5_resampled" ] From 4a0a8086ccadec2507f5a7130b60524869191fa8 Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Mon, 21 Oct 2024 12:34:14 -0600 Subject: [PATCH 5/5] Fix to address pydata/xarray#9043 --- notebooks/7-animation.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notebooks/7-animation.ipynb b/notebooks/7-animation.ipynb index 24585bd6..41e6f5d3 100644 --- a/notebooks/7-animation.ipynb +++ b/notebooks/7-animation.ipynb @@ -341,8 +341,8 @@ "metadata": {}, "outputs": [], "source": [ - "vmin = t.min()\n", - "vmax = t.max()\n", + "vmin = t.min().values\n", + "vmax = t.max().values\n", "levels = 30\n", "\n", "# create initial plot that we will update\n",