Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
meggart committed Sep 23, 2022
1 parent 8d592d9 commit e86272e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Shapefile = "0.6, 0.7"
StatsBase = "0.32, 0.33"
Tables = "0.2, 1.0"
WeightedOnlineStats = "0.5, 0.6"
YAXArrays = "0.2.1, 0.3, 0.4"
YAXArrays = "0.4"
Zarr = "0.6.2, 0.7"
julia = "1.6"

Expand Down
20 changes: 4 additions & 16 deletions test/access.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,36 +87,24 @@ using DiskArrayTools: DiskArrayStack
data1=readcubedata(d)
#Test saving cubes
dire=tempname()
YAXdir(dire)
savecube(data1,"mySavedCube")
savecube(data1,dire)


data3=readcubedata(loadcube("mySavedCube"))
data3=readcubedata(Cube(dire))
@test data1.axes==data3.axes
@test data1.data==data3.data

# Test loadOrGenerate macro
d=subsetcube(c,time=Date(2001)..Date(2005),lon=(10,11),lat=(50,51),variable=["gross_primary_productivity","net_ecosystem_exchange"])

rmcube("Anomalies")
@loadOrGenerate danom=>"Anomalies" begin
danom = removeMSC(d)
end

@test danom.data isa Array

@loadOrGenerate danom=>"Anomalies" begin
error("This should never execute")
end;
@test danom.data isa DiskArrayStack
danom = removeMSC(d)

zp = tempname()
savecube(danom, zp, overwrite=true)

@test danom.data isa DiskArrayStack

danom=readcubedata(danom)
danom2=readcubedata(loadcube(zp))
danom2=readcubedata(Cube(zp))

@test danom.axes==danom2.axes
@test all(map(isequal,danom.data,danom2.data))
Expand Down
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ cgermany = c[
var = ["gross", "net_ecosystem", "air_temperature_2m", "terrestrial_ecosystem", "land_surface_temperature"],
time = 2000:2010
]
savecube(cgermany,"germanycube",
chunksize=Dict("lon"=>20,"lat"=>20,"time"=>92))
cgermany = setchunks(cgermany,Dict("lon"=>20,"lat"=>20,"time"=>92))
savecube(cgermany,"germanycube")
YAXArrays.YAXDefaults.cubedir[] = joinpath(newcubedir,"germanycube")
include("access.jl")
include("analysis.jl")
Expand Down

2 comments on commit e86272e

@meggart
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/68816

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.10.0 -m "<description of version>" e86272e6dff0ef12975709d286de844a8e647ee4
git push origin v0.10.0

Please sign in to comment.