Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • CSTools CSTools
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 28
    • Issues 28
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 2
    • Merge requests 2
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • External
  • CSToolsCSTools
  • Issues
  • #130
Closed
Open
Issue created Sep 13, 2023 by aho@ahoMaintainer

Calibration() doesn't show warnings in atomic function when multiple cores are used

Hi @erifarov,

Summary

In CST_Calibration.R, the inner function .cal() that is used by Apply() has warning. But the warning cannot be printed if ncores > 1 & the data is bigger than the essential dimensions*. I guess it is due to the parallel packages used by Apply(), but I need to check more. But if it is not easy to improve on Apply() side, it would be better to see if there is another way to return this warning by Calibration().

*The "essential dimension" means the minimal dimensions required. In Calibration(), it is [sdate, member].
NOTE1: warning() cannot be returned, but print() can.
NOTE2: The mechanism in the functions to print the warning only once (using warning_shown) works as expected when ncores = 1; but when multiple cores are used, the message is returned by each core so it is printed multiple times still. I realized this by adding print() in .cal().

Example

#NOTE: If remove time = 2, the warning shows always
exp <- array(1:24, dim = c(time = 2, member = 4, sdate = 3))
obs <- array(1:6, dim = c(time = 2, member = 1, sdate = 3))
res <- Calibration(exp, obs, cal.method = "mse_min")

Warning message:
In (new("functionWithTrace", .Data = function (exp, obs, exp_cor = NULL,  :
  Some forecast data could not be corrected due to data lack and is replaced with NA values.

res <- Calibration(exp, obs, cal.method = "mse_min", ncores = 2)
# Nothing returns

Best,
An-Chi

Assignee
Assign to
Time tracking