Visualizing Wind Direction
at Your Place

Outline:

1) Setting Geographics Location

2) Get Wind Direction Data

3) Organize the Data

4) Visualize the Information

Introduction

About the tutorial

1) Setting Geographics Location

Find out our current coordinate
note: make sure we have stable internet connection

FindGeoLocation[]

GeoGraphics[FindGeoLocation[]]

Assign our location to a new unique name as reference

mylocation=FindGeoLocation[];

?mylocation

More about FindGeoLocation

?FindGeoLocation

Other specific location based on coordinate

?GeoPosition

2) Get Wind Direction

Our location

mylocation

Get the wind direction

WeatherData[mylocation,"WindDirection"]

Get wind direction data for the set of time

WeatherData[
mylocation,
"WindDirection",
{{2016,9},{2017,9}}]

Assign this set of wind direction data to new unique name

windDirection=WeatherData[
mylocation,
"WindDirection",
{{2016,9},{2017,9}}];

Plot the data

DateListPlot[windDirection]

3) Organize the Data

From dataset with date to histogram plot

Define chart element function that stores bin width and count data using Sow

sowingBar[{{x0_,x1_},{y0_,y1_}},__]:=(
Sow[{x1-x0,100(y1-y0)}];
Rectangle[{x0,y0},{x1,y1}])

Create a histogram of wind directions, and store the bin width and frequencies

{histogramPlot,directiveValue}=Reap[
Histogram[
windDirection,Automatic,"Probability",
ChartElementFunction->sowingBar]]

Check

histogramPlot

directiveValue

4) Visualize the Information

Histogram and list of data

histogramPlot

directiveValue

Create polar histogram of the wind direction frequencies

SectorChart[
directiveValue,
SectorOrigin->{(π/2),"Clockwise"},
PolarAxes->True,PolarGridLines->Automatic,
PolarTicks->{"Direction",Automatic}]

Assign this polar histogram to new unique name

polarHistogram=SectorChart[
directiveValue,
SectorOrigin->{(π/2),"Clockwise"},
PolarAxes->True,PolarGridLines->Automatic,
PolarTicks->{"Direction",Automatic}]

Show the polar histogram on the map of our location

GeoGraphics[
GeoMarker[
FindGeoLocation[],
polarHistogram,
"Scale"->Offset[250]]]

SetOptions[EvaluationNotebook[],ShowGroupOpener->False]