Hi All,

i'm new to basemap, truing to learn how to plot vector from a netcdf file

the variables in my file are :

- time
- Significant_height_of_combined_wind_waves_and_swell_surface
- u-component_of_wind_surface
- v-component_of_wind_surface

this is my code, the pcolormesh is fine 

####

import netCDF4
import datetime as dt

import numpy as np
import numpy.ma as ma
from datetime import date, datetime, timedelta
        
from mpl_toolkits.basemap import Basemap



url='http://geoport.whoi.edu/thredds/dodsC/fmrc/NCEP/ww3/cfsr/4m/best'
#url = 'http://geoport.whoi.edu/thredds/dodsC/fmrc/NCEP/ww3/cfsr/10m/best'
nc = netCDF4.Dataset(url)
#nc.variables.keys()


time_var = nc.variables[str('time')]
wave_var = 
nc.variables['Significant_height_of_combined_wind_waves_and_swell_surface']
date = datetime(1991,11,1,12)
istart = netCDF4.date2index(date,time_var,select='nearest')
lat = nc.variables['lat'][:]
lon = nc.variables['lon'][:]
uin = nc.variables['u-component_of_wind_surface'][istart,:,:]
vin = nc.variables['v-component_of_wind_surface'][istart,:,:]
var = wave_var[istart,:,:]
wave = ma.masked_where(np.isnan(var),var)


m = Basemap(llcrnrlon=-71.5,llcrnrlat=39.5,urcrnrlon=-63.0,urcrnrlat=46.0,\
            lat_0=20.,lon_0=-60.,lat_ts=20.)


lons, lats = np.meshgrid(lon,lat)
x, y = m(lons, lats)


m.pcolormesh(lon[:], lat[:], wave, vmin=0, vmax=3);
m.quiver(x, y, uin, vin);


####

.. but the vector plot in overlay doesn't render what i'm looking for .. 
obviously my fault in the code
thank you for your precious help!


------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to