forked from rsignell-usgs/notebook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMatlab_test.py
61 lines (39 loc) · 1.03 KB
/
Matlab_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <codecell>
import iris
iris.FUTURE.netcdf_promote = True
print(iris.__version__)
import os.path
os.path.abspath(iris.__file__)
# <codecell>
%load_ext pymatbridge
# <codecell>
import iris.plot as iplt
import matplotlib.pyplot as plt
def plot_profile(c):
coord = c.coord('sea_surface_height_above_reference_ellipsoid')
lon = c.coord(axis='X').points.squeeze()
lat = c.coord(axis='Y').points.squeeze()
depth = coord.points.min()
fig, ax = plt.subplots(figsize=(5, 6))
kw = dict(linewidth=2, color=(.3, .4, .5),
alpha=0.75, marker='o', label='iris')
iplt.plot(c, coord, **kw)
ax.grid()
ax.set_ylabel('{} ({})'.format(coord.standard_name, coord.units))
ax.set_xlabel('{} ({})'.format(c.name(), c.units))
ax.set_title('lon: %s\nlat: %s\nMax depth = %s' % (lon, lat, depth))
return fig, ax
# <codecell>
a=2
# <codecell>
%%matlab -i a -o b
b=a^3;
# <codecell>
print b
# <codecell>
%%matlab
peaks;
colorbar;
# <codecell>