Jump to content

User:Crunch41/sandbox: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Crunch41 (talk | contribs)
No edit summary
Crunch41 (talk | contribs)
An error in the weather box template for trace precipitation or rainfall in January
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
I came across an error message when trying to create a weather box. Any box with '''|Jan precipitation inch = trace''' will give an error. The same error also appears when '''|Jan rain inch = trace'''. Snowfall and metric units are not affected. A temporary fix can be made by changing the units for January to mm or cm. Since the value is only a trace, the change is not visible to the reader and does not change the yearly sum.
{{Weather box |location = Milwaukee, Wisconsin (Mitchell Airport) 2021
|single line = Y
|Jan high F = 33.3
|Feb high F = 26.7
|Mar high F =
|Apr high F =
|May high F =
|Jun high F =
|Jul high F =
|Aug high F =
|Sep high F =
|Oct high F =
|Nov high F =
|Dec high F =


The error traces back to the code for Module:Weather_box. Lines 203 and 214
|Jan mean F = 28.0
|Feb mean F = 19.9
|Mar mean F =
|Apr mean F =
|May mean F =
|Jun mean F =
|Jul mean F =
|Aug mean F =
|Sep mean F =
|Oct mean F =
|Nov mean F =
|Dec mean F =


'''203:'''prefer_cm = precision(_ifset('Jan precipitation inch', '0')) < 1,
|Jan low F = 22.6
|Feb low F = 13.0
|Mar low F =
|Apr low F =
|May low F =
|Jun low F =
|Jul low F =
|Aug low F =
|Sep low F =
|Oct low F =
|Nov low F =
|Dec low F =


'''214:'''prefer_cm = precision(_ifset('Jan rain inch', '0')) < 1,
|Jan record high F = 41
|Feb record high F = 49
|Mar record high F =
|Apr record high F =
|May record high F =
|Jun record high F =
|Jul record high F =
|Aug record high F =
|Sep record high F =
|Oct record high F =
|Nov record high F =
|Dec record high F =
|year record high F =


|Jan record low F = 9
|Feb record low F = -7
|Mar record low F =
|Apr record low F =
|May record low F =
|Jun record low F =
|Jul record low F =
|Aug record low F =
|Sep record low F =
|Oct record low F =
|Nov record low F =
|Dec record low F =
|year record low F =


|precipitation colour = green
|Jan precipitation inch = 2.02
|Feb precipitation inch = 1.19
|Mar precipitation inch =
|Apr precipitation inch =
|May precipitation inch =
|Jun precipitation inch =
|Jul precipitation inch =
|Aug precipitation inch =
|Sep precipitation inch =
|Oct precipitation inch =
|Nov precipitation inch =
|Dec precipitation inch =


|Jan snow inch = 23.3
This box has Jan precipitation inch = trace
|Feb snow inch = 17.5
|Mar snow inch =
|Apr snow inch =
|May snow inch =
|Jun snow inch =
|Jul snow inch =
|Aug snow inch =
|Sep snow inch =
|Oct snow inch =
|Nov snow inch =
|Dec snow inch =
|Year snow inch =


{{Weather box
|unit precipitation days = 0.01 in
|single line = Y
|unit snow days = 0.1 in
|Jan precipitation days = 12
|Jan precipitation inch = trace
|Feb precipitation days = 8
|Feb precipitation inch = 1.00
|Mar precipitation days =
|Mar precipitation inch = 1.00
|Apr precipitation days =
|Apr precipitation inch = 1.00
|May precipitation days =
|May precipitation inch = 1.00
|Jun precipitation days =
|Jun precipitation inch = 1.00
|Jul precipitation days =
|Jul precipitation inch = 1.00
|Aug precipitation days =
|Aug precipitation inch = 1.00
|Sep precipitation days =
|Sep precipitation inch = 1.00
|Oct precipitation days =
|Oct precipitation inch = 1.00
|Nov precipitation days =
|Nov precipitation inch = 1.00
|Dec precipitation days =
|Dec precipitation inch = 1.00
}}


Any other month can be a trace, as long as January is not "trace". I tried a blank entry, a short text string "cat", and numbers. Deleting the row completely also does not cause an error. "trace" is the only value I found to cause an error.
{{Weather box
|single line = Y
|Jan precipitation inch = 0.00
|Feb precipitation inch = trace
|Mar precipitation inch = trace
|Apr precipitation inch = trace
|May precipitation inch = trace
|Jun precipitation inch = trace
|Jul precipitation inch = trace
|Aug precipitation inch = trace
|Sep precipitation inch = trace
|Oct precipitation inch = trace
|Nov precipitation inch = trace
|Dec precipitation inch = trace
}}


This box has all months as a trace, but January has units of mm. This could be used as a workaround for the rare case it is needed.
{{Weather box
|single line = Y
|Jan precipitation mm = trace
|Feb precipitation inch = trace
|Mar precipitation inch = trace
|Apr precipitation inch = trace
|May precipitation inch = trace
|Jun precipitation inch = trace
|Jul precipitation inch = trace
|Aug precipitation inch = trace
|Sep precipitation inch = trace
|Oct precipitation inch = trace
|Nov precipitation inch = trace
|Dec precipitation inch = trace
}}




|Jan rain days = 2
|Feb rain days = 0
|Mar rain days =
|Apr rain days =
|May rain days =
|Jun rain days =
|Jul rain days =
|Aug rain days =
|Sep rain days =
|Oct rain days =
|Nov rain days =
|Dec rain days =
|year rain days =


The same problem happens with Jan rain inch = trace.
|Jan humidity = 74
|Feb humidity = 64
|Mar humidity =
|Apr humidity =
|May humidity =
|Jun humidity =
|Jul humidity =
|Aug humidity =
|Sep humidity =
|Oct humidity =
|Nov humidity =
|Dec humidity =
|year humidity =


{{Weather box
|single line = Y
|Jan rain inch = trace
|Feb rain inch = 1.00
|Mar rain inch = 1.00
|Apr rain inch = 1.00
|May rain inch = 1.00
|Jun rain inch = 1.00
|Jul rain inch = 1.00
|Aug rain inch = 1.00
|Sep rain inch = 1.00
|Oct rain inch = 1.00
|Nov rain inch = 1.00
|Dec rain inch = 1.00
}}


Other months can have trace rainfall.
{{Weather box
|single line = Y
|Jan rain inch = 1.00
|Feb rain inch = trace
|Mar rain inch = trace
|Apr rain inch = trace
|May rain inch = trace
|Jun rain inch = trace
|Jul rain inch = trace
|Aug rain inch = trace
|Sep rain inch = trace
|Oct rain inch = trace
|Nov rain inch = trace
|Dec rain inch = trace
}}




This does not happen with trace snowfall.
|Jan snow days = 13
{{Weather box
|Feb snow days = 8
|Mar snow days =
|single line = Y
|Apr snow days =
|Jan snow inch = trace
|May snow days =
|Feb snow inch = 1.00
|Jun snow days =
|Mar snow inch = 1.00
|Jul snow days =
|Apr snow inch = 1.00
|Aug snow days =
|May snow inch = 1.00
|Sep snow days =
|Jun snow inch = 1.00
|Oct snow days =
|Jul snow inch = 1.00
|Nov snow days =
|Aug snow inch = 1.00
|Dec snow days =
|Sep snow inch = 1.00
|year snow days =
|Oct snow inch = 1.00
|Nov snow inch = 1.00

|Dec snow inch = 1.00
|source 1 = NOWData, Iowa Environmental Mesonet}}
}}

