Need to normalize time from 'find max' Tidal peaks within a natural cycle
Ältere Kommentare anzeigen
I have continuous (every 15 minutes) water level data from a tidal creek. I am no hydrographer. I am basing this on a method in K. Ellis et al (2017 Journal of South Carolina Water Resources). I am trying to process my tidal creek data to obtain accurate discharge. I deployed an instrument to measure discharge over a week and I have a rating curve that I can only use on HWS-normalized data.
I need to normalize time to high-water slack (HWS), which means detect the (max) high water mark every 9-14 hours (the tidal cycle time varies with wind).
What I was trying to do with Matlab give the initial high-water slack (HWS), because my water level data doesn't start at a peak, and then tell Matlab to find the next HWS 7-14 hours later (samples are every 15 minutes), so starting at 28 and ending at 56 cells after the last HWS index and I don't know how to do a moving window based on moving index of (max).
Ultimately, I need to make a new column of normalized time: time 0 (at high water), +0.25hrs, cum +0.25hr for each time step until the next HW (or 0)
There are 2 high waters and 2 high waters per lunar day- not a 24 hour cycle. Also of note... My average tidal cycle was 12.375 hrs... so 50 measurements
Sometimes the cycles are hard to detect, if there is a strong wind blowing the water out or keeping the water in. So I go with the 12.5 hour cycle as the default there.
Akzeptierte Antwort
Weitere Antworten (1)
William Fuller
am 29 Okt. 2019
0 Stimmen
I don't think this function is quite what you want but just in case --> the movmax function (there is also movmean and movvar for instance) is the simplest way to do a sliding window for the max value.
I would agree with Adam and use findpeaks, note that you'll need to code it as: [height, location] = findpeaks(data); if you want the location of the peak as well as the height value. Just doing findpeaks(data) will only return the height vector. Another helpful tip with findpeaks that I believe is relevant for you is to use the optional input argument minpeakdistance so you can force the function to ignore peaks occurring within a specified time of the last peak. In practice this would look like [height, location] = findpeaks(data,'minpeakdistance',40) if you wanted to eliminate all peaks within 10 hours (4 samples per hour * 10 hours). I would recommend checking out the findpeaks function documentation for clarification on, and examples of, the input/output arguments in practice.
1 Kommentar
The problem with movemax() is that it requires a fixed size of the moving window. Tidal data is typically cyclical which would make movemax() a decent option but due to rainfall, and the lunar cycle, the actual width of the sliding window may vary. Wind may add additional local maxima as well.
In addition to the minpeakdistance, you can also constrain the findpeaks algorithm by accept peaks that have a minimum prominence. Together, this approach is a bit more flexible than using a set window size.
A good idea might be to use both methods and compare the results.
Kategorien
Mehr zu Oceanography and Hydrology finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!