Skip to content

Commit

Permalink
Update ruff format (#434)
Browse files Browse the repository at this point in the history
  • Loading branch information
janbjorge authored Mar 3, 2024
1 parent 7090e6f commit f79c7e5
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 23 deletions.
1 change: 1 addition & 0 deletions docs/make_plots.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Generates plots for usage in documentation"""

from pathlib import Path

import matplotlib.pyplot as plt
Expand Down
23 changes: 12 additions & 11 deletions src/pyscal/constants.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
"""Constants used for pyscal modules:
* ``SWINTEGERS``: Number of different Sw values within [0,1] we allow
This is used to create integer indices of Sw, since Floating Point
indices are flaky in Pandas (and in general on computers)
* ``SWINTEGERS``: Number of different Sw values within [0,1] we allow
This is used to create integer indices of Sw, since Floating Point
indices are flaky in Pandas (and in general on computers)
* ``EPSILON``: Used as "a small number" for ensuring no floating point
comparisons/errors pop up. You cannot have the h parameter less
than this when generating relperm tables
* ``EPSILON``: Used as "a small number" for ensuring no floating point
comparisons/errors pop up. You cannot have the h parameter less
than this when generating relperm tables
* ``MAX_EXPONENT_KR``: Maximal number for exponents in relperm parameterizations.
Used to avoid numerical instabilities. It could probably be much
higher than the chosen number in most circumstances, but such high
numbers should not be relevant for relative permeability
* ``MAX_EXPONENT_KR``: Maximal number for exponents in relperm parameterizations.
Used to avoid numerical instabilities. It could probably be much
higher than the chosen number in most circumstances, but such high
numbers should not be relevant for relative permeability
* ``MAX_EXPONENT_PC``: Maximal number for exponents in cap pressure parameterizations.
* ``MAX_EXPONENT_PC``: Maximal number for exponents in cap pressure parameterizations.
"""

SWINTEGERS: int = 10000

EPSILON: float = 1e-08
Expand Down
6 changes: 3 additions & 3 deletions src/pyscal/gasoil.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,9 @@ def set_endpoints_linearpart_krg(
self.table["SG"] >= (1 - (self.sorg + self.swl + epsilon)), "KRG"
] = tmp.loc[tmp["SG"] >= (1 - (self.sorg + self.swl + epsilon)), "KRG"]
else:
self.table.loc[
self.table["SG"] > (1 - (self.swl + epsilon)), "KRG"
] = krgend
self.table.loc[self.table["SG"] > (1 - (self.swl + epsilon)), "KRG"] = (
krgend
)
if krgmax and krgmax < 1.0 and self.sorg > 0:
# Only warn if something else than default is in use
logger.warning("krgmax ignored when not anchoring to sorg")
Expand Down
16 changes: 8 additions & 8 deletions src/pyscal/wateroil.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,10 @@ def add_fromtable(
dframe[linearpart][swcolname].astype(float),
dframe[linearpart][krwcolname].astype(float),
)
self.table.loc[
self.table["SW"] >= 1 - sorw, "KRW"
] = linearinterpolator(
self.table.loc[self.table["SW"] >= 1 - sorw, "SW"]
self.table.loc[self.table["SW"] >= 1 - sorw, "KRW"] = (
linearinterpolator(
self.table.loc[self.table["SW"] >= 1 - sorw, "SW"]
)
)
self.table["KRW"] = self.table["KRW"].clip(lower=0.0, upper=1.0)
self.sorw = sorw
Expand Down Expand Up @@ -393,10 +393,10 @@ def add_fromtable(
dframe.loc[linearpart, swcolname].astype(float),
dframe.loc[linearpart, krowcolname].astype(float),
)
self.table.loc[
self.table["SW"] >= 1 - socr, "KROW"
] = linearinterpolator(
self.table.loc[self.table["SW"] >= 1 - socr, "SW"]
self.table.loc[self.table["SW"] >= 1 - socr, "KROW"] = (
linearinterpolator(
self.table.loc[self.table["SW"] >= 1 - socr, "SW"]
)
)
self.table["KROW"] = self.table["KROW"].clip(lower=0.0, upper=1.0)
self.socr = socr
Expand Down
1 change: 0 additions & 1 deletion src/pyscal/wateroilgas.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@


class WaterOilGas:

"""A representation of three-phase properties for oil-water-gas
Use one object for each satnum.
Expand Down
1 change: 1 addition & 0 deletions tests/benchme.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Example code for benchmarking of the "fast" feature"""

import timeit

from pyscal import WaterOilGas
Expand Down
1 change: 1 addition & 0 deletions tests/test_factory.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test the PyscalFactory module"""

import os
from pathlib import Path

Expand Down
1 change: 1 addition & 0 deletions tests/test_gasoil.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test module for GasOil objects"""

import io
import sys

Expand Down
1 change: 1 addition & 0 deletions tests/test_utils_capillarypressure.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test module for capillary pressure support code in pyscal"""

import math

import hypothesis.strategies as st
Expand Down
1 change: 1 addition & 0 deletions tests/test_utils_monotonicity.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test module for monotonicity support functions in pyscal"""

import os

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions tests/test_wateroil.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test module for the WaterOil object"""

import io
import sys

Expand Down

0 comments on commit f79c7e5

Please sign in to comment.