Skip to content

Commit

Permalink
Fixed typing/mypy issues (#907)
Browse files Browse the repository at this point in the history
  • Loading branch information
sigurdp authored Jan 5, 2022
1 parent 32b7352 commit 011d374
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def interpolate_backfill(
# Finds the leftmost valid insertion indices for the values x in xp
indices = np.searchsorted(xp, x, side="left")

padded_y = np.concatenate((yp, [yright]))
padded_y = np.concatenate((yp, np.array([yright])))

ret_arr = padded_y[indices]

Expand Down
6 changes: 3 additions & 3 deletions webviz_subsurface/_utils/simulation_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ def calc_series_statistics(
refaxis is used if another column than DATE should be used to groupby.
"""
# Invert p10 and p90 due to oil industry convention.
def p10(x: List[float]) -> List[float]:
def p10(x: List[float]) -> np.floating:
return np.nanpercentile(x, q=90)

def p90(x: List[float]) -> List[float]:
def p90(x: List[float]) -> np.floating:
return np.nanpercentile(x, q=10)

def p50(x: List[float]) -> List[float]:
def p50(x: List[float]) -> np.floating:
return np.nanpercentile(x, q=50)

# Calculate statistics, ignoring NaNs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,10 @@ def calc_series_statistics(
refaxis is used if another column than DATE should be used to groupby.
"""
# Invert p10 and p90 due to oil industry convention.
def p10(x: List[float]) -> List[float]:
def p10(x: List[float]) -> np.floating:
return np.nanpercentile(x, q=90)

def p90(x: List[float]) -> List[float]:
def p90(x: List[float]) -> np.floating:
return np.nanpercentile(x, q=10)

# Calculate statistics, ignoring NaNs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ def create_vectors_statistics_df(vectors_df: pd.DataFrame) -> pd.DataFrame:
)

# Invert p10 and p90 due to oil industry convention.
def p10(x: List[float]) -> List[float]:
def p10(x: List[float]) -> np.floating:
return np.nanpercentile(x, q=90)

def p90(x: List[float]) -> List[float]:
def p90(x: List[float]) -> np.floating:
return np.nanpercentile(x, q=10)

def p50(x: List[float]) -> List[float]:
def p50(x: List[float]) -> np.floating:
return np.nanpercentile(x, q=50)

statistics_df: pd.DataFrame = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def create_comparison_df(

def compute_highlighted_col(
df: pd.DataFrame, response: str, value1: str, selections: dict
) -> list:
) -> np.ndarray:
highlight_mask = (df[response][value1] > selections["Ignore <"]) & (
df[response]["diff (%)"].abs() > selections["Accept value"]
)
Expand Down

0 comments on commit 011d374

Please sign in to comment.