Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #100477
| From | jorge.conrado@cptec.inpe.br |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | netcdf 4 time |
| Date | 2015-12-15 15:42 -0200 |
| Message-ID | <mailman.37.1450201905.22044.python-list@python.org> (permalink) |
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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
netcdf 4 time jorge.conrado@cptec.inpe.br - 2015-12-15 15:42 -0200
csiph-web