Exemplo n.º 1
0
    def test_kepert_us(self):

        from numpy import ones, float as Float
        from string import split

        f = open('test_data/us.csv', 'r')
        l = ones((61, 61), Float)

        for i in range(61):
            tls = []
            tlf = []
            fline = f.readline()
            tls = split(fline, ',')
            for j in range(61):
                l[i, j] = float(tls[j])

        f.close()

        x = resize(arange(-150e3, 151e3, 5e3), (61, 61))
        y = transpose(x)

        p = Kepert_linear_assym(x, y, lat=15, rm=4e4, vm=40.0, b=1.3, \
                                dp=3680.13292308, pe=1e5, rho=1.1, Ut=-5)

        assert allclose(p.us, l, rtol=1.e-4, atol=1.e-8)
Exemplo n.º 2
0
    def test_kepert_inputs(self):

        x = resize(arange(-150e3, 151e3, 5e3), (61, 61))
        y = transpose(x)

        p = Kepert_linear_assym(x, y, lat=15, rm=4e4, vm=40.0, b=1.3, \
                                dp=3680.13292308, pe=1e5, rho=1.1, Ut=-5)

        assert p.rm == 4e4
        assert p.vm == 40.0
        assert p.b == 1.3
        assert p.lat == 15
        assert p.rho == 1.1
        assert p.dp == 3680.13292308
        assert p.pe == 1e5
        assert p.Ut == -5
Exemplo n.º 3
0
y = np.arange(-150e3, 151e3, 2.5e3)
z = np.arange(5, nz * 5 + 1, 5)
xgrid, ygrid = np.meshgrid(
    x, y)  #np.resize(np.arange(-150e3,151e3,5e3), (61, 61))

xkm = xgrid * 1e-3
ykm = ygrid * 1e-3
xx = xkm[0, ]

rm = 4e4
lp = 60

cx = rm * 1e-3 * np.sin(np.arange(0.00, 6.29, 0.01))  # Circle for rmw plots.
cy = rm * 1e-3 * np.cos(np.arange(0.00, 6.29, 0.01))

p = Kepert_linear_assym(xgrid, ygrid, lat=-15, rm=4e4, vm=65.0, b=1.5, \
                        dp=7000.13292308, pe=1e5, rho=1.15, Ut=-5)

#output circle for rmw plots

for i in range(len(cx)):
    f.write(repr(cx[i]) + ',' + repr(cy[i]) + '\n')

#output horizontal wind fields

(a, b) = xkm.shape

for i in range(a):
    for j in range(b):
        f1.write(repr(xkm[i,j]) + ',' + repr(ykm[i,j]) + ',' + \
                 repr(p.us[i,j]) + '\n')
        f2.write(repr(xkm[i,j]) + ',' + repr(ykm[i,j]) + ',' + \