Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: jorge.conrado@cptec.inpe.br Newsgroups: comp.lang.python Subject: netcdf 4 time Date: Tue, 15 Dec 2015 15:42:39 -0200 Lines: 76 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de HFBECyW8OAaqc1NGqhh4EA5vZIZEtOC7X1lNChSoRunw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.030 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'skip:[ 20': 0.03; 'array.': 0.07; 'data:': 0.07; 'received:150': 0.09; '...,': 0.16; '00:00:00': 0.16; 'numpy': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'values:': 0.16; 'shape': 0.18; 'year,': 0.22; '31,': 0.22; 'import': 0.24; 'header:User-Agent:1': 0.26; 'example': 0.26; 'values': 0.28; "i'm": 0.30; 'print': 0.30; 'anyone': 0.32; 'skip:d 20': 0.34; 'on,': 0.35; 'subject:time': 0.35; 'data.': 0.36; 'to:addr:python-list': 0.36; 'thanks': 0.37; '12,': 0.37; 'skip:9 10': 0.37; 'charset:us-ascii': 0.37; 'hi,': 0.38; 'data': 0.39; 'to:addr:python.org': 0.40; 'from:no real name:2**0': 0.60; 'default': 0.61; 'skip:n 10': 0.62; '30,': 0.63; 'please,': 0.63; 'hours': 0.65; 'air': 0.65; 'received:br': 0.66; 'day': 0.67; 'filling': 0.76 X-Virus-Scanned: Debian amavisd-new at tornado X-PHP-Originating-Script: 33:rcube.php X-Sender: jorge.conrado@cptec.inpe.br User-Agent: Roundcube Webmail/1.0.3 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:100477 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. 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