Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ds_sigma_map = ds_sigma.sel( | |
time='2000-01', | |
sigma_0=26.6, | |
method='nearest' | |
).sel(y=slice(-90,0)).squeeze() | |
import cartopy.crs as ccrs | |
import matplotlib.path as mpath | |
import cartopy.feature as cfeature |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ds_sigma_section = ds_sigma.sel( | |
time='2010-01', | |
y=slice(-90,10) | |
).interp(x=230).squeeze() | |
fig, axarr = plt.subplots(nrows=2, figsize=[10,8], sharex=True) | |
for ax, var, cmap in zip( | |
axarr.flat, | |
['so', 'cfc11'], | |
[cmo.haline, cmo.matter] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Lets do the same thing with cfcs and package them into a dataset | |
cfc_sigma = grid.transform( | |
ds.cfc11, | |
'Z', | |
target_values, | |
target_data=ds.sigma_0) | |
ds_sigma = xr.Dataset({'cfc11':cfc_sigma, 'so':so_sigma}) | |
ds_sigma |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
so_sigma = grid.transform( | |
ds.so, | |
'Z', | |
target_values, | |
target_data=ds.sigma_0 | |
) | |
so_sigma |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
target_values = levels=np.arange(24.2,28, 0.2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create the grid object | |
from xgcm import Grid | |
grid = Grid( | |
ds, | |
periodic=False, | |
coords={'Z':{'center':'lev', 'outer':'lev_outer'}}) | |
grid |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fig, axarr = plt.subplots(nrows=3, figsize=[10,12], sharex=True) | |
for ax, var, cmap in zip( | |
axarr.flat, | |
['thetao', 'so', 'cfc11'], | |
[cmo.thermal, cmo.haline, cmo.matter] | |
): | |
kwargs = dict(yincrease=False, x='lat', y='lev', ax=ax) | |
# Plot a section along the dateline in 1980 in the southern ocean |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ds_section = ds.sel( | |
time='2010-01', | |
y=slice(-90,10), | |
lev=slice(0,1500) | |
).interp(x=230).squeeze() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fastjmd95 import rho | |
ds['sigma_0'] = rho(ds.so, ds.thetao, 0) - 1000 |