Skip to content

Commit

Permalink
Merge pull request #58 from kafitzgerald/resample_fix
Browse files Browse the repository at this point in the history
Resampling fix
  • Loading branch information
jukent authored Oct 21, 2024
2 parents cc86550 + 4a0a808 commit d392a5d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion notebooks/4-taylor-diagrams.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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()\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'] = era5_resampled.get_index('time') + offset\n",
"\n",
"era5_resampled"
]
Expand Down
4 changes: 2 additions & 2 deletions notebooks/7-animation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit d392a5d

Please sign in to comment.