コード例 #1
0
def u_model(params, pfl, zlim, deg):

    phi_0, X, Z, phase_0 = params
    zmin, zmax = zlim
    nope = np.isnan(pfl.zef) | (pfl.zef < zmin) | (pfl.zef > zmax)

    t = 60*60*24*(pfl.UTCef - np.nanmin(pfl.UTCef))
    x = 1000.*(pfl.dist_ef - np.nanmin(pfl.dist_ef))
    k = 2*np.pi/X
    l = 0.
    m = 2*np.pi/Z
    f = gsw.f(pfl.lat_start)
    N = np.mean(np.sqrt(pfl.N2_ref[~nope]))

    om = gw.omega(N, k, m, l, f)

    u = gw.u(x, 0., pfl.zef, t, phi_0, k, l, m, om, phase_0=phase_0)

    return u[~nope] - utils.nan_detrend(pfl.zef[~nope], pfl.U[~nope], deg)
コード例 #2
0
                        5,
                        sharey='row',
                        sharex='col',
                        figsize=(14, 20))
fig.subplots_adjust(hspace=0.05, wspace=0.1)
rot = 'vertical'
col = 'black'
deg = 2

U_var = 'U'
V_var = 'V'

for pfl, axs in zip(pfls, axm):

    axs[0].set_ylabel('$z$ (m)')
    axs[0].plot(100. * utils.nan_detrend(pfl.zef, getattr(pfl, U_var), deg),
                pfl.zef, col)
    axs[0].plot(100. * getattr(pfl, U_var), pfl.zef, 'grey')
    axs[0].plot(100. * utils.nan_polyvalfit(pfl.zef, getattr(pfl, U_var), deg),
                pfl.zef, 'grey')
    axs[1].plot(100. * utils.nan_detrend(pfl.zef, getattr(pfl, V_var), deg),
                pfl.zef, col)
    axs[1].plot(100. * getattr(pfl, V_var), pfl.zef, 'grey')
    axs[1].plot(100. * utils.nan_polyvalfit(pfl.zef, getattr(pfl, V_var), deg),
                pfl.zef, 'grey')
    axs[2].plot(100. * pfl.Ww, pfl.z, col)
    axs[3].plot(10000. * pfl.b, pfl.z, col)
    axs[4].plot((pfl.dist_ctd - np.nanmin(pfl.dist_ctd)), pfl.z, col)
    axs[4].annotate("Float {}\nhpid {}".format(pfl.floatID, pfl.hpid[0]),
                    (0.5, -200))
コード例 #3
0
ylims = {27: (-1000, -200),
         26: (-1540, -600),
         31: (-1474, -600),
         32: (-1580, -400)}

Ms = {26: M3,
      27: M4,
      31: M1,
      32: M2}


for pfl, axs in zip(pfls, axm):

    axs[0].set_ylabel('$z$ (m)')
    axs[0].plot(100.*utils.nan_detrend(pfl.zef, getattr(pfl, U_var), deg), pfl.zef, col)
    axs[1].plot(100.*utils.nan_detrend(pfl.zef, getattr(pfl, V_var), deg), pfl.zef, col)
    axs[2].plot(100.*pfl.Ww, pfl.z, col)
    axs[3].plot(10000.*pfl.b, pfl.z, col)
    axs[2].annotate("EM {}\nP {}".format(pfl.floatID, pfl.hpid[0]),
                    (-29, -250))

    for ax in axs:
        ax.vlines(0., *ax.get_ylim())
        ax.grid()
        ax.axhspan(*ylims[pfl.hpid[0]], color='grey', alpha=0.5)
        ax.set_ylim(-1600., 0.)

    Ns = len(M1.trace('X')[:])
    M = Ms[pfl.hpid[0]]
コード例 #4
0
lx = -2050.
ly = -1700.
lz = -1880.
phi_0 = 0.038
phase_0 = 3.24

pfl = E77.get_profiles(26)

params['z_0'] = np.nanmin(pfl.z)
params['N'] = 2.0e-3

X = far.model_verbose(phi_0, lx, ly, lz, phase_0, params)
X.u[:, 0] -= X.U

