Generates plots comparing the frequency of wet days between observed and simulated precipitation data across specified seasons and geographic locations. Each season is visualized in a separate plot, with observed and simulated data presented side-by-side for direct comparison. The function uses a threshold to classify days as wet or dry and calculates the percentage of wet days for each location.

plot_wet_frequency(sim, observed, dates, seasons, coordinates, names_seasons)

Arguments

sim

A 3-dimensional array of simulated precipitation data with dimensions [time, location, variable].

observed

A 3-dimensional array of observed precipitation data with the same dimensions as `sim`.

dates

A vector of dates corresponding to the first dimension of the `sim` and `observed` arrays.

seasons

A list where each element defines the start and end days and months of a season.

coordinates

A data frame or matrix containing the geographic coordinates (longitude and latitude) for each location in the `sim` and `observed` arrays.

names_seasons

(Optional) A vector of names corresponding to the seasons defined in the `seasons` list. If `NULL`, the names are derived from the `seasons` list itself.

Value

A combined `ggplot` object that includes the plots for all seasons, arranged side-by-side, each comparing the wet day frequency between observed and simulated data for the specified locations.