Skip to content
Frank Thomas Tveter edited this page Aug 28, 2019 · 7 revisions

cgi-bin/short.pl supports the legacy calls to api.met.no/sunrise.

USAGE cgi-bin/short.pl:

Parameters

The following parameters are supported:

  • lat (latitude), in decimal degrees, mandatory
  • lon (longtitude), in decimal degrees, mandatory
  • height altitude above ellipsoide, in km (default 0)
  • date given as YYYY-MM-DD, mandatory
  • offset timezone offset, on the format +HH:MM or -HH:MM mandatory
  • days number of days forward to include (default 1, max 15)

Example URLs

New York (test), Blindern-Oslo without DST (test), polar midsummer in Novaya Zemlya (test), start of polar night in Hopen-Svalbard (test).

Output format

See also https://github.com/FrankThomasTveter/astro-api/wiki/event for more info on returned values Output format

In contrast to previous versions, the new XML format only contains event that actually are occuring. This means that sunrise/sunset may not occur in polar regions, and there may be 0, 1 or 2 moonrise/moonsets.

The data are sorted per location and time. For each date, 0..n of the following elements may be included (attributes given in parens), sorted chronologically:

  • sunrise (time)

  • sunset (time)

  • solarnoon (time, elevation)

  • solarmidnight (time, elevation)

  • moonphase (time, value), value representing:

    0..25: "waxing crescent" 25..50: "waxing gibbous" 50..75: "waning gibbous" 75..100: "waning crescent"

  • moonshadow (time, elevation, azimuth)

  • moonposition (time, elevation, azimuth, range)

  • moonrise (time)

  • moonset (time)

  • high_moon (time, elevation)

  • low_moon (time, elevation)

  • polardayend (time)

  • polardaystart (time)

  • polarnightend (time)

  • polarnightstart (time)

Note that elevations are of the "upper-limb" of the mentioned celestial bodies, and not the body center. You may check if the body is visible above the horizon by checking if the upper-limb elevation is greater than the refraction (36"), i.e. upper-limb-elevation > -0.5666 implies that the body is visible above horizon.

A desc attribute may also be present to explain the correct scientific term for the event. This should not be used for computational purposes as it may change without warning. Example

Oslo: https://api.met.no/weatherapi/sunrise/2.0?lat=59.933333&lon=10.716667&date=2018-05-11&offset=+01:00

  <astrodata>
     <meta licenseurl="https://api.met.no/license_data.html" />
     <location latitude="59.933333" longitude="10.716667" height="0">
        <time date="2018-05-11">
           <moonphase time="2018-05-11T00:00:00+01:00" value="83.993572055" desc="LOCAL MOON STATE * MOON PHASE= 84.0 (waning crescent)" />
           <moonshadow time="2018-05-11T00:00:00+01:00" elevation="-32.253039217" azimuth="271.265661838" desc="LOCAL MOON STATE * SHADOW ANGLES (azi=271.3,ele=-32.3)" />
           <moonposition time="2018-05-11T00:00:00+01:00" elevation="-25.013542658" azimuth="56.467253658" range="392860.059469108" phase="83.993572055" desc="LOCAL MOON POSITION Elv: -25.014 deg, Azi: 56.467, Rng: 392860.1 km" />
           <solarmidnight time="2018-05-11T00:13:10+01:00" elevation="-12.009908896" desc="LOCAL DIURNAL MINIMUM SOLAR ELEVATION" />
           <moonrise time="2018-05-11T03:26:15+01:00" desc="LOCAL DIURNAL MOON RISE" />
           <sunrise time="2018-05-11T03:50:00+01:00" desc="LOCAL DIURNAL SUN RISE" />
           <high_moon time="2018-05-11T09:02:59+01:00" elevation="25.034235521" desc="LOCAL DIURNAL MAXIMUM MOON ELEVATION" />
           <solarnoon time="2018-05-11T12:13:43+01:00" elevation="48.252695306" desc="LOCAL DIURNAL MAXIMUM SOLAR ELEVATION" />
           <moonset time="2018-05-11T14:43:59+01:00" desc="LOCAL DIURNAL MOON SET" />
           <sunset time="2018-05-11T20:38:41+01:00" desc="LOCAL DIURNAL SUN SET" />
           <low_moon time="2018-05-11T21:15:28+01:00" elevation="-32.732948918" desc="LOCAL DIURNAL MINIMUM MOON ELEVATION" />
        </time>
        <time date="2018-05-12">
           <moonposition time="2018-05-12T00:00:00+01:00" elevation="-25.174434139" azimuth="43.263992958" range="387470.25262391" phase="87.326858603" desc="LOCAL MOON POSITION Elv: -25.174 deg, Azi: 43.264, Rng: 387470.3 km" />
        </time>
     </location>
  </astrodata>