সমললৈ যাওক

Module:Celestial object quadrangle

অসমীয়া ৱিকিপিডিয়াৰ পৰা

For the quadrangle category, use

{{#invoke:Celestial object quadrangle|category|globe=GLOBE|lat=XX.XXX|lon=YY.YYY}}

or, for the quadrangle name, use

{{#invoke:Celestial object quadrangle|name|globe=GLOBE|lat=XX.XXX|lon=YY.YYY}}
Parameter Description
globe Name of the celestial object: moon, mars, mercury, or venus
lat Degrees latitude (between -90 and 90)
lon Degrees longitude (between -360 and 360)

The following two invocations should produce identical results

  • {{chop head and tail|{{#invoke:Celestial object quadrangle|category|globe=mars|lat=80|lon=-10}}}}সাঁচ:Chop head and tail
  • Category:{{#invoke:Celestial object quadrangle|name|globe=mars|lat=80|lon=-10}} quadrangle → Category:Mare Boreum quadrangle
Input parameters Module result Expected result
West
|globe=mars|lat=80|lon=-10 Mare Boreum Mare Boreum
|globe=mars|lat=60|lon=-10 Mare Acidalium Mare Acidalium
|globe=mars|lat=60|lon=-70 Arcadia Arcadia
|globe=mars|lat=60|lon=-130 Diacria Diacria
|globe=mars|lat=60|lon=-190 Cebrenia Cebrenia
|globe=mars|lat=60|lon=-280 Casius Casius
|globe=mars|lat=60|lon=-340 Ismenius Lacus Ismenius Lacus
|globe=mars|lat=20|lon=-10 Oxia Palus Oxia Palus
|globe=mars|lat=20|lon=-55 Lunae Palus Lunae Palus
|globe=mars|lat=20|lon=-100 Tharsis Tharsis
|globe=mars|lat=20|lon=-145 Amazonis Amazonis
|globe=mars|lat=20|lon=-190 Elysium Elysium
|globe=mars|lat=20|lon=-235 Amenthes Amenthes
|globe=mars|lat=20|lon=-280 Syrtis Major Syrtis Major
|globe=mars|lat=20|lon=-325 Arabia Arabia
|globe=mars|lat=-20|lon=-10 Margaritifer Sinus Margaritifer Sinus
|globe=mars|lat=-20|lon=-55 Coprates Coprates
|globe=mars|lat=-20|lon=-100 Phoenicis Lacus Phoenicis Lacus
|globe=mars|lat=-20|lon=-145 Memnonia Memnonia
|globe=mars|lat=-20|lon=-190 Aeolis Aeolis
|globe=mars|lat=-20|lon=-235 Mare Tyrrhenum Mare Tyrrhenum
|globe=mars|lat=-20|lon=-280 Iapygia Iapygia
|globe=mars|lat=-20|lon=-325 Sinus Sabaeus Sinus Sabaeus
|globe=mars|lat=-60|lon=-10 Argyre Argyre
|globe=mars|lat=-60|lon=-70 Thaumasia Thaumasia
|globe=mars|lat=-60|lon=-130 Phaethontis Phaethontis
|globe=mars|lat=-60|lon=-190 Eridania Eridania
|globe=mars|lat=-60|lon=-280 Hellas Hellas
|globe=mars|lat=-60|lon=-340 Noachis Noachis
|globe=mars|lat=-80|lon=-10 Mare Australe Mare Australe
East
|globe=mars|lat=80|lon=10 Mare Boreum Mare Boreum
|globe=mars|lat=60|lon=10 Ismenius Lacus Ismenius Lacus
|globe=mars|lat=60|lon=70 Casius Casius
|globe=mars|lat=60|lon=130 Cebrenia Cebrenia
|globe=mars|lat=60|lon=190 Diacria Diacria
|globe=mars|lat=60|lon=280 Arcadia Arcadia
|globe=mars|lat=60|lon=340 Mare Acidalium Mare Acidalium
|globe=mars|lat=20|lon=10 Arabia Arabia
|globe=mars|lat=20|lon=55 Syrtis Major Syrtis Major
|globe=mars|lat=20|lon=100 Amenthes Amenthes
|globe=mars|lat=20|lon=145 Elysium Elysium
|globe=mars|lat=20|lon=190 Amazonis Amazonis
|globe=mars|lat=20|lon=235 Tharsis Tharsis
|globe=mars|lat=20|lon=280 Lunae Palus Lunae Palus
|globe=mars|lat=20|lon=325 Oxia Palus Oxia Palus
|globe=mars|lat=-20|lon=10 Sinus Sabaeus Sinus Sabaeus
|globe=mars|lat=-20|lon=55 Iapygia Iapygia
|globe=mars|lat=-20|lon=100 Mare Tyrrhenum Mare Tyrrhenum
|globe=mars|lat=-20|lon=145 Aeolis Aeolis
|globe=mars|lat=-20|lon=190 Memnonia Memnonia
|globe=mars|lat=-20|lon=235 Phoenicis Lacus Phoenicis Lacus
|globe=mars|lat=-20|lon=280 Coprates Coprates
|globe=mars|lat=-20|lon=325 Margaritifer Sinus Margaritifer Sinus
|globe=mars|lat=-60|lon=10 Noachis Noachis
|globe=mars|lat=-60|lon=70 Hellas Hellas
|globe=mars|lat=-60|lon=130 Eridania Eridania
|globe=mars|lat=-60|lon=190 Phaethontis Phaethontis
|globe=mars|lat=-60|lon=280 Thaumasia Thaumasia
|globe=mars|lat=-60|lon=340 Argyre Argyre
|globe=mars|lat=-80|lon=10 Mare Australe Mare Australe
Input parameters Module result Expected result
|globe=mercury|lat=-69|lon=-103 Bach Bach
|globe=mercury|lat=-20|lon=-124 Beethoven Beethoven
|globe=mercury|lat=73.4|lon=-79.5 Borealis Borealis
|globe=mercury|lat=-33.9|lon=-347.5 Debussy Debussy
|globe=mercury|lat=-8.7|lon=-340.3 Derain Derain
|globe=mercury|lat=-56.3|lon=-38.3 Discovery Discovery
|globe=mercury|lat=10.79|lon=-245.87 Eminescu Eminescu
|globe=mercury|lat=58.3|lon=-342.3 Hokusai Hokusai
|globe=mercury|lat=-11.35|lon=-31.23 Kuiper Kuiper
|globe=mercury|lat=-45.0|lon=-109.1 Michelangelo Michelangelo
|globe=mercury|lat=-52.6|lon=-234.2 Neruda Neruda
|globe=mercury|lat=27.28|lon=-240.93 Raditladi Raditladi
|globe=mercury|lat=49.7|lon=-150.9 Shakespeare Shakespeare
|globe=mercury|lat=-16.3|lon=-163.5 Tolstoj Tolstoj
|globe=mercury|lat=50.9|lon=-31.1 Victoria Victoria
Input parameters Module result Expected result
West
|globe=moon|lat=80|lon=-10 LQ01 LQ01
|globe=moon|lat=60|lon=-10 LQ04 LQ04
|globe=moon|lat=60|lon=-70 LQ03 LQ03
|globe=moon|lat=60|lon=-130 LQ02 LQ02
|globe=moon|lat=60|lon=-190 LQ07 LQ07
|globe=moon|lat=60|lon=-280 LQ06 LQ06
|globe=moon|lat=60|lon=-340 LQ05 LQ05
|globe=moon|lat=20|lon=-10 LQ11 LQ11
|globe=moon|lat=20|lon=-55 LQ10 LQ10
|globe=moon|lat=20|lon=-100 LQ09 LQ09
|globe=moon|lat=20|lon=-145 LQ08 LQ08
|globe=moon|lat=20|lon=-190 LQ15 LQ15
|globe=moon|lat=20|lon=-235 LQ14 LQ14
|globe=moon|lat=20|lon=-280 LQ13 LQ13
|globe=moon|lat=20|lon=-325 LQ12 LQ12
|globe=moon|lat=-20|lon=-10 LQ19 LQ19
|globe=moon|lat=-20|lon=-55 LQ18 LQ18
|globe=moon|lat=-20|lon=-100 LQ17 LQ17
|globe=moon|lat=-20|lon=-145 LQ16 LQ16
|globe=moon|lat=-20|lon=-190 LQ23 LQ23
|globe=moon|lat=-20|lon=-235 LQ22 LQ22
|globe=moon|lat=-20|lon=-280 LQ21 LQ21
|globe=moon|lat=-20|lon=-325 LQ20 LQ20
|globe=moon|lat=-60|lon=-10 LQ26 LQ26
|globe=moon|lat=-60|lon=-70 LQ25 LQ25
|globe=moon|lat=-60|lon=-130 LQ24 LQ24
|globe=moon|lat=-60|lon=-190 LQ29 LQ29
|globe=moon|lat=-60|lon=-280 LQ28 LQ28
|globe=moon|lat=-60|lon=-340 LQ27 LQ27
|globe=moon|lat=-80|lon=-10 LQ30 LQ30
East
|globe=moon|lat=80|lon=10 LQ01 LQ01
|globe=moon|lat=60|lon=10 LQ05 LQ05
|globe=moon|lat=60|lon=70 LQ06 LQ06
|globe=moon|lat=60|lon=130 LQ07 LQ07
|globe=moon|lat=60|lon=190 LQ02 LQ02
|globe=moon|lat=60|lon=280 LQ03 LQ03
|globe=moon|lat=60|lon=340 LQ04 LQ04
|globe=moon|lat=20|lon=10 LQ12 LQ12
|globe=moon|lat=20|lon=55 LQ13 LQ13
|globe=moon|lat=20|lon=100 LQ14 LQ14
|globe=moon|lat=20|lon=145 LQ15 LQ15
|globe=moon|lat=20|lon=190 LQ08 LQ08
|globe=moon|lat=20|lon=235 LQ09 LQ09
|globe=moon|lat=20|lon=280 LQ10 LQ10
|globe=moon|lat=20|lon=325 LQ11 LQ11
|globe=moon|lat=-20|lon=10 LQ20 LQ20
|globe=moon|lat=-20|lon=55 LQ21 LQ21
|globe=moon|lat=-20|lon=100 LQ22 LQ22
|globe=moon|lat=-20|lon=145 LQ23 LQ23
|globe=moon|lat=-20|lon=190 LQ16 LQ16
|globe=moon|lat=-20|lon=235 LQ17 LQ17
|globe=moon|lat=-20|lon=280 LQ18 LQ18
|globe=moon|lat=-20|lon=325 LQ19 LQ19
|globe=moon|lat=-60|lon=10 LQ27 LQ27
|globe=moon|lat=-60|lon=70 LQ28 LQ28
|globe=moon|lat=-60|lon=130 LQ29 LQ29
|globe=moon|lat=-60|lon=190 LQ24 LQ24
|globe=moon|lat=-60|lon=280 LQ25 LQ25
|globe=moon|lat=-60|lon=340 LQ26 LQ26
|globe=moon|lat=-80|lon=10 LQ30 LQ30
Input parameters Module result Expected result
|globe=venus|lat=60|lon=90 Ishtar Terra Ishtar Terra
|globe=venus|lat=40|lon=20 Sedna Planitia Sedna Planitia
|globe=venus|lat=40|lon=80 Niobe Planitia Niobe Planitia
|globe=venus|lat=40|lon=200 Guinevere Planitia Guinevere Planitia
|globe=venus|lat=-40|lon=20 Lavinia Planitia Lavinia Planitia
|globe=venus|lat=-40|lon=80 Aphrodite Terra Aphrodite Planitia
|globe=venus|lat=-40|lon=200 Helen Planitia Helen Planitia
|globe=venus|lat=-60|lon=90 Lada Terra Lada Terra
|globe=venus|lat=60|lon=-90 Ishtar Terra Ishtar Terra
|globe=venus|lat=40|lon=-20 Sedna Planitia Sedna Planitia
|globe=venus|lat=40|lon=-80 Guinevere Planitia Guinevre Planitia
|globe=venus|lat=40|lon=-200 Niobe Planitia Niobe Planitia
|globe=venus|lat=-40|lon=-20 Lavinia Planitia Lavinia Planitia
|globe=venus|lat=-40|lon=-80 Helen Planitia Helen Planitia
|globe=venus|lat=-40|lon=-200 Aphrodite Terra Aphrodite Terra
|globe=venus|lat=-60|lon=-90 Lada Terra Lada Terra

Templates using this module

[সম্পাদনা কৰক]

-- This module implements/replaces
-- [[Template:Lunar quadrangle]]
-- [[Template:Mars quadrangle]]
-- [[Template:Venus quadrangle]]
local p = {}

local function moonquad(lat, lon)
	local function LQ(n)
		if n < 10 then 
			return 'LQ0' .. n
		else 
			return 'LQ' .. n
		end
	end
	-- Note: requires positive longitude coordinates
	if lat > 65 then
		return LQ(1)
	elseif lat > 30 then
		if lon >= 180 then
			return LQ(2 + math.floor( (lon - 180) / 60 ) )
		else
			return LQ(5 + math.floor( lon / 60 ) )
		end
	elseif lat >= 0 then
		if lon >= 180 then
			return LQ(8 + math.floor( (lon - 180) / 45 ) )
		else
			return LQ(12 + math.floor( lon / 45 ) )
		end
	elseif lat >= -30 then
		if lon >= 180 then
			return LQ(16 + math.floor( (lon - 180) / 45 ) )
		else
			return LQ(20 + math.floor( lon / 45 ) )
		end
	elseif lat >= -65 then
		if lon >= 180 then
			return LQ(24 + math.floor( (lon - 180) / 60 ) )
		else
			return LQ(27 + math.floor( lon / 60 ) )
		end
	else
		return LQ(30)
	end

	return 'Error'
end

local function marsquad(lat, lon)
	-- Note: requires positive longitude coordinates
	if lat > 65 then 
		return 'Mare Boreum'
	elseif lat > 30 then 
		if lon < 60 then return 'Ismenius Lacus'
		elseif lon < 120 then return 'Casius'
		elseif lon < 180 then return 'Cebrenia'
		elseif lon < 240 then return 'Diacria'
		elseif lon < 300 then return 'Arcadia'
		else return 'Mare Acidalium' end
	elseif lat >= 0 then 
		if lon < 45 then return 'Arabia'
		elseif lon <  90 then return 'Syrtis Major'
		elseif lon < 135 then return 'Amenthes'
		elseif lon < 180 then return 'Elysium'
		elseif lon < 225 then return 'Amazonis'
		elseif lon < 270 then return 'Tharsis'
		elseif lon < 315 then return 'Lunae Palus'
		else return 'Oxia Palus' end
	elseif lat >= -30 then 
		if lon < 45 then return 'Sinus Sabaeus'
		elseif lon <  90 then return 'Iapygia'
		elseif lon < 135 then return 'Mare Tyrrhenum'
		elseif lon < 180 then return 'Aeolis'
		elseif lon < 225 then return 'Memnonia'
		elseif lon < 270 then return 'Phoenicis Lacus'
		elseif lon < 315 then return 'Coprates'
		else return 'Margaritifer Sinus' end
	elseif lat >= -65 then 
		if lon < 60 then return 'Noachis'
		elseif lon < 120 then return 'Hellas'
		elseif lon < 180 then return 'Eridania'
		elseif lon < 240 then return 'Phaethontis'
		elseif lon < 300 then return 'Thaumasia'
		else return 'Argyre' end
	else
		return 'Mare Australe'
	end
end

local function mercuryquad(lat, lon)
	-- Note: requires positive longitude coordinates
	if lat >= 66 then
		return 'Borealis'
	elseif lat >= 21 then
		if lon < 90 then return 'Hokusai'
		elseif lon < 180 then return 'Raditladi'
		elseif lon < 270 then return 'Shakespeare'
		else return 'Victoria' end
	elseif lat > -21 then
		if lon < 72 then return 'Derain'
		elseif lon < 144 then return 'Eminescu'
		elseif lon < 216 then return 'Tolstoj'
		elseif lon < 266 then return 'Beethoven'
		else return 'Kuiper' end
	elseif lat > -66 then
		if lon < 90 then return 'Debussy'
		elseif lon < 180 then return 'Neruda'
		elseif lon < 270 then return 'Michelangelo'
		else return 'Discovery' end
	else
		return 'Bach'
	end

	return 'Error'
end

local function venusquad(lat, lon)
	-- Note: requires positive longitude coordinates
	if lat > 57 then
		return 'Ishtar Terra'
	elseif lat >= 0 then
		if lon < 60 or lon >= 300 then return 'Sedna Planitia'
		elseif lon < 180 then return 'Niobe Planitia'
		else return 'Guinevere Planitia' end
	elseif lat >= -57 then
		if lon < 60  or lon >= 300 then return 'Lavinia Planitia'
		elseif lon < 180 then return 'Aphrodite Terra'
		else return 'Helen Planitia' end
	else
		return 'Lada Terra'
	end
end

local function quad_name(lat, lon, globe)
	-- lower case
	globe = globe:lower() or ''

	-- convert to numbers
	lat = tonumber(lat) or ''
	lon = tonumber(lon) or ''

	-- get the quad name
	if lat ~= '' and lon ~= '' and globe ~= '' then
		if lon < 0 then lon = lon + 360 end
		if lon < 0 or lon > 360 then
			return 'Error'
		end
		if globe == 'mars' then
			return marsquad(lat, lon)
		elseif globe == 'mercury' then
			return mercuryquad(lat, lon)
		elseif globe == 'moon' then
			return moonquad(lat, lon)
		elseif globe == 'venus' then
			return venusquad(lat, lon)
		end
	end

	return 'Error'
end

function p.category(frame)
	local args = frame.args
	local res = quad_name(args['lat'] or '', args['lon'] or '', args['globe'] or '')
	
	if res ~= 'Error' then
		if args['nameonly'] and args['nameonly'] ~= '' then
			return res
		else
			return '[[Category:' .. res .. ' quadrangle]]'
		end
	end

	return '<span class="error">Error</span>'
end

function p.name(frame)
	local args = frame.args
	local res = quad_name(args['lat'] or '', args['lon'] or '', args['globe'] or '')
	
	if res ~= 'Error' then
		return res
	end
	return '<span class="error">Error</span>'
end

return p