Skip to content
Frank Thomas Tveter edited this page Oct 29, 2021 · 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)

Example

Oslo: https://api.met.no/weatherapi/sunrise/2.0?lat=59.933333&lon=10.716667&date=2018-05-11&offset=+01:00 (test). Note that api.met.no runs the operational version which may be older than the test version.

  <astrodata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://schema.api.met.no/schemas/astrodata-2.0.xsd">
   <meta licenseurl="https://api.met.no/license_data.html"/>
   <location latitude="59.93" longitude="10.71" height="0">
    <time date="2018-05-11">
     <sunposition time="2018-05-11T00:00:00+01:00" elevation="-12.225" azimuth="356.703" range="151077491.3" visible="false" polar="none"/>
     <moonposition time="2018-05-11T00:00:00+01:00" elevation="-25.271" azimuth="56.461" range="392860.5" cangle="271.3" iangle="-32.3" phase="84.0" visible="false" polar="none"/>
     <solarmidnight time="2018-05-11T00:13:12+01:00" elevation="-12.272" azimuth="359.918" range="151077817.9" visible="false"/>
     <moonrise time="2018-05-11T03:26:16+01:00" azimuth="101.138" illumination="22.0"/>
     <high_moon time="2018-05-11T09:03:00+01:00" elevation="24.779" azimuth="181.448" range="385450.5" illumination="20.4" visible="true"/>
     <solarnoon time="2018-05-11T12:13:45+01:00" elevation="47.997" azimuth="180.081" range="151089192.0" visible="true"/>
     <moonset time="2018-05-11T14:44:01+01:00" azimuth="263.052" illumination="18.7"/>
     <sunset time="2018-05-11T20:38:42+01:00" azimuth="309.956"/>
     <low_moon time="2018-05-11T21:15:30+01:00" elevation="-32.992" azimuth="358.503" range="388842.9" illumination="16.3" visible="false"/>
    </time>
    <time date="2018-05-12">
     <sunposition time="2018-05-12T00:00:00+01:00" elevation="-11.97" azimuth="356.717" range="151112270.1" visible="false" polar="none"/>
     <moonposition time="2018-05-12T00:00:00+01:00" elevation="-25.436" azimuth="43.258" range="387470.7" cangle="278.2" iangle="-44.1" phase="87.3" visible="false" polar="none"/>
    </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.