Skip to content

Commit

Permalink
Don't generate surrogates if emis==0 (second try)
Browse files Browse the repository at this point in the history
  • Loading branch information
ctessum committed Jan 29, 2022
1 parent 70e27b1 commit 5a6377f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 8 additions & 0 deletions inmaputil/inmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"fmt"
"io"
"log"
"math"
"os"
"runtime"
"sync"
Expand Down Expand Up @@ -362,6 +363,13 @@ func setEmissionsAEP(inventoryConfig *aeputil.InventoryConfig, spatialConfig *ae
} else if err != nil {
return err
}
var totalEmis float64
for _, v := range rec.Totals() {
totalEmis += math.Abs(v.Value())
}
if totalEmis == 0 {
continue
}
spatialRecs = append(spatialRecs, rec.(aep.RecordGridded))
}

Expand Down
7 changes: 0 additions & 7 deletions io.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,6 @@ func FromAEP(r []aep.RecordGridded, grids []*aep.GridDef, gi int, VOC, NOx, NH3,
groundERecs := make(map[int]*EmisRecord)

for _, rec := range r {
var totalEmis float64
for _, v := range rec.Totals() {
totalEmis += math.Abs(v.Value())
}
if totalEmis == 0 {
continue
}
gridSrg, _, inGrid, err := rec.GridFactors(gi)
if err != nil {
return nil, err
Expand Down

0 comments on commit 5a6377f

Please sign in to comment.