From 70e27b1e455a9384974bf9fd134f6b0c886137d5 Mon Sep 17 00:00:00 2001 From: Christopher Tessum Date: Thu, 27 Jan 2022 10:07:50 -0600 Subject: [PATCH] Don't generate surrogates if emis==0 (#102) --- go.mod | 1 + go.sum | 2 ++ io.go | 7 +++++++ 3 files changed, 10 insertions(+) diff --git a/go.mod b/go.mod index 037e213d5..114c4cbf3 100644 --- a/go.mod +++ b/go.mod @@ -39,6 +39,7 @@ require ( github.com/lnashier/viper v0.0.0-20180730210402-cc7336125d12 github.com/magiconair/properties v1.7.3 // indirect github.com/mattn/go-sqlite3 v1.11.0 + github.com/opencontainers/image-spec v1.0.2 // indirect github.com/pelletier/go-toml v1.0.1 // indirect github.com/rs/cors v1.3.0 // indirect github.com/russross/blackfriday v2.0.0+incompatible // indirect diff --git a/go.sum b/go.sum index b7b8c9959..41c3ceda6 100644 --- a/go.sum +++ b/go.sum @@ -819,6 +819,8 @@ github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3I github.com/opencontainers/image-spec v1.0.0/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI= github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= +github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v1.0.0-rc8.0.20190926000215-3e425f80a8c9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= diff --git a/io.go b/io.go index 61721a057..a5e4b339e 100644 --- a/io.go +++ b/io.go @@ -274,6 +274,13 @@ 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