Skip to content

Commit

Permalink
Solve the inversion calving problem differently (#794)
Browse files Browse the repository at this point in the history
* WIP: refactor inversion internals

* Add find inversion calving

* Add what's new
  • Loading branch information
fmaussion committed Jun 12, 2019
1 parent f545b36 commit 1b59178
Show file tree
Hide file tree
Showing 9 changed files with 457 additions and 86 deletions.
9 changes: 9 additions & 0 deletions docs/whats-new.rst
Expand Up @@ -16,6 +16,10 @@ Breaking changes
affect the majority of users (which used ``run_until_and_store``), but
the results or ``run_until`` can be affected (:pull:`726`).
By `Matthias Dusch <https://github.com/matthiasdusch>`_.
- ``find_inversion_calving`` has been renamed to
``find_inversion_calving_loop`` and will probably be deprecated soon
(:pull:`794`).
By `Fabien Maussion <https://github.com/fmaussion>`_.

Enhancements
~~~~~~~~~~~~
Expand All @@ -38,6 +42,11 @@ Enhancements
to the code base as it increases the number of choices available to users
and demonstrates the modularity of the model.
By `Moritz Oberrauch <https://github.com/oberrauch>`_.
- Changed the way the calving flux is computed during the ice thickness
inversion. This no longer relies on an iteration over mu*, but solves
for `h` instead. The new function is likely to replace the "old"
calving loop(:pull:`794`).
By `Fabien Maussion <https://github.com/fmaussion>`_.


Bug fixes
Expand Down
2 changes: 1 addition & 1 deletion oggm/cfg.py
Expand Up @@ -204,7 +204,7 @@ def __setitem__(self, key, value):
BASENAMES['model_diagnostics'] = ('model_diagnostics.nc', _doc)

_doc = ('A csv file containing the output of each iteration of the '
'find_inversion_calving task loop.')
'find_inversion_calving_loop task loop.')
BASENAMES['calving_loop'] = ('calving_loop.csv', _doc)

_doc = 'Calving output (deprecated).'
Expand Down
8 changes: 5 additions & 3 deletions oggm/core/climate.py
Expand Up @@ -1332,7 +1332,7 @@ def mu_star_calibration(gdir):


@entity_task(log, writes=['inversion_flowlines', 'linear_mb_params'])
def apparent_mb_from_linear_mb(gdir, mb_gradient=3.):
def apparent_mb_from_linear_mb(gdir, mb_gradient=3., ela_h=None):
"""Compute apparent mb from a linear mass-balance assumption (for testing).
This is for testing currently, but could be used as alternative method
Expand All @@ -1358,8 +1358,10 @@ def to_minimize(ela_h):
smb = mbmod.get_specific_mb(heights=h, widths=w)
return (smb - cmb)**2

ela_h = optimization.minimize(to_minimize, [0.], bounds=((0, 10000), ))
ela_h = ela_h['x'][0]
if ela_h is None:
ela_h = optimization.minimize(to_minimize, [0.], bounds=((0, 10000), ))
ela_h = ela_h['x'][0]

mbmod = LinearMassBalance(ela_h, grad=mb_gradient)

# For each flowline compute the apparent MB
Expand Down

0 comments on commit 1b59178

Please sign in to comment.