Jump to content

Module:StormCategoryColor

From Shark's Hypothetical Weather

Documentation for this module may be created at Module:StormCategoryColor/doc

local p = {}

-- Function to determine text color based on the category number
function p.getTextColor(catnum)
    catnum = tostring(catnum or "unknown")  -- Ensure catnum is a string
    if catnum == 'cat7' then
        return 'FFFFFF' -- White for Category 7 with neon glow (text color)
    else
        return '000000' -- Default dark gray for other categories
    end
end

-- Function to determine text based on the wind speed
function p.getWindSpeed(winds)
    winds = tonumber(winds) or 0  -- Default to 0 if winds is non-numeric or nil
    if winds >= 300 then
        return 'cat7'
    elseif winds >= 225 then
        return 'cat6'
    elseif winds >= 160 then
        return 'cat5'
    elseif winds >= 130 then
        return 'cat4'
    elseif winds >= 115 then
        return 'cat3'
    elseif winds >= 95 then
        return 'cat2'
    elseif winds >= 75 then
        return 'cat1'
    elseif winds >= 40 then
        return 'storm'
    elseif winds >= 20 then
        return 'depression'
    elseif winds >= 1 then
        return 'posttropical'
    else
        return 'unknown'
    end
end

-- Function to determine text based on the wind speed
function p.getWindSpeedAHWS(winds)
    winds = tonumber(winds) or 0  -- Default to 0 if winds is non-numeric or nil
    if winds >= 160 then
        return 'ahwscat5'
    elseif winds >= 130 then
        return 'ahwscat4'
    elseif winds >= 115 then
        return 'ahwscat3'
    elseif winds >= 95 then
        return 'ahwscat2'
    elseif winds >= 75 then
        return 'ahwscat1'
    elseif winds >= 40 then
        return 'ahwsstorm'
    elseif winds >= 39 then
        return 'ahwsdepression'
    else
        return 'unknown'
    end
end

-- Function to determine text based on the wind speed
function p.getWindSpeedSSHWS(winds)
    winds = tonumber(winds) or 0  -- Default to 0 if winds is non-numeric or nil
    if winds >= 157 then
        return 'sshwscat5'
    elseif winds >= 130 then
        return 'sshwscat4'
    elseif winds >= 111 then
        return 'sshwscat3'
    elseif winds >= 96 then
        return 'sshwscat2'
    elseif winds >= 74 then
        return 'sshwscat1'
    elseif winds >= 39 then
        return 'sshwsstorm'
    elseif winds >= 38 then
        return 'sshwsdepression'
    elseif winds >= 1 then
        return 'sshwsposttropical'
    else
        return 'unknown'
    end
end

-- Function to determine text based on the wind speed
function p.getWindSpeedTornado(winds)
    winds = tonumber(winds) or 0  -- Default to 0 if winds is non-numeric or nil
    if winds >= 201 then
        return 'EF5'
    elseif winds >= 166 then
        return 'EF4'
    elseif winds >= 136 then
        return 'EF3'
    elseif winds >= 111 then
        return 'EF2'
    elseif winds >= 86 then
        return 'EF1'
    elseif winds >= 65 then
        return 'EF0'
    else
        return 'EFU'
    end
end

-- Function to determine text based on the wind speed
function p.getWindSpeedTornadoFScale(winds)
    winds = tonumber(winds) or 0  -- Default to 0 if winds is non-numeric or nil
    if winds >= 261 then
        return 'F5'
    elseif winds >= 207 then
        return 'F4'
    elseif winds >= 158 then
        return 'F3'
    elseif winds >= 113 then
        return 'F2'
    elseif winds >= 73 then
        return 'F1'
    elseif winds >= 65 then
        return 'F0'
    else
        return 'FU'
    end
end

-- Function to determine the background color based on the category number
function p.getBackgroundColor(catnum)
    if not catnum then return "CCCCCC" end  -- Default gray if no catnum
    local backgroundColor = mw.getCurrentFrame():expandTemplate{title = 'Storm colour', args = {tostring(catnum)}}
    return backgroundColor or "CCCCCC"  -- Return a default if background color is nil
