def drdt(r, t, phi_0, k, l, m, N=2e-3, U=0.3, V=0., Wf=0.1, f=0., phase_0=0.):
    x = r[0]
    y = r[1]
    z = r[2]

    om = gw.omega(N, k, m, l, f)
    dxdt = U + gw.u(x, y, z, t, phi_0, k, l, m, om, f=f, U=U, phase_0=phase_0)
    dydt = V + gw.v(x, y, z, t, phi_0, k, l, m, om, f=f, U=U, phase_0=phase_0)
    dzdt = Wf + gw.w(x, y, z, t, phi_0, k, l, m, om, N, U=U, phase_0=phase_0)

    return np.array([dxdt, dydt, dzdt])
def u_model(params, data):

    phi_0, X, Y, Z, phase_0 = params

    time, x, y, z, U, V, N, f = data

    k = 2*np.pi/X
    l = 2*np.pi/Y
    m = 2*np.pi/Z

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

    u = gw.u(x, y, z, time, phi_0, k, l, m, om, f=f, U=U, V=V, phase_0=phase_0)

    return u
def drdt(r, t, phi_0, Ufunc, Wf_pvals, k, l, m, om, N, f=0., phase_0=0.):
    x = r[0]
    y = r[1]
    z = r[2]

    Wf_g = Wf_pvals[0]
    Wf_0 = Wf_pvals[1]

    U = Ufunc(z)

    dxdt = U + gw.u(x, y, z, t, phi_0, k, l, m, om, f=f, U=U, phase_0=phase_0)
    dydt = gw.v(x, y, z, t, phi_0, k, l, m, om, f=f, U=U, phase_0=phase_0)
    dzdt = (Wf_0 + gw.w(x, y, z, t, phi_0, k, l, m, om, N, U=U, phase_0=phase_0))/(1 - Wf_g)

    return np.array([dxdt, dydt, dzdt])
def drdt(r, t, phi_0, Ufunc, Wf_pvals, k, l, m, om, N, f=0., phase_0=0.):
    x = r[0]
    y = r[1]
    z = r[2]

    Wf_g = Wf_pvals[0]
    Wf_0 = Wf_pvals[1]

    U = Ufunc(z)

    dxdt = U + gw.u(x, y, z, t, phi_0, k, l, m, om, f=f, U=U, phase_0=phase_0)
    dydt = gw.v(x, y, z, t, phi_0, k, l, m, om, f=f, U=U, phase_0=phase_0)
    dzdt = (Wf_0 + gw.w(
        x, y, z, t, phi_0, k, l, m, om, N, U=U, phase_0=phase_0)) / (1 - Wf_g)

    return np.array([dxdt, dydt, dzdt])
Exemplo n.º 5
0
def u_model(params, data):

    X, Y, Z, phase_0 = params

    time, dist, depth, U, V, W, B, N, f = data

    k = 2*np.pi/X
    l = 2*np.pi/Y
    m = 2*np.pi/Z

    om = gw.omega(N, k, m, l, f)
    phi_0 = np.max(W)*(N**2 - f**2)*m/(om*(k**2 + l**2 + m**2))

    u = gw.u(dist, 0., depth, time, phi_0, k, l, m, om, phase_0=phase_0)

    return u - U
def full_model(params, data):

    phi_0, X, Y, Z, phase_0 = params

    time, x, y, z, U, V, N, f, w_data, u_data, v_data, b_data = data

    k = 2*np.pi/X
    l = 2*np.pi/Y
    m = 2*np.pi/Z

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

    u = gw.u(x, y, z, time, phi_0, k, l, m, om, f=f, U=U, V=V, phase_0=phase_0)
    v = gw.v(x, y, z, time, phi_0, k, l, m, om, f=f, U=U, V=V, phase_0=phase_0)
    w = gw.w(x, y, z, time, phi_0, k, l, m, om, N, U=U, V=V, phase_0=phase_0)
    b = gw.b(x, y, z, time, phi_0, k, l, m, om, N, U=U, V=V, phase_0=phase_0)

    return np.hstack((w - w_data, u - u_data, v - v_data, b - b_data))
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)