Skip to content

Commit 5a6377f

Browse files
committed
Don't generate surrogates if emis==0 (second try)
1 parent 70e27b1 commit 5a6377f

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

inmaputil/inmap.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"fmt"
2323
"io"
2424
"log"
25+
"math"
2526
"os"
2627
"runtime"
2728
"sync"
@@ -362,6 +363,13 @@ func setEmissionsAEP(inventoryConfig *aeputil.InventoryConfig, spatialConfig *ae
362363
} else if err != nil {
363364
return err
364365
}
366+
var totalEmis float64
367+
for _, v := range rec.Totals() {
368+
totalEmis += math.Abs(v.Value())
369+
}
370+
if totalEmis == 0 {
371+
continue
372+
}
365373
spatialRecs = append(spatialRecs, rec.(aep.RecordGridded))
366374
}
367375

io.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -274,13 +274,6 @@ func FromAEP(r []aep.RecordGridded, grids []*aep.GridDef, gi int, VOC, NOx, NH3,
274274
groundERecs := make(map[int]*EmisRecord)
275275

276276
for _, rec := range r {
277-
var totalEmis float64
278-
for _, v := range rec.Totals() {
279-
totalEmis += math.Abs(v.Value())
280-
}
281-
if totalEmis == 0 {
282-
continue
283-
}
284277
gridSrg, _, inGrid, err := rec.GridFactors(gi)
285278
if err != nil {
286279
return nil, err

0 commit comments

Comments
 (0)