Hi,
I'm reading ndetcdf 4 data from NCEP Reanalyisis project.
I use to read the data: air_2010_2014_850hPa_d.nc
is four year daily data.
mport matplotlib.pylab as plt
from netCDF4 import Dataset, num2date, date2index, date2num
import pandas as pd
from mpl_toolkits.basemap import Basemap
import numpy as np
from jdcal import gcal2jd, jd2gcal
f = Dataset('air_2010_2014_850hPa_d.nc')
air = f.variables['air'][:]
time = f.variables['time']
lon = f.variables['lon'][:]
lat = f.variables['lat'][:]
lon, lat = np.meshgrid(lon, lat)
dates = num2date(time[:], time.units)
print dates
This is the date values:
[datetime.datetime(2010, 1, 1, 0, 0) datetime.datetime(2010, 1, 2, 0, 0)
datetime.datetime(2010, 1, 3, 0, 0) ...,
datetime.datetime(2014, 12, 29, 0, 0)
datetime.datetime(2014, 12, 30, 0, 0)
datetime.datetime(2014, 12, 31, 0, 0)]
Please, how can I get an arrya for each year, monht and day from the
dates values and how can I get an specific day for my dates array.
Please anyone have any example of date2index for the netcdf 4.
This is the time for my netcdf data.
<type 'netCDF4._netCDF4.Variable'>
float64 time(time)
long_name: Time
delta_t: 0000-00-01 00:00:00
avg_period: 0000-00-01 00:00:00
standard_name: time
axis: T
units: hours since 1800-01-01 00:00:0.0
actual_range: [ 1840824. 1884624.]
unlimited dimensions: time
current shape = (1826,)
filling on, default _FillValue of 9.96920996839e+36 used
Thanks in advance,
Conrado
--
https://mail.python.org/mailman/listinfo/python-list