96 lines
2.2 KiB
Go
96 lines
2.2 KiB
Go
package ds
|
|
|
|
import (
|
|
"time"
|
|
|
|
api "git.intra.yksa.space/gsn/predictor/pkg/rest"
|
|
)
|
|
|
|
type PredictionParameters struct {
|
|
LaunchLatitude *float64
|
|
LaunchLongitude *float64
|
|
LaunchDatetime *time.Time
|
|
LaunchAltitude *float64
|
|
Profile *string
|
|
AscentRate *float64
|
|
BurstAltitude *float64
|
|
DescentRate *float64
|
|
FloatAltitude *float64
|
|
StopDatetime *time.Time
|
|
AscentCurve *string // base64
|
|
DescentCurve *string // base64
|
|
SimulateStages []string
|
|
Interpolate *bool
|
|
Format *string
|
|
Dataset *time.Time
|
|
// Add other parameters as needed
|
|
}
|
|
|
|
type PredicitonResult struct {
|
|
Latitude *float64
|
|
Longitude *float64
|
|
Altitude *float64
|
|
Timestamp *time.Time
|
|
WindU *float64
|
|
WindV *float64
|
|
// Add other result fields as needed
|
|
}
|
|
|
|
// Converts flat ogen params to internal pointer-based model
|
|
func ConvertFlatPredictionParams(params api.PerformPredictionParams) *PredictionParameters {
|
|
out := &PredictionParameters{}
|
|
if v, ok := params.LaunchLatitude.Get(); ok {
|
|
out.LaunchLatitude = &v
|
|
}
|
|
if v, ok := params.LaunchLongitude.Get(); ok {
|
|
out.LaunchLongitude = &v
|
|
}
|
|
if v, ok := params.LaunchDatetime.Get(); ok {
|
|
out.LaunchDatetime = &v
|
|
}
|
|
if v, ok := params.LaunchAltitude.Get(); ok {
|
|
out.LaunchAltitude = &v
|
|
}
|
|
if v, ok := params.Profile.Get(); ok {
|
|
s := string(v)
|
|
out.Profile = &s
|
|
}
|
|
if v, ok := params.AscentRate.Get(); ok {
|
|
out.AscentRate = &v
|
|
}
|
|
if v, ok := params.BurstAltitude.Get(); ok {
|
|
out.BurstAltitude = &v
|
|
}
|
|
if v, ok := params.DescentRate.Get(); ok {
|
|
out.DescentRate = &v
|
|
}
|
|
if v, ok := params.FloatAltitude.Get(); ok {
|
|
out.FloatAltitude = &v
|
|
}
|
|
if v, ok := params.StopDatetime.Get(); ok {
|
|
out.StopDatetime = &v
|
|
}
|
|
if v, ok := params.AscentCurve.Get(); ok {
|
|
out.AscentCurve = &v
|
|
}
|
|
if v, ok := params.DescentCurve.Get(); ok {
|
|
out.DescentCurve = &v
|
|
}
|
|
if v, ok := params.Interpolate.Get(); ok {
|
|
out.Interpolate = &v
|
|
}
|
|
if v, ok := params.Format.Get(); ok {
|
|
s := string(v)
|
|
out.Format = &s
|
|
}
|
|
if v, ok := params.Dataset.Get(); ok {
|
|
out.Dataset = &v
|
|
}
|
|
if len(params.SimulateStages) > 0 {
|
|
out.SimulateStages = make([]string, len(params.SimulateStages))
|
|
for i, stage := range params.SimulateStages {
|
|
out.SimulateStages[i] = string(stage)
|
|
}
|
|
}
|
|
return out
|
|
}
|