2 added 9 characters in body
source | link

Your uwnd variable holds 32 bit floats and has shape (1,73,144) corresponding to time, lat, lon and is located in the Dataset you have called 'U'.

One way to put this in a numpy array is:

uwind = np.zeros((lat,lon), np.float)
uwind = U.variables['uwnd'][1,:,:]

The first line sets the size of the uwind array, which is helpful from a performance standpoint and the second loads the data from time 1 into the array. lat and lon above are your grid dimensions 73 and 144 and np is the numpy module.

The u wind is just the east-west component of the wind. The north-south component will be in the v wind variable. You will need both to plot the wind. To plot the barbs you will need to setup arrays for your x and y coordinates which will depend on lat,lon and possibly your map projection. once you have an x and y array as well as uwind and vwind you can plot the wind barbs using matplotlib as:

plt.barbs(x, y, u, v)

and can customize their look with various options. The plt reference is the matplotlib.pyplot module.

For further reading, here are some examples of plotting netcdf data from a friend of mine at CSU.

Your uwnd variable holds 32 bit floats and has shape (1,73,144) corresponding to time, lat, lon and is located in the Dataset you have called 'U'.

One way to put this in a numpy array is:

uwind = np.zeros((lat,lon), np.float)
uwind = U.variables['uwnd'][1,:,:]

The first line sets the size of the uwind array, which is helpful from a performance standpoint and the second loads the data from time 1 into the array. lat and lon above are your grid dimensions 73 and 144 and np is the numpy module.

The u wind is just the east-west component of the wind. The north-south component will be in the v wind variable. You will need both to plot the wind. To plot the barbs you will need to setup arrays for your x and y coordinates which will depend on lat,lon and your map projection. once you have an x and y array as well as uwind and vwind you can plot the wind barbs using matplotlib as:

plt.barbs(x, y, u, v)

and can customize their look with various options. The plt reference is the matplotlib.pyplot module.

For further reading, here are some examples of plotting netcdf data from a friend of mine at CSU.

Your uwnd variable holds 32 bit floats and has shape (1,73,144) corresponding to time, lat, lon and is located in the Dataset you have called 'U'.

One way to put this in a numpy array is:

uwind = np.zeros((lat,lon), np.float)
uwind = U.variables['uwnd'][1,:,:]

The first line sets the size of the uwind array, which is helpful from a performance standpoint and the second loads the data from time 1 into the array. lat and lon above are your grid dimensions 73 and 144 and np is the numpy module.

The u wind is just the east-west component of the wind. The north-south component will be in the v wind variable. You will need both to plot the wind. To plot the barbs you will need to setup arrays for your x and y coordinates which will depend on lat,lon and possibly your map projection. once you have an x and y array as well as uwind and vwind you can plot the wind barbs using matplotlib as:

plt.barbs(x, y, u, v)

and can customize their look with various options. The plt reference is the matplotlib.pyplot module.

For further reading, here are some examples of plotting netcdf data from a friend of mine at CSU.

1
source | link

Your uwnd variable holds 32 bit floats and has shape (1,73,144) corresponding to time, lat, lon and is located in the Dataset you have called 'U'.

One way to put this in a numpy array is:

uwind = np.zeros((lat,lon), np.float)
uwind = U.variables['uwnd'][1,:,:]

The first line sets the size of the uwind array, which is helpful from a performance standpoint and the second loads the data from time 1 into the array. lat and lon above are your grid dimensions 73 and 144 and np is the numpy module.

The u wind is just the east-west component of the wind. The north-south component will be in the v wind variable. You will need both to plot the wind. To plot the barbs you will need to setup arrays for your x and y coordinates which will depend on lat,lon and your map projection. once you have an x and y array as well as uwind and vwind you can plot the wind barbs using matplotlib as:

plt.barbs(x, y, u, v)

and can customize their look with various options. The plt reference is the matplotlib.pyplot module.

For further reading, here are some examples of plotting netcdf data from a friend of mine at CSU.