Skip to content

Commit b4cff41

Browse files
error message for time range
1 parent 753dd4b commit b4cff41

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/cdm.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ function download(dsopendap::CDMDataset{TDS},variablename::Symbol;
7272
time = time - Dates.Second(dsopendap.time_shift)
7373
end
7474

75+
if !(nctime[1] <= time[1] && time[end] <= nctime[end])
76+
error("out of date: available time range is $(nctime[1]) - $(nctime[end]). Requested time range is $(time[1]) - $(time[end])")
77+
end
78+
7579
indices = (; ((Symbol(name(ncv)), rg(findall(first(b) .<= ncv[:] .<= last(b))) )
7680
for (ncv,b) in [ (nclon,longitude),(nclat,latitude),(nctime,time)]) ...)
7781

0 commit comments

Comments
 (0)