Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
working_with_subregions [2026/08/02 21:25]
hermann
working_with_subregions [2026/08/31 02:12] (current)
hermann
Line 5: Line 5:
 Region Manager exists for three distinct reasons, and it's worth being clear about which one applies before reaching for it: Region Manager exists for three distinct reasons, and it's worth being clear about which one applies before reaching for it:
  
-  * **The computation itself requires region-specific inputs.** [[Patcher]] and [[Expander]] each take exactly one [[Transition ​Matrix Type|Transition ​Matrix]] and one [[Transition Function Parameter Matrix Type|Transition Function Parameter Matrix]] per call. If those rates or patch parameters genuinely differ by region, there'​s no single call that can express that — running once per region, with region-specific parameters, is the only way to get that behavior.+  * **The computation itself requires region-specific inputs.** [[Patcher]] and [[Expander]] each take exactly one [[Change ​Matrix Type|Change ​Matrix]] and one [[Transition Function Parameter Matrix Type|Transition Function Parameter Matrix]] per call. If those change quantities ​or patch parameters genuinely differ by region, there'​s no single call that can express that — running once per region, with region-specific parameters, is the only way to get that behavior.
   * **The map is too large to process as one raster.** Splitting into regions keeps each piece a manageable size to work with, independent of whether the calculation itself cares about regions at all.   * **The map is too large to process as one raster.** Splitting into regions keeps each piece a manageable size to work with, independent of whether the calculation itself cares about regions at all.
   * **A windowed or accumulating calculation would be distorted at a hard-clipped edge.** Anything that looks beyond the current cell — a cost surface, a distance calculation,​ a neighborhood statistic — needs *real* context past a region'​s boundary, not just reserved space for it. ''​borderCells''​ reserves that extra space around each region, but by default it's filled with null, not real data — getting real values into it also requires ''​keepNonRegionCells:​ Yes''​ on the [[Regionalize Map]] / [[Regionalize Categorical Map]] call that produces the regional map.   * **A windowed or accumulating calculation would be distorted at a hard-clipped edge.** Anything that looks beyond the current cell — a cost surface, a distance calculation,​ a neighborhood statistic — needs *real* context past a region'​s boundary, not just reserved space for it. ''​borderCells''​ reserves that extra space around each region, but by default it's filled with null, not real data — getting real values into it also requires ''​keepNonRegionCells:​ Yes''​ on the [[Regionalize Map]] / [[Regionalize Categorical Map]] call that produces the regional map.
Line 151: Line 151:
     regionalProbabilities := RegionalizeMap { globalMap = probabilitiesMap,​ keepNonRegionCells = .yes };     regionalProbabilities := RegionalizeMap { globalMap = probabilitiesMap,​ keepNonRegionCells = .yes };
  
-    { changedLandscape = regionalChanged, corrodedProbabilities ​_remainingChanges ​= _ } :=+    { regionalChanged = changedLandscapecorrodedProbabilities, ​= remainingChanges ​} :=
         Patcher regionalLandscape regionalProbabilities regionChanges regionParams;​         Patcher regionalLandscape regionalProbabilities regionChanges regionParams;​
  
-    ​RegionalMap ​"cost_map" regionalChanged;​+    ​RegionalCategoricalMap ​"changed_landscape" regionalChanged;​
 }}; }};
 </​code>​ </​code>​
  
-[[Patcher]] returns three outputs, and this example only stores one of them. ''​corrodedProbabilities''​ — the probability surface with used-up areas depleted — and ''​remainingChanges''​ — a Change Matrix of whatever couldn'​t be placed, given the current ''​neighborWindowLines''/''​neighborWindowColumns''/''​pruneFactor''​ — are both genuinely useful diagnostics in a real model, not values to ignore on principle. They'​re discarded here only because this page is illustrating region-manager mechanics rather than full Patcher diagnostics. All three outputs are still named explicitly, with the unwanted two bound to ''​_'', ​rather than left out of the destructuring entirely — whether ​EGO Script ​allows binding only some of a multi-output ​functor's outputs isn't confirmedso naming all of them is the safer pattern used consistently throughout this page.+[[Patcher]] returns three outputs, and this example only stores one of them. ''​corrodedProbabilities''​ — the probability surface with used-up areas depleted — and ''​remainingChanges''​ — a Change Matrix of whatever couldn'​t be placed, given the current ''​neighborWindowLines''/''​neighborWindowColumns''/''​pruneFactor''​ — are both genuinely useful diagnostics in a real model, not values to ignore on principle. They'​re discarded here only because this page is illustrating region-manager mechanics rather than full Patcher diagnostics. All three outputs are still named explicitly, with the unwanted two bound to ''​_'', ​following ​EGO Script's documented convention for discarding outputs from a multi-output ​nominal binding — each output is either bound to a variable or explicitly discarded with ''​_'', ​never left out of the block.
  
 A model that does care about ''​remainingChanges''​ would most likely want it accumulated across regions too, the same way [[#​computing_per-class_areas_within_each_region|the area-by-region example]] accumulates its table with [[Mux Table]] — checking, once the loop finishes, whether any region failed to place all of its requested changes. A model that does care about ''​remainingChanges''​ would most likely want it accumulated across regions too, the same way [[#​computing_per-class_areas_within_each_region|the area-by-region example]] accumulates its table with [[Mux Table]] — checking, once the loop finishes, whether any region failed to place all of its requested changes.
Line 207: Line 207:
             regionalProbabilities := RegionalizeMap { globalMap = probabilitiesMap,​ keepNonRegionCells = .yes };             regionalProbabilities := RegionalizeMap { globalMap = probabilitiesMap,​ keepNonRegionCells = .yes };
  
-            { changedLandscape = regionalChanged, corrodedProbabilities ​_remainingChanges ​= _ } :=+            { regionalChanged = changedLandscapecorrodedProbabilities, ​= remainingChanges ​} :=
                 Patcher regionalLandscape regionalProbabilities regionChanges regionParams;​                 Patcher regionalLandscape regionalProbabilities regionChanges regionParams;​