python4oceanographers

Turning ripples into waves

Open figures

Warning: This post is written in Portuguese!

Recentemente tive que re-encontrar e re-fazer algumas figuras que fiz quando ensinava Introdução à Oceanografia Física Descritiva, para evitar esse problema no futuro resolvi seguir meu próprio exemplo e colocar mais algumas das figuras que fiz online e sob licença Creative Commons

A figura em questão é um exemplo de perfis oceanográficos onde a temperatura é aproximada pela lei de potência:

$t(z) = t_o, -\text{MLD} \le z < 0$

$t(z) = t_o az^{b}, z < -\text{MLD}$

In [2]:
import numpy as np


def temperature(to=25, a=115, b=-0.9, mld=200, maxdepth=4000):
    dz = 1
    z = np.arange(0, maxdepth + dz, dz)
    t_mld = [to] * len(z[:mld])
    t = to * a * z[mld:] ** b
    return np.r_[t_mld, t], z

  
mld = 200
t, z = temperature(mld=mld)

A salinidade será ajusta à temperatura através da sua relação TS para o Atlântico:

In [3]:
from netCDF4 import Dataset


nc = Dataset('./data/woa01an.nc')
lon = nc.variables['WOA01_LONX'][:]
lat = nc.variables['WOA01_LATX'][:]
temp = nc.variables['WOA01_MEAN_TEMP'][:]
sal = nc.variables['WOA01_MEAN_PSAL'][:]

maskx = np.logical_and(lon < -5.5, lon > -45.5)
masky = np.logical_and(lat < 0, lat > -45)
lon = lon[maskx]
lat = lat[masky]

temp = temp[masky, ...][:, maskx, :].mean(axis=0).mean(axis=0)
sal = sal[masky, ...][:, maskx, :].mean(axis=0).mean(axis=0)

p = np.polyfit(temp, sal, 3)
S = np.polyval(p, t)
S[:mld+25] = S.max()

Finalmente a densidade é calculada usando ambos perfis:

In [4]:
import seawater as sw


dens = sw.dens0(S, t) - 1000
In [5]:
%matplotlib inline
import seaborn
import matplotlib.pyplot as plt


fig, (ax0, ax1, ax2) = plt.subplots(ncols=3, sharey=True, figsize=(12, 8))

ax0.invert_yaxis()
kw = dict(colors='k', zorder=2)
kwp = dict(linewidth=2, zorder=1)
kwt = dict(va='center', ha='center', fontweight='semibold')

xmin, xmax = 0, 26
ax0.plot(t, z, **kwp)
ax0.set_xlim(xmin, xmax)
ax0.set_ylim(z.max(), -100)
ax0.set_xlabel(u'Temperatura [\u00B0C]')
ax0.set_ylabel('Profundidade [m]')

ax0.hlines(mld, xmin, xmax, linestyles='--', **kw)
ax0.hlines(1000, xmin, xmax, linestyles='--', **kw)

ax0.text(12.5, 0, 'Camada de Mistura', **kwt)
ax0.text(12.5, 750, 'Termoclina', **kwt)
ax0.text(12.5, 1500, 'Camada profunda', **kwt)

xmin, xmax = 34, 36.5
ax1.plot(S, z, **kwp)
ax1.set_xlim(xmin, xmax)
ax1.set_ylim(z.max(), -100)
ax1.set_xlabel(r'Salinidade [g kg$^{-1}$]')

ax1.hlines(mld, xmin, xmax, linestyles='--', **kw)
ax1.hlines(1000, xmin, xmax, linestyles='--', **kw)

ax1.text(35.25, 0, 'Camada de Mistura', **kwt)
ax1.text(35.25, 750, 'Haloclina', **kwt)
ax1.text(35.25, 1500, 'Camada profunda', **kwt)

xmin, xmax = 24, 28
ax2.plot(dens, z, **kwp)
ax2.set_xlim(xmin, xmax)
ax2.set_ylim(z.max(), -100)
ax2.set_xlabel(r'$\sigma_{\theta}$ [kg m$^{-3}$]')

ax2.hlines(mld, xmin, xmax, linestyles='--', **kw)
ax2.hlines(1000, xmin, xmax, linestyles='--', **kw)

ax2.text(26, 0, 'Camada de Mistura', **kwt)
ax2.text(26, 750, 'Picnoclina', **kwt)
ax2.text(26, 1500, 'Camada profunda', **kwt)
Out[5]:
<matplotlib.text.Text at 0x7ff4d47f0690>

A medida que for re-criado as figuras vou postando aqui. Tudo com licença livre!

In [6]:
HTML(html)
Out[6]:

This post was written as an IPython notebook. It is available for download or as a static html.

Creative Commons License
python4oceanographers by Filipe Fernandes is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Based on a work at https://ocefpaf.github.io/.

Comments