pycontrails.datalib.geo_utils

Tooling and support for GEO satellites.

Functions

parallax_correct(longitude, latitude, ...)

Apply parallax correction to WGS84 geodetic coordinates based on satellite perspective.

to_ash(da[, convention])

Compute 3d RGB array for the ASH color scheme.

pycontrails.datalib.geo_utils.parallax_correct(longitude, latitude, altitude, goes_da)

Apply parallax correction to WGS84 geodetic coordinates based on satellite perspective.

This function considers the ray from the satellite to the points of interest and finds the intersection of this ray with the WGS84 ellipsoid. The intersection point is then returned as the corrected longitude and latitude coordinates.

@ satellite
 \
  \
   \
    \
     \
      * aircraft
       \
        \
         x parallax corrected aircraft
 -------------------------  surface

If the point of interest is not visible from the satellite (ie, on the opposite side of the earth), the function returns nan for the corrected coordinates.

This function requires the pyproj package to be installed.

Parameters:
  • longitude (npt.NDArray[np.floating]) – A 1D array of longitudes in degrees.

  • latitude (npt.NDArray[np.floating]) – A 1D array of latitudes in degrees.

  • altitude (npt.NDArray[np.floating]) – A 1D array of altitudes in meters.

  • goes_da (xarray.DataArray) – DataArray containing the GOES projection information. Only the goes_imager_projection field of the xr.DataArray.attrs is used.

Returns:

tuple[npt.NDArray[np.floating], npt.NDArray[np.floating]] – A tuple containing the corrected longitude and latitude coordinates.

pycontrails.datalib.geo_utils.to_ash(da, convention='SEVIRI')

Compute 3d RGB array for the ASH color scheme.

Parameters:
  • da (xarray.DataArray) – DataArray of GOES data with appropriate bands.

  • convention (str, optional) – Convention for color space.

    • SEVIRI convention requires bands C11, C14, C15. Used in [Kulik, 2019].

    • Standard convention requires bands C11, C13, C14, C15

Returns:

npt.NDArray[np.float32] – 3d RGB array with ASH color scheme according to convention.

References

Examples

>>> from pycontrails.datalib.goes import GOES
>>> goes = GOES(region="M2", bands=("C11", "C14", "C15"))
>>> da = goes.get("2022-10-03 04:34:00")
>>> rgb = to_ash(da)
>>> rgb.shape
(500, 500, 3)
>>> rgb[0, 0, :]
array([0.0127004 , 0.22793579, 0.3930847 ], dtype=float32)