New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cdms2 file variable does not support var.ndim #191

Closed
doutriaux1 opened this Issue Nov 13, 2017 · 2 comments

Comments

Projects
None yet
3 participants
@doutriaux1
Member

doutriaux1 commented Nov 13, 2017

In [1]: import cdms2,sys,os,vcs,cdat_info

In [2]: f=cdms2.open(os.path.join(sys.prefix,"share","cdutil","navy_land.nc"))

In [3]: v=f['sftlf']

In [4]: v.ndim
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-4-a70ea5f09b56> in <module>()
----> 1 v.ndim

AttributeError: 'FileVariable' object has no attribute 'ndim'

rank has been deprecated

@doutriaux1 doutriaux1 added this to the 3.0 milestone Nov 13, 2017

@dnadeau4

This comment has been minimized.

Contributor

dnadeau4 commented Feb 13, 2018

This is no documentation or any source code for ndim attribute. u

Use:

len(v.shape)

@dnadeau4 dnadeau4 closed this Feb 13, 2018

@durack1

This comment has been minimized.

Member

durack1 commented Feb 13, 2018

@dnadeau4 it seems in the example below, it inherits numpy behavior.. Might be good to document this

In [1]: import numpy as np
In [2]: import cdms2 as cdm
In [5]: npVar = np.ones([10,10])
In [6]: cdVar = cdm.createVariable(npVar,id='cdVar')
In [7]: npVar.ndim
Out[7]: 2
In [8]: cdVar.ndim
Out[8]: 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment