Skip to content

Commit 5191b4f

Browse files
committed
aep: Log error message for missing input shape
1 parent 0e457f0 commit 5191b4f

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

emissions/aep/inventory.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"encoding/gob"
2323
"fmt"
2424
"io"
25+
"log"
2526
"os"
2627
"strconv"
2728
"strings"
@@ -392,16 +393,16 @@ func (e *EmissionsReader) ReadFiles(files []*InventoryFile, f RecFilter) ([]Reco
392393
for _, file := range files {
393394
report.AddData(file)
394395
}
395-
recordList := make([]Record, len(records))
396-
i := 0
396+
recordList := make([]Record, 0, len(records))
397397
for _, r := range records {
398398
if ar, ok := r.(sourceDataLocationer); ok {
399399
if err := e.sourceDataLocator.Locate(ar.getSourceDataLocation()); err != nil {
400-
return nil, nil, err
400+
log.Println(err)
401+
continue // Drop records we can't find a location for.
402+
// return nil, nil, err
401403
}
402404
}
403-
recordList[i] = r
404-
i++
405+
recordList = append(recordList, r)
405406
}
406407
return recordList, report, nil
407408
}

emissions/aep/sourcedata.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,11 @@ func (sdl *sourceDataLocator) Locate(sd *SourceDataLocation) error {
146146
return err
147147
}
148148
}
149-
sd.location = sdl.inputShapes[srgSpec][sd.FIPS]
150-
return nil
149+
if l, ok := sdl.inputShapes[srgSpec][sd.FIPS]; ok {
150+
sd.location = l
151+
return nil
152+
}
153+
return fmt.Errorf("aep: missing input shape for spatial surrogate %s%s FIPS %s", srgSpec.region(), srgSpec.code(), sd.FIPS)
151154
}
152155

153156
// Location returns the polygon representing the location of emissions.

0 commit comments

Comments
 (0)