Normalized Wind Rose Plot help

조회 수: 5 (최근 30일)
Douglas Leaffer
Douglas Leaffer 2023년 6월 22일
댓글: Star Strider 2023년 12월 22일
I am trying to generate a normalized (to the max) wind rose plot of air pollutant concentration (UFP) by wind direction. See photo below. A data vector is attached. The simple code: polarplot(N.WD_Deg,N.UFPConc) doesn't generate what I want. Any help is appreciated. Thank you
load winddata.mat
polarplot(N.WD_Deg,N.UFPConc)
  댓글 수: 4
Douglas Leaffer
Douglas Leaffer 2023년 6월 24일
이동: VBBV 2023년 6월 25일
Thank you VBBV and Star Strider. Both of your suggested codes worked for me - but I can't seem to rotate the compass points to have 0 at the top and then clockwise ticks, with 90 deg at right, 180 at bottom and 270 at left. Is there a simple programmatic fix for this?
E. Cheynet
E. Cheynet 2023년 6월 25일
For the direction with meteorological conventions, you can simply give a new direction newD = 90-oldD

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

채택된 답변

Star Strider
Star Strider 2023년 6월 23일
Perhaps something like this —
LD = load('winddata.mat');
N = LD.N;
N.WD_Rad = deg2rad(N.WD_Deg) % Add Radian Variable (For Convenience, Since 'polarplot' Requires It)
N = 133872×4 table
WD_Deg WS UFPConc WD_Rad ______ ______ _______ ______ 30 25.927 0.11886 0.5236 30 25.927 0.13314 0.5236 30 25.927 0.16629 0.5236 30 25.927 0.15657 0.5236 30 25.927 0.15257 0.5236 30 25.927 0.15486 0.5236 30 25.927 0.12457 0.5236 30 25.927 0.12457 0.5236 30 25.927 0.15829 0.5236 30 25.927 0.13657 0.5236 30 25.927 0.124 0.5236 30 25.927 0.108 0.5236 30 25.927 0.10343 0.5236 30 25.927 0.12914 0.5236 30 25.927 0.18229 0.5236 30 25.927 0.19371 0.5236
[UDir,ix,iv] = unique(N.WD_Rad); % Unique Radian Values & Indices (Sorted)
Concv = accumarray(iv, (1:numel(iv)).', [], @(x)numel(N.UFPConc(x))); % Accumulate Count Values Of 'UFPConc' By Direction (Use 'numel' To Count Occurrences)
[sDir, sConc] = stairs(UDir, Concv); % Return 'stairs' Stepwise Result
figure
polarplot(sDir, sConc) % Plot 'stairs' Stepwise Result
figure
polarplot(UDir, Concv) % Plot Continuous Result
figure
polarhistogram(N.WD_Rad, UDir) % Plot Using 'polarhistogram'
Make appropriate changes to get the result you want.
Using the accumarray function, it is possible to get other parameters of the concentration, such as the mean or median values, as well as standard deviations (std and metrics derived from it, such as confidence intervals) and plot them also using the patch function (although that is more complicated and requires calculating them in polar coordinates and then using the pol2cart function first, and plotting them in Cartesian coordinates), not only the counts.
.
  댓글 수: 4
Douglas Leaffer
Douglas Leaffer 2023년 6월 24일
Excellent. It worked fine. Thank you
Star Strider
Star Strider 2023년 6월 24일
As always, my pleasure!

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

추가 답변 (1개)

Douglas Leaffer
Douglas Leaffer 2023년 12월 22일
Hello, it seems the plots generated from these suggested answers are not what I need. I need a normalized [0 1] wind rose of UFP (air pollution particle) by wind degree sector, as show in these 3 examples. My dataset is attached. The code I ran is given below. I could use some more help if anyone is able. Thank you.
load CR_1hr_wind.mat
NC = normalize(CT1,"norm",Inf,"DataVariables","UFPConc");
NC.WD_Rad = deg2rad(NC.WD_Deg) % Add Radian Variable (For Convenience, Since 'polarplot' Requires It)
[UDir,ix,iv] = unique(NC.WD_Rad); % Unique Radian Values & Indices (Sorted)
Concv = accumarray(iv, (1:numel(iv)).', [], @(x)numel(NC.UFPConc(x))); % Accumulate Count Values Of 'UFPConc' By Direction (Use 'numel' To Count Occurrences)
%[sDir, sConc] = stairs(UDir, Concv); % Return 'stairs' Stepwise Result
%figure
%polarplot(sDir, sConc)
figure
%subplot (121)
polarplot(UDir, Concv, 'LineWidth', 4) % Plot Continuous Result
Ax = gca;
Ax.ThetaZeroLocation = 'top';
Ax.ThetaDir = 'clockwise';
  댓글 수: 3
Douglas Leaffer
Douglas Leaffer 2023년 12월 22일
That seems to be more of what I need. Thanks again
Star Strider
Star Strider 2023년 12월 22일
As always, my pleasure!

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

카테고리

Help CenterFile Exchange에서 Geographic Plots에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by