feat: add Singlular module for time-series (later add Plural)

This commit is contained in:
Jonas Juselius
2023-06-16 15:12:31 +02:00
parent ff947bb364
commit eb2a981576

View File

@@ -551,6 +551,48 @@ module Siglay =
Log.Error $"{err}"
Array.empty
module Singular =
let readUv (ds: DataSet) e t d =
try
let u = ds[ "u" ].GetData([| t; d; e |], [| 1; 1; 1 |]) :?> single [,,]
let v = ds[ "v" ].GetData([| t; d; e |], [| 1; 1; 1 |]) :?> single [,,]
u[0, 0, 0], v[0, 0, 0]
with
| err ->
Log.Warning $"readUv {e} {t}"
Log.Error $"{err}"
0f, 0f
let readTemp (ds: DataSet) n t d =
try
let t = ds[ "temp" ].GetData([| t; d; n |], [| 1; 1; 1 |]) :?> single [,,]
t[0, 0, 0]
with
| err ->
Log.Warning $"readTemp {n} {t}"
Log.Error $"{err}"
0f
let readSalinity (ds: DataSet) n t d =
try
let t =
ds["salinity"].GetData([| t; d; n |], [| 1; 1; 1 |]) :?> single [,,]
t[0, 0, 0]
with
| err ->
Log.Warning $"readS {n} {t}"
Log.Error $"{err}"
0f
let readZeta (ds: DataSet) n t =
try
let zeta = ds[ "zeta" ].GetData([| t; n |], [| 1; 1 |]) :?> single [,]
zeta[0, 0]
with
| e ->
Log.Error $"{e}"
0f
let getBBox (ds: DataSet) : BBox =
try
let x = ds[ "x" ].GetData() :?> single []