Skip to content

Commit

Permalink
Merge branch 'review_round1'
Browse files Browse the repository at this point in the history
# Conflicts:
#	.binder/environment.yml
#	general-preprocessing-rainfall_noaa.ipynb
  • Loading branch information
acocac committed Jun 21, 2022
2 parents eeadee3 + 903c4f9 commit c5bad4e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 28 deletions.
3 changes: 2 additions & 1 deletion .binder/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ dependencies:
- pandas
- xarray
- iris
- cartopy
- cartopy
- cf-units
40 changes: 13 additions & 27 deletions general-preprocessing-rainfall_noaa.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
"\n",
":::{eval-rst}\n",
":opticon:`tag`\n",
":badge:`Wildfires,badge-primary`\n",
":badge:`General,badge-primary`\n",
":badge:`Preprocessing,badge-secondary`\n",
":::\n",
"\n",
"[![RoHub - FAIR Executable Research Object](https://img.shields.io/badge/RoHub-FAIR_Executable_Research_Object-2ea44f?logo=Open+Access&logoColor=blue)](https://w3id.org/ro-id/1b8921af-e77f-4ccf-ae38-4813cdceba0f)\n",
"\n",
"## Context\n",
"### Purpose\n",
"To load and extract a region of interest from a gridded rainfall dataset, and concatenate into a time series using the [Iris package](https://scitools-iris.readthedocs.io/en/stable/).\n",
Expand Down Expand Up @@ -50,7 +48,7 @@
"```{bibliography}\n",
" :style: plain\n",
" :list: bullet\n",
" :filter: topic % \"wildfires_preprocessing_rainfall_timeseries\"\n",
" :filter: topic % \"general-preprocessing-rainfall_noaa\"\n",
"```\n",
"\n",
":::{note}\n",
Expand Down Expand Up @@ -85,6 +83,8 @@
"import iris.quickplot as qplt\n",
"import iris.coord_categorisation as coord_cat\n",
"\n",
"import cf_units\n",
"\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
Expand All @@ -93,8 +93,6 @@
"import warnings\n",
"warnings.filterwarnings(action='ignore')\n",
"\n",
"import intake\n",
"\n",
"%matplotlib inline"
]
},
Expand Down Expand Up @@ -203,6 +201,7 @@
"outputs": [],
"source": [
"# Interactive plotting\n",
"plt.figure(figsize=(15, 5))\n",
"iplt.pcolormesh(precip[0]) # plot the first time in the cube\n",
"plt.title(\"Global Precipitation on 1 Jan 1948\", fontsize=20)\n",
"cbar = plt.colorbar()\n",
Expand All @@ -218,7 +217,7 @@
"source": [
"# Another way of plotting using iris.quickplot (with limited interactivity)\n",
"qplt.pcolormesh (precip[0])\n",
"plt.gca.coastlines()"
"plt.gca().coastlines()"
]
},
{
Expand Down Expand Up @@ -296,7 +295,8 @@
"Borneo_lon = iris.Constraint(longitude=lambda v: v > 107.815 and v <= 117.987 )\n",
"\n",
"# Extract data based on the spatial extent\n",
"Borneo = annual_seasonal_mean.extract(Borneo_lat & Borneo_lon) "
"Borneo = annual_seasonal_mean.extract(Borneo_lat & Borneo_lon) \n",
"print(Borneo)"
]
},
{
Expand All @@ -306,9 +306,9 @@
"outputs": [],
"source": [
"# Plot data of the first season in the study region\n",
"print(Borneo)\n",
"plt.figure(figsize=(12, 4))\n",
"iplt.pcolormesh(Borneo[0]) # plot the first timestep in the cube\n",
"plt.title(\"Mean daily precipitation in Borneo in Jan and Feb 1948\", fontsize=20)\n",
"plt.title(\"Mean daily precipitation in Borneo in Jan and Feb 1948\", fontsize=14)\n",
"cbar = plt.colorbar()\n",
"cbar.set_label('Precipitation (' + str(Borneo.units) + ')')\n",
"plt.gca().coastlines()"
Expand Down Expand Up @@ -404,20 +404,6 @@
"This notebook has demonstrated the use of the Iris package to easily load, plot and manipulate gridded environmental NetCDF data."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Citing this Notebook"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Timothy Lam, Marlene Kretschmer, Samantha Adams, Rachel Prudden, Elena Saggioro, and XXX. \"Concatenating a gridded rainfall dataset into a time series (Jupyter Notebook) published in the Environmental Data Science book.\" ROHub. XXX, XX,2022. Available at <link>."
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -449,9 +435,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "EDS Env 3",
"language": "python",
"name": "python3"
"name": "tim_eds-env_2"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -463,7 +449,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.10"
"version": "3.8.13"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
Expand Down

0 comments on commit c5bad4e

Please sign in to comment.