What does Solar Terms, Thermal Lag and Seasonal Demand conclude, in numbers, about “Closing the Loop: the Solar-Term Order Calendar, Store Scheduling and a Pre-Registered Test”?

Answer: Chapter 8 gives a buyer's order calendar, a store's term-based promotion schedule, the distilled Solar-Term Order Calendar and a pre-registered test. Marked boxes separate published evidence, runnable Python calculations (18 programs), classical sources and the author's hypotheses.

Scope of the numbers: Parameters in this book are illustrative; all calculations are generated by the book's programs; the book is non-personalised business guidance, and its order dates are demonstrations that promise no sales to any merchant. Chapter 4 shows that "the hottest day" is a statistic dominated by weather noise: in illustrative data the single hottest day misses by 16.81 days, while the harmonic phase from three years of daily data misses by only 1.25 days.

中文版

Data table

The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python only

Solar-Term Order Calendar 2026 (illustrative, lag 32.5 d)
Xiazhi 06-21 16:24Dongzhi 12-22 04:54peak 26-07-24trough 27-01-23
fu: chufu 07-15zhongfu 07-25mofu 08-14out 08-24(40 d)
categoryleadstartsdaysorder bynear termnamedshift
iced drinks2126-06-0310226-05-06Lixia+026-04-03+32.5
fans4526-06-187126-04-27Guyu+726-03-26+32.5
sunscreen3026-04-2112226-03-15Chunfen-526-03-15+0.0
hot pot2126-12-0210226-11-04Lidong-326-10-03+32.5
down coats9026-12-157626-09-09Bailu+226-08-08+32.5
spring jackets6026-02-2211925-12-17Dongzhi-525-11-14+32.5
same calendar with a maritime lag of 44.0 d: iced drinks order by 26-05-17
Show the full program
# Chapter 8. p81: the solar-term order calendar (core of tool.py)
# Functions copied unchanged from distill/tool.py. For 2026: the
# terms (p21 formula, Beijing time), heat peak and cold trough
# (solstice plus a 32.5-day lag, Trenberth 1983), the fu periods
# (p31 geng-day rule) and, per category, the half-peak selling window
# of p53, the latest order date (window start minus a 7-day shelf
# buffer minus the supplier lead time) and the date a buyer reaches
# by reading the season off the term names (lag 0). Thresholds and
# lead times are ILLUSTRATIVE: heat-driven iced drinks (18 C, lead
# 21 d) and fans (24 C, 45 d), sun-driven sunscreen (30 d), cold-
# driven hot pot (10 C, 21 d) and down coats (5 C, 90 d), and spring
# jackets driven by the warming rate (60 d). Temperature: mean 14.0,
# amplitude 14.0, day-to-day sd 3.0 C. "near term" names the closest
# term and the days from it; "shift" is order date minus named date.
# Tool examples in the chapter: --lag 41.3 (the coastal site of p33),
# --mean 16.5 --amp 11.0 --sd 2.5 (a milder, damper city).
import datetime
import math

YEAR = 365.2422
W = 2 * math.pi / YEAR
J2000 = datetime.datetime(2000, 1, 1, 12)
BJ = datetime.timedelta(hours=8)
NAMES = ["Chunfen", "Qingming", "Guyu", "Lixia", "Xiaoman", "Mangzhong",
         "Xiazhi", "Xiaoshu", "Dashu", "Liqiu", "Chushu", "Bailu",
         "Qiufen", "Hanlu", "Shuangjiang", "Lidong", "Xiaoxue", "Daxue",
         "Dongzhi", "Xiaohan", "Dahan", "Lichun", "Yushui", "Jingzhe"]
# name, driver, threshold C, first scan day after Xiazhi, lead days
CATS = [("iced drinks", "heat", 18.0, -120, 21),
        ("fans", "heat", 24.0, -120, 45),
        ("sunscreen", "sun", 0.0, -120, 30),
        ("hot pot", "cold", 10.0, 60, 21),
        ("down coats", "cold", 5.0, 60, 90),
        ("spring jackets", "rise", 0.0, -300, 60)]


def sun_lon(t):
    n = (t - J2000).total_seconds() / 86400
    big_l = (280.460 + 0.9856474 * n) % 360
    g = math.radians((357.528 + 0.9856003 * n) % 360)
    return (big_l + 1.915 * math.sin(g) + 0.020 * math.sin(2 * g)) % 360


def crossing(year, target):
    """Beijing datetime when the Sun's longitude reaches target."""
    def gap(x):
        return (sun_lon(x) - target + 180) % 360 - 180
    t = datetime.datetime(year, 1, 1) - BJ
    day = datetime.timedelta(days=1)
    while not (gap(t) < 0 <= gap(t + day)):
        t += day
    lo, hi = t, t + day
    while (hi - lo).total_seconds() > 1:
        mid = lo + (hi - lo) / 2
        if gap(mid) < 0:
            lo = mid
        else:
            hi = mid
    return hi + BJ


def terms(year):
    out = [(crossing(year, 15 * k), k) for k in range(24)]
    return sorted(out)


def cycle(d):
    return (d.toordinal() + 1721425 + 49) % 60


def geng_from(d, k):
    seen = 0
    while True:
        if cycle(d) % 10 == 6:
            seen += 1
            if seen == k:
                return d
        d += datetime.timedelta(days=1)


