Filter löschen
Filter löschen

Cutoff Threshold of data points

1 Ansicht (letzte 30 Tage)
Queena Edwards
Queena Edwards am 6 Mär. 2022
Kommentiert: Queena Edwards am 8 Mär. 2022
I have calculated the sum of rainfall per rainfall event [RF_Total(x,:) ] and the sum of hours in that event [RF_Hours(x,:)]. I would like to remove rainfall events that are greater that 50.8 mm and more than 51h. This is what I've developed thus far.
(I've attached a compressed file containing the data that you would need for line 1 )
M1 = readmatrix('Pevents.txt'); % Text File to Matrix
NaNv = find(isnan(M1)); % Numeric Indices Of 'NaN' Values
NaNv = [NaNv; size(M1,1)]; % Last Index (Instead Of Last 'NaN') Is The End Of The Vector
Events = 1:numel(NaNv)-1;
for x = Events
idxrng = NaNv(x)+2:NaNv(x+1)-1;
RF_Vector{x,:} = M1(idxrng); % Vector Of Rainfall Events (Between 'NaN' Elements)
RF_Hours(x,:) = numel(idxrng); % Number Of Hours In Each Event (h)
RF_Total(x,:) = sum(M1(idxrng)); % Sum Of Rainfall Data (mm)
end
t_holdrain = 50.8; % Cutoff Threshold of Rainfall Data(mm)
t_holdhr = 51; % Cutoff Threshold of Hourly Rainfall(h)
y(x,:) = RF_Total(x,:);
z(x,:) = RF_Hours(x,:);
if y(y > t_holdrain)& z(z > t_holdhr) % Excluding rainfall greater than the threshold
end

Antworten (1)

Image Analyst
Image Analyst am 6 Mär. 2022
Try this:
y(x,:) = RF_Total(x,:);
z(x,:) = RF_Hours(x,:);
% Determine what rows we want to eliminate.
rowsToDelete = (y > t_holdrain) & (z > t_holdhr); % Excluding rainfall greater than the threshold
% Now remove them from y and z
y(rowsToDelete, :) = [];
z(rowsToDelete, :) = [];
  5 Kommentare
Queena Edwards
Queena Edwards am 8 Mär. 2022
M1 = readmatrix('Pevents.txt'); % Text File to Matrix
NaNv = find(isnan(M1)); % Numeric Indices Of 'NaN' Values
NaNv = [NaNv; size(M1,1)]; % Last Index (Instead Of Last 'NaN') Is The End Of The Vector
Events = 1:numel(NaNv)-1;
for x = Events
idxrng = NaNv(x)+2:NaNv(x+1)-1;
RF_Vector{x,:} = M1(idxrng); % Vector Of Rainfall Events (Between 'NaN' Elements)
RF_Hours(x,:) = numel(idxrng); % Number Of Hours In Each Event (h)
RF_Total(x,:) = sum(M1(idxrng)); % Sum Of Rainfall Data (mm)
end
Total_Hours = [ RF_Hours, RF_Total];
Okay i think it'll be easier to understand based on how i put it into a vector as Total_Hours.
If a row in column 1 is more than 51 or a row in column 2 is more than 50.8. I would like to remove the entire row.
Queena Edwards
Queena Edwards am 8 Mär. 2022
i got it thanksss

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by