lzray's picture
Add files using upload-large-folder tool
614eceb verified
|
Raw
History Blame Contribute Delete
8.18 kB

Web data format v1

Invariants

  • Supported civil years are 1950 through 17000, inclusive.
  • Civil dates use the proleptic Gregorian calendar and are represented by integer year, month, and day values. Consumers must not parse them with JavaScript Date or <input type="date">.
  • Display timezone and lunar day boundary are both UTC+08:00.
  • Huangli longitude is 120 degrees east. Civil time, lunar day boundary, Huangli day boundary, and true solar time remain separate concepts.
  • Daily state is sampled at local 12:00:00. Exact solar-term and four-phase events are roots calculated by the C++ core, never noon phase labels.
  • sec is seconds since local midnight, rounded to the nearest second. A rounded value that crosses midnight is carried into the adjacent civil day.
  • null means the algorithm defines the field but no value/contact exists. Missing keys are used only where the schema says a field is optional.

Directory layout

v1/
  manifest.json
  schema.json
  dict.json
  calendar/<year>/<month>.json[.br|.gz]
  eclipse/<year>.json[.br|.gz]
  astro/<year>/<month>.json[.br|.gz]
  index/years.json
  checksums/sha256.txt
  failed_years.json
  .state/<year>.json

.state is resumability metadata and need not be deployed. Brotli files use the .json.br suffix and gzip files use .json.gz.

Calendar month

v, y, and m are schema version, civil year, and civil month. meta records timezone, lunar boundary, Huangli longitude, noon sample second, ephemeris selection, and event rounding.

days is the light month-grid array:

  • d: civil day of month.
  • w: weekday, Sunday=0 through Saturday=6.
  • l: [lunar_year, lunar_month, lunar_day, leap_flag].
  • fest: stable festival codes.
  • terms: solar-term codes occurring on the civil day.
  • phases: exact new_moon, fst_qtr, full_moon, or lst_qtr roots.
  • solar_eclipses / lunar_eclipses: [type_code, event_id] pairs.

events contains the month's solar terms and four exact lunar phases. Each entry has stable kind/code, local civil, day, sec, jd_tdb, jd_utc, and the source program's UTC/local strings. JD and source strings are retained even though the front end normally formats sec.

detail parallels days and retains:

  • the full noon sample (jd_utc, jd_tdb, UTC/local source strings);
  • compact lunar date and 60-cycle indexes for year/month/day;
  • year zodiac code;
  • daily lunar geometry: solar/lunar apparent longitude and rates, elongation, illumination, waxing state, phase-state code, and lunar mansion;
  • festival, exact-event, eclipse, and astronomy references;
  • all four Huangli profiles as lossless common + profiles data.

The daily moon.phase_name is a sampled eight-sector state. It must not be used as an exact four-phase event.

Dictionary reconstruction

dict.json.domains is an array-per-domain keyed by the integer code emitted by the C++ core. Null array positions are unused codes. event_names maps stable string codes to labels. Huangli label domains carry an @<profile_code> suffix because the repository intentionally emits profile-specific wording (for example, the same duty-god code may render differently).

The following source redundancies are omitted from day records and restored without information loss:

  • a ganzhi index restores text, stem=index % 10, and branch=index % 12;
  • lunar month/day labels restore from the lunar dictionaries; the complete source label is 农历{year}年{month_label}{day_label};
  • paired Huangli text/code fields restore from the profile-specific domain;
  • god/activity text arrays restore from their code arrays;
  • each hour triple [slot_index, ganzhi_index, is_bad] restores slot text, ganzhi object, luck label, and boolean. All 13 source slots are preserved;
  • common is merged with the named profile diff, then dictionary expansion is applied. The generator compares the result to the original profile object before writing any year.

Bit masks remain present because they are useful for fast filtering. Raw strings without a stable source code (for example Pengzu text or a composed clash string) are retained rather than assigned order-dependent Web codes.

Festivals

Festivals and legal holiday arrangements are distinct datasets. v1 generates only rule-based festivals:

  • Gregorian: New Year's Day, Labour Day, National Day.
  • Non-leap lunar months: Spring Festival, Lantern Festival, Dragon Boat, Qixi, Mid-Autumn, Double Ninth, Laba, and northern Xiaonian.
  • Derived: New Year's Eve when the following civil day is non-leap lunar 1/1.
  • Solar-term based: Qingming on the exact J3 local civil day.

Levels are 0 (stored but hidden by default), 1 (normal month display), and 2 (emphasized). No future statutory holiday or make-up-work policy is inferred.

Huangli profiles and boundaries

Profiles are folk, ziping, purple, and xieji. Each profile retains its source rule profile, year boundary, month boundary, leap-month mode, day boundary, ganzhi nodes, 建除, duty god/tag, clashes, harmonies, Pengzu, nayin, five elements, fetal god, meridian, direction fields, lunar mansions, gods, activities, Yi/Ji level/rule, equation/true-solar time, and all 13 hour slots.

Profile defaults come from make_hli_rule_set; the generator does not collapse their distinct boundaries. UTC+08 civil midnight is not substituted for a profile's Hour-23/Hour-0 Huangli boundary.

Eclipses

The month grid references an eclipse on the UTC+08 civil date containing the algorithm's maximum eclipse (MAX). Contact points may cross dates. The annual eclipse record retains the complete original nested C++ JSON: all available contacts, magnitudes, durations, distances, gamma, geometry, libration, contact metadata, delta-T, and solar Besselian coefficients. Nonexistent contacts are JSON null; NaN is forbidden.

Solar MAX uses the standard greatest-eclipse definition: the instant when the lunar shadow axis has minimum distance from Earth's geocentre, equivalently the minimum of x^2 + y^2 in the Besselian fundamental plane. The final Besselian Newton refinement makes repeated solutions independent of the new-moon seed (the 2023 and 3462 regression cases agree within 0.00005 second). The Web serializer canonicalizes the outer event time to the complete nested max node, so the two representations are byte-for-byte consistent in JD.

Astronomy

Astronomy events live outside the calendar payload. Geocentric conjunction, opposition, quadrature, greatest elongation, and stationary events are emitted by default. Transit and occultation events require an explicit observer and the generator records that observer in each shard. Algorithm-produced detail (separation, elongation, or state) is retained.

Solar-term count at far-future civil-year boundaries

Solar terms remain a continuous 24-code astronomical cycle, but a UTC+08 Gregorian civil year is only a time slice of that cycle. In the far future, calendar/tropical-year drift can place two occurrences of one code in a civil year (25 total) and none in the following year (23 total). Validation accepts 23..25 per civil year while still requiring exact code succession and an astronomically plausible 13..17 day interval; it does not treat 24 as an unconditional per-file invariant.

Time scales and future uncertainty

The supplied code treats TDB and TT as equal at its current precision. For 1972..2026 it converts with the built-in leap-second table; 1970..<1972 uses the legacy model; outside 1970..2026 it uses the repository's delta53/EM53 quadratic-periodic extrapolation. Far-future UTC+08 civil dates are therefore model projections, not claims about future observed UTC. JD TDB is retained as the stable dynamical coordinate.

Intentionally omitted representations

Only values exactly and cheaply reconstructible from retained codes are omitted. Debug temporaries and internal caches have no Web semantics and are not serialized. No calculated astronomy, calendar, Huangli, eclipse, or festival information is removed merely because the default UI hides it.