모듈:음력양력변환

이 모듈은 틀:음력양력변환 내에서 음력 날짜 변환을 위한 값을 저장하고 불러오기 위해 제작된 모듈입니다. 문서 내에 삽입할 때에는 틀:음력양력변환 또는 틀:음력양력변환/차이를 이용합니다.

1 작동 원리[편집]

{{#invoke:음력양력변환|lunar|연|월|윤달}}

  • 윤달: 평달(0), 윤달(1)

2 데이터 추가 방법[편집]

음력과 양력 사이에는 간단한 변환 규칙이 없어 이용자가 직접 모듈:음력양력변환에 데이터를 추가해야합니다. 방법은 다음과 같습니다.

  1. 한국천문연구원 등 음력 → 양력 변환 정보를 얻을 수 있는 곳을 찾는다.
  2. 음력 Y년 (윤)M월 1일을 변환한 날짜가 양력 A년 B월 C일일 때, 양력 Y년 M월 1일과 양력 A년 B월 C일의 차이 (이하 "D")를 구한다.
  3. (작성되지 않았다면) 음력 Y년에 해당하는 코드를 모듈:음력양력변환Month1Month2에 각각 추가한다.
    [Y] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  4. 다음과 같이 값을 바꾼다.
    1. 평달은 Month1에서 [Y] = 옆의 리스트의 M번째 값을 D로 바꾼다.
    2. 윤달은 Month2에서 [Y] = 옆의 리스트의 M번째 값을 D로 바꾼다. (윤달이 있는 경우에 한정)

-- 2051년은 음력 2050년 12월 끝날을 계산하기 위해 1월만 추가되었으며, 음력 2050년 12월, 1월 첫날은 위키백과 "2050년", "2051년" 문서를 참조하였습니다.

local p = {}
local Month1 = {
    [1980] = {46, 45, 45, 43, 43, 41, 41, 39, 38, 38, 36, 36},
    [1981] = {35, 33, 35, 33, 32, 31, 30, 28, 27, 27, 25, 25},
    [1982] = {24, 23, 24, 23, 51, 50, 49, 47, 46, 46, 44, 44},
    [1983] = {43, 42, 43, 42, 41, 39, 39, 37, 35, 35, 33, 33},
    [1984] = {32, 31, 31, 30, 30, 28, 27, 26, 24, 23, 51, 51},
    [1985] = {50, 48, 50, 49, 48, 47, 46, 45, 43, 42, 41, 40},
    [1986] = {39, 37, 39, 38, 37, 36, 36, 34, 33, 32, 31, 30},
    [1987] = {28, 27, 28, 27, 27, 25, 54, 53, 52, 51, 50, 49},
    [1988] = {48, 46, 46, 45, 44, 43, 42, 41, 40, 39, 38, 38},
    [1989] = {36, 35, 36, 34, 34, 32, 32, 30, 29, 29, 27, 27},
    [1990] = {26, 24, 26, 24, 23, 51, 50, 49, 48, 47, 46, 46},
    [1991] = {45, 43, 45, 43, 42, 41, 40, 38, 37, 36, 35, 35},
    [1992] = {34, 32, 33, 32, 31, 29, 29, 27, 25, 25, 23, 23},
    [1993] = {22, 20, 22, 50, 50, 48, 48, 46, 44, 44, 42, 42},
    [1994] = {40, 39, 41, 40, 39, 38, 37, 36, 34, 33, 32, 31},
    [1995] = {30, 28, 30, 29, 28, 27, 27, 25, 53, 53, 51, 50},
    [1996] = {49, 47, 48, 46, 46, 45, 44, 43, 41, 41, 40, 39},
    [1997] = {38, 36, 37, 36, 35, 34, 33, 32, 31, 30, 29, 29},
    [1998] = {27, 26, 27, 25, 25, 52, 52, 51, 49, 49, 48, 48},
    [1999] = {46, 45, 46, 44, 44, 42, 41, 40, 38, 38, 37, 37},
    [2000] = {35, 34, 35, 33, 32, 31, 30, 28, 27, 26, 25, 25},
    [2001] = {23, 22, 24, 23, 51, 50, 49, 47, 46, 45, 44, 43},
    [2002] = {42, 41, 43, 41, 41, 39, 39, 37, 35, 35, 33, 33},
    [2003] = {31, 30, 32, 30, 30, 29, 28, 27, 25, 24, 23, 22},
    [2004] = {21, 19, 49, 48, 48, 46, 46, 44, 43, 42, 41, 40},
    [2005] = {39, 37, 39, 37, 37, 35, 35, 34, 32, 32, 31, 30},
    [2006] = {28, 27, 28, 27, 26, 25, 24, 52, 51, 51, 49, 49},
    [2007] = {48, 46, 47, 46, 45, 43, 43, 41, 40, 40, 39, 38},
    [2008] = {37, 36, 36, 34, 34, 32, 31, 30, 28, 28, 27, 26},
    [2009] = {25, 24, 26, 24, 23, 51, 50, 49, 47, 47, 45, 45},
    [2010] = {44, 43, 44, 43, 42, 41, 40, 38, 37, 36, 35, 34},
    [2011] = {33, 32, 33, 32, 32, 30, 30, 28, 26, 26, 24, 24},
    [2012] = {22, 21, 21, 50, 50, 48, 48, 46, 44, 44, 42, 42},
    [2013] = {40, 39, 40, 39, 39, 37, 37, 35, 34, 33, 32, 31},
    [2014] = {30, 28, 30, 28, 28, 26, 26, 24, 23, 52, 51, 50},
    [2015] = {49, 47, 49, 47, 46, 45, 44, 43, 42, 42, 40, 40},
    [2016] = {38, 37, 37, 36, 35, 33, 33, 31, 30, 30, 28, 28},
    [2017] = {27, 25, 27, 25, 25, 52, 52, 50, 49, 48, 47, 47},
    [2018] = {46, 44, 46, 44, 44, 42, 41, 40, 38, 38, 36, 36},
    [2019] = {35, 34, 35, 34, 33, 32, 31, 29, 28, 27, 26, 25},
    [2020] = {24, 23, 23, 22, 51, 50, 49, 47, 46, 45, 44, 43},
    [2021] = {42, 40, 42, 41, 40, 39, 38, 37, 35, 35, 33, 33},
    [2022] = {31, 30, 31, 30, 29, 28, 28, 26, 25, 24, 23, 22},
    [2023] = {21, 19, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41},
    [2024] = {40, 38, 39, 37, 36, 35, 34, 33, 32, 31, 30, 30},
    [2025] = {28, 27, 28, 27, 26, 24, 53, 52, 50, 50, 49, 49},
    [2026] = {47, 46, 47, 46, 45, 43, 43, 41, 40, 39, 38, 38},
    [2027] = {37, 35, 37, 35, 35, 33, 32, 31, 29, 28, 27, 27},
    [2028] = {26, 24, 25, 24, 23, 51, 50, 49, 47, 46, 45, 45},
    [2029] = {43, 42, 44, 42, 42, 41, 40, 38, 37, 36, 34, 34},
    [2030] = {33, 31, 33, 31, 31, 30, 29, 28, 26, 26, 24, 24},
    [2031] = {22, 21, 22, 50, 50, 48, 48, 47, 45, 45, 43, 43},
    [2032] = {41, 40, 40, 38, 38, 36, 36, 35, 33, 33, 32, 31},
    [2033] = {30, 28, 30, 28, 27, 26, 25, 24, 22, 22, 21, 50},
    [2034] = {49, 47, 49, 47, 46, 45, 44, 43, 41, 41, 40, 40},
    [2035] = {38, 37, 38, 37, 36, 34, 34, 32, 30, 30, 29, 28},
    [2036] = {27, 26, 27, 25, 25, 23, 52, 50, 48, 48, 47, 46},
    [2037] = {45, 44, 46, 44, 44, 42, 41, 40, 38, 37, 36, 35},
    [2038] = {34, 33, 35, 33, 33, 31, 31, 29, 28, 27, 25, 25},
    [2039] = {23, 22, 24, 22, 22, 50, 50, 48, 47, 46, 45, 44},
    [2040] = {42, 41, 41, 40, 40, 38, 38, 37, 35, 35, 33, 33},
    [2041] = {31, 30, 31, 29, 29, 27, 27, 26, 24, 24, 23, 22},
    [2042] = {21, 19, 50, 48, 48, 46, 46, 44, 43, 43, 41, 41},
    [2043] = {40, 38, 40, 38, 37, 36, 35, 33, 32, 32, 30, 30},
    [2044] = {29, 28, 28, 27, 26, 24, 24, 51, 50, 49, 48, 48},
    [2045] = {47, 46, 47, 46, 45, 43, 43, 41, 39, 39, 37, 37},
    [2046] = {36, 35, 36, 35, 35, 33, 32, 31, 29, 28, 27, 26},
    [2047] = {25, 24, 25, 24, 24, 52, 51, 50, 48, 47, 46, 45},
    [2048] = {44, 42, 43, 42, 41, 40, 40, 38, 37, 36, 35, 34},
    [2049] = {32, 31, 32, 31, 30, 29, 29, 27, 26, 26, 24, 24},
    [2050] = {22, 21, 22, 50, 49, 48, 47, 46, 45, 44, 43, 43},
    [2051] = {41,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
}
local Month2 = {
    [1980] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [1981] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [1982] = { 0,  0,  0, 52,  0,  0,  0,  0,  0,  0,  0,  0},
    [1983] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [1984] = { 0,  0,  0,  0,  0,  0,  0,  0,  0, 53,  0,  0},
    [1985] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [1986] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [1987] = { 0,  0,  0,  0,  0, 55,  0,  0,  0,  0,  0,  0},
    [1988] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [1989] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [1990] = { 0,  0,  0,  0, 53,  0,  0,  0,  0,  0,  0,  0},
    [1991] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [1992] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [1993] = { 0,  0, 52,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [1994] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [1995] = { 0,  0,  0,  0,  0,  0,  0, 55,  0,  0,  0,  0},
    [1996] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [1997] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [1998] = { 0,  0,  0,  0, 54,  0,  0,  0,  0,  0,  0,  0},
    [1999] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2000] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2001] = { 0,  0,  0, 52,  0,  0,  0,  0,  0,  0,  0,  0},
    [2002] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2003] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2004] = { 0, 49,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2005] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2006] = { 0,  0,  0,  0,  0,  0, 54,  0,  0,  0,  0,  0},
    [2007] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2008] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2009] = { 0,  0,  0,  0, 53,  0,  0,  0,  0,  0,  0,  0},
    [2010] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2011] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2012] = { 0,  0, 51,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2013] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2014] = { 0,  0,  0,  0,  0,  0,  0,  0, 53,  0,  0,  0},
    [2015] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2016] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2017] = { 0,  0,  0,  0, 54,  0,  0,  0,  0,  0,  0,  0},
    [2018] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2019] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2020] = { 0,  0,  0, 52,  0,  0,  0,  0,  0,  0,  0,  0},
    [2021] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2022] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2023] = { 0, 49,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2024] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2025] = { 0,  0,  0,  0,  0, 54,  0,  0,  0,  0,  0,  0},
    [2026] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2027] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2028] = { 0,  0,  0,  0, 53,  0,  0,  0,  0,  0,  0,  0},
    [2029] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2030] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2031] = { 0,  0, 52,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2032] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2033] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 51,  0},
    [2034] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2035] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2036] = { 0,  0,  0,  0,  0, 52,  0,  0,  0,  0,  0,  0},
    [2037] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2038] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2039] = { 0,  0,  0,  0, 52,  0,  0,  0,  0,  0,  0,  0},
    [2040] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2041] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2042] = { 0, 49,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2043] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2044] = { 0,  0,  0,  0,  0,  0, 53,  0,  0,  0,  0,  0},
    [2045] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2046] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2047] = { 0,  0,  0,  0, 53,  0,  0,  0,  0,  0,  0,  0},
    [2048] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2049] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2050] = { 0,  0, 51,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    [2051] = { 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
}

function p.lunar(inputs)
  local year  = tonumber(inputs.args[1])
  local month = tonumber(inputs.args[2])
  local m2    = tonumber(inputs.args[3])
  local result = ""
  if m2 == 0 then
    result = Month1[year][month]
  else
    result = Month2[year][month]
  end
  if result == 0 then
    return "@"
  end
  return result
end
return p