Weather Heatmaps: Sound Waves

Introduction

After I finished my Pregnancy Weather Heatmap, I wanted to create a different style. My goal was to stitch a weather heatmap with annual weather data that was inclusive of my entire immediate family. I sketched out a few visualizations and eventually settled upon one that resembled a sound wave. I began this journey with Excel, but did eventually translate the setup into R code and launched it as a product in my Etsy shop.

These are the steps each heatmap goes through when a customer orders a pattern. In order to protect my intellectual property, I am purposely showing the result without including the code.

STEP ONE

Gather the necessary data. This is provided by the customer when they order the pattern on Etsy.

Year space ZIP code
1977 space 22553

STEP TWO

Determine the closest weather station, using Open Street Map and the National Oceanic and Atmospheric Administration's API. In urban areas, there are several weather stations so it is easier to find one nearby. In more rural settings (such as this one), the weather station may be further away.

Closest stations
FREDERICKSBURG NP (16.4 miles)
CORBIN (17.3 miles)

STEP THREE

Pull the closest station's weather data for the requested time period from the NOAA (only the head is shown here). This lists the high and low temperature for all the dates listed in step 1 for the weather station in step 2.

Date Station ID Station name Max Min
1977-01-01 USC00443192 FREDERICKSBURG NP (16.4 miles) 30 12
1977-01-02 USC00443192 FREDERICKSBURG NP (16.4 miles) 39 10
1977-01-03 USC00443192 FREDERICKSBURG NP (16.4 miles) 33 18
1977-01-04 USC00443192 FREDERICKSBURG NP (16.4 miles) 30 12
1977-01-05 USC00443192 FREDERICKSBURG NP (16.4 miles) 32 11
1977-01-06 USC00443192 FREDERICKSBURG NP (16.4 miles) 32 14

STEP FOUR

Assign colors to the temperatures. I used the same color mapping as with my Pregnancy Heatmap.

Since every geography is different, the actual temperature for any given color will vary from heatmap to heatmap. For instance, this heatmap example is for Virginia. The coldest color (dark purple) is -4 degrees Fahrenheit and the warmest color (dark red) is 105 degrees. If I created a heatmap in Texas which had a minimum temperature of 20 and a high of 120, then 20 would be dark purple and 120 would be dark red (and 95 might be orange).

Note: hex colors do not match exactly to the color of the embroidery floss, they are approximations.
plot of chunk unnamed-chunk-12

STEP FIVE

Create the heatmap. Each column is a day. Some days have a small temperature range and some have a large temperature range. Those with a small range will have fewer colors represented in the column AND will have a narrower height (vice versa for large ranges).

The code used here sets up the low to high temps, varies the height of the wave by day, and assigns a symbol that represents what DMC color to stitch with. For brevity, I'm displaying the first 50 rows.

