Skip to content

CubeList instantiation #4079

@rcomer

Description

@rcomer

📚 Documentation

I was reviewing a code change and saw something like

cubelist = iris.cube.CubeList(list(dictionary_of_cubes.values()))

list has been inserted by 2to3, and I initially thought "that's redundant". But then I looked at the docs, and it does specifically say "Given a list of cubes, return a CubeList instance." Is this intentional? So far, every sequence type I've tried appears to work at Iris3.0.1:

cube1 = iris.cube.Cube(1, long_name='foo')
cube2 = iris.cube.Cube(1, long_name='bar')

def generate_cubes():
    yield cube2
    yield cube1

cubedict = dict(foo=cube1, bar=cube2)

cubelist1 = iris.cube.CubeList((cube1, cube2))
cubelist2 = iris.cube.CubeList(generate_cubes())
cubelist3 = iris.cube.CubeList(cubedict.values())

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions