How do you change a cube name?

962 views
Skip to first unread message

Rutger Dankers

unread,
Feb 12, 2013, 9:21:48 AM2/12/13
to scitoo...@googlegroups.com

Well, how do you do that? It turns out this is very simple:

mycube.rename('my_new_name')

But how could you know? It's only mentioned at the bottom of one of the last pages of the user guide: http://scitools.org.uk/iris/docs/latest/userguide/cube_maths.html?highlight=rename

I couldn't find it in the reference documentation. Is there an overview of nifty iris functions like this somewhere?

Cheers
Rutger

RHattersley

unread,
Feb 12, 2013, 9:36:49 AM2/12/13
to scitoo...@googlegroups.com
Hi Rutger,

Thanks for highlighting this.

Our reference documentation is automatically created from documentation within the Iris source code (known as docstrings). It seems this automatic process is missing a couple of entries. Specifically, the Cube, Coord, DimCoord, and AuxCoord classes all have the two methods "name" and "rename" but their documentation is missing. I'll raise this as a bug issue on GitHub.

In the meantime, you can access the help text for these methods at the Python command prompt. For example:

>>> import iris
>>> help(iris.cube.Cube.name)
>>> help(iris.cube.Cube.rename)

Thanks
Richard

RHattersley

unread,
Feb 12, 2013, 9:43:40 AM2/12/13
to scitoo...@googlegroups.com

Rutger Dankers

unread,
Feb 12, 2013, 12:16:43 PM2/12/13
to scitoo...@googlegroups.com
Thanks Richard.

More generally, though, if you don't know that such a method exist, how can you find out? What is the python/iris equivalent for 'help.search()' in R?

Or is there an overview of iris operators, something like http://docs.scipy.org/doc/numpy/reference/routines.ma.html ?

Cheers
Rutger



RHattersley

unread,
Feb 13, 2013, 5:04:11 AM2/13/13
to scitoo...@googlegroups.com
Under normal circumstances my first port of call would be the search function in the online documentation. You can see this on the right-hand side of the page at http://scitools.org.uk/iris/docs/latest/index.html

Other useful techniques are the built-in dir() and help() methods for use at the Python interactive prompt, as documented in http://docs.python.org/2.7/library/functions.html

For example, at the interactive prompt one could do:
>>> import iris
>>> help(iris.cube.Cube)
and then use the arrow keys and page up/down to browse all the documentation for the Cube class. Press "q" when you're finished. When reading help in this fashion one can also search for keywords - e.g. type "/rename" followed by the Enter key to find the help text for the rename method.
Reply all
Reply to author
Forward
0 new messages