earthkit.geo.rotate.rotate_vector

earthkit.geo.rotate.rotate_vector(lat, lon, vector_x, vector_y, source_projection, target_projection)

Rotate vectors from source to target projection coordinates.

Parameters:
  • lat (ndarray) – Latitude coordinates of the points (degrees).

  • lon (ndarray) – Longitude coordinates of the points (degrees).

  • vector_x (ndarray) – x component of the vector in the source projection.

  • vector_y (ndarray) – y component of the vector in the source projection.

  • source_projection (str, dict) – Projection that the vector components are defined in. It is either a proj string or a dict of map projection control parameter key/value pairs. Passed to pyproj.Proj().

  • target_projection (str, dict) – Projection that the vector components should be transformed to. It is either a proj string or a dict of map projection control parameter key/value pairs. Passed to pyproj.Proj().

Returns:

  • ndarray – x component of the vector in the target projection.

  • ndarray – y component of the vector in the target projection).

The vector is returned at the same locations (lat, lon), but rotated into target_projection coordinates. The magnitude of the vector is preserved.

Based on code from MET Norway.