Skip to content
Snippets Groups Projects
Commit 7beef93c authored by Aiko Voigt's avatar Aiko Voigt
Browse files

Adds precip plot for icon-esm amip run

parent afc5d09e
Branches main
No related tags found
No related merge requests found
File added
File added
%% Cell type:markdown id:603bc442-cda3-4721-ace8-1b3d788a6fee tags:
# Plot of time-mean precipitation in ICON-ESM AMIP simulation
%% Cell type:code id:1db9d389-ddb4-43e9-aa95-0a57dd26633f tags:
``` python
!pip install cartopy
```
%% Output
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: cartopy in /home/fs72044/avoigt_teach/.local/lib/python3.10/site-packages (0.24.1)
Requirement already satisfied: shapely>=1.8 in /home/fs72044/avoigt_teach/.local/lib/python3.10/site-packages (from cartopy) (2.1.1)
Requirement already satisfied: packaging>=21 in /opt/conda/lib/python3.10/site-packages (from cartopy) (23.0)
Requirement already satisfied: numpy>=1.23 in /home/fs72044/avoigt_teach/.local/lib/python3.10/site-packages (from cartopy) (1.24.2)
Requirement already satisfied: matplotlib>=3.6 in /home/fs72044/avoigt_teach/.local/lib/python3.10/site-packages (from cartopy) (3.7.1)
Requirement already satisfied: pyproj>=3.3.1 in /home/fs72044/avoigt_teach/.local/lib/python3.10/site-packages (from cartopy) (3.7.1)
Requirement already satisfied: pyshp>=2.3 in /home/fs72044/avoigt_teach/.local/lib/python3.10/site-packages (from cartopy) (2.3.1)
Requirement already satisfied: contourpy>=1.0.1 in /home/fs72044/avoigt_teach/.local/lib/python3.10/site-packages (from matplotlib>=3.6->cartopy) (1.0.7)
Requirement already satisfied: fonttools>=4.22.0 in /home/fs72044/avoigt_teach/.local/lib/python3.10/site-packages (from matplotlib>=3.6->cartopy) (4.39.3)
Requirement already satisfied: pillow>=6.2.0 in /home/fs72044/avoigt_teach/.local/lib/python3.10/site-packages (from matplotlib>=3.6->cartopy) (9.5.0)
Requirement already satisfied: cycler>=0.10 in /home/fs72044/avoigt_teach/.local/lib/python3.10/site-packages (from matplotlib>=3.6->cartopy) (0.11.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /home/fs72044/avoigt_teach/.local/lib/python3.10/site-packages (from matplotlib>=3.6->cartopy) (1.4.4)
Requirement already satisfied: pyparsing>=2.3.1 in /home/fs72044/avoigt_teach/.local/lib/python3.10/site-packages (from matplotlib>=3.6->cartopy) (3.0.9)
Requirement already satisfied: python-dateutil>=2.7 in /opt/conda/lib/python3.10/site-packages (from matplotlib>=3.6->cartopy) (2.8.2)
Requirement already satisfied: certifi in /opt/conda/lib/python3.10/site-packages (from pyproj>=3.3.1->cartopy) (2022.12.7)
Requirement already satisfied: six>=1.5 in /opt/conda/lib/python3.10/site-packages (from python-dateutil>=2.7->matplotlib>=3.6->cartopy) (1.16.0)
%% Cell type:code id:8d2a1000-dee1-49a9-8c37-5761c001c068 tags:
``` python
import xarray as xr
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
```
%% Cell type:code id:c353fa2e-b332-4619-940b-3d6aeb2f91bc tags:
``` python
pr = xr.open_dataset("./amip_atm_2d_ml_2000-2010.ymonmean.r180x90.pr.prw.ts.nc")
```
%% Cell type:code id:086643a3-4f2c-4531-97f1-c3d314cb5ab1 tags:
``` python
fig = plt.figure(figsize=(10, 5))
ax = plt.axes(projection=ccrs.PlateCarree())
#from precip flux to mm/day
pr_mean = pr.mean(dim="time") * 86400
# Plot using pcolormesh with coordinate reference system
pcm = ax.pcolormesh(pr_mean.lon, pr_mean.lat, pr_mean["pr"],
transform=ccrs.PlateCarree())#, vmin=0, vmax=12)
# Add geographic features
ax.coastlines()
gl = ax.gridlines(draw_labels=True)
gl.top_labels = False
gl.right_labels = False
# Add colorbar
plt.colorbar(pcm, ax=ax, orientation='vertical', label='Precipitation (mm/day)')
plt.title("Mean Precipitation ICON ESM in AMIP run, 2000-2010 (mm/day)")
plt.savefig("icon-esm-amip_precip_mean_2000-2010.pdf")
```
%% Output
%% Cell type:code id:b7960c04-9635-4a22-b5f9-4c5746f19df4 tags:
``` python
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment