Skip to content

Instantly share code, notes, and snippets.

@eiriks
Last active December 15, 2020 10:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eiriks/108ee24df0fc75c2e1a47a8026bf8db8 to your computer and use it in GitHub Desktop.
Save eiriks/108ee24df0fc75c2e1a47a8026bf8db8 to your computer and use it in GitHub Desktop.
draught adjustment factor pseudocode
def draught_adjustment_factor(hour_slice_of_ais_ts):
# #
#
# Things we are missing:
# - DraughtRatio for ballasted ship (DRb)
# - DraughtRatio for loaded ship (DRl)
# - DraughtRatio for non-ballasted ship (DRnbs)
# Are these in IHS Fairplay?
# Cannot see where they come from, or how they are computed.
#
# #
#
# Things we can compute:
# - assign AIS time series ballast/loaded labels pr voyage
# - percentage of ballast voyages (Pb)
# - percentage of loaded voyages (Pl)
#
# Draught Adjustmen Factor - non ballast ships
DAFnbs = (
# Draught Ratio - non-ballasted ships
DRnbs ** (2/3)
)
# Draught Adjustment Factor - ballasted ship
DAFbs = (
# DRb = draught ratio for ballasted ships during ballast condition
# Pb = percentage of ballast voyage annually for ballasted ships
(DRb ** (2/3) * Pb)
+
# DRl = draught ratio for ballasted ships during loaded condition
# Pl = percentage of loaded voyage annually for ballasted ships
(DRl ** (2/3) * Pl)
)
if (hour_slice_of_ais_ts.ballast == True):
return DAFbs
else:
return DAFnbs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment