Skip to content

Commit

Permalink
add period to nc_date
Browse files Browse the repository at this point in the history
  • Loading branch information
kongdd committed Jul 15, 2024
1 parent d197196 commit cf6fe9c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ makedocs(modules=[NetCDFTools], sitename="NetCDFTools.jl")
makedocs(modules=[NetCDFTools],
sitename="NetCDFTools.jl",
doctest=false,
warnonly=true,
format=Documenter.HTML(
prettyurls=CI,
),
Expand Down
8 changes: 6 additions & 2 deletions src/nc_date.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
nc_date(ds::NCdata) = ds["time"][:]

function nc_date(file::NCfiles)
function nc_date(file::NCfiles; period=nothing)
nc_open(file) do ds
nc_date(ds)
dates = nc_date(ds)
period === nothing && return dates

inds = period[1] .<= year.(dates) .<= period[2]
return dates[inds]
end
end

Expand Down

0 comments on commit cf6fe9c

Please sign in to comment.