Ejemplo n.º 1
0
def mapWind(nest, time):
    """Creates a map of the domain, showing
    wind barbs for the given time
    """
    nc = openWRF(nest)
    nc1 = openWRF(nest + 1)
    Nx, Ny, _Nz, longitude, latitude, _dx, _dy, _x, _y = getDimensions(nc)
    m = _getMapForNC(nc, False, _getDL(nest), 100)
    _makeDots(m)
    u10 = nc.variables["U10"][time, :, :]
    v10 = nc.variables["V10"][time, :, :]
    # Use data from every 10th grid point
    windx = 1 + Nx / 10
    windy = 1 + Ny / 10
    lat10 = np.zeros((windy, windx))
    lon10 = np.zeros((windy, windx))
    uwind = np.zeros((windy, windx))
    vwind = np.zeros((windy, windx))
    for j in range(windy):
        for i in range(windx):
            uwind[j, i] = 0.5 * (u10[j * 10, i * 10] + u10[j * 10, i * 10 + 1])
            # print 'u: ' + str(uwind[j,i])
            vwind[j, i] = 0.5 * (v10[j * 10, i * 10] + v10[j * 10 + 1, i * 10])
            # print 'v: ' + str(vwind[j,i])
            lat10[j, i] = latitude[j * 10, i * 10]
            lon10[j, i] = longitude[j * 10, i * 10]

    x10, y10 = m(lon10, lat10)
    plt.barbs(x10, y10, uwind, vwind, barb_increments=barb_increments, linewidth=1.0, color="green")

    if nc1 is not None:
        _plotBorder(nc1, m, "black")
    plt.show()
    plt.close()
Ejemplo n.º 2
0
def _windbarbs(nc,time,y,x,P):
    uwind = 0.5*(nc.variables['U'][time,:,y,x]+nc.variables['U'][time,:,y,x+1])
    vwind = 0.5*(nc.variables['V'][time,:,y,x]+nc.variables['V'][time,:,y+1,x])
    zmax = len(uwind)
    delta = 4
    baraxis = [45. for _j in range(0,zmax,delta)]
    plt.barbs(baraxis,P[0:zmax:delta],uwind[0:zmax:delta],vwind[0:zmax:delta], \
              barb_increments=barb_increments, linewidth = .75)
Ejemplo n.º 3
0
def _windbarbs(nc,time,y,x,P):
    uwind = 0.5*(nc.variables['U'][time,:,y,x]+nc.variables['U'][time,:,y,x+1])
    vwind = 0.5*(nc.variables['V'][time,:,y,x]+nc.variables['V'][time,:,y+1,x])
    zmax = len(uwind)
    delta = 4
    baraxis = [45. for _j in range(0,zmax,delta)]
    plt.barbs(baraxis,P[0:zmax:delta],uwind[0:zmax:delta],vwind[0:zmax:delta], \
              barb_increments=barb_increments, linewidth = .75)
Ejemplo n.º 4
0
def mapWind(nest, time):
    """Creates a map of the domain, showing
    wind barbs for the given time
    """
    nc = openWRF(nest)
    nc1 = openWRF(nest + 1)
    Nx, Ny, _Nz, longitude, latitude, _dx, _dy, _x, _y = getDimensions(nc)
    m = _getMapForNC(nc, False, _getDL(nest), 100)
    _makeDots(m)
    u10 = nc.variables['U10'][time, :, :]
    v10 = nc.variables['V10'][time, :, :]
    # Use data from every 10th grid point
    windx = 1 + Nx / 10
    windy = 1 + Ny / 10
    lat10 = np.zeros((windy, windx))
    lon10 = np.zeros((windy, windx))
    uwind = np.zeros((windy, windx))
    vwind = np.zeros((windy, windx))
    for j in range(windy):
        for i in range(windx):
            uwind[j, i] = 0.5 * (u10[j * 10, i * 10] + u10[j * 10, i * 10 + 1])
            #print 'u: ' + str(uwind[j,i])
            vwind[j, i] = 0.5 * (v10[j * 10, i * 10] + v10[j * 10 + 1, i * 10])
            #print 'v: ' + str(vwind[j,i])
            lat10[j, i] = latitude[j * 10, i * 10]
            lon10[j, i] = longitude[j * 10, i * 10]

    x10, y10 = m(lon10, lat10)
    plt.barbs(x10,
              y10,
              uwind,
              vwind,
              barb_increments=barb_increments,
              linewidth=1.0,
              color='green')

    if (nc1 is not None):
        _plotBorder(nc1, m, 'black')
    plt.show()
    plt.close()