Question Python libraries for Buhlmann

Please register or login

Welcome to ScubaBoard, the world's largest scuba diving community. Registration is not required to read the forums, but we encourage you to join. Joining has its benefits and enables you to participate in the discussions.

Benefits of registering include

  • Ability to post and comment on topics and discussions.
  • A Free photo gallery to share your dive photos with the world.
  • You can make this box go away

Joining is quick and easy. Log in or Register now!

LFMarm

Contributor
Messages
1,032
Reaction score
687
Location
Colorado
# of dives
500 - 999
Hi, has anyone found reliable libraries to calculate deco schedules? I plan dives with Subsurface but it doesn’t seem to have APIs to call from Python.
I would like to be able to calculate simple schedules, GF99, SurfGF.

Many thanks.
 
Hi, has anyone found reliable libraries to calculate deco schedules? I plan dives with Subsurface but it doesn’t seem to have APIs to call from Python.
I would like to be able to calculate simple schedules, GF99, SurfGF.

Many thanks.
I went looking around for this a long time ago after a question was posed by some friends after a dive to Hendley's Castle "what deco penalty would have occurred if I would have stayed 5 more minutes?". After some thorough research, I landed on this repo called 'DecoTengu', which is an implementation in python (and some Rust I believe) of Buhlmann ZH-L16-GF. I believe it was a translation from Erik Baker's repo in Fortran, but not 100% sure (it was before my time). I remember I was able to answer my question through writing a function that declared gases and then looped through calculating a bunch of dives by increasing time and depth and grabbing total deco time. I got close to an answer and didn't really venture further. I found a fork of it on Github. The original source doesn't appear to be hosted there any longer. Wish I had more to provide here. Let us know what you find out!
 
You could probably grab deco.c from subsurface and use cpython to wrap it or just refactor it into python.
 
Did you work through all these indents manually?

Edit: Oh I see something glitched out
 
Yeah, SB doesn't like the code. If you know Python, working out those indents will take less than 3 mins.
I remember a similar inline quote bug from when I used slack — I always preferred code blocks; but I digress
 
... 'DecoTengu' ...

I found DecoTengu to be way too "pythonic" for normal people so I put together a few dicts and functions. Look for "DIY ZHL" on github and feel free to reuse what you like.

I was playing with notebooks at the time so the actual deco stuff was not my main focus, that's my excuse for never taking it anywhere.
 

Back
Top Bottom