Files
Oceanbox.FvcomKit/src/NorKyst.fs
Simen Kirkvik 655abebe52 fix: Update Arome to translate latlon to lambert
Also:
- Add test for reading uv from tile coords
- Build with nix
- Pin nix with npins
- Remove .config tools manifest
- Remove preview flag
2026-01-06 10:23:49 +01:00

27 lines
778 B
Forth

module Oceanbox.FvcomKit.NorKyst
open System
open Thredds
let private getNorkystUrl (threddsUrl: string) (d: DateTime) =
let url = threddsUrl
let fmt (d: DateTime) =
$"{d.Year}%02d{d.Month}%02d{d.Day}T00Z.nc"
$"{url}/fou-hi/new_norkyst800m/his/ocean_his.an.{fmt d}"
let private getArchiveUrls urlf (t: DateTime) =
let t = t.ToUniversalTime ()
let now = DateTime.Now.ToUniversalTime ()
let dDay = (now.Date - t.Date).Days
if dDay < 0 then // no data available
[]
else
[ urlf t; urlf (t.AddDays -1) ]
let tryGetArchive (threddsUrl: string) (t: DateTime) =
getArchiveUrls (getNorkystUrl threddsUrl) t
|> tryOpenThredds
|> Option.bind (fun (_, ds) -> tryGetTimeIndex ds t |> Option.map (fun idx -> ds, idx))