Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ext/checkers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ function Checker.check(
sim_dates = ClimaAnalysis.dates(var)
sim_indices_for_obs_dates = indexin(obs_dates, sim_dates)

length(sim_indices_for_obs_dates) == 1 && @warn(
"There is only one date in the metadata. SequentialIndicesChecker will always return true"
)

# Do not need to check for nothing in sim_indices_for_obs_dates because
# of DimValuesChecker
for i in eachindex(sim_indices_for_obs_dates)[2:end]
Expand Down
12 changes: 12 additions & 0 deletions test/ensemble_builder.jl
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,18 @@ import ClimaAnalysis.Template:
verbose = true,
)

# Check warning from SequentialIndicesChecker
date_var5 =
TemplateVar() |>
add_dim("time", [0.0], units = "s") |>
add_attribs(start_date = "2010-12-01T00:00:42") |>
initialize
@test_logs (:warn, r"only one date in the metadata") Checker.check(
sequential_indices_checker,
date_var5,
make_metadata(date_var5),
)

# Check sign of data
sign_checker = Checker.SignChecker(0.05)
neg_var = ClimaAnalysis.remake(var, data = -var.data)
Expand Down
Loading