Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #46643 > unrolled thread

netcdF4 variables

Started bySudheer Joseph <sjo.india@gmail.com>
First post2013-05-31 20:30 -0700
Last post2013-06-01 04:54 -0700
Articles 3 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  netcdF4 variables Sudheer Joseph <sjo.india@gmail.com> - 2013-05-31 20:30 -0700
    Re: netcdF4 variables Andreas Perstinger <andipersti@gmail.com> - 2013-06-01 09:21 +0200
      Re: netcdF4 variables Sudheer Joseph <sjo.india@gmail.com> - 2013-06-01 04:54 -0700

#46643 — netcdF4 variables

FromSudheer Joseph <sjo.india@gmail.com>
Date2013-05-31 20:30 -0700
SubjectnetcdF4 variables
Message-ID<de9d0c8d-d7cc-45a8-a53e-06efed145700@googlegroups.com>
Dear members,
                    I have been using python NetcdF for some time. I understand that we can get variables from a netcdf one by one by using
temp=ncf.variable['temp'][:]
but is there  a way to get a list of variables with out the rest of the stuff as seen below?
some hing like a list
xx=nc,variables[:]
should get me all variable names with out other surrounding stuff??
with best regards.
Sudheer

In [4]: ncf.variables
Out[4]: OrderedDict([(u'LON', <netCDF4.Variable object at 0x254aad0>), (u'LAT', <netCDF4.Variable object at 0x254ab50>), (u'DEPTH1_1', <netCDF4.Variable object at 0x254abd0>), (u'TAX', <netCDF4.Variable object at 0x254ac50>), (u'DIF_FD1', <netCDF4.Variable object at 0x254acd0>), (u'DIF_FD2', <netCDF4.Variable object at 0x254ad50>), (u'DIF_FD3', <netCDF4.Variable object at 0x254add0>), (u'DIF_FD4', <netCDF4.Variable object at 0x254ae50>), (u'DIF_FD5', <netCDF4.Variable object at 0x254aed0>), (u'DEPTH', <netCDF4.Variable object at 0x254af50>), (u'DEPTH_bnds', <netCDF4.Variable object at 0x261b050>), (u'TIME', <netCDF4.Variable object at 0x261b0d0>), (u'TEMP_BIAS', <netCDF4.Variable object at 0x261b150>)])

[toc] | [next] | [standalone]


#46649

FromAndreas Perstinger <andipersti@gmail.com>
Date2013-06-01 09:21 +0200
Message-ID<mailman.2519.1370071265.3114.python-list@python.org>
In reply to#46643
On 01.06.2013 05:30, Sudheer Joseph wrote:
> some hing like a list
> xx=nc,variables[:]
> should get me all variable names with out other surrounding stuff??
>
> In [4]: ncf.variables
> Out[4]: OrderedDict([(u'LON', <netCDF4.Variable object at 0x254aad0>),
[SNIP]

It looks like "variables" is an OrderedDict. Thus

 >>> ncf.variables.keys()

should return a view (or list, depending on your python version) of all 
keys, i.e. all variable names.

Bye, Andreas

[toc] | [prev] | [next] | [standalone]


#46661

FromSudheer Joseph <sjo.india@gmail.com>
Date2013-06-01 04:54 -0700
Message-ID<abd41714-01b1-4f02-9868-99d23ba7ddb9@googlegroups.com>
In reply to#46649
Thank you very much it works for me.
with best regards,
Sudheer
On Saturday, June 1, 2013 12:51:01 PM UTC+5:30, Andreas Perstinger wrote:
> On 01.06.2013 05:30, Sudheer Joseph wrote:
> 
> > some hing like a list
> 
> > xx=nc,variables[:]
> 
> > should get me all variable names with out other surrounding stuff??
> 
> >
> 
> > In [4]: ncf.variables
> 
> > Out[4]: OrderedDict([(u'LON', <netCDF4.Variable object at 0x254aad0>),
> 
> [SNIP]
> 
> 
> 
> It looks like "variables" is an OrderedDict. Thus
> 
> 
> 
>  >>> ncf.variables.keys()
> 
> 
> 
> should return a view (or list, depending on your python version) of all 
> 
> keys, i.e. all variable names.
> 
> 
> 
> Bye, Andreas

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web