cbsyst icon indicating copy to clipboard operation
cbsyst copied to clipboard

Vectorising

Open oscarbranson opened this issue 8 years ago • 3 comments

A lot of the solvers in carbon_fns.py would be sped up by vectorising. At the moment, most serially apply zero_finder functions to solve for H.

The following functions in cbsyst/carbon_fns.py need to be vecotrised:

  • [ ] CO2SYS-style zero finder for HCO3_TA (case 11)
  • [ ] CO2SYS-style zero finder for CO3_TA (case 13)
  • [ ] Vectorise CO2_HCO3 (case 2)
  • [ ] Vectorise CO2_CO3 (case 3)
  • [ ] Vectorise CO2_DIC (case 5)
  • [ ] Vectorise HCO3_CO3 (case 10)
  • [ ] Vectorise HCO3_DIC (case 12)
  • [ ] Vectorise CO3_DIC (case 14)

oscarbranson avatar Jun 28 '17 03:06 oscarbranson

Might this be up your street, @pearseb?

oscarbranson avatar Jun 28 '17 04:06 oscarbranson

Yep I think I could apply myself to some vectorising. I'm finishing up some edits currently but will have a look at those scripts soon. I'll let you know when I get into it. I'm sure I'll have a few questions. Thanks for including me Oscar. Pearse

pearseb avatar Jun 28 '17 06:06 pearseb

Superb. No particular hurry. It works fine at the moment, just isn't very fast.

For reference, the CO2_TA and and TA_DIC functions are currently vectorised using pretty much identical code to matlab CO2SYS.

I was thinking the same approach for the other functions, but haven't had the brain space to work out the gradient functions yet... Hopefully this'll be trivial for you?!

oscarbranson avatar Jun 28 '17 07:06 oscarbranson