<a id="api-esmvaltool-diag-scripts-hydrology-hour-of-max-precipitation"></a>

# Hour of Maximum Precipitation

Calculate and plot hour of daily maximum precipitation.

## Description

This diagnostics calculates the hour of daily maximum precipitation and plots
it. The input data needs to be subdaily and of shape (hour, latitude,
longitude). The hour dimension should be in local solar time (see
[`local_solar_time()`](https://docs.esmvaltool.org/projects/ESMValCore/en/latest/api/esmvalcore.preprocessor.html#esmvalcore.preprocessor.local_solar_time)).

## Author

Manuel Schlund (DLR, Germany)

## Configuration options in recipe

caption: str, optional
: Figure caption used for provenance tracking. By default, uses “Global map
  of the hour of the daily maximum precipitation for {alias}.”.

cbar_label: str, optional (default: “Hour of daily maximum precipitation”)
: Colorbar label.

cbar_kwargs: dict, optional
: Optional keyword arguments for [`matplotlib.pyplot.colorbar()`](https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.colorbar.html#matplotlib.pyplot.colorbar). By
  default, uses `{orientation: "horizontal"}`.

figure_kwargs: dict, optional
: Optional keyword arguments for [`matplotlib.pyplot.figure()`](https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.figure.html#matplotlib.pyplot.figure). By
  default, uses `constrained_layout: true, ticks: [0, 3, 6, 9, 12, 15, 18,
  21]`.

matplotlib_rc_params: dict, optional
: Optional [`matplotlib.RcParams`](https://matplotlib.org/stable/api/matplotlib_configuration_api.html#matplotlib.RcParams) used to customize matplotlib plots.
  Options given here will be passed to [`matplotlib.rc_context()`](https://matplotlib.org/stable/api/matplotlib_configuration_api.html#matplotlib.rc_context) and used
  for all plots produced with this diagnostic.

method: str, optional (default: “dft”)
: Method to determine the hour of daily maximum precipitation. Possible
  options:
  <br/>
  - If “dft”, apply a discrete Fourier transform (DFT) to the data and use
    the peak of the first component (see
    [https://mdtf-diagnostics.readthedocs.io/en/latest/sphinx_pods/precip_diurnal_cycle.html](https://mdtf-diagnostics.readthedocs.io/en/latest/sphinx_pods/precip_diurnal_cycle.html)).
  - If “harmonic_fit”, fit a 12hr- plus 24hr-harmonic to the input data and
    use the peak of the 24hr-harmonic (see Dai, 2024;
    [https://doi.org/10.1007/s00382-024-07182-6](https://doi.org/10.1007/s00382-024-07182-6)). This should give
    identical/very similar results to “dft”, but is much slower.
  - If “max”, simply use the maximum in the input data.

plot_kwargs: dict, optional
: Optional keyword arguments for [`iris.plot.pcolormesh()`](https://scitools-iris.readthedocs.io/en/latest/generated/api/iris.plot.html#iris.plot.pcolormesh). By default,
  uses `cmap: twilight`.

projection: str, optional (default: None)
: Projection used for the plot. Needs to be a valid projection class of
  [`cartopy.crs`](https://cartopy.readthedocs.io/latest/reference/crs.html#module-cartopy.crs). Keyword arguments can be specified using the option
  `projection_kwargs`.

projection_kwargs: dict, optional
: Optional keyword arguments for the projection given by `projection`. For
  map plots, the default keyword arguments `{central_longitude: 10}` are
  used.

pyplot_kwargs: dict, optional
: Optional calls to functions of [`matplotlib.pyplot`](https://matplotlib.org/stable/api/pyplot_summary.html#module-matplotlib.pyplot). Dictionary keys
  are functions of [`matplotlib.pyplot`](https://matplotlib.org/stable/api/pyplot_summary.html#module-matplotlib.pyplot). Dictionary values are used as
  argument(s) for these functions (if values are dictionaries, these are
  interpreted as keyword arguments; otherwise a single argument is assumed).
  String arguments can contain format strings (e.g., `"{dataset}
  ({project})"`).

savefig_kwargs: dict, optional
: Optional keyword arguments for [`matplotlib.pyplot.savefig()`](https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.savefig.html#matplotlib.pyplot.savefig). By
  default, uses `bbox_inches: tight, dpi: 300, orientation: landscape`.

seaborn_settings: dict, optional
: Options for [`seaborn.set_theme()`](https://seaborn.pydata.org/generated/seaborn.set_theme.html#seaborn.set_theme) (affects all plots). By default, uses
  `style: ticks`.

threshold: float, optional (default: 0.0)
: Mask grid points where precipitation is lower than the given threshold.
