Filtering the large precipitation data for finding rainfall events

조회 수: 4 (최근 30일)
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.

채택된 답변

Bjorn Gustavsson
Bjorn Gustavsson 2022년 5월 20일
편집: Bjorn Gustavsson 2022년 5월 20일
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;
subplot(1,3,1)
imagesc(r_f) % the rainfall
xlabel('station')
ylabel('day-number')
axis xy
subplot(1,3,2)
imagesc(r_f>rf_threshold) % illustrating days with rainfall larger than selected threshold
axis xy
subplot(1,3,3)
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
HTH
  댓글 수: 2
Faisal Baig
Faisal Baig 2022년 5월 20일
Thank you very much for the response. I have given a matrix r_f = 'rain_ncm.mat' but i guess that didn't work. I have given the same rainfall data with dates and stations as I showed in my questions. Could you please see the below where I did wrong? as I am getting empty idx_all array.
r_f = 'rain_ncm.mat'
n_t = 52; % just to mock up an
n_s = 6453; % an illustrating
r_f = 5*randn(n_t,n_s).^2; % example
rf_threshold = 1;
subplot(1,3,1)
imagesc(r_f) % the rainfall
xlabel('station')
ylabel('day-number')
axis xy
Bjorn Gustavsson
Bjorn Gustavsson 2022년 5월 20일
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.
HTH

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matched Filter and Ambiguity Function에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by