Skip to content

Commit

Permalink
Merge c3696e3 into 4f21bb9
Browse files Browse the repository at this point in the history
  • Loading branch information
RDWimmers committed Jul 3, 2023
2 parents 4f21bb9 + c3696e3 commit 923b943
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions src/pygef/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

from dataclasses import dataclass
from enum import Enum
from typing import List
from typing import List, overload

import polars as pl
from numpy.typing import NDArray


@dataclass
Expand Down Expand Up @@ -52,7 +53,19 @@ def kpa_to_mpa(df: pl.DataFrame, columns: List[str]) -> pl.DataFrame:
return assign_multiple_columns(df, columns, df[columns] * 10**-3)


def offset_to_depth(ref: float | None, offset: float | None) -> float | None:
@overload
def offset_to_depth(ref: float, offset: float) -> float:
...


@overload
def offset_to_depth(ref: NDArray, offset: float) -> NDArray:
...


def offset_to_depth(
ref: float | None | NDArray, offset: float | None
) -> float | None | NDArray:
"""
Transform depth with respect to reference level to depth
Expand All @@ -65,7 +78,19 @@ def offset_to_depth(ref: float | None, offset: float | None) -> float | None:
return -(ref - offset)


@overload
def depth_to_offset(depth: float | None, offset: float | None) -> float | None:
...


@overload
def depth_to_offset(depth: NDArray, offset: float) -> NDArray:
...


def depth_to_offset(
depth: float | None | NDArray, offset: float | None
) -> float | None | NDArray:
"""
Transform depth to depth with respect to reference level
Expand Down

0 comments on commit 923b943

Please sign in to comment.