end

-- Function to determine the background color based on the category number
function p.getBackgroundColorTornado(efrating)
    if not efrating then return "CCCCCC" end  -- Default gray if no catnum
    local backgroundColor = mw.getCurrentFrame():expandTemplate{title = 'Storm colour', args = {tostring(efrating)}}
    return backgroundColor or "CCCCCC"  -- Return a default if background color is nil
end

-- Function to determine the label text for the category
function p.getCategoryLabel(catnum, basin)
    local categories = {
        posttropical = {
            name = {
                atl = "Remnant Low",
                epac = "Remnant Low",
                satl = "Remnant Low",
                wpac = "Remnant Low",
                default = "Remnant Low",
            },
        },
        depression = {
            name = {
                atl = "Tropical Depression",
                epac = "Tropical Depression",
                satl = "Tropical Depression",
                wpac = "Tropical Depression",
                default = "Tropical Depression",
            },
        },
        storm = {
            name = {
                atl = "Tropical Storm",
                epac = "Tropical Storm",
                satl = "Tropical Storm",
                wpac = "Tropical Storm",
                default = "Tropical Storm",
            },
        },
        cat1 = {
            name = {
                atl = "Category 1 hurricane",
                epac = "Category 1 hurricane",
                satl = "Category 1-equivalent hurricane",
                wpac = "Category 1-equivalent typhoon",
                default = "Category 1-equivalent tropical cyclone",
            },
        },
        cat2 = {
            name = {
                atl = "Category 2 hurricane",
                epac = "Category 2 hurricane",
                satl = "Category 2-equivalent hurricane",
                wpac = "Category 2-equivalent typhoon",
                default = "Category 2-equivalent tropical cyclone",
            },
        },
        cat3 = {
            name = {
                atl = "Category 3 major hurricane",
                epac = "Category 3 major hurricane",
                satl = "Category 3-equivalent hurricane",
                wpac = "Category 3-equivalent typhoon",
                default = "Category 3-equivalent tropical cyclone",
            },
        },
        cat4 = {
            name = {
                atl = "Category 4 major hurricane",
                epac = "Category 4 major hurricane",
                satl = "Category 4-equivalent hurricane",
                wpac = "Category 4-equivalent typhoon",
                default = "Category 4-equivalent tropical cyclone",
            },
        },
        cat5 = {
            name = {
                atl = "Category 5 major hurricane",
                epac = "Category 5 major hurricane",
                satl = "Category 5-equivalent hurricane",
                wpac = "Category 5-equivalent super typhoon",
                default = "Category 5-equivalent tropical cyclone",
            },
        },
        cat6 = {
            name = {
                atl = "Category 6 extreme hurricane",
                epac = "Category 6 extreme hurricane",
                satl = "Category 6-equivalent hurricane",
                wpac = "Category 6-equivalent extreme typhoon",
                default = "Category 6-equivalent tropical cyclone",
            },
        },
        cat7 = {
            name = {
                atl = "Hypercane",
                epac = "Hypercane",
                satl = "Hypercane",
                wpac = "Category 7-equivalent mega typhoon",
                default = "Category 7-equivalent tropical cyclone",
            },
        },
    }

    -- Ensure `catnum` and `basin` are valid
    local category = categories[tostring(catnum)]
    local basinName = basin and category and category.name[basin] or category and category.name.default

    -- Return the label or a fallback
    return basinName or "Unknown-strength storm"
end