fig, axs = plt.subplots(1, 6, sharey=True, figsize=(16,6))
axs[0].plot(1e2*utils.nan_detrend(pfl.zef, pfl.U_abs, 2), pfl.zef, 'red')
plt.setp(axs[0].xaxis.get_majorticklabels(), rotation=60)
axs[1].plot(1e2*utils.nan_detrend(pfl.zef, pfl.V_abs, 2), pfl.zef, 'red')
plt.setp(axs[1].xaxis.get_majorticklabels(), rotation=60)
axs[2].plot(1e2*pfl.Ww, pfl.z, color='red')
plt.setp(axs[2].xaxis.get_majorticklabels(), rotation=60)
axs[3].plot(1e4*pfl.b, pfl.z, 'red')
plt.setp(axs[3].xaxis.get_majorticklabels(), rotation=60)
axs[4].plot(pfl.Pprime, pfl.z, 'red')
plt.setp(axs[4].xaxis.get_majorticklabels(), rotation=60)
axs[5].plot((pfl.dist_ctd - np.nanmin(pfl.dist_ctd))*1000., pfl.z, 'red')
plt.setp(axs[5].xaxis.get_majorticklabels(), rotation=60)

#pf.my_savefig(fig, '4977', 'pfl26_UVWB', sdir, fsize='double_col')
use = X.r[:, 2] < -600.
コード例 #5
0
W = W[~nope]
B = B[~nope]

N = np.nanmean(np.sqrt(N2))
f = gsw.f(-57.5)

Unope = np.isnan(U)

timeef = timeef[~Unope]
U = U[~Unope]
V = V[~Unope]

U = np.interp(time, timeef, U)
V = np.interp(time, timeef, V)

U[time > t_split] = utils.nan_detrend(depth[time > t_split], U[time > t_split], 2)
U[time < t_split] = utils.nan_detrend(depth[time < t_split], U[time < t_split], 2)
U[U > 0.3] = 0.

V[time > t_split] = utils.nan_detrend(depth[time > t_split], V[time > t_split], 2)
V[time < t_split] = utils.nan_detrend(depth[time < t_split], V[time < t_split], 2)

#U = utils.nan_detrend(depth, U, 2)
#V = utils.nan_detrend(depth, V, 2)

time *= 60.*60.*24
dist *= 1000.
time -= np.min(time)
dist -= np.min(dist)

data = [time, dist, depth, U, V, W, B, N, f]
コード例 #6
0
N = np.nanmean(np.sqrt(N2))
f = gsw.f(Float.get_profiles(args.hpid).lat_start)

Unope = np.isnan(U)

timeef = timeef[~Unope]
U = U[~Unope]
V = V[~Unope]

U = np.interp(time, timeef, U)
V = np.interp(time, timeef, V)

Umean = np.mean(U)
Vmean = np.mean(V)

U = utils.nan_detrend(z, U, args.detrend)
V = utils.nan_detrend(z, V, args.detrend)
PP = utils.nan_detrend(z, PP, 1.)

time *= 60.*60.*24
time -= np.min(time)

data = [time, x, y, z, Umean, Vmean, N, f]

data_stack = np.hstack((U, V, wscale*W, bscale*B, pscale*PP))

X0, Y0, Z0 = args.xyz


def model():
コード例 #7
0
E76_hpids = np.array([31, 32])
E77_hpids = np.array([26, 27])

for Float, hpids in zip([E76, E77], [E76_hpids, E77_hpids]):
    __, idxs = Float.get_profiles(hpids, ret_idxs=True)

    z = Float.z[:, idxs]
    zef = Float.zef[:, idxs]
    u = Float.U_abs[:, idxs]
    v = Float.V_abs[:, idxs]
    w = Float.Ww[:, idxs]
    b = Float.b[:, idxs]
    p = Float.Pprime[:, idxs]
    N = np.sqrt(Float.N2_ref[:, idxs])

    ud = utils.nan_detrend(zef, u)
    vd = utils.nan_detrend(zef, v)
    pd = utils.nan_detrend(z, p)

    fig, axs = plt.subplots(1, 6, sharey=True, figsize=(16, 6))
    axs[0].set_ylabel('$z$ (m)')
    axs[0].plot(ud, zef)
    axs[0].set_xlabel('$u$')
    axs[1].plot(vd, zef)
    axs[1].set_xlabel('$v$')
    axs[2].plot(w, z)
    axs[2].set_xlabel('$w$')
    axs[3].plot(b, z)
    axs[3].set_xlabel('$b$')
    axs[4].plot(pd, z)
    axs[4].set_xlabel('$p$')