fix: open dataset with readonly mode
This commit is contained in:
@@ -8,6 +8,13 @@
|
||||
"fantomas"
|
||||
],
|
||||
"rollForward": false
|
||||
},
|
||||
"dotnet-trace": {
|
||||
"version": "9.0.553101",
|
||||
"commands": [
|
||||
"dotnet-trace"
|
||||
],
|
||||
"rollForward": false
|
||||
}
|
||||
}
|
||||
}
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -9,3 +9,6 @@ obj/
|
||||
.direnv/*
|
||||
*.sln.DotSettings.user
|
||||
.pre-commit-config.yaml
|
||||
*.def
|
||||
*.sif
|
||||
*.nettrace
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"sdk": {
|
||||
"version": "8.0.300",
|
||||
"version": "8.0.*",
|
||||
"rollForward": "latestPatch"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
open System
|
||||
open System
|
||||
open System.IO
|
||||
open Argu
|
||||
open Oceanbox.FvcomKit
|
||||
@@ -105,11 +105,13 @@ let main argv =
|
||||
let path = args.GetResult(Input_Grid)
|
||||
|
||||
Log.Information $"Using input file: %s{path}"
|
||||
let ds = DataSetUri.Create path |> DataSet.Open
|
||||
let ds = DataSet.Open(path, openMode = ResourceOpenMode.ReadOnly)
|
||||
Log.Verbose "Opened dataset"
|
||||
let grd = ds |> Fvcom.getGrid
|
||||
let neighborIndex = grd.ToGrid() |> Grid.makeNeighborIndex
|
||||
let grid = grd.ToGrid()
|
||||
let neighborIndex = grid |> Grid.makeNeighborIndex
|
||||
let extendedGrid = Grid.ExtendedGrid(grid)
|
||||
Log.Verbose "Created in-memory structures, separating coastline..."
|
||||
let coastEdges, innerNodes = separateCoastline grid
|
||||
|
||||
Log.Verbose
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
module Gridding.Polygon
|
||||
|
||||
open Oceanbox.FvcomKit
|
||||
open Serilog
|
||||
|
||||
/// <summary>
|
||||
/// Separate coastline nodes from inner nodes.
|
||||
@@ -11,6 +12,7 @@ let separateCoastline (grid: Grid.Grid) =
|
||||
let getEdges (a, b, c) = [ (a, b); (b, c); (c, a) ]
|
||||
|
||||
let allEdges =
|
||||
Log.Debug "Finding all edges"
|
||||
(Map.empty, grid.Elem)
|
||||
||> Array.fold (fun allEdges elem ->
|
||||
// Get all edges of the elem and sort the coordinates
|
||||
@@ -30,6 +32,7 @@ let separateCoastline (grid: Grid.Grid) =
|
||||
|
||||
// Coastal edges will only have one reference
|
||||
let coastalEdges =
|
||||
Log.Debug "Finding coastal edges"
|
||||
(Array.empty, allEdges)
|
||||
||> Map.fold (fun acc edge count ->
|
||||
match count with
|
||||
@@ -39,6 +42,7 @@ let separateCoastline (grid: Grid.Grid) =
|
||||
|
||||
// Find all nodes that are not part of a coastal edge
|
||||
let innerNodes =
|
||||
Log.Debug "Finding all nodes that are not part of a coastal edge"
|
||||
[| 0 .. grid.Nodes.Length - 1 |]
|
||||
|> Array.filter (fun node ->
|
||||
coastalEdges
|
||||
|
||||
Reference in New Issue
Block a user