parseElements関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Read element sets from text: OMM as JSON (an array or a single object), OMM as CSV (a header row, then one satellite a row) or TLE (two lines, or three with the name first). The format is found from the text.
An element set that is missing a number, has a wrong TLE checksum or is not a possible orbit is left out, with the reason, in skipped. It throws if the text is none of the three.
インポート
import { parseElements } from "@johnmorrisdotca/chikyu-earth/satellites";
定義
function parseElements(text: string): ParsedElements
引数
| 名前 | 型 | 説明 |
|---|---|---|
text | string | What the source answered. |
戻り値
ParsedElements
The element sets that can be used and the ones that cannot.
例
import { parseElements } from "@johnmorrisdotca/chikyu-earth/satellites";
const csv = [
"OBJECT_NAME,OBJECT_ID,EPOCH,MEAN_MOTION,ECCENTRICITY,INCLINATION,RA_OF_ASC_NODE,ARG_OF_PERICENTER,MEAN_ANOMALY,NORAD_CAT_ID,BSTAR,MEAN_MOTION_DOT,MEAN_MOTION_DDOT",
"MADE-UP 1,2026-001A,2026-11-03T12:00:00,15.2,0.0002,53,10,90,20,900001,0.0001,0.00001,0",
].join("\n");
const { sets, format } = parseElements(csv);
console.log(format, sets.length, sets[0].OBJECT_NAME);omm-csv 1 MADE-UP 1出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。