# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# # Plotting a pressure versus latitude contour: panels
#
# We have plotted pressure versus latitude in previous examples. We can also do this using panels for different quantities or experiments. Let's import obrero:

# +
# small hack to be able to import module without install
import os
import sys
sys.path.append(os.getcwd() + '/../')

import obrero
import obrero.plot as oplot
# -

# And we read some data:

# +
# file name
f1 = 'data/ctl_winds.nc'

# read as data array
da = obrero.read_nc(f1, 'ua')
db = obrero.read_nc(f1, 'va')
# -

# Then we get the zonal means:

zm1 = obrero.get_zonal_means(da, time_mean=True)
zm2 = obrero.get_zonal_means(db, time_mean=True)

# And now we use the function `panel_pressure_latitude()` in the `obrero.plot` module. Keywords are very similar to those used in other panel plots in obrero:

# +
# data list
dlist = [zm1, zm2]

# specifications and list
spec1 = dict(minv=-30, maxv=30, nlevels=11, extend='both', cm='coolwarm', cbstring=r'Zonal wind (m s$^{-1}$)', 
             title='CTL', xlim=[-85, 85])
spec2 = dict(minv=-1, maxv=1, nlevels=11, extend='both', cm='coolwarm', cbstring=r'Meridional wind (m s$^{-1}$)', 
             title='CTL', xlim=[-85, 85])
slist = [spec1, spec2]

# plot
# %matplotlib inline
fig = oplot.panel_pressure_latitude(dlist, slist)

StarcoderdataJupyterScriptsDedupFiltered