oscarbranson / cbsyst

Python module for calculating carbon and boron solution chemistry.
MIT License
29 stars 17 forks source link

Vectorising #11

Open oscarbranson opened 7 years ago

oscarbranson commented 7 years ago

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:

oscarbranson commented 7 years ago

Might this be up your street, @pearseb?

pearseb commented 7 years ago

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

oscarbranson commented 7 years ago

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?!