¥
Δ
& Δ
&
y
y
# t
# d f
s d f
^ s # f
e @ % m # f y
e x % m m # # # s & # y
e ^ x @ m e # # # s & f # t
s e ^ c @ e t e s s y s m n f n s d
s ^ % c x e d ^ s s y s m m n n s d
m ^ % @ r @ x ^ d ^ m m t m e e # n y y m
m % @ x l x c e e ^ % m m # # d m e e # n y y n e m
e % @ x l x c e e % % e e s # d e ^ ^ s y t t n e e &
e @ x c b c r ^ ^ % & @ e e s s t e ^ ^ s y d n d y ^ e &
^ @ x c b c l ^ ^ @ & @ ^ ^ m s d ^ % % m t d n d y ^ ^
^ x c r k r l % % @ x ^ ^ m m & d & ^ % % m d y f t % ^
% ^ x c l k l b % % x x % % ^ e m & % @ @ e d y d % % #
% % c r l # i l b @ @ e x # c % ^ % ^ e e % @ @ e & t & d @ % #
@ % c l b # i b k @ @ e c & # c @ ^ @ % ^ e & # @ x x ^ & d & @ @ s
% @ % @ ^ r l b s a b k x x ^ c s r @ % @ % ^ ^ # & # @ x x ^ & d m x @ s
@ x @ @ % l b k s a k i x x ^ r s l x % x @ % ^ # s x c c % & n & m x x m
@ x @ x % l # b k m 9 k i c c % l s # m l x @ x @ % % s s x c c % # n # & e c x m
x c ^ x x @ # b s k i m 9 i a c c % l m & # m b c @ c x @ % s # m c r r @ # & y # e c c e
x c ^ x c @ s b ^ s k i e 8 i a r r @ b m s e b c x c x @ @ m # m c l l @ # s & y s ^ r c e
c r % c c x s k ^ m i a e 8 a 9 l l @ b e s & e k r x r c x @ m s e r l l x # s t s # ^ l r ^
c l % c r x m k % m i a ^ 7 a 9 l l x k e # m ^ k l c l c x x e s e l b b x s m d m # % l l ^
r l @ r l c m i % e a 9 ^ 7 9 8 b b x k ^ # m ^ i l c l r c x e m ^ l b b c s m # d m s % b l %
l b @ l l c e i @ e a 9 % 6 9 8 b b c i ^ s e # % i b r b l c c ^ m ^ b k k c m e # e s @ b b %
l b x l b r e a @ ^ 9 8 % % 6 8 7 k k c i % s e # % a b l b l r c ^ e % b k k r m e s e m @ k b @
b k x b b l ^ a x ^ 9 8 @ % 5 8 7 k k r a % m ^ s @ a k l k b l r % e % k i i l e ^ s & ^ m x k k @
b k c b k l ^ 9 x % 8 7 @ @ 5 7 6 i i l a @ m ^ s @ 9 k b k b l l % ^ @ k i i l e ^ m & ^ e x i k x
k i c k k b % 9 c % 8 7 x @ 4 7 6 i i l 9 @ e % m x 9 i b i k b l @ ^ @ i a a b ^ % m % e c i i x
k i r k i b % 8 c @ 7 6 x x 4 6 5 a a b 9 x e % m x 8 i k i k b b @ % x i a a b ^ % e % ^ c a i c
i a l i i k @ 8 r @ 7 6 c x 3 6 5 a a b 8 x ^ @ e c 8 a k a i k b x % x a 9 9 k % @ e # @ ^ r a a c
i a l i a k @ 7 l x 6 5 c c 3 5 4 9 9 k 8 c ^ @ e c 7 a i a i k k x @ c a 9 9 k % @ ^ # @ % l 9 a r
a 9 b a a i x 7 l x 6 5 r c 2 5 4 9 9 k 7 c % x ^ r 7 9 i 9 a i k c @ c 9 8 8 i @ x ^ s x % l 9 9 l
a 9 b a 9 i x 6 b c 5 4 l r 2 4 3 8 8 i 7 r % x ^ l 6 9 a 9 a i i c x r 9 8 8 i @ x % s x @ b 8 9 l
9 8 k 9 9 a c 6 b c 5 4 l l 1 4 3 8 8 i 6 l @ c % l 6 8 a 8 9 a i r x l 8 7 7 a x c % m c @ b 8 8 b
9 8 k 9 9 a c 6 b c 5 4 l l 1 4 3 8 8 i 6 l @ c % l 6 8 a 8 9 a i r x l 8 7 7 a x c % m c @ b 8 8 b
a 9 b a 9 i x 6 b c 5 4 l r 2 4 3 8 8 i 7 r % x ^ l 6 9 a 9 a i i c x r 9 8 8 i @ x % s x @ b 8 9 l
a 9 b a a i x 7 l x 6 5 r c 2 5 4 9 9 k 7 c % x ^ r 7 9 i 9 a i k c @ c 9 8 8 i @ x ^ s x % l 9 9 l
i a l i a k @ 7 l x 6 5 c c 3 5 4 9 9 k 8 c ^ @ e c 7 a i a i k k x @ c a 9 9 k % @ ^ # @ % l 9 a r
i a l i i k @ 8 r @ 7 6 c x 3 6 5 a a b 8 x ^ @ e c 8 a k a i k b x % x a 9 9 k % @ e # @ ^ r a a c
k i r k i b % 8 c @ 7 6 x x 4 6 5 a a b 9 x e % m x 8 i k i k b b @ % x i a a b ^ % e % ^ c a i c
k i c k k b % 9 c % 8 7 x @ 4 7 6 i i l 9 @ e % m x 9 i b i k b l @ ^ @ i a a b ^ % m % e c i i x
b k c b k l ^ 9 x % 8 7 @ @ 5 7 6 i i l a @ m ^ s @ 9 k b k b l l % ^ @ k i i l e ^ m & ^ e x i k x
b k x b b l ^ a x ^ 9 8 @ % 5 8 7 k k r a % m ^ s @ a k l k b l r % e % k i i l e ^ s & ^ m x k k @
l b x l b r e a @ ^ 9 8 % % 6 8 7 k k c i % s e # % a b l b l r c ^ e % b k k r m e s e m @ k b @
l b @ l l c e i @ e a 9 % 6 9 8 b b c i ^ s e # % i b r b l c c ^ m ^ b k k c m e # e s @ b b %
r l @ r l c m i % e a 9 ^ 7 9 8 b b x k ^ # m ^ i l c l r c x e m ^ l b b c s m # d m s % b l %
c l % c r x m k % m i a ^ 7 a 9 l l x k e # m ^ k l c l c x x e s e l b b x s m d m # % l l ^
c r % c c x s k ^ m i a e 8 a 9 l l @ b e s & e k r x r c x @ m s e r l l x # s t s # ^ l r ^
x c ^ x c @ s b ^ s k i e 8 i a r r @ b m s e b c x c x @ @ m # m c l l @ # s & y s ^ r c e
x c ^ x x @ # b s k i m 9 i a c c % l m & # m b c @ c x @ % s # m c r r @ # & y # e c c e
@ x @ x % l # b k m 9 k i c c % l s # m l x @ x @ % % s s x c c % # n # & e c x m
@ x @ @ % l b k s a k i x x ^ r s l x % x @ % ^ # s x c c % & n & m x x m
% @ % @ ^ r l b s a b k x x ^ c s r @ % @ % ^ ^ # & # @ x x ^ & d m x @ s
@ % c l b # i b k @ @ e c & # c @ ^ @ % ^ e & # @ x x ^ & d & @ @ s
% % c r l # i l b @ @ e x # c % ^ % ^ e e % @ @ e & t & d @ % #
% ^ x c l k l b % % x x % % ^ e m & % @ @ e d y d % % #
^ x c r k r l % % @ x ^ ^ m m & d & ^ % % m d y f t % ^
^ @ x c b c l ^ ^ @ & @ ^ ^ m s d ^ % % m t d n d y ^ ^
e @ x c b c r ^ ^ % & @ e e s s t e ^ ^ s y d n d y ^ e &
e % @ x l x c e e % % e e s # d e ^ ^ s y t t n e e &
m % @ x l x c e e ^ % m m # # d m e e # n y y n e m
m ^ % @ r @ x ^ d ^ m m t m e e # n y y m
s ^ % c x e d ^ s s y s m m n n s d
s e ^ c @ e t e s s y s m n f n s d
e ^ x @ m e # # # s & f # t
e x % m m # # # s & # y
e @ % m # f y
^ s # f
s d f
# d f
# t
y
y
&
& Δ
Δ
¥

STEP SIX

Convert the data frame into the PDF cross-stitch pattern deliverable. Standard practice in cross-stitch patterns is to grid the pattern in 10x10 squares over however many pages it takes to present the entire pattern. The grey line is added down the middle of the pattern to make it easier for the stitcher to orient themselves while stitching.

test.JPG

THE FINISHED RESULT