-- Function to determine the label text for the category
function p.getCategoryLabelSSHWS(catnum, basin)
    local categories = {
        sshwsposttropical = {
            name = {
                atl = "Remnant Low",
                epac = "Remnant Low",
                satl = "Remnant Low",
                wpac = "Remnant Low",
                default = "Remnant Low",
            },
        },
        sshwsdepression = {
            name = {
                atl = "Tropical Depression",
                epac = "Tropical Depression",
                satl = "Tropical Depression",
                wpac = "Tropical Depression",
                default = "Tropical Depression",
            },
        },
        sshwsstorm = {
            name = {
                atl = "Tropical Storm",
                epac = "Tropical Storm",
                satl = "Tropical Storm",
                wpac = "Tropical Storm",
                default = "Tropical Storm",
            },
        },
        sshwscat1 = {
            name = {
                atl = "Category 1 hurricane",
                epac = "Category 1 hurricane",
                satl = "Category 1-equivalent hurricane",
                wpac = "Category 1-equivalent typhoon",
                default = "Category 1-equivalent tropical cyclone",
            },
        },
        sshwscat2 = {
            name = {
                atl = "Category 2 hurricane",
                epac = "Category 2 hurricane",
                satl = "Category 2-equivalent hurricane",
                wpac = "Category 2-equivalent typhoon",
                default = "Category 2-equivalent tropical cyclone",
            },
        },
        sshwscat3 = {
            name = {
                atl = "Category 3 major hurricane",
                epac = "Category 3 major hurricane",
                satl = "Category 3-equivalent hurricane",
                wpac = "Category 3-equivalent typhoon",
                default = "Category 3-equivalent tropical cyclone",
            },
        },
        sshwscat4 = {
            name = {
                atl = "Category 4 major hurricane",
                epac = "Category 4 major hurricane",
                satl = "Category 4-equivalent hurricane",
                wpac = "Category 4-equivalent typhoon",
                default = "Category 4-equivalent tropical cyclone",
            },
        },
        sshwscat5 = {
            name = {
                atl = "Category 5 major hurricane",
                epac = "Category 5 major hurricane",
                satl = "Category 5-equivalent hurricane",
                wpac = "Category 5-equivalent super typhoon",
                default = "Category 5-equivalent tropical cyclone",
            },
        },
    }

    -- Ensure `catnum` and `basin` are valid
    local category = categories[tostring(catnum)]
    local basinName = basin and category and category.name[basin] or category and category.name.default

    -- Return the label or a fallback
    return basinName or "Unknown-strength storm"
end

-- Function to determine the label text for the category
function p.getCategoryLabelAHWS(hurricane)
    local labels = {
    	ahwsdepression = "Tropical Depression",
        ahwsstorm = "Tropical Storm",
        ahwscat1 = "Category 1 arrocane",
        ahwscat2 = "Category 2 arrocane",
        ahwscat3 = "Category 3 major arrocane",
        ahwscat4 = "Category 4 major arrocane",
        ahwscat5 = "Category 5 major arrocane",
    }
    return labels[tostring(hurricane)] or "Unknown-strength storm"
end

-- Function to determine the label text for the category
function p.getCategoryLabelAHWS2(hurricane)
    local labels = {
    	ahwsdepression = "Tropical depression (AAWS)",
        ahwsstorm = "Tropical storm (AAWS)",
        ahwscat1 = "Category 1 arrocane (AAWS)",
        ahwscat2 = "Category 2 arrocane (AAWS)",
        ahwscat3 = "Category 3 arrocane (AAWS)",
        ahwscat4 = "Category 4 arrocane (AAWS)",
        ahwscat5 = "Category 5 arrocane (AAWS)",
    }
    return labels[tostring(hurricane)] or "Unknown-strength storm (AHWS)"
end

-- Function to determine the label text for the category
function p.getCategoryLabelAHWS3(hurricane)
    local labels = {
    	ahwsdepression = "TD",
        ahwsstorm = "TS",
        ahwscat1 = "C1",
        ahwscat2 = "C2",
        ahwscat3 = "C3",
        ahwscat4 = "C4",
        ahwscat5 = "C5",
    }
    return labels[tostring(hurricane)] or "UN"
end

-- Function to determine the label text for the category
function p.getCategoryLabelAHWS4(hurricane)
    local labels = {
    	ahwsdepression = "Tropical depression",
        ahwsstorm = "Tropical storm",
        ahwscat1 = "Category 1 arrocane",
        ahwscat2 = "Category 2 arrocane",
        ahwscat3 = "Category 3 arrocane",
        ahwscat4 = "Category 4 arrocane",
        ahwscat5 = "Category 5 arrocane",
    }
    return labels[tostring(hurricane)] or "Unknown-strength storm"
end

