How to count wind direction by year

Hi.
I have daily data of wind direction from 1973 to 2013, and I want to make a loop that separates the data according to a certain wind direction (22.5-67.5 degrees) and then do a count every year. So that I will end up with a matrix with (2013-1973=) 40 values.
How can I do this in matlab?
Thanks in advance, Kristine

3 Comments

And what do your data look like?
This is the beginning of my data set:
1973 1 1 0 0 0 200.4
1973 1 2 0 0 0 247.08
1973 1 3 0 0 0 95.42
1973 1 4 0 0 0 86.67
1973 1 5 0 0 0 228
1973 1 6 0 0 0 155
1973 1 7 0 0 0 242.50
1973 1 8 0 0 0 156.96
1973 1 9 0 0 0 298.26
1973 1 10 0 0 0 276.36
So year, month, day, minute, second and wind direction

Sign in to comment.

 Accepted Answer

Assuming you have (or can create) an array that has column containing year and another for direction (I'll use w for the wind column and y for year)...
a) segregate the direction data from the rest--
ix=iswithin(wdir,22.5,67.5);
b) count by year
n=hist(y(ix),[1973:2013]);

13 Comments

Perfect, thank you!
Where did you find ‘iswithin’?
It’s not in the current online documentation.
Oh, it's one of my utilities, sorry...
function flg=iswithin(x,lo,hi)
% returns T for values within range of input
% SYNTAX:
% [log] = iswithin(x,lo,hi)
% returns T for x between lo and hi values, inclusive
flg= (x>=lo) & (x<=hi);
I forget it's not a TMW-supplied I've used it so long...
So, curious...how much variation is there in days of wind direction from year-to-year and where???
I figured so.
In my experience (private pilot) wind direction varies by altitude and season. Around here (flatland) it’s pretty much 220° at 10-20 kts most of the year at the surface, increasing in velocity with altitude. I imagine in Hawaii, (about N) with the prevailing easterlies (‘Trade Winds’) it’s less. Same with Tahiti, S at about the same longitude. Cyclones (low-pressure cells of various pressure and velocity magnitudes) and associated cold or occluded fronts would provide transient disruptions in the overall pattern. No guarantees in the lee of a mountain range like the Rockies or Sierras (in the U.S.). There, orographic influences take over for a few hundred km.
...Around here (flatland) it’s ...
What caught my eye/interest--here is "southwind" country (yesterday and today been good examples). Just was curious about an area that might have shifting prevalent winds and just where that might be...and particularly curious if there's either apparent cyclic or changing behavior over time...just got curious.
Much depends on the jet stream at different latitudes, but generally the prevailing surface winds don’t change much. If you want an idea of the prevailing winds in a particular area, look at the orientation of airport runways. They’re generally aligned with the prevailing surface winds. The runway numbers give the magnetic compass direction as: round(dir/10). Around here, the runway headings are 17-35, 4-22, and 3-21.
This is how I found the wind direction:
trade=find(22.5 < vinddata_mean_daily(:,7) & vinddata_mean_daily(:,7) < 67.5); trade_interval=vinddata_mean_daily(trade,:);
What I really needed help with was how to do the count, so the hist command worked out perfectly:)
Hawaii is located about 21°N. During summer the trade wind, blowing from NE-ENE, is pretty consistent but during winter time it gets more interupted by kona lows, low-pressure systems, fronts, etc. But my professor here at UH at Oahu thinks we are starting to see a decrease in trade wind days, and possibly an increase in kona wind days blowing from the SW.
But where is Flatland located?
dpb
dpb on 16 Jun 2014
Edited: dpb on 17 Jun 2014
US High Plains region east of the Rockies. We're SW KS; today is typical for spring/early summer. "Kansas" from the Kansa (Kaw) for "south wind people". At the moment it's 100 F, DP 22 F (RH 6%), 35 mph sustained, 45 mph gust. Will keep it up the rest of the day and will into tomorrow before the front arrives, finally.
...professor here at UH at Oahu thinks we are starting to see a decrease in trade wind days, and possibly an increase in kona wind days blowing from the SW.
I'd be curious to see if there's any correlation w/ La Nina and El Nino cycles. They make big differences here by shifting the jetstream predominant locations. El Nino leads to drought/heat, La Nina is more favorable by bring the jet farther west, closer to the eastern Rockies where it comes southward across US.
I actually looked at Kristine’s data with respect to ENSO and the North Pacific Decadal Oscillation, and from the information I could discover, there didn’t seem to be a clear correlation with trade wind days, at least visually. But then this is only an are of interest for me, not expertise.
According to The Guardian article of a few days ago ‘How El Niño will change the world's weather in 2014’, it’s supposed to make the Western U.S. wetter. We’re counting on it here ( 35° N, 106° W ).
So're we... 37N, 101W. Signs but so far still all the really good rains are N and E of us w/ some to the south--seems like there's a band here in the middle that just can't catch a break. As the old timers around here are wont to say, "well, it's a day closer!". We can only wait and hope. No winter crops and no spring crops planted either this or last year...
Kristine
Kristine on 19 Jun 2014
Edited: Kristine on 19 Jun 2014
Thank you for looking at my data, if you ever do want the full data set this is where I found it:
Hourly data at www.ncdc.noaa.gov:
Select Data Access
Select Quick Links under Data Access
Select Integrated Surface Data, Hourly, Global under Quick Links
Select ISD/CDO under Integrated Surface Database (ISD), Hourly, Global
Select Simplified Options
Interesting article. In Hawaii we might experience drought-like conditions, and we may also get bigger winter swells.
Cool! Thanks!

Sign in to comment.

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Asked:

on 13 Jun 2014

Commented:

on 19 Jun 2014

Community Treasure Hunt

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

Start Hunting!