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

run for gcm #273

Merged
merged 1 commit into from
Sep 22, 2017
Merged

run for gcm #273

merged 1 commit into from
Sep 22, 2017

Conversation

anoukvlug
Copy link
Collaborator

This is a pull request for the function run_from_gcm. The function is for a large part a copy of random_glacier_evolution function. The function can be used to run the glaciers with a the climate from for instance a CESM simulation.

I could later include a 'spin-up' option in the function, but I would first like to discuss the basis.

Copy link
Member

@fmaussion fmaussion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good! I have a few suggestions, otherwise this is good to go!

@@ -1653,3 +1653,63 @@ def iterative_initial_glacier_search(gdir, y0=None, init_bias=0., rtol=0.005,
_ = past_model.run_until_and_store(y1, path=path)
else:
past_model.to_netcdf(path)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add an empty line here (PEP8)

Parameters
----------
y0 : is the start year of the model run
y1 : is the end year of the model run
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't these parameters missing?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to avoid confusion with the y0 of the random run, I suggest to call them ys and ye (for start and end) instead.

kwargs.setdefault('glen_a', glen_a)

y0 = cfg.PARAMS['y0']
ye = cfg.PARAMS['y1']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aha I see. Can you also change the name of the params to ys, ye in the params.cfg file?

You can keep the idea of having them as keyword arguments in the function and use the params as default if the user didn't set them.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if I understand what you are suggesting. Do you mean that I add

ys = y0
ye = y1

to the cfg.params?

ye = cfg.PARAMS['y1']

mb_model = oggm.core.models.massbalance.\
PastMassBalanceModel(gdir, filename=filename, filesuffix=filesuffix)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use mbmods.PastMassBalanceModel instead

raise RuntimeError(
'%s: we did our best, the model is still '
'unstable.', gdir.rgi_id)
continue
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic slitghly changed in the most OGGM version. See https://github.com/OGGM/oggm/blob/master/oggm/core/models/flowline.py#L1602-L1605 and copy from there

@anoukvlug
Copy link
Collaborator Author

Thank you for the feedback!

I have also looked into the problem with the process_cesm_data function, but I didn't found a way to fix it yet. So that will probably need to wait a bit, as I will be out of office the next 2 weeks.
While looking for a solution I found the following pull request at xarray: pydata/xarray#1252. This might make handling data outside the 1677-2262 range much more easy in the future :)

@fmaussion
Copy link
Member

I have to leave on holidays now, so I'd suggest that either we merge this now or it waits until sept.

@anoukvlug
Copy link
Collaborator Author

If you have to leave right this moment I wish you a very nice holiday! The PR can wait till September.

@fmaussion
Copy link
Member

@anoukvlug do you have time to work on this in the next days? Otherwise I might merge this soon and make the changes myself later.

@anoukvlug
Copy link
Collaborator Author

No, I won't have time to work on this till the end of the ArcTrain Annual Meeting. So the earliest day I could start working on it will be the 25th of September.

@fmaussion
Copy link
Member

OK, no problem! I can start from here

@fmaussion fmaussion merged commit b0c355e into OGGM:master Sep 22, 2017
@fmaussion
Copy link
Member

Merging this now, will add my modifs and tests in a subsequent PR.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants