review-factory-dem-audit.mjs 1.7 KB

123456789101112
  1. import assert from 'node:assert/strict'
  2. import {readFileSync,writeFileSync} from 'node:fs'
  3. import {createHash} from 'node:crypto'
  4. const dir='.scratch/cockpit-shell-panel-layout/verify/artifacts/t35/large-building-audit/',plan=JSON.parse(readFileSync(dir+'factory-dem-plan.json')),sample=JSON.parse(readFileSync(dir+'factory-dem-samples.json'))
  5. assert.equal(createHash('sha256').update(JSON.stringify(plan.samples)).digest('hex'),sample.samplesSha256)
  6. assert.equal(sample.missingSamples,0)
  7. const results=plan.buildings.map(b=>{const all=b.sampleIndices.map(i=>({point:plan.samples[i],height:sample.heights[i]}));assert.ok(all.every(x=>Number.isFinite(x.height)));const summary=list=>{const heights=list.map(p=>p.height);return{count:list.length,min:Math.min(...heights),max:Math.max(...heights),relief:Math.max(...heights)-Math.min(...heights)}}
  8. return{id:b.id,originalSparseRelief:b.originalRelief,dense:summary(all),perimeter:summary(all.filter(x=>x.point.edge)),interior:summary(all.filter(x=>!x.point.edge)),passesExistingPlinthLimit:summary(all).relief<=3.2,acceptedForRuntime:false}
  9. })
  10. assert.ok(results.every(b=>!b.passesExistingPlinthLimit),'do not relax the existing global limit to admit factories')
  11. const report={source:sample.source,layerJsonSha256:sample.layerJsonSha256,samplesSha256:sample.samplesSha256,points:sample.heights.length,missingSamples:0,results,modelChanged:false,decision:'All four imagery-supported roof candidates remain excluded by existing seating policy; dense original DEM evidence does not justify bypassing height/plinth checks. Foundation/stepped design and height source still needed.'}
  12. writeFileSync(dir+'factory-dem-review.json',JSON.stringify(report,null,2));console.log(JSON.stringify(report))