How to band pass wind data then use quiver correctly?
8 次查看(过去 30 天)
显示 更早的评论
Hi everyone,
I have an hourly resolution wind dataset contains dates, wind speed, and wind direction (come from). I would like to apply a 2 - 7 days band pass filter then quiver it to get a timeseries of the wind magnitude.
Portion of my dataset as .mat files:
date:
734417.666666667
734417.708333333
734417.750000000
734417.791666667
734417.833333333
734417.875000000
734417.916666667
734417.958333333
734418
734418.041666667
WindSpeed:
11.2000000000000
11.4000000000000
12
11.4000000000000
12.1000000000000
11.9000000000000
11.2000000000000
11.7000000000000
15.1000000000000
15.5000000000000
WindDirection:
276
271
267
260
256
261
275
283
281
This is the code I used to band pass filter the wind data and then quiver it:
wind7S= windHr.WindSpeed- pl33tn(windHr.WindSpeed,1,168);
wind27S= pl33tn(wind7S,1,48);
HrDir = deg2rad(windHr.WindDirection -180); % change the direction to 'blow towards'
U_hr = wind27S .* cos(HrDir); % Eastward
V_hr = wind27S .* sin(HrDir); % Northward
U_7day = U_hr - pl33tn(U_hr, dt, 168);
V_7day = V_hr - pl33tn(V_hr, dt, 168);
U_bp27 = pl33tn(U_7day, dt, 48);
V_bp27 = pl33tn(V_7day, dt, 48);
quiver(datenum(date), zeros(size(date)), U_bp27, V_bp27);
However, when I plot the quiver for the band pass filtered data and the original data, I have a plot like this:
It confuses me of why the band pass filtered quiver look so different than the hourly resolution. Is it suppose be to the right plot for me to identify any weather events or anyone has ideas on how to fix it if it is not correct? Thanks!
1 个评论
Umar
2024-6-14
My comments are listed below. Hope this will help to figure out solution to your problem.
To address the discrepancy between the band-pass filtered quiver plot and the original hourly resolution data plot, several factors need consideration. Let's delve into potential reasons for the observed differences and explore ways to enhance the visualization for better interpretation.
1. Band-Pass Filtering Parameters
The band-pass filter parameters (e.g., filter length, cutoff frequencies) play a crucial role in shaping the filtered output. Ensure that the parameters used in the pl33tn function align with the desired band-pass characteristics. Adjusting these parameters might help in obtaining a more representative filtered signal.
2. Data Preprocessing
Before applying the band-pass filter, preprocess the data to handle any outliers, missing values, or inconsistencies that could affect the filtering process. Ensure data integrity and quality to improve the accuracy of the filtered results.
3. Quiver Plot Scaling
The scaling of the quiver plot vectors can impact the visual representation of wind magnitude. Check the scaling factors applied to the quiver plot (U_bp27 and V_bp27) to ensure they accurately reflect the magnitude and direction of the wind after filtering. Adjusting the scaling factors might align the quiver plot with the expected wind behavior.
4. Plot Interpretation
Consider the interpretation of the quiver plot in the context of wind patterns and weather events. The band-pass filtered data may emphasize specific frequency components of the wind signal, potentially highlighting variations that are not as prominent in the original hourly data. Understanding the characteristics of the filtered signal is essential for meaningful interpretation.
5. Visualization Enhancement
To improve the visual clarity and interpretability of the quiver plot, experiment with different plotting styles, color schemes, or overlays. Adding annotations, legends, or reference lines can provide additional context to the plot, aiding in the identification of weather events or patterns.
By revisiting the band-pass filtering parameters, ensuring data quality, adjusting plot scaling, interpreting the filtered signal, and enhancing visualization techniques, you can refine the quiver plot representation of the band-pass filtered wind data. These steps can help you achieve a more informative and visually appealing visualization that facilitates the identification and analysis of wind patterns over time.
回答(1 个)
UDAYA PEDDIRAJU
2024-8-19
Hi Lang,
The data you provide is insufficient to replicate your problem my side, but possibly you could rectify the problem with the following solutions.
- Filter Implementation: Ensure the "pl33tn" function is correctly implementing a band-pass filter. Verify its frequency response. Consider using built-in MATLAB functions like "filtfilt" for more reliable filtering.
- Scaling: The magnitude of the filtered data might be significantly different from the original. Normalize the data to compare visually. Adjust the "quiver" scale using the "scale" parameter in the "quiver" function.
- Data Units: Check the units of your wind speed and direction data. Inconsistent units can lead to incorrect quiver plots.
- Time Series: Verify that the time series data is aligned correctly before applying the filter and creating the quiver plot.
here's a snippet template this might help you with proper initialization and setup.
Note: I assumed the data as complete details are not available to me from your side.
date = [734417.666666667, 734417.708333333, 734417.750000000, 734417.791666667, ...
734417.833333333, 734417.875000000, 734417.916666667, 734417.958333333, ...
734418, 734418.041666667];
WindSpeed = [11.2, 11.4, 12, 11.4, 12.1, 11.9, 11.2, 11.7, 15.1, 15.5];
WindDirection = [276, 271, 267, 260, 256, 261, 275, 283, 281, 282];
% Calculate time step
dt = mean(diff(date));
% Convert wind direction to radians (blowing towards)
HrDir = deg2rad(WindDirection - 180);
% Ensure WindSpeed and HrDir are column vectors
WindSpeed = WindSpeed(:);
HrDir = HrDir(:);
% Calculate U and V components
U_hr = WindSpeed .* cos(HrDir);
V_hr = WindSpeed .* sin(HrDir);
% Band-pass filter
fs = 1/dt; % Sampling frequency
[b, a] = butter(1, [2/(fs/2) 7/(fs/2)], 'bandpass');
U_bp = filtfilt(b, a, U_hr);
V_bp = filtfilt(b, a, V_hr);
% Create quiver plot
quiver(date, zeros(size(date)), U_bp', V_bp');
documentation reference for filtfilt: https://www.mathworks.com/help/signal/ref/filtfilt.html?searchHighlight=filtfilt&s_tid=srchtitle_support_results_1_filtfilt
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Vector Fields 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!