Skip to content

Commit

Permalink
Format plot code and update authors
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvothecoder committed Apr 16, 2024
1 parent 4acd4c6 commit 3775c0d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 19 deletions.
8 changes: 3 additions & 5 deletions docs/examples/climatology-and-departures.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@
"source": [
"# Calculating Climatology and Departures from Time Series Data\n",
"\n",
"Author: [Tom Vo](https://github.com/tomvothecoder/)\n",
"Author: [Tom Vo](https://github.com/tomvothecoder/) & [Jiwoo Lee](https://github.com/lee1043/)\n",
"\n",
"Date: 05/27/22\n",
"\n",
"Last Updated: 2/27/23\n",
"Updated: 04/01/24 (v0.6.1)\n",
"\n",
"Related APIs:\n",
"\n",
Expand Down Expand Up @@ -4486,7 +4484,7 @@
" freq=\"season\",\n",
" weighted=True,\n",
" season_config={\"dec_mode\": \"DJF\", \"drop_incomplete_djf\": True},\n",
")\n"
")"
]
},
{
Expand Down
40 changes: 26 additions & 14 deletions docs/examples/temporal-average.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3659,7 +3659,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Visualize averages derived from monthly data on a specific point"
"### Visualize averages derived from monthly data on a specific point\n"
]
},
{
Expand All @@ -3683,15 +3683,21 @@
"lat_point = 30\n",
"lon_point = 30\n",
"\n",
"start_year = '2005-01-01'\n",
"end_year = '2014-12-31'\n",
"start_year = \"2005-01-01\"\n",
"end_year = \"2014-12-31\"\n",
"\n",
"plt.figure(figsize=(10, 3))\n",
"ax = plt.subplot()\n",
"\n",
"ds.tas.sel(lat=lat_point, lon=lon_point, time=slice(start_year, end_year)).plot(ax=ax, label=\"monthly (RAW DATA)\", alpha=0.5)\n",
"ds_season.tas.sel(lat=lat_point, lon=lon_point, time=slice(start_year, end_year)).plot(ax=ax, label=\"season\", alpha=0.5)\n",
"ds_yearly.tas.sel(lat=lat_point, lon=lon_point, time=slice(start_year, end_year)).plot(ax=ax, label=\"yearly\", alpha=0.5)\n",
"ds.tas.sel(lat=lat_point, lon=lon_point, time=slice(start_year, end_year)).plot(\n",
" ax=ax, label=\"monthly (RAW DATA)\", alpha=0.5\n",
")\n",
"ds_season.tas.sel(lat=lat_point, lon=lon_point, time=slice(start_year, end_year)).plot(\n",
" ax=ax, label=\"season\", alpha=0.5\n",
")\n",
"ds_yearly.tas.sel(lat=lat_point, lon=lon_point, time=slice(start_year, end_year)).plot(\n",
" ax=ax, label=\"yearly\", alpha=0.5\n",
")\n",
"\n",
"plt.title(\"Seasonal and yearly averages derived from monthly time series\")\n",
"\n",
Expand Down Expand Up @@ -4469,7 +4475,7 @@
"ds2 = xcdat.open_dataset(\n",
" \"https://esgf-data1.llnl.gov/thredds/dodsC/css03_data/CMIP6/CMIP/CSIRO/ACCESS-ESM1-5/historical/r10i1p1f1/3hr/tas/gn/v20200605/tas_3hr_ACCESS-ESM1-5_historical_r10i1p1f1_gn_201001010300-201501010000.nc\",\n",
" chunks={\"time\": \"auto\"},\n",
" add_bounds=[\"T\"]\n",
" add_bounds=[\"T\"],\n",
")\n",
"\n",
"# Unit adjust (-273.15, K to C)\n",
Expand Down Expand Up @@ -5166,7 +5172,7 @@
"ds3 = xcdat.open_dataset(\n",
" \"https://esgf-data1.llnl.gov/thredds/dodsC/css03_data/CMIP6/CMIP/CSIRO/ACCESS-ESM1-5/historical/r10i1p1f1/3hr/tas/gn/v20200605/tas_3hr_ACCESS-ESM1-5_historical_r10i1p1f1_gn_201001010300-201501010000.nc\",\n",
" chunks={\"time\": \"auto\"},\n",
" add_bounds=[\"T\"]\n",
" add_bounds=[\"T\"],\n",
")\n",
"\n",
"# Unit adjust (-273.15, K to C)\n",
Expand Down Expand Up @@ -6344,7 +6350,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Visualize averages derived from 3-hourly data on a specific point"
"### Visualize averages derived from 3-hourly data on a specific point\n"
]
},
{
Expand All @@ -6368,15 +6374,21 @@
"lat_point = 30\n",
"lon_point = 30\n",
"\n",
"start_year = '2010-01-01'\n",
"end_year = '2014-12-31'\n",
"start_year = \"2010-01-01\"\n",
"end_year = \"2014-12-31\"\n",
"\n",
"plt.figure(figsize=(10, 3))\n",
"ax = plt.subplot()\n",
"\n",
"ds2.tas.sel(lat=lat_point, lon=lon_point, time=slice(start_year, end_year)).plot(ax=ax, label=\"3-hourly (RAW DATA)\", alpha=0.5)\n",
"ds3_day_avg.tas.sel(lat=lat_point, lon=lon_point, time=slice(start_year, end_year)).plot(ax=ax, label=\"daily\", alpha=0.5)\n",
"ds2_monthly_avg.tas.sel(lat=lat_point, lon=lon_point, time=slice(start_year, end_year)).plot(ax=ax, label=\"monthly\", alpha=0.5)\n",
"ds2.tas.sel(lat=lat_point, lon=lon_point, time=slice(start_year, end_year)).plot(\n",
" ax=ax, label=\"3-hourly (RAW DATA)\", alpha=0.5\n",
")\n",
"ds3_day_avg.tas.sel(\n",
" lat=lat_point, lon=lon_point, time=slice(start_year, end_year)\n",
").plot(ax=ax, label=\"daily\", alpha=0.5)\n",
"ds2_monthly_avg.tas.sel(\n",
" lat=lat_point, lon=lon_point, time=slice(start_year, end_year)\n",
").plot(ax=ax, label=\"monthly\", alpha=0.5)\n",
"\n",
"plt.title(\"Daily and monthly averages derived from 3-hourly time series\")\n",
"plt.legend()\n",
Expand Down

0 comments on commit 3775c0d

Please sign in to comment.