fix(landscape): func_zoning ranks the original P suitability rasters, not C

The reference notebook ("Three scenarios" cells) and zoning_core.py feed E plus
the five P_* WEIGHTED_CLASS rasters into functional zoning; the diagram folder
300-…-Equals_102_202 pointing at the C layers was a drawing error. C_k =
min(P_k, E) stay diagnostic conflict layers. Node 30 keeps its code/stage;
its changed inputs change every fingerprint, so V1–V3 recompute on the next run.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
2026-09-11 21:45:39 +05:00
parent dae9294b4d
commit 2544d4e146
4 changed files with 34 additions and 7 deletions

View File

@@ -89,7 +89,11 @@ var Nodes = []Node{
{Code: "10", Name: "e_ecological_constraint", Stage: 1, Inputs: []string{OutZIntegrated, OutUIntegrated}, Outputs: []string{OutE}, Kernel: kernelE},
{Code: "20", Name: "c_conflicts", Stage: 2, Inputs: append(append([]string{}, pInputs...), OutE), Outputs: cOutputs, Kernel: kernelCConflicts},
{Code: "21", Name: "p_max", Stage: 2, Inputs: pInputs, Outputs: []string{OutPMax}, Kernel: kernelMaxAnyValid},
{Code: "30", Name: "func_zoning", Stage: 3, Inputs: append([]string{OutE}, cOutputs...), Outputs: []string{OutV1, OutV2, OutV3}, Kernel: kernelFuncZoning},
// func_zoning ranks the original suitability rasters P1..P5 against E (the
// reference notebook and zoning_core.py); the conflict layers C_k are
// diagnostics and are not zoning inputs. It stays in stage 3 to keep the
// diagram's folder numbering (30x) even though it only depends on stage 1.
{Code: "30", Name: "func_zoning", Stage: 3, Inputs: append([]string{OutE}, pInputs...), Outputs: []string{OutV1, OutV2, OutV3}, Kernel: kernelFuncZoning},
{Code: "31", Name: "c_max", Stage: 3, Inputs: cOutputs, Outputs: []string{OutCMax}, Kernel: kernelMaxAnyValid},
}

View File

@@ -132,3 +132,22 @@ func TestNodeForOutput(t *testing.T) {
t.Fatal("NodeForOutput(nope) should not be found")
}
}
// Functional zoning ranks the ORIGINAL suitability rasters P1..P5 against E
// (reference notebook cells "Three scenarios" and zoning_core.py); the
// conflict layers C_k are diagnostics and must not replace P_k here.
func TestFuncZoningTakesEAndOriginalP(t *testing.T) {
n, ok := NodeByCode("30")
if !ok {
t.Fatal("node 30 missing")
}
want := []string{OutE, SlotPIrrigation, SlotPSnow, SlotPCrop, SlotPPasture, SlotPTourism}
if len(n.Inputs) != len(want) {
t.Fatalf("node 30 inputs = %v, want %v", n.Inputs, want)
}
for i := range want {
if n.Inputs[i] != want[i] {
t.Fatalf("node 30 input[%d] = %s, want %s (order is E, then sectors 1..5)", i, n.Inputs[i], want[i])
}
}
}