Jump to content

Module:Weather/doc: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
add palette and show function
Testing: I think displaying the graphs here is helpful, so that the results of changes can immediately be seen; discussion of average temperature palette
Line 38: Line 38:


== Testing ==
== Testing ==
One of the following can be previewed in a sandbox to display graphs showing how the red/green/blue colors vary with temperature. A table of the resulting colors is also displayed; the table shows °C values.
The function <code>show</code> provides a way to test the color schemes. It generates a graph of how the red, green, and blue portions of the color vary with temperature, and a table of the full range of temperatures in °C.

<pre>
The following codes produce the same result:
{{#invoke:weather|show}}
* <code><nowiki>{{#invoke:weather|show}}</nowiki></code>
* <code><nowiki>{{#invoke:weather|show|palette=cool}}</nowiki></code>

{{#invoke:weather|show|palette=cool}}
{{#invoke:weather|show|palette=cool}}

Modified palette:
* <code><nowiki>{{#invoke:weather|show|palette=cool2}}</nowiki></code>


{{#invoke:weather|show|palette=cool2}}
{{#invoke:weather|show|palette=cool2}}

This modified palette is intended for average temperatures. It results in good colors between the extreme highest average monthly temperature of {{convert|+39|C}} in [[Death Valley]], California, and {{convert|-68|C}}, the extreme lowest average monthly temperature at [[Vostok Station]], at a high elevation on the Antarctic ice sheet. These are the highest and lowest known ''average'' temperatures recorded on Earth, not to be confused with the highest and lowest records, which are quite a bit hotter and colder.


* <code><nowiki>{{#invoke:weather|show|palette=cool2avg}}</nowiki></code>
{{#invoke:weather|show|palette=cool2avg}}
{{#invoke:weather|show|palette=cool2avg}}
</pre>

Revision as of 04:44, 13 September 2016

This module can be used to display temperatures in a table. It is under development and is intended to be efficient so a page can hold many tables.

  • Input numbers must use a hyphen if negative (Unicode minus "−" would give an error).
  • All displayed numbers (including inputs) use Unicode minus if negative.
  • The input consists of 13 values, separated by any number of spaces.
  • Each of the 13 values must be a number. Any invalid value results in the corresponding cell being blank with no error message or tracking category.

The following functions are available:

Function  Input   Output
-------------------------
CtoF       °C     °C (°F)
FfromC     °C     °F (°C)
CfromF     °F     °C (°F)
FtoC       °F     °F (°C)

The following templates use the module:

An example using the above templates and therefore the module is at:

The output can be examined by entering the following example at Special:ExpandTemplates. The output from each of the following lines is identical.

{{#invoke:weather|CtoF|-10 -5 0 5 10 15 20 25 30 35 40 45 50}}
----
{{#invoke:weather|CfromF|14 23 32 41 50 59 68 77 86 95 104 113 122}}

Optional parameter

  • |palette=name
    Where name is the built-in name of a palette:
    cool (default)
    cool2 (modified)
    cool2avg (modified and intended for average temperatures)

Testing

The function show provides a way to test the color schemes. It generates a graph of how the red, green, and blue portions of the color vary with temperature, and a table of the full range of temperatures in °C.

The following codes produce the same result:

  • {{#invoke:weather|show}}
  • {{#invoke:weather|show|palette=cool}}
−90 −89 −88 −87 −86 −85 −84 −83 −82 −81
−80 −79 −78 −77 −76 −75 −74 −73 −72 −71
−70 −69 −68 −67 −66 −65 −64 −63 −62 −61
−60 −59 −58 −57 −56 −55 −54 −53 −52 −51
−50 −49 −48 −47 −46 −45 −44 −43 −42 −41
−40 −39 −38 −37 −36 −35 −34 −33 −32 −31
−30 −29 −28 −27 −26 −25 −24 −23 −22 −21
−20 −19 −18 −17 −16 −15 −14 −13 −12 −11
−10 −9 −8 −7 −6 −5 −4 −3 −2 −1
0 1 2 3 4 5 6 7 8 9
10 11 12 13 14 15 16 17 18 19
20 21 22 23 24 25 26 27 28 29
30 31 32 33 34 35 36 37 38 39
40 41 42 43 44 45 46 47 48 49
50 51 52 53 54 55 56 57 58 59


Modified palette:

  • {{#invoke:weather|show|palette=cool2}}


−90 −89 −88 −87 −86 −85 −84 −83 −82 −81
−80 −79 −78 −77 −76 −75 −74 −73 −72 −71
−70 −69 −68 −67 −66 −65 −64 −63 −62 −61
−60 −59 −58 −57 −56 −55 −54 −53 −52 −51
−50 −49 −48 −47 −46 −45 −44 −43 −42 −41
−40 −39 −38 −37 −36 −35 −34 −33 −32 −31
−30 −29 −28 −27 −26 −25 −24 −23 −22 −21
−20 −19 −18 −17 −16 −15 −14 −13 −12 −11
−10 −9 −8 −7 −6 −5 −4 −3 −2 −1
0 1 2 3 4 5 6 7 8 9
10 11 12 13 14 15 16 17 18 19
20 21 22 23 24 25 26 27 28 29
30 31 32 33 34 35 36 37 38 39
40 41 42 43 44 45 46 47 48 49
50 51 52 53 54 55 56 57 58 59


This modified palette is intended for average temperatures. It results in good colors between the extreme highest average monthly temperature of +39 °C (102 °F) in Death Valley, California, and −68 °C (−90 °F), the extreme lowest average monthly temperature at Vostok Station, at a high elevation on the Antarctic ice sheet. These are the highest and lowest known average temperatures recorded on Earth, not to be confused with the highest and lowest records, which are quite a bit hotter and colder.


  • {{#invoke:weather|show|palette=cool2avg}}
−90 −89 −88 −87 −86 −85 −84 −83 −82 −81
−80 −79 −78 −77 −76 −75 −74 −73 −72 −71
−70 −69 −68 −67 −66 −65 −64 −63 −62 −61
−60 −59 −58 −57 −56 −55 −54 −53 −52 −51
−50 −49 −48 −47 −46 −45 −44 −43 −42 −41
−40 −39 −38 −37 −36 −35 −34 −33 −32 −31
−30 −29 −28 −27 −26 −25 −24 −23 −22 −21
−20 −19 −18 −17 −16 −15 −14 −13 −12 −11
−10 −9 −8 −7 −6 −5 −4 −3 −2 −1
0 1 2 3 4 5 6 7 8 9
10 11 12 13 14 15 16 17 18 19
20 21 22 23 24 25 26 27 28 29
30 31 32 33 34 35 36 37 38 39
40 41 42 43 44 45 46 47 48 49
50 51 52 53 54 55 56 57 58 59