Estou tentando plotar farpas de vento no mapa base e tenho dois arquivos netCDF separados. Aqui está o que estou tentando produzir, ou algo parecido: Como leio um uwnd variável em um arquivo netCDF em python?
from mpl_toolkits.basemap import Basemapfrom netCDF4 import Dataset, date2indeximport numpy como npimport matplotlib.pyplot as pltfrom datetime import datetimefrom IPython.display import Imagefrom IPython.display import Imagefrom IPython.pyplot. exibir importar HTML importar netCDF4 as ncplt.clf () nc_file = '042711_V.nc'nc_file2 =' 042711_U.nc'V = Conjunto de dados (nc_file, modo = 'r') U = Conjunto de dados (nc_file2, modo = 'r') imprimir U.variables
Isso verifica se uwnd é realmente uma variável, mas por que não lê?
OrderedDict ([(u'lat ', <type 'netCDF4._netCDF4.Variable'>float32 unidades lat (lat): degrees_north actual_range: [90. -90.] Long_name: Latitudeunlimited dimensões: current shape = (73,) preenchendo), (u'lon', <type 'netCDF4 ._netCDF4.Variable'>floa t32 unidades lon (lon): degrees_east long_name: Longitude actual_range: [0. 357.5] dimensões ilimitadas: forma atual = (144,) preenchendo), (u'time ', <type' netCDF4._netCDF4.Variable'>float64 tempo (tempo ) unidades: horas desde 1800-1-1 00: 00: 0.0 long_name: Tempo real_range: [71870952. 71870952.] delta_t: 0000-01-00 00: 00: 00 dimensões ilimitadas: forma da corrente do tempo = (1,) preenchendo) , (u'uwnd ', <type' netCDF4._netCDF4.Variable'>float32 uwnd (time, lat, lon) long_name: u wind valid_range: [-99999. 99999.] intervalo_real: [-26.84999084 377.20001221] unidades: m / s add_offset: 0,0 fator_escala: 1,0 valor ausente: -9,96921e + 36 precisão: 99 dígito menos significativo: 99 var_desc: u conjunto de dados do vento: CDC Derived NCEP Reanalysis Nível de pressão dos produtos: 500mb estatística: Composite parent_stat: Otherunlimited dimensões: timecurrent shape = (1, 73, 144) fill off)]) KeyError: 'uwnd'
Estou tentando plotar alguns widnbarbs no mapa. consegui ler a hora, longitude e latitude, mas o que significa uwnd e como faço para lê-lo no formato numpy?
Aqui está o site que encontrei sobre como ler netCDF arquivos: http://www.hydro.washington.edu/~jhamman/hydro-logic/blog/2013/10/12/plot-netcdf-data/