-- Function to determine the label text for the category
function p.getCategoryLabelTornado(fujita)
    local labels = {
    	EFU = "EFU tornado",
        EF0 = "EF0 tornado",
        EF1 = "EF1 tornado",
        EF2 = "EF2 tornado",
        EF3 = "EF3 tornado",
        EF4 = "EF4 tornado",
        EF5 = "EF5 tornado",
    }
    return labels[tostring(fujita)] or "Unrated tornado"
end

-- Function to determine the label text for the category
function p.getCategoryLabelTornado2(fujita)
    local labels = {
    	EFU = "EFU tornado",
        EF0 = "EF0 tornado",
        EF1 = "EF1 tornado",
        EF2 = "EF2 tornado",
        EF3 = "EF3 tornado",
        EF4 = "EF4 tornado",
        EF5 = "EF5 tornado",
    }
    return labels[tostring(fujita)] or "Unrated tornado"
end

-- Function to determine the label text for the category
function p.getCategoryLabelTornado3(fujita)
    local labels = {
    	EFU = "EFU",
        EF0 = "EF0",
        EF1 = "EF1",
        EF2 = "EF2",
        EF3 = "EF3",
        EF4 = "EF4",
        EF5 = "EF5",
    }
    return labels[tostring(fujita)] or "UNK"
end

-- Function to determine the label text for the category
function p.getCategoryLabelTornadoFScale(fujita)
    local labels = {
    	FU = "'''FU tornado'''",
        F0 = "'''F0 tornado'''",
        F1 = "'''F1 tornado'''",
        F2 = "'''F2 tornado'''",
        F3 = "'''F3 tornado'''",
        F4 = "'''F4 tornado'''",
        F5 = "'''F5 tornado'''",
    }
    return labels[tostring(fujita)] or "'''Unrated tornado'''"
end

-- Function to determine the label text for the category
function p.getCategoryLabelTornadoFScale2(fujita)
    local labels = {
    	FU = "FU tornado",
        F0 = "F0 tornado",
        F1 = "F1 tornado",
        F2 = "F2 tornado",
        F3 = "F3 tornado",
        F4 = "F4 tornado",
        F5 = "F5 tornado",
    }
    return labels[tostring(fujita)] or "Unrated tornado"
end

-- Function to determine the label text for the category
function p.getCategoryLabelTornadoFScale3(fujita)
    local labels = {
    	FU = "FU",
        F0 = "F0",
        F1 = "F1",
        F2 = "F2",
        F3 = "F3",
        F4 = "F4",
        F5 = "F5",
    }
    return labels[tostring(fujita)] or "UNK"
end

