Set the probability value for PROB groups
This commit is contained in:
parent
c28f74b5a5
commit
2f29c50b2b
11
taf.go
11
taf.go
@ -320,17 +320,18 @@ func DecodeWithOptions(r io.Reader, opts Options) (*Forecast, error) {
|
|||||||
// happen to the change rather than the root forecast.
|
// happen to the change rather than the root forecast.
|
||||||
out = reflect.ValueOf(ch).Elem()
|
out = reflect.ValueOf(ch).Elem()
|
||||||
case item.Probability != nil:
|
case item.Probability != nil:
|
||||||
|
prob, err := strconv.Atoi(item.Probability.Value)
|
||||||
|
if err != nil {
|
||||||
|
return nil, participle.Errorf(item.Probability.Pos, "prob: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
// If the time is empty, this probability belongs to the
|
// If the time is empty, this probability belongs to the
|
||||||
// next change.
|
// next change.
|
||||||
if item.Probability.Valid.Start == "" {
|
if item.Probability.Valid.Start == "" {
|
||||||
prob, err := strconv.Atoi(item.Probability.Value)
|
|
||||||
if err != nil {
|
|
||||||
return nil, participle.Errorf(item.Probability.Pos, "prob: %s", err)
|
|
||||||
}
|
|
||||||
// Set the setProb variable. This will let the decoder know to add it to the next change.
|
// Set the setProb variable. This will let the decoder know to add it to the next change.
|
||||||
setProb = prob
|
setProb = prob
|
||||||
} else {
|
} else {
|
||||||
pr := &Probability{}
|
pr := &Probability{Value: prob}
|
||||||
|
|
||||||
pr.Valid, err = parseValid(&item.Probability.Valid, opts.Month, opts.Year)
|
pr.Valid, err = parseValid(&item.Probability.Valid, opts.Month, opts.Year)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user