Cape Dyer has a tundra climate with severe winters. Snowfall is extremely high compared to most of the Canadian arctic.
Snow depth is 1cm or higher on 299.8 days a year, 20cm or higher on 265.8 days. The average snow depth is 39 at the end of JUNE. Every month has seen a depth of at least 40cm, the record was 330cm in January 1992. Every month has seen measurable rain, too


This also does not happen with metric units (mm or cm).
{{Weather box
{{Weather box
|location = CAPE DYER A (393m) 1971-2000 normals
|metric first = Y
|single line = Y
|single line = Y
|Jan high C = -19.3
|metric first = Y
|Feb high C = -20.8
|Jan rain mm = trace
|Mar high C = -17.9
|Feb rain mm = trace
|Apr high C = -11.1
|Mar rain mm = trace
|May high C = -3.1
|Apr rain mm = trace
|Jun high C = 3.8
|May rain mm = trace
|Jul high C = 8.7
|Jun rain mm = trace
|Aug high C = 7.5
|Jul rain mm = trace
|Sep high C = 1.7
|Aug rain mm = trace
|Oct high C = -4.2
|Sep rain mm = trace
|Nov high C = -10.7
|Oct rain mm = trace
|Dec high C = -16.8
|Nov rain mm = trace
|year high C = -6.8
|Dec rain mm = trace
|Jan snow mm = trace
|Jan mean C = -24.2
|Feb snow cm = trace
|Feb mean C = -25.5
|Mar snow cm = trace
|Mar mean C = -22.9
|Apr snow cm = trace
|Apr mean C = -16.3
|May snow cm = trace
|May mean C = -6.9
|Jun snow cm = trace
|Jun mean C = 0.7
|Jul snow cm = trace
|Jul mean C = 5.3
|Aug snow cm = trace
|Aug mean C = 4.4
|Sep snow cm = trace
|Sep mean C = -1.2
|Oct snow cm = trace
|Oct mean C = -8.1
|Nov snow cm = trace
|Nov mean C = -15.2
|Dec snow cm = trace
|Dec mean C = -21.6
|Jan precipitation mm = trace
|year mean C = -11.0
|Feb precipitation mm = trace
|Mar precipitation mm = trace
|Jan low C = -29.1
|Apr precipitation mm = trace
|Feb low C = -30.2
|May precipitation mm = trace
|Mar low C = -27.9
|Jun precipitation mm = trace
|Apr low C = -21.4
|Jul precipitation mm = trace
|May low C = -10.5
|Aug precipitation mm = trace
|Jun low C = -2.4
|Sep precipitation mm = trace
|Jul low C = 1.9
|Oct precipitation mm = trace
|Aug low C = 1.2
|Nov precipitation mm = trace
|Sep low C = -4.0
|Dec precipitation mm = trace
|Oct low C = -11.9
|Nov low C = -19.6
|Dec low C = -26.4
|year low C = -15.0
|Jan record high C = 1.1
|Feb record high C = 2.2
|Mar record high C = 2.8
|Apr record high C = 10.0
|May record high C = 11.7
|Jun record high C = 17.8
|Jul record high C = 19.4
|Aug record high C = 18.9
|Sep record high C = 16.6
|Oct record high C = 9.3
|Nov record high C = 6.2
|Dec record high C = 5.6
|year record high C = 34.5
|Jan record low C = -44.9
|Feb record low C = -46.9
|Mar record low C = -47.2
|Apr record low C = -39.7
|May record low C = -28.3
|Jun record low C = -13.9
|Jul record low C = -5.5
|Aug record low C = -9.8
|Sep record low C = -18.9
|Oct record low C = -31.1
|Nov record low C = -39.4
|Dec record low C = -45.0
|year record low C =
|precipitation colour = green
|Jan precipitation mm = 52.7
|Feb precipitation mm = 32.9
|Mar precipitation mm = 28.8
|Apr precipitation mm = 42.2
|May precipitation mm = 49.8
|Jun precipitation mm = 31.2
|Jul precipitation mm = 42.7
|Aug precipitation mm = 45.6
|Sep precipitation mm = 67.2
|Oct precipitation mm = 92.1
|Nov precipitation mm = 65.5
|Dec precipitation mm = 51.9
|year precipitation mm = 602.5
|unit precipitation days = 0.2 mm
|Jan precipitation days = 10.8
|Feb precipitation days = 9.0
|Mar precipitation days = 9.6
|Apr precipitation days = 11.1
|May precipitation days = 13.3
|Jun precipitation days = 8.0
|Jul precipitation days = 10.4
|Aug precipitation days = 11.3
|Sep precipitation days = 12.1
|Oct precipitation days = 17.0
|Nov precipitation days = 14.7
|Dec precipitation days = 11.5
|year precipitation days = 138.8
|unit rain days = 0.2 mm
|Jan rain mm = 0.3
|Feb rain mm = 0
|Mar rain mm = 0
|Apr rain mm = 0.1
|May rain mm = 1.2
|Jun rain mm = 8.6
|Jul rain mm = 34.5
|Aug rain mm = 34.2
|Sep rain mm = 15.2
|Oct rain mm = 3.4
|Nov rain mm = 0.9
|Dec rain mm = 0.1
|year rain mm = 98.4
|Jan rain days = 0.22
|Feb rain days = 0.09
|Mar rain days = 0.05
|Apr rain days = 0.14
|May rain days = 1.1
|Jun rain days = 3.0
|Jul rain days = 9.0
|Aug rain days = 8.8
|Sep rain days = 3.9
|Oct rain days = 1.7
|Nov rain days = 0.5
|Dec rain days = 0.18
|year rain days = 28.6
|unit snow days = 0.2 cm
|Jan snow cm = 59.2
|Feb snow cm = 38.1
|Mar snow cm = 35.8
|Apr snow cm = 49.9
|May snow cm = 56.2
|Jun snow cm = 20.9
|Jul snow cm = 7.4
|Aug snow cm = 11.0
|Sep snow cm = 50.8
|Oct snow cm = 95.2
|Nov snow cm = 79.6
|Dec snow cm = 62.1
|year snow cm = 566.2
|Jan snow days = 11.0
|Feb snow days = 9.4
|Mar snow days = 9.8
|Apr snow days = 11.8
|May snow days = 13.8
|Jun snow days = 6.2
|Jul snow days = 2.8
|Aug snow days = 4.0
|Sep snow days = 10.1
|Oct snow days = 17.1
|Nov snow days = 15.0
|Dec snow days = 11.6
|year snow days = 122.5
|Jan Sun =
|Feb Sun =
|Mar Sun =
|Apr Sun =
|May Sun =
|Jun Sun =
|Jul Sun =
|Aug Sun =
|Sep Sun =
|Oct Sun =
|Nov Sun =
|Dec Sun =
|year Sun =
|Jan Percentsun =
|Feb Percentsun =
|Mar Percentsun =
|Apr Percentsun =
|May Percentsun =
|Jun Percentsun =
|Jul Percentsun =
|Aug Percentsun =
|Sep Percentsun =
|Oct Percentsun =
|Nov Percentsun =
|Dec Percentsun =
|year Percentsun =
|source 1 = Environment Canada<ref>{{cite web |title=Cape Dyer A |url=https://climate.weather.gc.ca/climate_normals/results_e.html?stnID=1740&dispBack=1 |website=Canadian Climate Normals 1971-2000}}</ref>
}}
}}

Latest revision as of 16:37, 5 February 2022

I came across an error message when trying to create a weather box. Any box with |Jan precipitation inch = trace will give an error. The same error also appears when |Jan rain inch = trace. Snowfall and metric units are not affected. A temporary fix can be made by changing the units for January to mm or cm. Since the value is only a trace, the change is not visible to the reader and does not change the yearly sum.

The error traces back to the code for Module:Weather_box. Lines 203 and 214

203:prefer_cm = precision(_ifset('Jan precipitation inch', '0')) < 1,

214:prefer_cm = precision(_ifset('Jan rain inch', '0')) < 1,


This box has Jan precipitation inch = trace

Climate data for {{{location}}}
Month Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Year
Average precipitation inches (cm) trace 1.00
(2.5)
1.00
(2.5)
1.00
(2.5)
1.00
(2.5)
1.00
(2.5)
1.00
(2.5)
1.00
(2.5)
1.00
(2.5)
1.00
(2.5)
1.00
(2.5)
1.00
(2.5)
11
(27.5)
[citation needed]

Any other month can be a trace, as long as January is not "trace". I tried a blank entry, a short text string "cat", and numbers. Deleting the row completely also does not cause an error. "trace" is the only value I found to cause an error.

Climate data for {{{location}}}
Month Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Year
Average precipitation inches (mm) 0.00
(0.00)
trace trace trace trace trace trace trace trace trace trace trace 0
(0)
[citation needed]

This box has all months as a trace, but January has units of mm. This could be used as a workaround for the rare case it is needed.

Climate data for {{{location}}}
Month Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Year
Average precipitation inches (mm) trace trace trace trace trace trace trace trace trace trace trace trace 0
(0)
[citation needed]


The same problem happens with Jan rain inch = trace.

Climate data for {{{location}}}
Month Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Year
Average rainfall inches (cm) trace 1.00
(2.5)
1.00
(2.5)
1.00
(2.5)
1.00
(2.5)
1.00
(2.5)
1.00
(2.5)
1.00
(2.5)
1.00
(2.5)
1.00
(2.5)
1.00
(2.5)
1.00
(2.5)
11
(27.5)
[citation needed]

Other months can have trace rainfall.

Climate data for {{{location}}}
Month Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Year
Average rainfall inches (mm) 1.00
(25)
trace trace trace trace trace trace trace trace trace trace trace 1
(25)
[citation needed]


This does not happen with trace snowfall.

Climate data for {{{location}}}
Month Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Year
Average snowfall inches (cm) trace 1.00
(2.5)
1.00
(2.5)
1.00
(2.5)
1.00
(2.5)
1.00
(2.5)
1.00
(2.5)
1.00
(2.5)
1.00
(2.5)
1.00
(2.5)
1.00
(2.5)
1.00
(2.5)
11
(27.5)
[citation needed]

This also does not happen with metric units (mm or cm).

Climate data for {{{location}}}
Month Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec Year
Average precipitation mm (inches) trace trace trace trace trace trace trace trace trace trace trace trace 0
(0)
Average rainfall mm (inches) trace trace trace trace trace trace trace trace trace trace trace trace 0
(0)
Average snowfall cm (inches) trace trace trace trace trace trace trace trace trace trace trace trace 0
(0)
[citation needed]