Module:Celestial object quadrangle
Revision as of 19:16, 11 July 2017 by blackwiki>Frietjes
| This module is rated as beta, and is ready for widespread use. It is still new and should be used with some caution to ensure the results are as expected. |
Contents
Usage
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) |
Tests
Category
The following two invocations should produce identical results
{{chop head and tail|{{#invoke:Celestial object quadrangle|category|globe=mars|lat=80|lon=-10}}}}→Category:{{#invoke:Celestial object quadrangle|name|globe=mars|lat=80|lon=-10}} quadrangle→ Category:Script error: The function "name" does not exist. quadrangle
Mars
| Input parameters | Module result | Expected result |
|---|---|---|
| West | ||
|globe=mars|lat=80|lon=-10
|
Script error: The function "name" does not exist. | Mare Boreum |
|globe=mars|lat=60|lon=-10
|
Script error: The function "name" does not exist. | Mare Acidalium |
|globe=mars|lat=60|lon=-70
|
Script error: The function "name" does not exist. | Arcadia |
|globe=mars|lat=60|lon=-130
|
Script error: The function "name" does not exist. | Diacria |
|globe=mars|lat=60|lon=-190
|
Script error: The function "name" does not exist. | Cebrenia |
|globe=mars|lat=60|lon=-280
|
Script error: The function "name" does not exist. | Casius |
|globe=mars|lat=60|lon=-340
|
Script error: The function "name" does not exist. | Ismenius Lacus |
|globe=mars|lat=20|lon=-10
|
Script error: The function "name" does not exist. | Oxia Palus |
|globe=mars|lat=20|lon=-55
|
Script error: The function "name" does not exist. | Lunae Palus |
|globe=mars|lat=20|lon=-100
|
Script error: The function "name" does not exist. | Tharsis |
|globe=mars|lat=20|lon=-145
|
Script error: The function "name" does not exist. | Amazonis |
|globe=mars|lat=20|lon=-190
|
Script error: The function "name" does not exist. | Elysium |
|globe=mars|lat=20|lon=-235
|
Script error: The function "name" does not exist. | Amenthes |
|globe=mars|lat=20|lon=-280
|
Script error: The function "name" does not exist. | Syrtis Major |
|globe=mars|lat=20|lon=-325
|
Script error: The function "name" does not exist. | Arabia |
|globe=mars|lat=-20|lon=-10
|
Script error: The function "name" does not exist. | Margaritifer Sinus |
|globe=mars|lat=-20|lon=-55
|
Script error: The function "name" does not exist. | Coprates |
|globe=mars|lat=-20|lon=-100
|
Script error: The function "name" does not exist. | Phoenicis Lacus |
|globe=mars|lat=-20|lon=-145
|
Script error: The function "name" does not exist. | Memnonia |
|globe=mars|lat=-20|lon=-190
|
Script error: The function "name" does not exist. | Aeolis |
|globe=mars|lat=-20|lon=-235
|
Script error: The function "name" does not exist. | Mare Tyrrhenum |
|globe=mars|lat=-20|lon=-280
|
Script error: The function "name" does not exist. | Iapygia |
|globe=mars|lat=-20|lon=-325
|
Script error: The function "name" does not exist. | Sinus Sabaeus |
|globe=mars|lat=-60|lon=-10
|
Script error: The function "name" does not exist. | Argyre |
|globe=mars|lat=-60|lon=-70
|
Script error: The function "name" does not exist. | Thaumasia |
|globe=mars|lat=-60|lon=-130
|
Script error: The function "name" does not exist. | Phaethontis |
|globe=mars|lat=-60|lon=-190
|
Script error: The function "name" does not exist. | Eridania |
|globe=mars|lat=-60|lon=-280
|
Script error: The function "name" does not exist. | Hellas |
|globe=mars|lat=-60|lon=-340
|
Script error: The function "name" does not exist. | Noachis |
|globe=mars|lat=-80|lon=-10
|
Script error: The function "name" does not exist. | Mare Australe |
| East | ||
|globe=mars|lat=80|lon=10
|
Script error: The function "name" does not exist. | Mare Boreum |
|globe=mars|lat=60|lon=10
|
Script error: The function "name" does not exist. | Ismenius Lacus |
|globe=mars|lat=60|lon=70
|
Script error: The function "name" does not exist. | Casius |
|globe=mars|lat=60|lon=130
|
Script error: The function "name" does not exist. | Cebrenia |
|globe=mars|lat=60|lon=190
|
Script error: The function "name" does not exist. | Diacria |
|globe=mars|lat=60|lon=280
|
Script error: The function "name" does not exist. | Arcadia |
|globe=mars|lat=60|lon=340
|
Script error: The function "name" does not exist. | Mare Acidalium |
|globe=mars|lat=20|lon=10
|
Script error: The function "name" does not exist. | Arabia |
|globe=mars|lat=20|lon=55
|
Script error: The function "name" does not exist. | Syrtis Major |
|globe=mars|lat=20|lon=100
|
Script error: The function "name" does not exist. | Amenthes |
|globe=mars|lat=20|lon=145
|
Script error: The function "name" does not exist. | Elysium |
|globe=mars|lat=20|lon=190
|
Script error: The function "name" does not exist. | Amazonis |
|globe=mars|lat=20|lon=235
|
Script error: The function "name" does not exist. | Tharsis |
|globe=mars|lat=20|lon=280
|
Script error: The function "name" does not exist. | Lunae Palus |
|globe=mars|lat=20|lon=325
|
Script error: The function "name" does not exist. | Oxia Palus |
|globe=mars|lat=-20|lon=10
|
Script error: The function "name" does not exist. | Sinus Sabaeus |
|globe=mars|lat=-20|lon=55
|
Script error: The function "name" does not exist. | Iapygia |
|globe=mars|lat=-20|lon=100
|
Script error: The function "name" does not exist. | Mare Tyrrhenum |
|globe=mars|lat=-20|lon=145
|
Script error: The function "name" does not exist. | Aeolis |
|globe=mars|lat=-20|lon=190
|
Script error: The function "name" does not exist. | Memnonia |
|globe=mars|lat=-20|lon=235
|
Script error: The function "name" does not exist. | Phoenicis Lacus |
|globe=mars|lat=-20|lon=280
|
Script error: The function "name" does not exist. | Coprates |
|globe=mars|lat=-20|lon=325
|
Script error: The function "name" does not exist. | Margaritifer Sinus |
|globe=mars|lat=-60|lon=10
|
Script error: The function "name" does not exist. | Noachis |
|globe=mars|lat=-60|lon=70
|
Script error: The function "name" does not exist. | Hellas |
|globe=mars|lat=-60|lon=130
|
Script error: The function "name" does not exist. | Eridania |
|globe=mars|lat=-60|lon=190
|
Script error: The function "name" does not exist. | Phaethontis |
|globe=mars|lat=-60|lon=280
|
Script error: The function "name" does not exist. | Thaumasia |
|globe=mars|lat=-60|lon=340
|
Script error: The function "name" does not exist. | Argyre |
|globe=mars|lat=-80|lon=10
|
Script error: The function "name" does not exist. | Mare Australe |
Mercury
| Input parameters | Module result | Expected result |
|---|---|---|
|globe=mercury|lat=-69|lon=-103
|
Script error: The function "name" does not exist. | Bach |
|globe=mercury|lat=-20|lon=-124
|
Script error: The function "name" does not exist. | Beethoven |
|globe=mercury|lat=73.4|lon=-79.5
|
Script error: The function "name" does not exist. | Borealis |
|globe=mercury|lat=-33.9|lon=-347.5
|
Script error: The function "name" does not exist. | Debussy |
|globe=mercury|lat=-8.7|lon=-340.3
|
Script error: The function "name" does not exist. | Derain |
|globe=mercury|lat=-56.3|lon=-38.3
|
Script error: The function "name" does not exist. | Discovery |
|globe=mercury|lat=10.79|lon=-245.87
|
Script error: The function "name" does not exist. | Eminescu |
|globe=mercury|lat=58.3|lon=-342.3
|
Script error: The function "name" does not exist. | Hokusai |
|globe=mercury|lat=-11.35|lon=-31.23
|
Script error: The function "name" does not exist. | Kuiper |
|globe=mercury|lat=-45.0|lon=-109.1
|
Script error: The function "name" does not exist. | Michelangelo |
|globe=mercury|lat=-52.6|lon=-234.2
|
Script error: The function "name" does not exist. | Neruda |
|globe=mercury|lat=27.28|lon=-240.93
|
Script error: The function "name" does not exist. | Raditladi |
|globe=mercury|lat=49.7|lon=-150.9
|
Script error: The function "name" does not exist. | Shakespeare |
|globe=mercury|lat=-16.3|lon=-163.5
|
Script error: The function "name" does not exist. | Tolstoj |
|globe=mercury|lat=50.9|lon=-31.1
|
Script error: The function "name" does not exist. | Victoria |
Moon
| Input parameters | Module result | Expected result |
|---|---|---|
| West | ||
|globe=moon|lat=80|lon=-10
|
Script error: The function "name" does not exist. | LQ01 |
|globe=moon|lat=60|lon=-10
|
Script error: The function "name" does not exist. | LQ04 |
|globe=moon|lat=60|lon=-70
|
Script error: The function "name" does not exist. | LQ03 |
|globe=moon|lat=60|lon=-130
|
Script error: The function "name" does not exist. | LQ02 |
|globe=moon|lat=60|lon=-190
|
Script error: The function "name" does not exist. | LQ07 |
|globe=moon|lat=60|lon=-280
|
Script error: The function "name" does not exist. | LQ06 |
|globe=moon|lat=60|lon=-340
|
Script error: The function "name" does not exist. | LQ05 |
|globe=moon|lat=20|lon=-10
|
Script error: The function "name" does not exist. | LQ11 |
|globe=moon|lat=20|lon=-55
|
Script error: The function "name" does not exist. | LQ10 |
|globe=moon|lat=20|lon=-100
|
Script error: The function "name" does not exist. | LQ09 |
|globe=moon|lat=20|lon=-145
|
Script error: The function "name" does not exist. | LQ08 |
|globe=moon|lat=20|lon=-190
|
Script error: The function "name" does not exist. | LQ15 |
|globe=moon|lat=20|lon=-235
|
Script error: The function "name" does not exist. | LQ14 |
|globe=moon|lat=20|lon=-280
|
Script error: The function "name" does not exist. | LQ13 |
|globe=moon|lat=20|lon=-325
|
Script error: The function "name" does not exist. | LQ12 |
|globe=moon|lat=-20|lon=-10
|
Script error: The function "name" does not exist. | LQ19 |
|globe=moon|lat=-20|lon=-55
|
Script error: The function "name" does not exist. | LQ18 |
|globe=moon|lat=-20|lon=-100
|
Script error: The function "name" does not exist. | LQ17 |
|globe=moon|lat=-20|lon=-145
|
Script error: The function "name" does not exist. | LQ16 |
|globe=moon|lat=-20|lon=-190
|
Script error: The function "name" does not exist. | LQ23 |
|globe=moon|lat=-20|lon=-235
|
Script error: The function "name" does not exist. | LQ22 |
|globe=moon|lat=-20|lon=-280
|
Script error: The function "name" does not exist. | LQ21 |
|globe=moon|lat=-20|lon=-325
|
Script error: The function "name" does not exist. | LQ20 |
|globe=moon|lat=-60|lon=-10
|
Script error: The function "name" does not exist. | LQ26 |
|globe=moon|lat=-60|lon=-70
|
Script error: The function "name" does not exist. | LQ25 |
|globe=moon|lat=-60|lon=-130
|
Script error: The function "name" does not exist. | LQ24 |
|globe=moon|lat=-60|lon=-190
|
Script error: The function "name" does not exist. | LQ29 |
|globe=moon|lat=-60|lon=-280
|
Script error: The function "name" does not exist. | LQ28 |
|globe=moon|lat=-60|lon=-340
|
Script error: The function "name" does not exist. | LQ27 |
|globe=moon|lat=-80|lon=-10
|
Script error: The function "name" does not exist. | LQ30 |
| East | ||
|globe=moon|lat=80|lon=10
|
Script error: The function "name" does not exist. | LQ01 |
|globe=moon|lat=60|lon=10
|
Script error: The function "name" does not exist. | LQ05 |
|globe=moon|lat=60|lon=70
|
Script error: The function "name" does not exist. | LQ06 |
|globe=moon|lat=60|lon=130
|
Script error: The function "name" does not exist. | LQ07 |
|globe=moon|lat=60|lon=190
|
Script error: The function "name" does not exist. | LQ02 |
|globe=moon|lat=60|lon=280
|
Script error: The function "name" does not exist. | LQ03 |
|globe=moon|lat=60|lon=340
|
Script error: The function "name" does not exist. | LQ04 |
|globe=moon|lat=20|lon=10
|
Script error: The function "name" does not exist. | LQ12 |
|globe=moon|lat=20|lon=55
|
Script error: The function "name" does not exist. | LQ13 |
|globe=moon|lat=20|lon=100
|
Script error: The function "name" does not exist. | LQ14 |
|globe=moon|lat=20|lon=145
|
Script error: The function "name" does not exist. | LQ15 |
|globe=moon|lat=20|lon=190
|
Script error: The function "name" does not exist. | LQ08 |
|globe=moon|lat=20|lon=235
|
Script error: The function "name" does not exist. | LQ09 |
|globe=moon|lat=20|lon=280
|
Script error: The function "name" does not exist. | LQ10 |
|globe=moon|lat=20|lon=325
|
Script error: The function "name" does not exist. | LQ11 |
|globe=moon|lat=-20|lon=10
|
Script error: The function "name" does not exist. | LQ20 |
|globe=moon|lat=-20|lon=55
|
Script error: The function "name" does not exist. | LQ21 |
|globe=moon|lat=-20|lon=100
|
Script error: The function "name" does not exist. | LQ22 |
|globe=moon|lat=-20|lon=145
|
Script error: The function "name" does not exist. | LQ23 |
|globe=moon|lat=-20|lon=190
|
Script error: The function "name" does not exist. | LQ16 |
|globe=moon|lat=-20|lon=235
|
Script error: The function "name" does not exist. | LQ17 |
|globe=moon|lat=-20|lon=280
|
Script error: The function "name" does not exist. | LQ18 |
|globe=moon|lat=-20|lon=325
|
Script error: The function "name" does not exist. | LQ19 |
|globe=moon|lat=-60|lon=10
|
Script error: The function "name" does not exist. | LQ27 |
|globe=moon|lat=-60|lon=70
|
Script error: The function "name" does not exist. | LQ28 |
|globe=moon|lat=-60|lon=130
|
Script error: The function "name" does not exist. | LQ29 |
|globe=moon|lat=-60|lon=190
|
Script error: The function "name" does not exist. | LQ24 |
|globe=moon|lat=-60|lon=280
|
Script error: The function "name" does not exist. | LQ25 |
|globe=moon|lat=-60|lon=340
|
Script error: The function "name" does not exist. | LQ26 |
|globe=moon|lat=-80|lon=10
|
Script error: The function "name" does not exist. | LQ30 |
Venus
| Input parameters | Module result | Expected result |
|---|---|---|
|globe=venus|lat=60|lon=90
|
Script error: The function "name" does not exist. | Ishtar Terra |
|globe=venus|lat=40|lon=20
|
Script error: The function "name" does not exist. | Sedna Planitia |
|globe=venus|lat=40|lon=80
|
Script error: The function "name" does not exist. | Niobe Planitia |
|globe=venus|lat=40|lon=200
|
Script error: The function "name" does not exist. | Guinevere Planitia |
|globe=venus|lat=-40|lon=20
|
Script error: The function "name" does not exist. | Lavinia Planitia |
|globe=venus|lat=-40|lon=80
|
Script error: The function "name" does not exist. | Aphrodite Planitia |
|globe=venus|lat=-40|lon=200
|
Script error: The function "name" does not exist. | Helen Planitia |
|globe=venus|lat=-60|lon=90
|
Script error: The function "name" does not exist. | Lada Terra |
|globe=venus|lat=60|lon=-90
|
Script error: The function "name" does not exist. | Ishtar Terra |
|globe=venus|lat=40|lon=-20
|
Script error: The function "name" does not exist. | Sedna Planitia |
|globe=venus|lat=40|lon=-80
|
Script error: The function "name" does not exist. | Guinevre Planitia |
|globe=venus|lat=40|lon=-200
|
Script error: The function "name" does not exist. | Niobe Planitia |
|globe=venus|lat=-40|lon=-20
|
Script error: The function "name" does not exist. | Lavinia Planitia |
|globe=venus|lat=-40|lon=-80
|
Script error: The function "name" does not exist. | Helen Planitia |
|globe=venus|lat=-40|lon=-200
|
Script error: The function "name" does not exist. | Aphrodite Terra |
|globe=venus|lat=-60|lon=-90
|
Script error: The function "name" does not exist. | Lada Terra |
Templates using this module
-- This module implements/replaces
-- [[Template:Lunar quadrangle]]
-- [[Template:Mars quadrangle]]
-- [[Template:Mercury quadrangle category]]
-- [[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
function p.category(frame)
local args = frame.args
local lat, lon, globe = nil, nil, nil
local res = ''
local function cat(s) return '[[Category:' .. s .. ' quadrangle]]' end
-- process args
if args['globe'] and args['globe'] ~= '' then
globe = args['globe']:lower()
end
if args['lat'] and args['lat'] ~= '' then
lat = tonumber(args['lat'])
end
if args['lon'] and args['lon'] ~= '' then
lon = tonumber(args['lon'])
end
if lat ~= nil and lon ~= nil and globe ~= nil then
if lon < 0 then lon = lon + 360 end
if lon < 0 or lon > 360 then
return 'Error'
end
if globe == 'mars' then
res = marsquad(lat, lon)
elseif globe == 'mercury' then
res = mercuryquad(lat, lon)
elseif globe == 'moon' then
res = moonquad(lat, lon)
elseif globe == 'venus' then
res = venusquad(lat, lon)
else
res = 'Error'
end
if res ~= 'Error' then
if args['nameonly'] and args['nameonly'] ~= '' then
return res
end
return '[[Category:' .. res .. ' quadrangle]]'
end
end
return '<span class="error">Error</span>'
end
return p