-- Function to determine the label text for the category
function p.getCategoryLabel2(catnum, basin)
   local categories = {
        posttropical = {
            name = {
                atl = "Remnant Low (SLHWS)",
                epac = "Remnant Low (SLHWS)",
                satl = "Remnant Low (SLHWS)",
                wpac = "Remnant Low (SLHWS)",
                default = "Remnant Low (SLHWS)",
            },
        },
        depression = {
            name = {
                atl = "Tropical depression (SLHWS)",
                epac = "Tropical depression (SLHWS)",
                satl = "Tropical depression (SLHWS)",
                wpac = "Tropical depression (SLHWS)",
                default = "Tropical depression (SLHWS)",
            },
        },
        storm = {
            name = {
                atl = "Tropical storm (SLHWS)",
                epac = "Tropical storm (SLHWS)",
                satl = "Tropical storm (SLHWS)",
                wpac = "Tropical storm (SLHWS)",
                default = "Tropical storm (SLHWS)",
            },
        },
        cat1 = {
            name = {
                atl = "Category 1 hurricane (SLHWS)",
                epac = "Category 1 hurricane (SLHWS)",
                satl = "Category 1 hurricane (SLHWS)",
                wpac = "Category 1 typhoon (SLHWS)",
                default = "Category 1 tropical cyclone (SLHWS)",
            },
        },
        cat2 = {
            name = {
                atl = "Category 2 hurricane (SLHWS)",
                epac = "Category 2 hurricane (SLHWS)",
                satl = "Category 2 hurricane (SLHWS)",
                wpac = "Category 2 typhoon (SLHWS)",
                default = "Category 2 tropical cyclone (SLHWS)",
            },
        },
        cat3 = {
            name = {
                atl = "Category 3 hurricane (SLHWS)",
                epac = "Category 3 hurricane (SLHWS)",
                satl = "Category 3 hurricane (SLHWS)",
                wpac = "Category 3 typhoon (SLHWS)",
                default = "Category 3 tropical cyclone (SLHWS)",
            },
        },
        cat4 = {
            name = {
                atl = "Category 4 hurricane (SLHWS)",
                epac = "Category 4 hurricane (SLHWS)",
                satl = "Category 4 hurricane (SLHWS)",
                wpac = "Category 4 typhoon (SLHWS)",
                default = "Category 4 tropical cyclone (SLHWS)",
            },
        },
        cat5 = {
            name = {
                atl = "Category 5 hurricane (SLHWS)",
                epac = "Category 5 hurricane (SLHWS)",
                satl = "Category 5 hurricane (SLHWS)",
                wpac = "Category 5 typhoon (SLHWS)",
                default = "Category 5 tropical cyclone (SLHWS)",
            },
        },
        cat6 = {
            name = {
                atl = "Category 6 hurricane (SLHWS)",
                epac = "Category 6 hurricane (SLHWS)",
                satl = "Category 6 hurricane (SLHWS)",
                wpac = "Category 6 typhoon (SLHWS)",
                default = "Category 6 tropical cyclone (SLHWS)",
            },
        },
        cat7 = {
            name = {
                atl = "Hypercane (SLHWS)",
                epac = "Hypercane (SLHWS)",
                satl = "Hypercane (SLHWS)",
                wpac = "Category 7 typhoon (SLHWS)",
                default = "Category 7 tropical cyclone (SLHWS)",
            },
        },
    }

    -- Ensure `catnum` and `basin` are valid
    local category = categories[tostring(catnum)]
    local basinName = basin and category and category.name[basin] or category and category.name.default

    -- Return the label or a fallback
    return basinName or "Unknown-strength storm (SLHWS)"
end

-- Function to determine the label text for the category
function p.getCategoryLabelSSHWS2(catnum)
    local labels = {
    	sshwsposttropical = "'''Remnant Low (SSHWS)'''",
        sshwsdepression = "'''Tropical depression (SSHWS)'''",
        sshwsstorm = "'''Tropical storm (SSHWS)'''",
        sshwscat1 = "'''Category 1 hurricane (SSHWS)'''",
        sshwscat2 = "'''Category 2 hurricane (SSHWS)'''",
        sshwscat3 = "'''Category 3 hurricane (SSHWS)'''",
        sshwscat4 = "'''Category 4 hurricane (SSHWS)'''",
        sshwscat5 = "'''Category 5 hurricane (SSHWS)'''",
    }
    return labels[tostring(catnum)] or "'''Unknown-strength storm (SSHWS)'''"
end

-- Function to determine the label text for the category
function p.getCategoryLabel3(catnum)
    local labels = {
    	posttropical = "RL",
        depression = "TD",
        storm = "TS",
        cat1 = "C1",
        cat2 = "C2",
        cat3 = "C3",
        cat4 = "C4",
        cat5 = "C5",
        cat6 = "C6",
        cat7 = "HY",
    }
    return labels[tostring(catnum)] or "UN"
end

-- Function to determine the label text for the category
function p.getCategoryLabelSSHWS3(catnum)
    local labels = {
    	sshwsposttropical = "RL",
        sshwsdepression = "TD",
        sshwsstorm = "TS",
        sshwscat1 = "C1",
        sshwscat2 = "C2",
        sshwscat3 = "C3",
        sshwscat4 = "C4",
        sshwscat5 = "C5",
    }
    return labels[tostring(catnum)] or "UN"
end

function p.getCategoryLabel4(catnum)
    local labels = {
    	posttropical = "Remnant low",
        depression = "Tropical depression",
        storm = "Tropical storm",
        cat1 = "Category 1 hurricane",
        cat2 = "Category 2 hurricane",
        cat3 = "Category 3 hurricane",
        cat4 = "Category 4 hurricane",
        cat5 = "Category 5 hurricane",
        cat6 = "Category 6 hurricane",
        cat7 = "Hypercane"
    }
    return labels[tostring(catnum)] or "Unknown-strength storm"
