Skip to content

Enforce 300 ft minimum separation for CL1/CL2/CL3 in cloud-levels.lua#38

Draft
tackandr with Copilot wants to merge 2 commits into
masterfrom
copilot/bugcheck-himan-scripts-cloud-levels-lua
Draft

Enforce 300 ft minimum separation for CL1/CL2/CL3 in cloud-levels.lua#38
tackandr with Copilot wants to merge 2 commits into
masterfrom
copilot/bugcheck-himan-scripts-cloud-levels-lua

Conversation

Copilot AI commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

cloud-levels.lua could still emit CL1/CL2/CL3 bases closer than the required 300 ft after its layer selection and fallback reshuffling. This change adds a final spacing guard so the published cloud layers always satisfy the minimum separation rule.

  • What changed

    • Added a final normalization pass over CL1, CL2, and CL3 after the existing layer-selection logic.
    • If two adjacent layers are closer than dz = 300, the pass drops one layer and compacts the remaining outputs.
  • Selection rule for conflicts

    • Preserve the lower layer when it is BKN+.
    • Otherwise preserve the upper layer when it is BKN+.
    • If neither layer is BKN+, preserve the lower layer.
  • Why this is needed

    • Several existing branches assume replacement layers are already spaced far enough apart.
    • Those assumptions allow invalid close pairs to survive into the final output in some locations.
  • Implementation detail

    if bases[j + 1] - bases[j] < dz then
      if IsBknLayer(covs[j]) or not IsBknLayer(covs[j + 1]) then
        DropLayer(bases, tops, covs, j + 1)
      else
        DropLayer(bases, tops, covs, j)
      end
    end

Copilot AI linked an issue Jun 5, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix separation issue in cloud levels calculation Enforce 300 ft minimum separation for CL1/CL2/CL3 in cloud-levels.lua Jun 5, 2026
Copilot AI requested a review from tackandr June 5, 2026 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug check himan-scripts/cloud-levels.lua

2 participants