To compute the directional standard deviation of the ocean waves using ERA5 data, please have a look at the following document (from Jean Bidlot, ECMWF):

directional_width_parameter_in_ECWAM.pdf

Moreover, to complement the mean direction parameters, ERA5 data also provides the wave spectral directional width parameters for the total sea, wind waves and total swell

For more details, see section 10.3.5, of part VII of the ifs documentation:

https://www.ecmwf.int/en/publications/ifs-documentation