end

function p.getCategoryLabelSSHWS4(catnum)
    local labels = {
    	sshwsposttropical = "Remnant low",
        sshwsdepression = "Tropical depression",
        sshwsstorm = "Tropical storm",
        sshwscat1 = "Category 1 hurricane",
        sshwscat2 = "Category 2 hurricane",
        sshwscat3 = "Category 3 hurricane",
        sshwscat4 = "Category 4 hurricane",
        sshwscat5 = "Category 5 hurricane",
    }
    return labels[tostring(catnum)] or "Unknown-strength storm"
end

-- Function to add neon green glowing effect for Category 7
function p.getTextGlow(catnum)
    if tostring(catnum) == 'cat7' then
        return '0 0 5px rgba(255, 255, 255, 0.8), 0 0 15px rgba(255, 255, 255, 0.8)' -- Neon green glow effect
    else
        return '' -- No glow for other categories
    end
end

-- Main function to generate the HTML with the correct colors
function p.renderCategory(frame)
    local catnum = frame.args[1] or "unknown" -- Default to "unknown" if catnum is nil
    local textColor = p.getTextColor(catnum)
    local backgroundColor = p.getBackgroundColor(catnum)
    local categoryLabel = p.getCategoryLabel(catnum) or "Unknown-strength storm"
    local textGlow = p.getTextGlow(catnum) or ""  -- Default to no glow

    -- Return the formatted HTML with the correct style attributes
    return string.format(
        '! colspan="2" style="vertical-align: middle; text-align: center; background-color: %s; color: %s;" | %s',
        backgroundColor,
        textColor,
        categoryLabel
    )
end

-- Main function to generate the HTML with the correct colors
function p.renderCategoryTornado(frame)
    local efrating = frame.args[1] or "unknown" -- Default to "unknown" if efrating is nil
    local textColor = p.getTextColor(efrating)
    local backgroundColor = p.getBackgroundColorTornado(efrating)
    local categoryLabel = p.getCategoryLabelTornado3(efrating) or "EFU"
    local textGlow = p.getTextGlow(efrating) or ""  -- Default to no glow

    -- Return the formatted HTML with the correct style attributes
    return string.format(
        '! colspan="2" style="vertical-align: middle; text-align: center; background-color: %s; color: %s;" | %s',
        backgroundColor,
        textColor,
        categoryLabel
    )
end

-- Function to return the text color only
function p.renderTextColor(frame)
    local catnum = frame.args[1]
    return mw.text.trim(p.getTextColor(catnum)) -- Ensure text color is a plain string
end

-- Function to return the text glow only
function p.renderTextGlow(frame)
    local catnum = frame.args[1]
    return mw.text.trim(p.getTextGlow(catnum)) -- Ensure text color is a plain string
end

-- Function to return the background color only
function p.renderBackgroundColor(frame)
    local catnum = frame.args[1]
    return mw.text.trim(p.getBackgroundColor(catnum)) -- Ensure background color is a plain string
end

function p.renderCategoryLabel(frame)
    local catnum = frame.args[1] -- First argument is the category
    local basin = frame.args[2] -- Second argument is the basin
    return mw.text.trim(p.getCategoryLabel(catnum, basin)) -- Ensure category label is a plain string
end

function p.renderCategoryLabel2(frame)
    local catnum = frame.args[1] -- First argument is the category
    local basin = frame.args[2] -- Second argument is the basin
    return mw.text.trim(p.getCategoryLabel2(catnum, basin)) -- Ensure category label is a plain string
end

function p.renderCategoryLabel3(frame)
    local catnum = frame.args[1]
    return mw.text.trim(p.getCategoryLabel3(catnum)) -- Ensure category label is a plain string
end

function p.renderCategoryLabel4(frame)
    local catnum = frame.args[1]
    return mw.text.trim(p.getCategoryLabel4(catnum)) -- Ensure category label is a plain string