def fu_dates(year):
    xz = crossing(year, 90).date()
    lq = crossing(year, 135).date()
    c1, c2, c3 = geng_from(xz, 3), geng_from(xz, 4), geng_from(lq, 1)
    out = c3 + datetime.timedelta(days=10)
    return c1, c2, c3, out, (out - c1).days


def phi(z):
    return math.exp(-0.5 * z * z) / math.sqrt(2 * math.pi)


def cdf(z):
    return 0.5 * (1 + math.erf(z / math.sqrt(2)))


def pos_part(mu, s):
    return mu * cdf(mu / s) + s * phi(mu / s)


def excess(driver, c, d, lag, mean, amp, sd):
    m = mean + amp * math.cos(W * (d - lag))
    if driver == "heat":
        return pos_part(m - c, sd)
    if driver == "cold":
        return pos_part(c - m, sd)
    if driver == "sun":
        return max(0.0, math.cos(W * d))
    return max(0.0, -amp * W * math.sin(W * (d - lag)))


def window(driver, c, first, lag, mean, amp, sd):
    grid = [first + 0.25 * i for i in range(4 * 300)]
    vals = [excess(driver, c, d, lag, mean, amp, sd) for d in grid]
    k = max(range(len(grid)), key=lambda i: vals[i])
    lo = hi = k
    while lo > 0 and vals[lo - 1] >= vals[k] / 2:
        lo -= 1
    while hi < len(grid) - 1 and vals[hi + 1] >= vals[k] / 2:
        hi += 1
    return grid[k], grid[lo], grid[hi]


def nearest(t, table):
    best = min(table, key=lambda x: abs((t - x[0]).total_seconds()))
    days = int(round((t - best[0]).total_seconds() / 86400))
    return "{}{:+d}".format(NAMES[best[1]], days)


def calendar(year=2026, lag=32.5, mean=14.0, amp=14.0, sd=3.0,
             buffer=7, leads=None):
    leads = dict(leads or {})
    xz = crossing(year, 90)
    dz = crossing(year, 270)
    table = terms(year - 1) + terms(year) + terms(year + 1)
    rows = []
    for name, driver, c, first, lead in CATS:
        lead = leads.get(name, lead)
        pk, a, b = window(driver, c, first, lag, mean, amp, sd)
        _, a0, _ = window(driver, c, first, 0.0, mean, amp, sd)
        start = xz + datetime.timedelta(days=a)
        order = start - datetime.timedelta(days=buffer + lead)
        named = xz + datetime.timedelta(days=a0 - buffer - lead)
        rows.append({"category": name, "driver": driver, "lead": lead,
                     "start": start, "end": xz + datetime.timedelta(
                         days=b), "order_by": order, "named": named,
                     "shift": (order - named).total_seconds() / 86400,
                     "term": order})
    return {"year": year, "lag": lag, "xz": xz, "dz": dz,
            "heat_peak": xz + datetime.timedelta(days=lag),
            "cold_trough": dz + datetime.timedelta(days=lag),
            "fu": fu_dates(year), "rows": rows, "table": table,
            "terms": terms(year)}


def lines(cal):
    f = "%y-%m-%d"
    out = ["Solar-Term Order Calendar {} (illustrative, lag {:.1f} d)"
           .format(cal["year"], cal["lag"])]
    out.append("Xiazhi {}  Dongzhi {}  peak {}  trough {}".format(
        cal["xz"].strftime("%m-%d %H:%M"), cal["dz"].strftime("%m-%d %H:%M"),
        cal["heat_peak"].strftime(f), cal["cold_trough"].strftime(f)))
    c1, c2, c3, end, n = cal["fu"]
    out.append("fu: chufu {}  zhongfu {}  mofu {}  out {}  ({} d)".format(
        c1.strftime("%m-%d"), c2.strftime("%m-%d"),
        c3.strftime("%m-%d"), end.strftime("%m-%d"), n))
    out.append("category        lead  starts    days  order by  "
               "near term    named     shift")
    for r in cal["rows"]:
        days = (r["end"] - r["start"]).total_seconds() / 86400
        out.append("{:<15} {:4d}  {}  {:4.0f}  {}  {:<12} {}  {:+5.1f}"
                   .format(r["category"], r["lead"],
                           r["start"].strftime(f), days,
                           r["order_by"].strftime(f),
                           nearest(r["order_by"], cal["table"]),
                           r["named"].strftime(f), r["shift"]))
    return out


if __name__ == "__main__":
    for ln in lines(calendar()):
        print(ln)
    late = calendar(lag=44.0)
    print("same calendar with a maritime lag of 44.0 d: iced drinks order"
          " by {}".format(late["rows"][0]["order_by"].strftime("%y-%m-%d")))

Single source and citation

Fan, Y. (2026). Temperature Phase Lag across the Twenty-Four Solar Terms, First-Order Thermal Inertia behind the Dog Days and Seasonal Demand Forecasting (Version 1.0.0), Chapter 8: Closing the Loop: the Solar-Term Order Calendar, Store Scheduling and a Pre-Registered Test. 5D Library. DOI pending

DOI pending · monograph page goes live after publication · 5DL-B-232 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026232,
  author    = {Fan, Yafu},
  title     = {Temperature Phase Lag across the Twenty-Four Solar Terms, First-Order Thermal Inertia behind the Dog Days and Seasonal Demand Forecasting},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

Other chapter answers in this book