Week 4 – Data Visualization

Concept: Simulating Brownian Motion

In this project of data visualization, I chose the data set about the wind directions at Hong Kong International Airport (HKIA) from 1997-2023. It is interesting from two aspects. Firstly, the airport and wind directions have a close relationship. The wind directions impact the operation of the airport. Secondly, the wind directions are random to some extent. It is a natural and random phenomenon even though it could be observed or predicted. This leads to another concept called Brownian Motion, describing the random motions of particles in fluids. This makes me think what it looks like if the winds are particles moving in the air. Therefore, I decided to simulate the Brownian Motion with the data.

Highlight of the code

Firstly, I extracted the wind direction data from the CSV file and store them in the array call angles[]

for (let rowNum = 0; rowNum < strings.length; rowNum++) {
    let angle = split(strings[rowNum], ",")[3];
    if (angle != "***") { // This skips the unavailable data in the file
      angles.push(angle);
    }
  }

Then, each point is a vector, and it adds with another vector which has the angle from the angles array. This simulates the movement of particles, which in this case following the wind directions

if (
    // if the point reaches the boundaries, it will start from a random place within 
    // the canavas
    startPoint.x >= width ||
    startPoint.y >= height ||
    startPoint.x < 0 ||
    startPoint.y < 0
  ) {
    startPoint = createVector(random(20, width), random(20, height));
  } else {
    startPoint.add(createVector(sin(angles[i]), cos(angles[i]))); // this makes the 
    // point turn according to the angles in the file
  }

Note that because at one location the overall direction of winds is consistent, the points will move out of the canvas if not constrained. Therefore, I wrote in the code that if the point went beyond the boundaries, it should move to a random place within the canvas and continue drawing.

Reflections and future improvements

For this data visulaztion project, I tried other ideas like particle fields or mapping, but eventually I think that stimulating the Brownian Motion with the wind direction data is much more interesting. It explores the relations between randomness, nature, and art making while visualizing the data. Therefore, I am satisfied with this project. However, some improvements or alternations could be made, such as smoother movements, better color selections, etc.

Leave a Reply