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

Upgrade code: change all uses from deprecated OGGM code #51

Open
bearecinos opened this issue Apr 1, 2024 · 2 comments
Open

Upgrade code: change all uses from deprecated OGGM code #51

bearecinos opened this issue Apr 1, 2024 · 2 comments

Comments

@bearecinos
Copy link
Member

This issue is a bit more general and messy but can be re-draft! (sorry 😞 I don't have in-deep knowledge of all the new changes in oggm or understanding of the core structure of the mass-balance sandbox) so lets keep discussing how we can upgrade this. The text below is my best summary of the issue...

  • Many pytests, docs and notebooks make use of the default oggm mass balance which now is TIMonthly not PastMassBalance. Changing this is where it got out of hand for me and I stopped as I need to understand what is the most urgent tasks/scripts/functions that need changing.

  • There are also calls to functions that are not there anymore like oggm.core.climate.historical_climate_qc

If I fix some of the issues that I posted before (variable names, datetime, append) I'm down to this upgrade with only 3 test failing, which I think is down to the structural changes that happened in OGGM.

FAILED MBsandbox/tests/test_mb_modules_oneflowline.py::Test_directobs_hydro10::test_TIModel_monthly - AttributeError: module 'oggm.core.massbalance' has no attribute 'PastMassBalance'
FAILED MBsandbox/tests/test_mb_modules_oneflowline.py::Test_directobs_hydro10::test_loop - oggm.exceptions.InvalidParamsError: there is no gradient available in chosen climatefile, try instead e.g. ERA5_dai
ly or ERA5dr e.g.oggm.shop.ecmwf.process_ecmwf_data(gd, dataset="ERA5dr")
FAILED MBsandbox/tests/test_mb_modules_oneflowline.py::Test_directobs_hydro10::test_pseudo_daily_N_temp_std_const_from_hist - oggm.exceptions.InvalidParamsError: there is no gradient available in chosen cli
matefile, try instead e.g. ERA5_daily or ERA5dr e.g.oggm.shop.ecmwf.process_ecmwf_data(gd, dataset="ERA5dr")
============================================================= 3 failed, 32 passed, 21 skipped, 11 deselected, 5298 warnings in 276.29s (0:04:36) =============================================================
  • In the tutorials e.g. how_to_use.ipynb an extra steps needs to be added to come up with mb_calib.json which is now required to run TIMonthly. I started with the changes in the notebooks here but quickly realize that maybe I'm missing something. This cell is meant to output a same time series which now looks like this (probably down to how I calibrated things with geodetic SMB vs how it was done with WGMS data??):
plt.plot(mbdf.index, mb_specific)
plt.plot(mbdf.index, mb_specific_default)

plt.xlabel('year')
plt.ylabel('SMB (kg m−2^{-2} yr−1^{-1})');

image

@fmaussion
Copy link
Member

@bearecinos I think the best way forward would be to stop working on the sandbox but open a PR to OGGM directly. We want to start maintaining more complex MB models withing OGGM for now, and the MB sandbox could be updated but may not. Happy to discuss offline if you want.

@bearecinos
Copy link
Member Author

Sure, should I close all the issues I opened in the MB sandbox ? I can re post this in the OGGM/oggm repo ? Probably needs a more detailed issue with a list of the functions that you are planning to bring into oggm ... Anyway maybe is better to leave this for tomorrow ... Happy to discuss further at the hydro meeting tomorrow..

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

No branches or pull requests

2 participants