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

Allow fallbacks for failing entity tasks + fallback functions for 'local_t_star' and 'mu_star_calibration' #663

Merged
merged 5 commits into from Jan 14, 2019

Conversation

@matthiasdusch
Copy link
Member

@matthiasdusch matthiasdusch commented Jan 10, 2019

  • Tests added/passed
  • Fully documented
  • whats-new entry

This PR expands the execute_entity_task decorator with a fallback argument:
If a task fails and cfg.PARAMS['continue_on_error']==True a fallback-function will be executed If provided).

I suggest storing these fallback functions in utils/_fallbacks.py.

Hera also two first fallback functions for climate.local_t_star and climate.mu_star_calibration are included.
local_t_star writes a local_mustar.json to the glacier directory with information on tstar, mustar, and bias. If this task fails but cfg.PARAMS['continue_on_error']==True later tasks like 'mu_star_calibration' would read a possible preexisting json file (e.g. if the same glacier is run several times with different parameter settings).

@matthiasdusch matthiasdusch requested a review from fmaussion Jan 10, 2019
@fmaussion
Copy link
Member

@fmaussion fmaussion commented Jan 11, 2019

Looking good, thanks! I think it should be relatively easy to add a test for this, by setting unrealistic mu_start boundaries and let the run fail, then check that the files are nans. Could you add that?

@matthiasdusch
Copy link
Member Author

@matthiasdusch matthiasdusch commented Jan 14, 2019

After discussion with @fmaussion I removed utils/_fallbacks.py and added fallback_local_t_star directly to the climate module. It's a specific fallback function and not a general one.

I also got rid of fallback_mu_star_calibration: It is not really necessary as subsequent tasks will fail anyway, not matter if e.g. local_mustar['mu_star_allsame'] is NaN or does not exist et all. The important part is, that fallback_local_t_star writes and NaN-filled file to the GDir to avoid reuse of a previous run.

@matthiasdusch matthiasdusch merged commit d918505 into OGGM:master Jan 14, 2019
2 checks passed
@matthiasdusch matthiasdusch deleted the fallbacks branch Jan 14, 2019
sumnonpuella added a commit to sumnonpuella/oggm that referenced this issue Jul 12, 2019
…cal_t_star' and 'mu_star_calibration' (OGGM#663)

* 1st commit fallbacks

* splitted fallbacks into two functions

* renamend mu_star_calibration fallback

* added test, removed _fallbacks.py, removed fallback for mu_star_calibration

* added whats-new entry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants