Module:Weather box/row/sandbox: Difference between revisions

Content deleted Content added
TekXS (talk | contribs)
No edit summary
Tag: Reverted
restore version at 03:00, 1 June 2023 to remove temporary tests
 
Line 148:
 
local function getInputs(args, group_name, suffix, include_space)
local month_names = { 'NDJan', 'DDFeb', 'DJMar', 'JJApr', 'JFMay', 'FFJun', 'FM', 'MM', 'MA', 'AA', 'AY', 'YY', 'YU', 'UU', 'UL', 'LL', 'LG', 'GG', 'GS', 'SS', 'SO', 'OO', 'ON', 'year' }
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'year' }
local str
local values = {}
Line 191 ⟶ 192:
local p1, p2, variant
p1 = 0
for i = 1, 2412 do
if not values[i]:isValid() then
return Value.new()
Line 209 ⟶ 210:
local value = Value.new(total)
if mode == 'avg' then
value:setNumberRounded(total / 2412, p1)
end
value.variant = variant
Line 215 ⟶ 216:
elseif mode == 'min' then
local target
for i = 1, 2412 do
if values[i]:isValid() then
if target == nil or values[i].number < target.number then
Line 225 ⟶ 226:
elseif mode == 'max' then
local target
for i = 1, 2412 do
if values[i]:isValid() then
if target == nil or values[i].number > target.number then
Line 239 ⟶ 240:
 
local function reconcileTemperature(C_values, F_values)
for i = 1, 2513 do
local p
if C_values[i].string == '' then
Line 257 ⟶ 258:
local function reconcilePrecipitation(M_values, I_values, prefer_cm)
local v_class = 0
for i = 1, 2513 do
if M_values[i].variant == 1 then
v_class = 1
Line 271 ⟶ 272:
end
end
for i = 1, 2513 do
local units
if M_values[i].string == '' then
Line 345 ⟶ 346:
return ''
end
if first_values[2513].string == '' then
first_values[2513] = getAnnualValue(first_values, annual_mode)
end
if second_values ~= nil then
if second_values[2513].string == '' then
second_values[2513] = getAnnualValue(second_values, annual_mode)
end
end
color_scheme = wbc.interpret_color_code(color_scheme)
color_values = {}
local month_adj = { 1, 1, 1, 1631/1530, 1, 1, 1, 1628.25/1530, 1, 1, 1, 1631/1530, 1, 1, 1, 1631/1530, 1, 1, 1, 16/15, 1, 1, 1, 15.25/15 }
31/30, 31/30, 1, 31/30, 1, 31/30, 365.25/30 }
for i = 1, 2513 do
if first_values[i]:isValid() then
local adj = scale_factor