Skip to content
Frank Thomas Tveter edited this page Aug 13, 2019 · 5 revisions

cgi-bin/small.pl returns a smaller version of the XML-output from cgi-bin/short.pl.

USAGE cgi-bin/small.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, 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, azimuth, visible)

  • solarmidnight (time, elevation, azimuth, visible)

  • moonphase (time, value), value representing:

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

  • moonshadow (time,iangle,cangle)

    iangle (incidence angle): -90="100% shadow", 0="50% shadow", 90="0% shadow"

    cangle (clock angle): 0="sun up", 90="sun right", 180="sun down",270="sun left"

  • moonposition (time, elevation, azimuth, range)

  • moonrise (time, azimuth, illumination)

  • moonset (time, azimuth, illumination)

  • high_moon (time, elevation, azimuth, visible, illumination)

  • low_moon (time, elevation, azimuth, visible, illumination)

  • 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.

Example

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

  <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.993" />
           <moonshadow time="2018-05-11T00:00:00+01:00" iangle="-32.253" cangle="271.265" />
           <moonposition time="2018-05-11T00:00:00+01:00" elevation="-25.013" azimuth="56.467" range="392860.1" phase="84.0" />
           <solarmidnight time="2018-05-11T00:13:10+01:00" elevation="-12.009" azimuth="359.918" visible="false" />
           <moonrise time="2018-05-11T03:26:15+01:00" azimuth="101.139" illumination="22.0" />
           <sunrise time="2018-05-11T03:50:00+01:00" azimuth="50.479" />
           <high_moon time="2018-05-11T09:02:59+01:00" elevation="25.034" azimuth="181.449" illumination="20.4" visible="true" />
           <solarnoon time="2018-05-11T12:13:43+01:00" elevation="48.252" azimuth="180.081" visible="true" />
           <moonset time="2018-05-11T14:43:59+01:00" azimuth="263.051" illumination="18.7" />
           <sunset time="2018-05-11T20:38:41+01:00" azimuth="309.961" />
           <low_moon time="2018-05-11T21:15:28+01:00" elevation="-32.732" azimuth="358.502" illumination="16.3" visible="false" />
        </time>
        <time date="2018-05-12">
           <moonposition time="2018-05-12T00:00:00+01:00" elevation="-25.174" azimuth="43.264" range="387470.3" phase="87.3" />
        </time>
     </location>
  </astrodata>

cgi-bin/small_json.pl documentation

This script works similar to cgi-bin/small.pl, except that the output is in the json format.