# 5 Day Weather Forecast

Weather forecasting: Wrong too often to rely on, right too often to ignore.

Given a high and low temperature and one of four weather conditions per day, output an ASCII-art graphical five day weather forecast. The structure of the four graphical indicators are shown below.

 \ /
-O-       Sunny
/ \

\ /
-O(==)     Partly Cloudy
(====)

(==)     Cloudy
(====)

(==)
(====)     Rainy
/////


The forecasting chart is as follows: each graphical indicator is centered in its own 9x5 box, with 5 boxes across the chart. Each box is separated by | characters. Below the graphical indicator is a three-letter abbreviation for the day of the week (MON, TUE, WED, THU, FRI, SAT, SUN) centered in its own 9x1 box. The temperatures are below the day of the week centered in their own 9x2 box. An example is shown below.

---------------------------------------------------
|         |         |         |         |         |
|    (==) |    (==) |  \ /    |   \ /   |   \ /   |
|  (====) |  (====) |  -O(==) |   -O-   |   -O-   |
|         |  /////  |  (====) |   / \   |   / \   |
|         |         |         |         |         |
---------------------------------------------------
|   MON   |   TUE   |   WED   |   THU   |   FRI   |
---------------------------------------------------
|  H 75   |   H 69  |  H 77   |   H 80  |  H 85   |
|  L 57   |   L 53  |  L 61   |   L 63  |  L 66   |
---------------------------------------------------


Note that "centered" can be taken loosely -- see in the example how the graphical alignment and the temperature horizontal alignment are somewhat flexible.

Additionally, since I'm from the US and therefore use Fahrenheit, you can safely assume that the temperatures are all double-digit, so 9 < t < 100.

### I/O and Rules

The I/O examples here are demonstrative of the above example chart.

• Input can be taken in any reasonable format and by any convenient method. For example,
1) you could use numbers for the days of the week, the high and low temperatures, and the four conditions, and take input as five tuples, like [0, 75, 57, 2], [1, 69, 53, 3], ...
2) you could take input as five tuples using words, like ['MON', 75, 57, 'CLOUDY'], ['TUE', 69, 53, 'RAINY'] ...
3) you could take input as just the first day, and a list of high temperatures, a list of low temperatures, and a list of conditions, like 1, [75, 69, ...], [57, 53, ...], [2, 3, ...]
4) etc.

• Leading/trailing newlines or other whitespace are optional, provided that the characters line up appropriately.

• Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.
• Output can be to the console, returned as a list of strings, returned as a single string, etc.
• Standard loopholes are forbidden.
• This is so all usual golfing rules apply, and the shortest code (in bytes) wins.
• -1 for using °F ಠ_ಠ Feb 2, 2018 at 18:04
• -1 for making this not work for my state in the USA (it's 9° F today). Feb 2, 2018 at 18:07
• @MagicOctopusUrn I guess programs which work also outside this range are also accepted. Feb 2, 2018 at 23:31

# Emojicode, 1202 974 bytes

🍇a🍨🐚🍨🐚🚂🍮f🔷🍨🐚🍨🐚🔡🐸🍦D🍨🔤 MON  🔤🔤 TUE  🔤🔤 WED  🔤🔤 THU  🔤🔤 FRI  🔤🔤 SAT  🔤🔤 SUN  🔤🍆🍮f🍨🍨🔤 / \  🔤🔤 \ /  🔤🔤 -O-  🔤🍆🍨🔤(====)🔤🔤\ /   🔤🔤-O(==)🔤🍆🍨🔤      🔤🔤  (==)🔤🔤(====)🔤🍆🍨🔤///// 🔤🔤  (==)🔤🔤(====)🔤🍆🍆🍦l🔤 ---------------------------------------------------🔤🍦u🔤      🔤🍦s🔤 |  🔤🍦S🔤  |   🔤🍦w🍨🔤🔤🔤🔤🔤H 🔤🔤L 🔤🍆😀l🍦L🍪s u s u s u s u s u s🍪😀L🍮o🔤🔤🔂i⏩-2 4🍇🍮o s🍊◀️1i🍇🍮o🍪s🔤 🔤🍪🍉🔂j⏩0 5🍇🍊▶️1i🍇🍮o🍪o🍺🐽🍺🐽f🍺🐽🍺🐽a j 0i s🍪🍉🍋◀️1i🍇🍮o🍪o🍺🐽w i🔡🍺🐽🍺🐽a j i 10S🍪🍉🍓🍇🍮o🍪o🍺🐽D🍺🐽🍺🐽a j 1 s🍪🍉🍉😀o🍊🎉😛0i😛1i🍇🍊😛0i🍇😀L🍉😀l🍉🍉😀l🍉


Takes input as a list of lists of integers in the format of condition day high low where condition is an integer between 0 and 4. Try it online!

# JavaScript (ES8), 304263 222 bytes

Takes input as an array of 5 [w,d,h,l] entries, where d is the day as a string and w, h, l are integers representing the weather (0-indexed, with 0 = sunny), high temperature and low temperature respectively. Returns an array of strings.

a=>',0,04,05,06,0,,01,,0H 2,0L 3,'.split,.map(s=>(s=a.map(p=>s.replace(/\d/g,n=>+n?p[n]||'  (==),(====),/////,\\ /,-O(==), \\ /, -O-, / \\,'.split,['765143810210'[p*3-n+6]]:'|  ').padEnd(10,' -'[+!s])).join)+s)


### Demo

let f =

a=>',0,04,05,06,0,,01,,0H 2,0L 3,'.split,.map(s=>(s=a.map(p=>s.replace(/\d/g,n=>+n?p[n]||'  (==),(====),/////,\\ /,-O(==), \\ /, -O-, / \\,'.split,['765143810210'[p*3-n+6]]:'|  ').padEnd(10,' -'[+!s])).join)+s)

O.innerText =
f([
[2,'MON',75,57],
[3,'TUE',69,53],
[1,'WED',77,61],
[0,'THU',80,63],
[0,'FRI',85,66]
]).join('\n');
<pre id=O></pre>

### How?

We define:

• L = ',0,04,05,06,0,,01,,0H 2,0L 3,'.split(',')

An array of strings describing each line of the board, in which:

• 0 = prefix string: "| "
• 1 = day of week
• 2 = high temperature
• 3 = low temperature
• 4 = top pattern of the graphical indicator
• 5 = middle pattern of the graphical indicator
• 6 = bottom pattern of the graphical indicator
• W = ' (==),(====),/////,\\ /,-O(==), \\ /, -O-, / \\,'.split(',')

An array of strings describing the patterns of the graphical indicators.

• P = '765143810210'

A string describing the indices of the patterns in W for each graphical indicator, grouped by 3 and stored in reverse order.

The main function now reads as:

a => L.map(s =>                   // for each substring s in L
(s = a.map(p =>                 //   for each array of parameters p in a:
s.replace(                    //     replace in s
/\d/g, n =>                 //       each digit n with:
+n ?                      //         if n is non-zero:
p[n] ||                 //           the n-th parameter in p, if defined
W[P[p * 3 - n + 6]]  //           or a graphical indicator pattern
:                         //         else:
'|  '                   //           the prefix string '|  '
)                             //     end of replace()
.padEnd(10, ' -'[+!s])        //     pad the result with either spaces or '-'
).join)                       //   end of inner map(); join the results and save in s
+ s                          //   append the first character
)                                 // end of outer map()


# Charcoal, 110 94 bytes

↑χＦ⁵«Ｎθ↘→↘Ｐ⎇θ⁺⁺⎇⊖θ  ¦\ /¶-o“⎇)Ｄ№⸿≡⬤»”×/×⁵⁼θ³“2⸿φ*ＥＣ+@OΠ≦”Ｍ¹¦⁵ＰＳ¶¶ＥHL⁺⁺κ ＳＭ⁶±¹↑χ»Ｆ6231«Ｐ←⁵¹ＭＩι↓


