Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexisRenchon committed Aug 29, 2024
1 parent a67a817 commit 0b8063c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/diagnostics/diagnostics_tests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Test
using ClimaLand
using ClimaLand.Diagnostics: @with_error

@test isdefined(ClimaLand.Diagnostics, :compute_albedo!)

Expand All @@ -9,7 +10,22 @@ using ClimaLand
)

# Define some diagnostics for a DummyModel

@test ClimaLand.Diagnostics.ALL_DIAGNOSTICS isa Dict
@test length(ClimaLand.Diagnostics.ALL_DIAGNOSTICS) == 0
struct DummyModel end
ClimaLand.Diagnostics.@diagnostic_compute "albedo" DummyModel p.foo.bar

ClimaLand.Diagnostics.add_diagnostic_variable!(
short_name = "alpha",
long_name = "Albedo",
standard_name = "albedo",
units = "",
compute! = (out, Y, p, t) -> compute_albedo!(out, Y, p, t, land_model),
)

@test length(ClimaLand.Diagnostics.ALL_DIAGNOSTICS) == 1

ClimaLand.Diagnostics.define_diagnostics!(DummyModel())

# Just to trigger the error
Expand All @@ -24,3 +40,4 @@ out = Y = p = t = land_model = nothing
)

@test_throws ErrorException ClimaLand.Diagnostics.get_diagnostic_variable("Foo")

0 comments on commit 0b8063c

Please sign in to comment.