Return the indices to the data array which correspond to coordinate values.
Any index for a dimension of the data array for which no coordinates are specified is returned as a full slice (i.e. slice(None)).
Size 1 coordinates for dimensions of the space which are not spanned by the data array may be specified, but no corresponding index will be returned.
Parameters : |
|
---|---|
Returns : | out : tuple |
Examples
>>> f.slice(lat=0.0, lon=0.0)
<CF Field: air_temperature(12, 1, 1)
>>> f.slice(lon=cf.lt(0.0), lon=[0, 2.8125])
<CF Field: air_temperature(12, 32, 2)
>>> f.slice(lon=[0, 1])
ValueError: 'longitude' coordinate doesn't contain the value 1
>>> f.slice(lon=1)
ValueError: No indices found for 'longitude' coordinate