diff --git a/emissions/aep/inventory.go b/emissions/aep/inventory.go index 0def96adf..86498184e 100644 --- a/emissions/aep/inventory.go +++ b/emissions/aep/inventory.go @@ -22,6 +22,7 @@ import ( "encoding/gob" "fmt" "io" + "log" "os" "strconv" "strings" @@ -392,16 +393,16 @@ func (e *EmissionsReader) ReadFiles(files []*InventoryFile, f RecFilter) ([]Reco for _, file := range files { report.AddData(file) } - recordList := make([]Record, len(records)) - i := 0 + recordList := make([]Record, 0, len(records)) for _, r := range records { if ar, ok := r.(sourceDataLocationer); ok { if err := e.sourceDataLocator.Locate(ar.getSourceDataLocation()); err != nil { - return nil, nil, err + log.Println(err) + continue // Drop records we can't find a location for. + // return nil, nil, err } } - recordList[i] = r - i++ + recordList = append(recordList, r) } return recordList, report, nil } diff --git a/emissions/aep/sourcedata.go b/emissions/aep/sourcedata.go index 5a1c6ffc8..5e4888bc6 100644 --- a/emissions/aep/sourcedata.go +++ b/emissions/aep/sourcedata.go @@ -146,8 +146,11 @@ func (sdl *sourceDataLocator) Locate(sd *SourceDataLocation) error { return err } } - sd.location = sdl.inputShapes[srgSpec][sd.FIPS] - return nil + if l, ok := sdl.inputShapes[srgSpec][sd.FIPS]; ok { + sd.location = l + return nil + } + return fmt.Errorf("aep: missing input shape for spatial surrogate %s%s FIPS %s", srgSpec.region(), srgSpec.code(), sd.FIPS) } // Location returns the polygon representing the location of emissions.