Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
WIP: Allow different mu's for different flowlines #539
This is a longstandig issue and not an easy one.
I think I've managed to find an elegant way to deal with the calibration: it uses recursive calls to the calibration to calibrate the flowline's mu* until the entire glacier is done.
This still needs more test, and the mass-balance models need an update, hence still a WIP
Hello @fmaussion! Thanks for updating the PR.
Comment last updated on October 20, 2018 at 13:23 Hours UTC
The recursive approach is indeed elegant.
I have one comment/question regarding readability and also performance:
But I might miss a point here or you have already some future adaptions in mind.
Thanks for looking into it!
Yes, there are some issues regarding performance here. Even the call to "minimize" is superfluous altogether since the problem is linear in mu anyway.
However, I would like to avoid doing premature optimizations, following the good old adage*. They add complexity (here, at least one "if" and probably more), and we don't know yet if it's so slow.
*: "The First Rule of Program Optimization: Don’t do it.
This is slowly taking shape - I have added a new class to the mass-balance models which handles multiple flowlines. I spent the entire day on it - not because it's a lot of code (it's not that much code at all :D) but because it was quite hard to find the right API. I hope this is the right one now...
Anyways, still need to make this new MB the default in the production runs and also need to get the cross-validation working.
OK, the last commit is bigger than I wish it would, BUT:
So, why changing the API again? Let me try to explain.
Now, the mu candidates are computed and used in the same task (which kept its name):
Since I was changing things already, I reconsidered the names of the other climate calibration tasks:
In my last commit, I renamed
Now that I think about it, I believe they could even be merged in one big single task, which does both the interpolation of t* and the mu* calibration in one step. I'll consider this option, more on this later...