end

function p.renderCategoryLabelSSHWS(frame)
    local catnum = frame.args[1] -- First argument is the category
    local basin = frame.args[2] -- Second argument is the basin
    return mw.text.trim(p.getCategoryLabelSSHWS(catnum, basin)) -- Ensure category label is a plain string
end

function p.renderCategoryLabelSSHWS2(frame)
    local catnum = frame.args[1]
    return mw.text.trim(p.getCategoryLabelSSHWS2(catnum)) -- Ensure category label is a plain string
end

function p.renderCategoryLabelSSHWS3(frame)
    local catnum = frame.args[1]
    return mw.text.trim(p.getCategoryLabelSSHWS3(catnum)) -- Ensure category label is a plain string
end

function p.renderCategoryLabelSSHWS4(frame)
    local catnum = frame.args[1]
    return mw.text.trim(p.getCategoryLabelSSHWS4(catnum)) -- Ensure category label is a plain string
end

function p.renderCategoryLabelAHWS(frame)
    local hurricane = frame.args[1]
    return mw.text.trim(p.getCategoryLabelAHWS(hurricane)) -- Ensure category label is a plain string
end

function p.renderCategoryLabelAHWS2(frame)
    local hurricane = frame.args[1]
    return mw.text.trim(p.getCategoryLabelAHWS2(hurricane)) -- Ensure category label is a plain string
end

function p.renderCategoryLabelAHWS3(frame)
    local hurricane = frame.args[1]
    return mw.text.trim(p.getCategoryLabelAHWS3(hurricane)) -- Ensure category label is a plain string
end

function p.renderCategoryLabelAHWS4(frame)
    local hurricane = frame.args[1]
    return mw.text.trim(p.getCategoryLabelAHWS4(hurricane)) -- Ensure category label is a plain string
end

function p.renderCategoryLabelTornado(frame)
    local fujita = frame.args[1]
    return mw.text.trim(p.getCategoryLabelTornado(fujita)) -- Ensure category label is a plain string
end

function p.renderCategoryLabelTornado2(frame)
    local fujita = frame.args[1]
    return mw.text.trim(p.getCategoryLabelTornado2(fujita)) -- Ensure category label is a plain string
end

function p.renderCategoryLabelTornado3(frame)
    local fujita = frame.args[1]
    return mw.text.trim(p.getCategoryLabelTornado3(fujita)) -- Ensure category label is a plain string
end

function p.renderCategoryLabelTornadoFScale(frame)
    local fujita = frame.args[1]
    return mw.text.trim(p.getCategoryLabelTornadoFScale(fujita)) -- Ensure category label is a plain string
end

function p.renderCategoryLabelTornadoFScale2(frame)
    local fujita = frame.args[1]
    return mw.text.trim(p.getCategoryLabelTornadoFScale2(fujita)) -- Ensure category label is a plain string
end

function p.renderCategoryLabelTornadoFScale3(frame)
    local fujita = frame.args[1]
    return mw.text.trim(p.getCategoryLabelTornadoFScale3(fujita)) -- Ensure category label is a plain string
end

function p.renderText(frame)
    local winds = frame.args[1] or "0"  -- Default to "0" if winds is nil
    return p.getWindSpeed(winds)  -- Return directly without trimming
end

function p.renderTextSSHWS(frame)
    local winds = frame.args[1] or "0"  -- Default to "0" if winds is nil
    return p.getWindSpeedSSHWS(winds)  -- Return directly without trimming
end

function p.renderTextAHWS(frame)
    local winds = frame.args[1] or "0"  -- Default to "0" if winds is nil
    return p.getWindSpeedAHWS(winds)  -- Return directly without trimming
end

function p.renderTextTornado(frame)
    local winds = frame.args[1] or "0"  -- Default to "0" if winds is nil
    return p.getWindSpeedTornado(winds)  -- Return directly without trimming
end

function p.renderTextTornadoFScale(frame)
    local winds = frame.args[1] or "0"  -- Default to "0" if winds is nil
    return p.getWindSpeedTornadoFScale(winds)  -- Return directly without trimming
end

return p