s2d2.checking.array

Module Contents

Functions

are_two_arrays_equal(a, b)

check if two arrays have the same dimensions

are_three_arrays_equal(a, b, c)

check if three arrays have the same dimensions

correct_floating_parameter(a)

sometimes a float is asked for, but this is given in a list, array or

make_same_size(old, geotransform_old, geotransform_new)

clip array to the same size as another array

s2d2.checking.array.are_two_arrays_equal(a, b)[source]

check if two arrays have the same dimensions

Parameters:
  • a ({np.ma.array, np.ndarray}) – arrays of interest

  • b ({np.ma.array, np.ndarray}) – arrays of interest

Return type:

bool, provides True if all sizes are equal

s2d2.checking.array.are_three_arrays_equal(a, b, c)[source]

check if three arrays have the same dimensions

Parameters:
  • a ({np.ma.array, np.ndarray}) – arrays of interest

  • b ({np.ma.array, np.ndarray}) – arrays of interest

  • c ({np.ma.array, np.ndarray}) – arrays of interest

Return type:

bool, provides True if all sizes are equal

s2d2.checking.array.correct_floating_parameter(a)[source]

sometimes a float is asked for, but this is given in a list, array or tuple. This function provides the float that is within

Parameters:

a ({np.ma.array, np.ndarray, tuple, list, float, int}) – float of interest

Return type:

float, int

s2d2.checking.array.make_same_size(old, geotransform_old, geotransform_new, rows_new=None, cols_new=None)[source]

clip array to the same size as another array

Parameters:
  • old (np.array, size=(m,n), dtype={float, complex}) – data array to be clipped.

  • geotransform_old (tuple, size={(6,), (8,)}) – georeference transform of the old image.

  • geotransform_new (tuple, size={(6,), (8,)}) – georeference transform of the new image.

  • rows_new (integer, {x ∈ ℕ | x ≥ 0}) – amount of rows of the new image.

  • cols_new (integer, {x ∈ ℕ | x ≥ 0}) – amount of collumns of the new image.

Returns:

New – clipped data array.

Return type:

np.array, size=(k,l), dtype={float,complex}