Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
05edb56797 | ||
|
|
cfb3cf6ded | ||
|
|
7f0093c740 | ||
|
|
4c976f01ce | ||
|
|
bd687fd1ac | ||
|
|
2dd380a828 | ||
|
|
e16a61cbdf |
95
src/Fvcom.fs
95
src/Fvcom.fs
@@ -2,6 +2,7 @@ module Oceanbox.FvcomKit.Fvcom
|
||||
|
||||
#nowarn "57"
|
||||
|
||||
open System
|
||||
open Microsoft.Research.Science.Data
|
||||
open FSharpPlus
|
||||
open ProjNet.FSharp
|
||||
@@ -88,6 +89,18 @@ let getTime (ds: DataSet) n =
|
||||
Log.Error $"getTime exception: {e.Message}"
|
||||
None
|
||||
|
||||
let getTimeSpanSinceStart (ds: DataSet) n =
|
||||
try
|
||||
let days = ds[ "Itime" ].GetData() :?> int []
|
||||
let msec = ds[ "Itime2" ].GetData() :?> int []
|
||||
let t0 = TimeSpan.FromDays days[n]
|
||||
let t1 = TimeSpan.FromMilliseconds msec[n]
|
||||
t0 + t1 |> Some
|
||||
with
|
||||
| e ->
|
||||
Log.Error $"getTimeInDays exception: {e.Message}"
|
||||
None
|
||||
|
||||
let readUV (ds: DataSet) t l =
|
||||
try
|
||||
let n = ds.Dimensions["nele"].Length
|
||||
@@ -146,6 +159,48 @@ let readOmegas (ds: DataSet) t l es =
|
||||
Log.Error $"{e}"
|
||||
Array.empty
|
||||
|
||||
let readU (ds: DataSet) t l =
|
||||
try
|
||||
let n = ds.Dimensions["nele"].Length
|
||||
let u = ds[ "u" ].GetData([| t; l; 0 |], [| 1; 1; n |]) :?> single [,,]
|
||||
u[0, 0, *]
|
||||
with
|
||||
| e ->
|
||||
Log.Error $"{e}"
|
||||
Array.empty
|
||||
|
||||
let readUBlock (ds: DataSet) t =
|
||||
try
|
||||
let n = ds.Dimensions["nele"].Length
|
||||
let l = ds.Dimensions["siglay"].Length
|
||||
let u = ds[ "u" ].GetData([| t; 0; 0 |], [| 1; l; n |]) :?> single [,,]
|
||||
u[0, *, *]
|
||||
with
|
||||
| e ->
|
||||
Log.Error $"{e}"
|
||||
Array2D.zeroCreate 0 0
|
||||
|
||||
let readV (ds: DataSet) t l =
|
||||
try
|
||||
let n = ds.Dimensions["nele"].Length
|
||||
let v = ds[ "v" ].GetData([| t; l; 0 |], [| 1; 1; n |]) :?> single [,,]
|
||||
v[0, 0, *]
|
||||
with
|
||||
| e ->
|
||||
Log.Error $"{e}"
|
||||
Array.empty
|
||||
|
||||
let readVBlock (ds: DataSet) t =
|
||||
try
|
||||
let n = ds.Dimensions["nele"].Length
|
||||
let l = ds.Dimensions["siglay"].Length
|
||||
let v = ds[ "v" ].GetData([| t; 0; 0 |], [| 1; l; n |]) :?> single [,,]
|
||||
v[0, *, *]
|
||||
with
|
||||
| e ->
|
||||
Log.Error $"{e}"
|
||||
Array2D.zeroCreate 0 0
|
||||
|
||||
let readWw (ds: DataSet) t l =
|
||||
try
|
||||
let n = ds.Dimensions["nele"].Length
|
||||
@@ -156,6 +211,17 @@ let readWw (ds: DataSet) t l =
|
||||
Log.Error $"{e}"
|
||||
Array.empty
|
||||
|
||||
let readWwBlock (ds: DataSet) t =
|
||||
try
|
||||
let n = ds.Dimensions["nele"].Length
|
||||
let l = ds.Dimensions["siglay"].Length
|
||||
let w = ds[ "ww" ].GetData([| t; 0; 0 |], [| 1; l; n |]) :?> single [,,]
|
||||
w[0, *, *]
|
||||
with
|
||||
| e ->
|
||||
Log.Error $"{e}"
|
||||
Array2D.zeroCreate 0 0
|
||||
|
||||
let readWws (ds: DataSet) t l es =
|
||||
try
|
||||
let n = ds.Dimensions["nele"].Length
|
||||
@@ -215,6 +281,20 @@ let readTemp (ds: DataSet) t l =
|
||||
Log.Error $"{e}"
|
||||
Array.empty
|
||||
|
||||
let readTempBlock (ds: DataSet) t =
|
||||
try
|
||||
let n = ds.Dimensions["node"].Length
|
||||
let l = ds.Dimensions["siglay"].Length
|
||||
let sal =
|
||||
ds["temp"]
|
||||
.GetData([| t; 0; 0 |], [| 1; l; n |])
|
||||
:?> single [,,]
|
||||
sal[0, *, *]
|
||||
with
|
||||
| e ->
|
||||
Log.Error $"{e}"
|
||||
Array2D.zeroCreate 0 0
|
||||
|
||||
let readSalinity (ds: DataSet) t l =
|
||||
try
|
||||
let n = ds.Dimensions["node"].Length
|
||||
@@ -228,6 +308,21 @@ let readSalinity (ds: DataSet) t l =
|
||||
Log.Error $"{e}"
|
||||
Array.empty
|
||||
|
||||
let readSalinityBlock (ds: DataSet) t =
|
||||
try
|
||||
let n = ds.Dimensions["node"].Length
|
||||
let l = ds.Dimensions["siglay"].Length
|
||||
let sal =
|
||||
ds["salinity"]
|
||||
.GetData([| t; 0; 0 |], [| 1; l; n |])
|
||||
:?> single [,,]
|
||||
sal[0, *, *]
|
||||
with
|
||||
| e ->
|
||||
Log.Error $"{e}"
|
||||
Array2D.zeroCreate 0 0
|
||||
|
||||
|
||||
let readArt1 (ds: DataSet) =
|
||||
try
|
||||
ds[ "art1" ].GetData() :?> single []
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
<Compile Include="Smoothing.fs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Update="FSharp.Core" Version="7.0.200" />
|
||||
<PackageReference Include="FSharp.Data" Version="6.0.1-beta002" />
|
||||
<PackageReference Include="FSharpPlus" Version="1.4.0" />
|
||||
<PackageReference Update="FSharp.Core" Version="7.0.300" />
|
||||
<PackageReference Include="FSharp.Data" Version="6.2.0" />
|
||||
<PackageReference Include="FSharpPlus" Version="1.4.1" />
|
||||
<PackageReference Include="FsPickler" Version="5.3.2" />
|
||||
<PackageReference Include="KDTree" Version="1.4.1" />
|
||||
<PackageReference Include="MathNet.Numerics.FSharp" Version="5.0.0" />
|
||||
|
||||
Reference in New Issue
Block a user