Skip to content

Commit

Permalink
dont change array name in monthlyagg and co.
Browse files Browse the repository at this point in the history
  • Loading branch information
Datseris committed Mar 17, 2022
1 parent 36b3834 commit 25d87e7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
# 0.15
- Removed functions for calculating some decompositions of albedo to atmosphere/surface contributions. They were not basic enough for this package.


_Changelog for ClimateBase.jl is kept from version 0.14 onwards_
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ClimateBase"
uuid = "35604d93-0fb8-4872-9436-495b01d137e2"
authors = ["Datseris <[email protected]>", "Philippe Roy <[email protected]>"]
version = "0.15.1"
version = "0.15.2"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand Down
12 changes: 6 additions & 6 deletions src/physical_dimensions/temporal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ function monthlyagg(A::ClimArray, f = mean; mday = 15)
finaldate = Date(year(t0[end]), month(t0[end]), mday+1)
t = startdate:Month(1):finaldate
tranges = temporalrange(t0, Dates.month)
return timegroup(A, f, t, tranges, "monthly")
return timegroup(A, f, t, tranges)
end

"""
Expand All @@ -400,13 +400,13 @@ function yearlyagg(A::ClimArray, f = mean)
finaldate = Date(year(t0[end]), 2, 1)
t = startdate:Year(1):finaldate
tranges = temporalrange(t0, Dates.year)
return timegroup(A, f, t, tranges, "yearly")
return timegroup(A, f, t, tranges)
end

function timegroup(A, f, t, tranges, name)
function timegroup(A, f, t, tranges)
other = otherdims(A, Time)
n = A.name == Symbol("") ? A.name : Symbol(A.name, ", $(name)")
B = ClimArray(zeros(eltype(A), length.(other)..., length(t)), (other..., Time(t)), n)
B = ClimArray(zeros(eltype(A), length.(other)..., length(t)),
(other..., Time(t)); name = A.name)
for i in 1:length(tranges)
B[Time(i)] .= dropagg(f, view(A, Time(tranges[i])), Time)
end
Expand Down Expand Up @@ -453,7 +453,7 @@ function seasonalyagg(A::ClimArray, f = mean)
finaldate = to_seasonal_date(t0[end])
t = startdate:Month(3):finaldate
tranges = temporalrange(t0, season)
return timegroup(A, f, t, tranges, "seasonaly")
return timegroup(A, f, t, tranges)
end

function to_seasonal_date(t)
Expand Down

0 comments on commit 25d87e7

Please sign in to comment.