separate rain events by specific dry period
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Albert Johan Mamani Larico
el 12 de Mayo de 2022
Comentada: Jovon Jacob
el 8 de En. de 2023
Hi
I have hourly rain data for a period of 5 years
x = [0 0 0 0 0 2 4 5 14 10 16 0 0 0 0 0 24 33 22 0 0 2 3 5 0 0 0 0.........]
I need to group them considering that each rain event is separated by 3 hours of zero values or more
How could I get the numbers of rain events, their mean rain value and duration of each event?
0 comentarios
Respuesta aceptada
Image Analyst
el 12 de Mayo de 2022
Try this, if you have the Image Processing Toolbox.
x = [0 0 0 0 0 2 4 5 14 10 16 0 0 0 0 0 24 33 22 0 0 2 3 5 0 0 0 0]
props = regionprops(x > 0, x, 'Area', 'MeanIntensity')
numberOfRainPeriods = length(props)
stormLengths = [props.Area] % In hours
meanRainPerHour = [props.MeanIntensity] % In mm or whatever.
integratedRainTotalsPerStorm = stormLengths .* meanRainPerHour % In mm or whatever.
You get
numberOfRainPeriods =
3
stormLengths =
6 3 3
meanRainPerHour =
8.5 26.333 3.3333
integratedRainTotalsPerStorm =
51 79 10
3 comentarios
Image Analyst
el 7 de En. de 2023
@Jovon Jacob give an example. Input, and output vectors. Best if you start your own thread and attach this code as your starting code.
Jovon Jacob
el 8 de En. de 2023
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!