From c3b4ad2e2fb83c56219b1dc50716e248cf76c8c8 Mon Sep 17 00:00:00 2001 From: gaelforget Date: Mon, 16 Sep 2024 12:42:23 -0400 Subject: [PATCH 1/2] more robust if, increase codecov --- src/ReadWrite.jl | 7 ++++--- test/runtests.jl | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ReadWrite.jl b/src/ReadWrite.jl index c547f8d..152308c 100644 --- a/src/ReadWrite.jl +++ b/src/ReadWrite.jl @@ -30,13 +30,14 @@ Reformat Array data into a MeshArray shaped after `γ`. """ function read(xx::Array,γ::gcmgrid) siz=size.(Ref(xx),[1,2,3,4]) - if siz[1:2]==[i for i in γ.ioSize] + S=[i for i in γ.ioSize[:]] + if siz[1:2]==S||siz[1:2]==transpose(S) n3=siz[3]; n4=siz[4] yy=reshape(xx,(γ.ioSize...,n3,n4)) - elseif siz[1]==prod(γ.ioSize[:]) + elseif siz[1]==prod(S) n3=siz[2]; n4=siz[3] yy=reshape(xx,(γ.ioSize...,n3,n4)) - elseif mod(siz[1],prod(γ.ioSize[:]))==0 + elseif mod(siz[1],prod(S))==0 n3=Int(siz[1]/prod(γ.ioSize[:])) n4=1 yy=reshape(xx,(γ.ioSize...,n3,n4)) diff --git a/test/runtests.jl b/test/runtests.jl index 0943984..373f523 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -101,6 +101,10 @@ end GM_PsiY=read(randn(90,1170,50),Γ.hFacS) bolusU, bolusV, bolusW=MeshArrays.calc_bolus(GM_PsiX,GM_PsiY, Γ) + read(rand(90*1170),γ) + read(rand(90*1170*2),γ) + read(rand(90,1170,2,2),γ) + #See: OceanTransports/helper_functions.jl #u,v,uC,vC=rotate_uv(uv,Γ); From 0f60b883c34eeae0d1a1b0350ad7c19bd383788e Mon Sep 17 00:00:00 2001 From: gaelforget Date: Mon, 16 Sep 2024 12:42:45 -0400 Subject: [PATCH 2/2] bump version --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index a36ea06..00383ad 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "MeshArrays" uuid = "cb8c808f-1acf-59a3-9d2b-6e38d009f683" authors = ["gaelforget "] -version = "0.3.12" +version = "0.3.13" [deps] CatViews = "81a5f4ea-a946-549a-aa7e-2a7f63a27d31"