Skip to content

Commit

Permalink
aep: Log error message for missing input shape
Browse files Browse the repository at this point in the history
  • Loading branch information
ctessum committed Nov 12, 2019
1 parent 0e457f0 commit 261c68e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion emissions/aep/inventory.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"encoding/gob"
"fmt"
"io"
"log"
"os"
"strconv"
"strings"
Expand Down Expand Up @@ -397,7 +398,9 @@ func (e *EmissionsReader) ReadFiles(files []*InventoryFile, f RecFilter) ([]Reco
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
Expand Down
7 changes: 5 additions & 2 deletions emissions/aep/sourcedata.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 261c68e

Please sign in to comment.