OGGM / massbalance-sandbox

New generation of OGGM mass-balance models
BSD 3-Clause "New" or "Revised" License
6 stars 11 forks source link

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

Open bearecinos opened 5 months ago

bearecinos commented 5 months ago

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...

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) =============================================================

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


![image](https://github.com/OGGM/massbalance-sandbox/assets/16323300/b9df4199-b125-4361-b788-0346bc935efd)
fmaussion commented 5 months ago

@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 commented 5 months ago

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..