Try it online! Link is to verbose version of code. Edit: Saved 16 bytes by avoiding repeating the cloud. Explanation:

↑χ


Print the left-hand column of |s.

Ｆ⁵«


Loop over the 5 days.

Ｎθ


Input the weather condition, numbered 0 to 3 using the same order as the question.

↘→↘Ｐ⎇θ


If the weather condition is not sunny:

⁺⁺⎇⊖θ  ¦\ /¶-o


If the weather condition is partly cloudy then print a partial sun.

“⎇)Ｄ№⸿≡⬤»”


Print a cloud.

×/×⁵⁼θ³


If the weather is rain then print it.

“2⸿φ*ＥＣ+@OΠ≦”


Otherwise print the sun.

Ｍ¹¦⁵ＰＳ


¶¶ＥHL⁺⁺κ Ｓ


Loop over and input and print the temperatures.

Ｍ⁶±¹↑χ»


Print the next column of |s.

Ｆ6231«


Loop over the characters 6, 2, 3 and 1.

Ｐ←⁵¹


Print a row of -s.

ＭＩι↓


Cast the character to integer and move ready to print the next row.

# Python 3, 636610534464 379 bytes

def w(s,l,h,a):
g='|';A='   ';p,q,r=[A+'\ /'+A,'  \ / '+A,A+' (==) ',A+' (==) '],[A+'-O-'+A,'  -O(==) ','  (====) ','  (====) '],[A+'/ \\'+A,'  (====) ',A*3,'  /////  '];n='-'*51;R=n,;w=x=y=z=''
for e in s:x+=g+p[e];y+=g+q[e];z+=g+r[e];w+=g+A*3
R+=x+g,y+g,z+g,w+g;x=u=v=''
for i in range(5):x+=g+a[i];v+='|  H '+h[i]+A;u+='|  L '+l[i]+A
print('\n'.join(R+(x+g,n,u+g,v+g,n)))


Input Format:- The first list takes the weather conditions day wise -
0 - Sunny
1 - Partly cloudy
2 - Cloudy
3 - Rainy.

Second and third list take the highest and lowest temperatures respectively(as strings). Don't do anything with the fourth list - its mainly to store the days of the week.

Try It Online

Note:- A very special thanks to Mr.XCoder, ovs and pizzapants184 for helping reduce a lot of bytes.

# Clean, 328 bytes

import StdEnv,Text
s="----------"
u=" (====)"
v="(==)"
j=['-|||||-|-||-']
$[[d,h,l,w]:t]=[[z:cjustify 10(fromString x)]%(0,9)<+y\\x<-[s,"":[["\\ /","-O-","/ \\"],["\\ / "," -O"+v,u]:map((++)[" "+v,u])[[""],["/////"]]]!!w]++["",s,"MONTUEWEDTHUFRI"%(d*3,d*3+2),s,"H "<+h,"L "<+l,s]&y<-if(t>[])($t)(map((<+)"")j)&z<-j]

join"\n"o\$


Try it online!

As a partial function literal, taking [[Int]] and returning String.

# Vyxal, 206 bytes

→a\-51*D:,\|w6ẋfð9*j:,\ /   *\ /   *      *  (==)
-O-   *-O(==)*  (==)*(====)
/ \\   *(====)*(====)*///// ↵ƛ×/;ƛ£←aƛ¥ni; |  j|  p |+,;_,,?ƛð3*pð3*+;\|j\|p\|+,,|  H %   5*?%\|+,|  L %   5*?%\|+,,


Try it Online!