Hello,
I set the following constraints on latitude and longitude:
IceNS = iris.Constraint( latitude=lambda rwv: 20. <= rwv <= 40.)
IceEW = iris.Constraint( longitude=lambda rwv: 0. <= rwv <= 30.)
And now I would like to print what is actually set:
print IceNS
Constraint(coord_values={'latitude': <function <lambda> at 0x377f050>})
but I am after the values of lambda
I tried the following to no avail.
dir ( IceNS)
['_CIM_extract', '__and__', '__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__rand__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_coord_constraints', '_coord_values', '_coordless_match', '_cube_func', '_name', 'extract']
>>> IceNS._coord_constraints
[_CoordConstraint('latitude', <function <lambda> at 0x377f050>)]
>>>
>>> IceNS.extract
<bound method Constraint.extract of Constraint(coord_values={'latitude': <function <lambda> at 0x377f050>})>
>>> print IceNS._coord_constraints
[_CoordConstraint('latitude', <function <lambda> at 0x377f050>)]
>>> print IceNS._coord_values
{'latitude': <function <lambda> at 0x377f050>}
>>> print IceNS._coord_values.points
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'dict' object has no attribute 'points'
>>> dir( IceNS._coord_values)
['__class__', '__cmp__', '__contains__', '__delattr__', '__delitem__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'has_key', 'items', 'iteritems', 'iterkeys', 'itervalues', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values', 'viewitems', 'viewkeys', 'viewvalues']
>>> print IceNS._coord_values.viewvalues
<built-in method viewvalues of dict object at 0x3b40d30>
>>> print IceNS._coord_values.viewitems
<built-in method viewitems of dict object at 0x3b40d30>
>>>
>>> print IceNS._coord_values.itervalues
<built-in method itervalues of dict object at 0x3b40d30>
>>> print IceNS._coord_values.items
<built-in method items of dict object at 0x3b40d30>
How do you print a constraint so that you can check what threshold values are actually doing the constraint?
Thanks!