Skip to content

Commit

Permalink
Merge pull request #148 from gaelforget/v0p3p13_d
Browse files Browse the repository at this point in the history
V0p3p13(d)
  • Loading branch information
gaelforget committed Sep 16, 2024
2 parents dc71bde + 0f60b88 commit 9105671
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MeshArrays"
uuid = "cb8c808f-1acf-59a3-9d2b-6e38d009f683"
authors = ["gaelforget <gforget@mit.edu>"]
version = "0.3.12"
version = "0.3.13"

[deps]
CatViews = "81a5f4ea-a946-549a-aa7e-2a7f63a27d31"
Expand Down
7 changes: 4 additions & 3 deletions src/ReadWrite.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 4 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,Γ);

Expand Down

0 comments on commit 9105671

Please sign in to comment.