Skip to content

Commit cf6fe9c

Browse files
committed
add period to nc_date
1 parent d197196 commit cf6fe9c

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

docs/make.jl

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ makedocs(modules=[NetCDFTools], sitename="NetCDFTools.jl")
88
makedocs(modules=[NetCDFTools],
99
sitename="NetCDFTools.jl",
1010
doctest=false,
11+
warnonly=true,
1112
format=Documenter.HTML(
1213
prettyurls=CI,
1314
),

src/nc_date.jl

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
nc_date(ds::NCdata) = ds["time"][:]
22

3-
function nc_date(file::NCfiles)
3+
function nc_date(file::NCfiles; period=nothing)
44
nc_open(file) do ds
5-
nc_date(ds)
5+
dates = nc_date(ds)
6+
period === nothing && return dates
7+
8+
inds = period[1] .<= year.(dates) .<= period[2]
9+
return dates[inds]
610
end
711
end
812

0 commit comments

Comments
 (0)