geo.sunDay
This function gives the sunrise, the solar noon and the sunset at a point on a date, or a polar day or night.
CLI- Package
- @procedures/geo · README
- Path
["geo","sunDay"]- CLI
mark geo sunDay --point <object> --date <string>- As data
{"$proc":["geo","sunDay"],"input":{}}
Use it
In TypeScript
import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/geo/register"; // registers its procedures
const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["geo","sunDay"], { point: {}, date: "<date>" });
console.log(JSON.stringify(result));From the command line
$ mark geo sunDay --point <object> --date <string>
As data, in a program
{
"$proc": ["geo", "sunDay"],
"input": { "point": {}, "date": "<date>" }
}Input
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
point | object | yes | The point, with a latitude from -90 to 90 | |
date | string | yes | The date, `YYYY-MM-DD` | |
options | object | no | The altitude of the sun at sunrise and sunset |
Output
The schema does not list fields (object | object | object).
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"point": {
"type": "object",
"properties": {
"lat": {
"type": "number",
"description": "The latitude in degrees, from -90 to 90."
},
"lon": {
"type": "number",
"description": "The longitude in degrees. A normalized longitude is from -180 to less than 180."
}
},
"required": [
"lat",
"lon"
],
"additionalProperties": {},
"description": "The point, with a latitude from -90 to 90"
},
"date": {
"type": "string",
"description": "The date, `YYYY-MM-DD`"
},
"options": {
"type": "object",
"properties": {
"altitudeDeg": {
"type": "number",
"description": "The altitude of the center of the sun at sunrise and at sunset, in degrees from -90 to 90. The default is `SUNRISE_ALTITUDE_DEG`. For example, -6 gives the start and the end of civil twilight."
}
},
"additionalProperties": {},
"description": "The altitude of the sun at sunrise and sunset"
}
},
"required": [
"point",
"date"
],
"additionalProperties": false
},
"output": {
"anyOf": [
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "polar-day"
},
"noon": {
"type": "number"
},
"daylightHours": {
"type": "number",
"const": 24
}
},
"required": [
"kind",
"noon",
"daylightHours"
],
"additionalProperties": {}
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "polar-night"
},
"noon": {
"type": "number"
},
"daylightHours": {
"type": "number",
"const": 0
}
},
"required": [
"kind",
"noon",
"daylightHours"
],
"additionalProperties": {}
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "rise-set"
},
"rise": {
"type": "number"
},
"noon": {
"type": "number"
},
"set": {
"type": "number"
},
"daylightHours": {
"type": "number"
}
},
"required": [
"kind",
"rise",
"noon",
"set",
"daylightHours"
],
"additionalProperties": {}
}
]
}
}