From 7e386fea4085d57c8f99c16dc8bcbf1e963a5ad6 Mon Sep 17 00:00:00 2001 From: gaelforget Date: Mon, 8 Dec 2025 00:02:52 -0500 Subject: [PATCH 1/3] bump version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 863dcd27..a18656ee 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "MeshArrays" uuid = "cb8c808f-1acf-59a3-9d2b-6e38d009f683" -version = "0.4.7" +version = "0.4.8" authors = ["gaelforget "] [deps] From f41734c5718e00bc63af87553d5b9e022e5e83b6 Mon Sep 17 00:00:00 2001 From: gaelforget Date: Mon, 8 Dec 2025 00:50:04 -0500 Subject: [PATCH 2/3] fix test --- test/runtests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index a8c5a53a..9118ff02 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -395,7 +395,7 @@ end @testset "polygon operations" begin fil=MeshArrays.Dataset("countries_shp1",do_read=false) - pol=MeshArrays.read_shp(fil,format=0.2) + pol=MeshArrays.read_shp(fil,format=:Shapefile) name,rule=MeshArrays.within_pol(pol; ID=11) rule_vec = (x,y) -> rule.(x,y) From f0be82fcb80462fac03c567a570bceb59728b549 Mon Sep 17 00:00:00 2001 From: gaelforget Date: Mon, 8 Dec 2025 01:33:55 -0500 Subject: [PATCH 3/3] fix GridLoad_default, store grid ID via path --- src/grids/main.jl | 24 +++++++++++++++--------- test/runtests.jl | 11 +++++------ 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/grids/main.jl b/src/grids/main.jl index a5da1ec3..b479e01f 100644 --- a/src/grids/main.jl +++ b/src/grids/main.jl @@ -56,11 +56,11 @@ function GridSpec_default(xy=NamedTuple(), nFaces=1; ID=:unknown) else error("unknown grid ID") end - GridSpec_default_xy(xy,nFaces) + GridSpec_default_xy(xy,nFaces,path="_default_"*string(ID)) end end -function GridSpec_default_xy(xy::NamedTuple, nFaces=1) +function GridSpec_default_xy(xy::NamedTuple, nFaces=1; path="_default") (; xc, yc, xg, yg) = xy dx=diff(xg)[1] @@ -73,7 +73,6 @@ function GridSpec_default_xy(xy::NamedTuple, nFaces=1) ioSize=[ni nj] facesSize=[(nni, nnj), (nni, nnj), (nni, nnj), (nni, nnj)] ioPrec=Float32 - path="_default" g=gcmgrid(path, grTopo, nFaces, facesSize, ioSize, ioPrec, read, write) end @@ -118,10 +117,10 @@ true """ function GridLoad(γ=GridSpec(); ID=:default, option=:minimal, verbose=false) gr = (ID!==:default ? GridSpec(ID=ID) : γ) - if gr.path=="_default" + if occursin("_default",gr.path) verbose ? println("GridLoad_default") : nothing GridLoad_default(gr) - elseif gr.path=="_ones" + elseif occursin("_ones",gr.path) verbose ? println("GridLoad_ones") : nothing GridLoad_ones(gr; option=option) else @@ -295,10 +294,17 @@ include("NEMO.jl") MeshArrays.GridSpec_default(ID=:IAP) ``` """ -function GridLoad_default(gr=GridSpec())#; ID=:unknown) -# xy=Grids_simple.xy_IAP() -# gr=Grids_simple.grid_factors(xy) - +function GridLoad_default(gr=GridSpec()) + xy=(if gr.path=="_default_IAP" + Grids_simple.xy_IAP() + elseif gr.path=="_default_Oscar" + Grids_simple.xy_Oscar() + elseif gr.path=="_default_OISST" + Grids_simple.xy_OISST() + else + error("unknown grid ID") + end) + gr=Grids_simple.grid_factors(xy) dep=[10 100 1000]; msk=ones(gr[:XC].fSize[1]...,3) gr=Grids_simple.grid_add_z(gr,dep,msk) end diff --git a/test/runtests.jl b/test/runtests.jl index 9118ff02..1253c9fe 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -286,12 +286,11 @@ end @test isa(G,Dict) end -if false - γ = GridSpec(ID=:OISST) - γ = GridSpec(ID=:LLC90) - #γ=MeshArrays.GridSpec_ones("CubeSphere",6,20) - γ = GridSpec("ones") - Γ = GridLoad(γ;option="full") +@testset "GridSpec:" begin + γ = GridSpec(ID=:Oscar) + γ = GridSpec(ID=:IAP) + GridLoad(GridSpec(ID=:OISST)) + GridLoad(GridSpec("ones")) end @testset "Plotting:" begin