Filtering the large precipitation data for finding rainfall events

6 views (last 30 days)
I have daily precipitation data for 50 rain gauges for more than 10 years. I want to find the days where rainfall was greater than 1 mm for each rain gauge. Obviously, all rain gauges will have different dates of having rainfall event more than 1 mm. Is there a way in Matlab, I could do this process through a code that will give me a matrix containing the stations and the respective dates when rainfall was greater than 1 mm. Excel can sort this out, but we have to do the filter process to each rain gauge station one by one and it becomes laborious. Attaching a screenshot where the filter has been applied for just first column and the respective dates are visible. But when we will apply the filter to second column, again there will be a change.

Accepted Answer

Bjorn Gustavsson
Bjorn Gustavsson on 20 May 2022
Edited: Bjorn Gustavsson on 20 May 2022
If you store your rain-fall-data in an array, r_f for rain_falls, with n_t rows and n_stations columns you could easily do thing like:
n_t = 37; % just to mock up an
n_s = 6; % an illustrating
r_f = 5*randn(n_t,n_s).^2; % example
rf_threshold = 1;
imagesc(r_f) % the rainfall
axis xy
imagesc(r_f>rf_threshold) % illustrating days with rainfall larger than selected threshold
axis xy
stairs(sum(r_f>1,2),1:n_t) % stations with more than threshold rainfall at each day
grid on
idx_all = find(all(r_f>rf_threshold,2); % index to days with all stations with enough rain
idx_5 = find(sum(r_f>rf_threshold,2)>=5); % index to days with 5 or more stations with enough rain
Bjorn Gustavsson
Bjorn Gustavsson on 20 May 2022
You will have to explicitly load the data from the file:
lopad rain_ncm.mat
In order to find out what you have in the file and what the variable-names etc are you can use the whos-command:
whos -file rain_ncm.mat
That will give you a listing of the contents of the file.
From the question you ask you appear to be rather new to using matlab, for you to rapidly get up to speed there are an online introduction to matlab: on-ramp - that is designed with this objective, you might consider browsing the parts of that you find relevant. I think no questions or answers here will compare to that type of introduction-explanationings.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by