pecans.utilities.domain_utilities.compute_coordinates_from_config(config, as_vectors=True)[source]

Calculates the x, y, and z coordinate vectors in kilometers from the origin based on the configuration.

Parameters:
  • config (BetterConfig) – the BetterConfig instance representing the model configuration

  • as_vectors (bool) – whether to return the coordinates as vectors (True, default) or full arrays (False)

Returns:

the x, y, and z coordinates as 1D numpy arrays

Return type:

three numpy.ndarray

pecans.utilities.domain_utilities.coord_arrays_to_vecs(X, Y=None, Z=None)[source]

Convert coordinate arrays to vectors

The reverse operation of coord_vecs_to_arrays(), this takes representations of the model coordinates as arrays (where there is an individual model coordinate for every model box) and returns the vector form.

Parameters:
  • X (numpy.ndarray) – the x-coordinate array

  • Y (numpy.ndarray) – the y-coordinate array

  • Z (numpy.ndarray) – the z-coordinate array

Returns:

the coordinate vectors

Return type:

three numpy.ndarray vectors

pecans.utilities.domain_utilities.coord_vecs_to_arrays(x, y=None, z=None)[source]

Convert coordinate vectors to arrays

In some cases it makes sense to represent the model domain coordinates as vectors, since the domain boxes follow cartesian coordinates, i.e. all boxes along M[0,:,:] will have the same x-coordinate. However, in some cases we need an individual coordinate for every box. This converts the coordinate vectors to the latter representation.

Parameters:
  • x (numpy.ndarray) – the x-coordinates, as a vector

  • y (numpy.ndarray) – the y-coordinates, as a vector

  • z (numpy.ndarray) – the z-coordinates, as a vector

Returns:

the coordinates in array form

Return type:

three numpy.ndarray