Mapping Global Temperatures

*NOTE – Images of Earth not to scale

I wanted to develop a streamlined method for plotting the 3D geo-spatial variations over time. I decided that a rotating globe showing temporal variation as it rotates was the best way to go (at least for global data). The primary steps are outlined and explained below, using a weekly dataset over one year.

  • Import mean temperature data
  • Map that data to an image
  • Wrap the image around a globe
  • Repeat this process iteratively over the desired time frame
  • Rotate the globe x amount for each iteration
  • Create animation

Data Import

Create a nodal grid of latitude and longitude, each in five-degree increments, and import weekly mean temperature data for each node.

data = Table[WeatherData[{i, j},
"MeanTemperature", {{2000, 1, 1}, {2000, 1, 365},"Week"}], {i, -90, 90, 5}, {j, -180, 180, 5}];

Map to Image

Generate a list density plot for the data. In this example we map the first week of mean temperature, remove plot range padding, and adjust the scale of the map to range from -25C to 35C for easier viewing.

plot=ListDensityPlot[Flatten[Table[Append[Table[{j, i}, {i, -90, 90, 5}, {j, -180, 180, 5}][[i, j]] // Flatten,
Table[data[[i, j]]["Values"][[1]], {i, 1, 37}, {j, 1, 73}][[i,
j]]]], {i, 1, 37}, {j, 1, 73}], 1], AspectRatio -> 1/2,
Frame -> False, ColorFunction ->(ColorData["TemperatureMap"][Rescale[#, {-25, 35}]] &),
PlotRangePadding -> 0]

Before I mapped the temperature plots to the globe, I overlayed each image with a country border plot to give some context to the animation.

Wrap to Sphere

For all weeks, rasterize each temperature density plot and wrap it around a sphere. This example would use the plot generated in the previous step

globe=ParametricPlot3D[{Cos[u] Sin[v], Sin[u] Sin[v], Cos[v]}, {u, 0,2 Pi}, {v, 0, Pi}, Mesh -> None, PlotPoints -> Automatic,
TextureCoordinateFunction -> ({#4, 1 - #5} &), Boxed -> False,
PlotStyle ->Texture[Show[Rasterize[plot],
ImageSize -> 1000]], Lighting -> "Neutral", Axes -> False,
RotationAction -> "Clip",ViewPoint -> {-2.026774, 2.07922, 1.73753418}, ImageSize -> 600,
PlotRangePadding -> None]

Sphere Rotation

Having generated a globestable (is it globes table or globe stable?) of all desired spheres, rotate each successive sphere incrementally (by Pi/26 in this case) to generate frames for the animation.

RotationMatrix[i*Pi/26, {0, 0, 1}]]}, Boxed -> False,
ViewPoint -> Front, ImageSize -> 500, Lighting -> "Neutral"], {i, 1,

Final Product

One thought on “Mapping Global Temperatures

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: