-
Notifications
You must be signed in to change notification settings - Fork 1
/
impacts_test.go
executable file
·46 lines (41 loc) · 1.12 KB
/
impacts_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package cityaq
import (
"context"
"fmt"
"os"
"testing"
"time"
rpc "github.com/ctessum/cityaq/cityaqrpc"
"github.com/spatialmodel/inmap/emissions/aep/aeputil"
)
func TestCityAQ_ImpactSummary(t *testing.T) {
dir := fmt.Sprintf("temp_test_%d", time.Now().Unix())
c := &CityAQ{
CityGeomDir: "testdata/cities",
SpatialConfig: aeputil.SpatialConfig{
SrgSpecOSM: "testdata/srgspec_osm.json",
SCCExactMatch: true,
GridRef: []string{"testdata/gridref.txt"},
OutputSR: "+proj=longlat",
InputSR: "+proj=longlat",
},
CacheLoc: "file://" + dir,
Version: "latest",
InMAPCityMarginalConfigFile: "testdata/inmap_config.toml",
}
os.Mkdir(dir, os.ModePerm)
defer os.RemoveAll(dir)
r := &rpc.ImpactSummaryRequest{
CityName: "Accra Metropolitan",
Emission: rpc.Emission_PM2_5,
SourceType: "roadways",
SimulationType: rpc.SimulationType_CityMarginal,
}
s, err := c.ImpactSummary(context.Background(), r)
if err != nil {
t.Fatal(err)
}
// There is no population in the example domain, so we get a null
// response.
fmt.Println(s)
}