是否可以基于cell_methods创建虹膜约束?

问题描述:

这只是想出来,我有一个答案,但我想在这里分享...是否可以基于cell_methods创建虹膜约束?

“是否有可能创建基于cell_methods的虹膜约束?

我有一个数据文件加载生产很多立方体。
我想只提取那些含有合奏传播,我可以从他们的cell_methods,而被设定为了确定:
(CellMethod(method=u'standard_deviation', coord_names=(u'realization',), intervals=(), comments=()),)

有没有办法过滤负担,让我只在需要的读“合奏传播“数据?

您需要使用“cube_func”方法。
http://scitools.org.uk/iris/docs/latest/iris/iris.html?highlight=constraint#iris.Constraint

所以,一些很粗略像...

def cube_is_mean(cube): 
    return any(cm.method == 'mean' for cm in cube.cell_methods) 

means_constraint = iris.Constraint(cube_func=cube_is_mean)