wrf.get_right_slices

wrf.get_right_slices(var, right_ndims, fixed_val=0)

Return an indexing tuple where the left dimensions are held to a fixed value and the right dimensions are set to slice objects.

For example, if var is a 5D variable, and the desired indexing sequence for a numpy array is (0,0,0,:,:), then right_ndims should be set to 2 and fixed_val set to 0.

Parameters:
  • var (numpy.ndarray) – A numpy array.
  • right_ndims (int) – The number of right dimensions to be sliced.
  • fixed_val (int) – The value to hold the left dimensions to.
Returns:

An indexing tuple that can be used to index a numpy.ndarray.

Return type:

tuple