Skip to content

Create Your Own Rules

Gordon edited this page Nov 9, 2026 · 10 revisions

Create Your Own Rules

Available only in Astronomical Sun Clock, the web/PWA version. Custom weather-singularity rules are not available in the other versions of Gordon's Sun Clock.

You can develop and test a regional rule set (mod) without changing the application code. A rule set is a JSON document defining where and when particular weather patterns should be checked and which forecast conditions count as a match.

Try a rule set

  1. Open page 2 in Sun Clock and expand section 4, Functions.
  2. Under Singularities, open Custom Rules.
  3. Paste or edit your JSON in the text area.
  4. Below the text area, choose whether to enable Use Rule Set Exclusively (checked by default), then select Check and Save.

The app checks the JSON with its existing mod validation. If it is valid, the original JSON text is stored unchanged in your browser's localStorage. The checkbox setting is also saved locally. Nothing is uploaded by this action; the local copy stays in that browser.

When the current location matches your custom rule set, the "Use Rule Set Exclusively" checkbox determines how rules are evaluated:

  • Checked: Only your custom rule set is used, replacing any automatically selected catalogue rules for that location area.
  • Unchecked: Your custom rules take priority over the automatically selected catalogue rules (if available). If an event key exists in both rule sets, your custom event completely replaces the catalogue event, including all variants and message texts, even if your rule produces no match. Events with different keys are evaluated from both rule sets.

JSON format

A mod specifies its regional coverage and a set of seasonal events under events, with their recognition conditions. The limit is 32 events per JSON file. The full specification and an example are in the rule-set JSON format reference.

Developing a rule from historical weather

I enjoy observing and analysing the weather, particularly the phenological seasons and recurring weather singularities. Over many years, I have developed a [rule set for Germany in ten languages. Some of these events may also occur in your region.

Develop one event at a time. You can do the analysis yourself or use an LLM to help with the work. A good starting point is a traditional local weather saying or a known weather singularity. Compare it with at least 20 years of historical weather data to see whether the pattern actually exists, and then derive suitable conditions for a forecast-based rule. The Open-Meteo Historical Weather API is one possible data source. All numerical findings must come from real weather data.

You might consider not following traditional calendar dates too strictly. Weather patterns may have shifted due to climate change or calendar changes. A slightly different or wider period may reveal a genuine pattern, but extending the period just to obtain a match is not valid. If the data does not support the rule, leave it out. As a rule of thumb, a relative temperature difference should be at least 5 °C.

You also need to decide whether each event is representative of the geographical area covered by your JSON. I recommend starting with a whole country. If the weather patterns you want to include in your json file differ too much across that area, choose a smaller region (such as northern Germany instead of Germany).

See the LLM example prompt: January midwinter for a step-by-step method.

When creating events for a mod (= a json file), please include the region, data source, years examined and number of years in which each event occurred. The comment key that every event should have is the right place for that.

Share Your Mod with Others

If you develop a well-researched and tested mod, I would be happy to consider including it in the official rule-set catalogue of Astronomical Sun Clock. This requires transferring the necessary rights to me so that I can publish and adapt the rule set as part of the project. You can become or stay the official maintainer, if you wish. Please contact me if you would like to contribute your work (via GitHub or via email which is included on page 4 of the app).

Phenological Seasons >

Clone this wiki locally