pycontrails.datalib.himawari

Support for Himawari-8/9 satellite data access.

class pycontrails.datalib.himawari.Himawari(region=HimawariRegion.FLDK, bands=None, *, bucket=None, cachestore=<object object>)

Bases: object

Support for Himawari-8/9 satellite data access via AWS S3.

This interface requires the s3fs package to download data from the AWS Public Dataset.

Parameters:
  • region (HimawariRegion | str, optional) – The Himawari-8/9 area to download. By default, HimawariRegion.FLDK (Full Disk).

  • bands (str | Iterable[str] | None, optional) – The bands to download. The 16 possible bands are B01 to B16. For the SEVIRI ash color scheme, bands B11, B14, and B15 are required (default). For the true color scheme, bands B01, B02, and B03 are required. See here for more information on the bands.

  • bucket (str | None, optional) – The S3 bucket to use. By default, the bucket is chosen based on the time (Himawari-8 before 2022-12-13, Himawari-9 after).

  • cachestore (cache.CacheStore | None, optional) – The cache store to use. By default, a disk cache in the user cache directory is used. If None, data is downloaded directly into memory from S3.

get(time)

Get Himawari-8/9 data for a given time.

s3_rpaths(time)

Return S3 remote paths for a given time.

class pycontrails.datalib.himawari.HimawariRegion(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Himawari-8/9 regions.

FLDK = 1
Japan = 2
Target = 3
pycontrails.datalib.himawari.extract_visualization(da, color_scheme='ash', ash_convention='SEVIRI', gamma=2.2)

Extract artifacts for visualizing Himawari data with the given color scheme.

Parameters:
  • da (xarray.DataArray) – DataArray of Himawari data as returned by Himawari.get(). Must have the channels required by to_ash().

  • color_scheme (str) – Color scheme to use for visualization. Must be one of {“true”, “ash”}. If “true”, the da must contain channels B01, B02, and B03. If “ash”, the da must contain channels B11, B14, and B15 (SEVIRI convention) or channels B11, B13, B14, and B15 (standard convention).

  • ash_convention (str) – Passed into to_ash(). Only used if color_scheme="ash". Must be one of {“SEVIRI”, “standard”}. By default, “SEVIRI” is used.

  • gamma (float) – Passed into to_true_color(). Only used if color_scheme="true". By default, 2.2 is used.

Returns:

  • rgb (npt.NDArray[np.float32]) – 3D RGB array of shape (height, width, 3). Any nan values are replaced with 0.

  • src_crs (cartopy.crs.Geostationary) – The Geostationary projection built from the Himawari metadata.

  • src_extent (tuple[float, float, float, float]) – Extent of Himawari data in the Geostationary projection

pycontrails.datalib.himawari.parse_himawari_header(content)

Parse the Himawari header data.

Skips variable-length fields and spares.

pycontrails.datalib.himawari.to_true_color(da, gamma=2.2)

Compute 3d RGB array for the true color scheme.

Parameters:
  • da (xarray.DataArray) – DataArray of GOES data with channels B01, B02, B03.

  • gamma (float, optional) – Gamma correction for the RGB channels.

Returns:

npt.NDArray[np.floating] – 3d RGB array with true color scheme.

References