get.ensemble.samples rejects "torus" even though it is a documented sampling method

Open Beginner friendly
#4,236 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
r
Domain
data

Research direction

Read modules/uncertainty/R/ensemble.R, especially the supported-methods check at lines 81–85 and the existing torus branches. Add a test that get.ensemble.samples returns the requested number of samples for method = "torus" and still errors for an unknown method. The issue says to open the PR after #4229 merges, since it changes the same function signature.

Written by the indexing model from the issue text.

Description

Setting the ensemble sampling method to torus stops with "Invalid sampling method", even though torus is a documented option.

PEcAn.uncertainty::get.ensemble.samples(
  3, list(a = data.frame(x = c(1, 5, 2, 8, 2))), list(), method = "torus"
)
#> Error in get.ensemble.samples(...): Invalid sampling method

(develop at 9fa7807, macOS arm64, R 4.5.2)

The @param method docs list torus, and the function already has torus branches (L115 and L152), but torus is missing from the supported-methods check:

https://github.com/PecanProject/pecan/blob/9fa7807a4908fd4aa048d171054088b33fa50f15/modules/uncertainty/R/ensemble.R#L81-L85

The fix is adding "torus" to that vector, plus a test that torus returns the right number of samples and an unknown method still errors. Since #4229 edits the same function's signature, I'd open the PR after that one merges to avoid a conflict.

I didn't find an existing issue. (The same docstring also says "Default is uniform" while the default argument is "random", which falls through to uniform; I've left that out of this one.)

Dominant language
R
Stars
246
Forks
322
Avg merge
5d 9h
Merged PRs (30d)
21

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from PecanProject/pecan

All issues in PecanProject/pecan

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.