Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add general part #2035

Merged
merged 32 commits into from
Jan 13, 2025
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
0830edc
add general_partition
juliettelavoie May 23, 2024
90f3b7d
import better
juliettelavoie May 24, 2024
7c5463a
init
juliettelavoie May 24, 2024
b0c5ddd
attrs
juliettelavoie Jun 10, 2024
a81ba85
use adjustment
juliettelavoie Jun 10, 2024
132df88
try to fix loess
juliettelavoie Jun 12, 2024
9b65098
poly if not loess
juliettelavoie Jun 13, 2024
34a9673
warning
juliettelavoie Jun 13, 2024
8427939
test
juliettelavoie Jun 13, 2024
f7c7f4e
remove try
juliettelavoie Jun 13, 2024
bfefde6
try handling 0s
juliettelavoie Jun 14, 2024
e2c8782
try change with delta
juliettelavoie Jun 14, 2024
456ff76
keep attrs
juliettelavoie Jun 18, 2024
80ceff5
units
juliettelavoie Aug 28, 2024
74f5785
merge with main
juliettelavoie Jan 6, 2025
564fcc6
change log
juliettelavoie Jan 6, 2025
b43eff0
fix test
juliettelavoie Jan 6, 2025
b049ee3
cleanup
juliettelavoie Jan 6, 2025
81eadce
cleanup
juliettelavoie Jan 6, 2025
b88090f
pr num
juliettelavoie Jan 6, 2025
06ea4c3
Update CHANGELOG.rst
juliettelavoie Jan 6, 2025
0444ffe
Update src/xclim/ensembles/_partitioning.py
juliettelavoie Jan 6, 2025
58b58eb
Update src/xclim/ensembles/_partitioning.py
juliettelavoie Jan 6, 2025
525b4c0
Apply suggestions from code review
juliettelavoie Jan 6, 2025
31b73c9
suggestion
juliettelavoie Jan 6, 2025
0887677
order
juliettelavoie Jan 6, 2025
96a458c
close instead of equal
juliettelavoie Jan 7, 2025
cf95a2f
Merge branch 'main' into add_general_part
juliettelavoie Jan 7, 2025
77a9e23
fix docs
juliettelavoie Jan 8, 2025
8f524cd
Merge remote-tracking branch 'origin/add_general_part' into add_gener…
juliettelavoie Jan 8, 2025
ab4397d
remove loess
juliettelavoie Jan 8, 2025
7e09f65
Update src/xclim/ensembles/_partitioning.py
Zeitsperre Jan 8, 2025
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
Prev Previous commit
Next Next commit
poly if not loess
juliettelavoie committed Jun 13, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 9b6509810a0a1270e4a59466130b2cf348795138
8 changes: 7 additions & 1 deletion xclim/ensembles/_partitioning.py
Original file line number Diff line number Diff line change
@@ -360,7 +360,13 @@ def general_partition(
da.notnull()
)
elif sm == "loess":
sm = loess.loess_smoothing(da)
try:
sm = loess.loess_smoothing(da)
except np.linalg.LinAlgError:
fit = da.polyfit(dim="time", deg=4, skipna=True)
sm = xr.polyval(coord=da.time, coeffs=fit.polyfit_coefficients).where(
da.notnull()
)

# "Interannual variability is then estimated as the centered rolling 11-year variance of the difference
# between the extracted forced response and the raw outputs, averaged over all outputs."