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 commentaires

José-Luis
José-Luis le 13 Juin 2014
And what do your data look like?
Kristine
Kristine le 16 Juin 2014
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
Kristine
Kristine le 16 Juin 2014
So year, month, day, minute, second and wind direction

Connectez-vous pour commenter.

 Réponse acceptée

dpb
dpb le 14 Juin 2014
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 commentaires

Kristine
Kristine le 14 Juin 2014
Perfect, thank you!
Star Strider
Star Strider le 14 Juin 2014
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...
dpb
dpb le 14 Juin 2014
So, curious...how much variation is there in days of wind direction from year-to-year and where???
Star Strider
Star Strider le 14 Juin 2014
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.
dpb
dpb le 14 Juin 2014
...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.
Star Strider
Star Strider le 14 Juin 2014
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.
Kristine
Kristine le 16 Juin 2014
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 le 16 Juin 2014
Modifié(e) : dpb le 17 Juin 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.
Star Strider
Star Strider le 17 Juin 2014
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 ).
dpb
dpb le 17 Juin 2014
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 le 19 Juin 2014
Modifié(e) : Kristine le 19 Juin 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.
Star Strider
Star Strider le 19 Juin 2014
Cool! Thanks!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Programming dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by