Skip to content

Commit

Permalink
Format with latest ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
mferrera committed Mar 1, 2024
1 parent 7950987 commit 891dd48
Show file tree
Hide file tree
Showing 22 changed files with 37 additions and 21 deletions.
26 changes: 13 additions & 13 deletions src/subscript/casegen_upcars/model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
""" Engine part of casegen_upcars """
"""Engine part of casegen_upcars"""

import datetime
import io
Expand Down Expand Up @@ -468,9 +468,9 @@ def _build_grid(self):
if self._a * self._b * self._c == 0.0:
self.dict_info["ModelDescription"] = f"Slab with tilting angle {self._tilt}"
else:
self.dict_info[
"ModelDescription"
] = "Dome structure with radius (x, y, z) : {:.2f}m, {:.2f}m, {:.2f}m"
self.dict_info["ModelDescription"] = (
"Dome structure with radius (x, y, z) : {:.2f}m, {:.2f}m, {:.2f}m"
)

x_mid = self._centroid_x * self._lx
y_mid = self._centroid_y * self._ly
Expand All @@ -492,13 +492,13 @@ def _build_grid(self):
cell_dz = np.empty((self._total_nx, self._total_ny, self._total_nz))

for idx in self._fracture_i:
cell_dx[
idx : idx + self._fracture_cell_count, :, :
] = self._fracture_thickness
cell_dx[idx : idx + self._fracture_cell_count, :, :] = (
self._fracture_thickness
)
for idx in self._fracture_j:
cell_dy[
:, idx : idx + self._fracture_cell_count, :
] = self._fracture_thickness
cell_dy[:, idx : idx + self._fracture_cell_count, :] = (
self._fracture_thickness
)
for idx in range(self._nz):
cell_dz[:, :, idx] = self._layer_dz[idx]
self._cell_volume = cell_dx * cell_dy * cell_dz
Expand Down Expand Up @@ -771,9 +771,9 @@ def export_grdecl(self, filename):
)

for idx in range(1, self._total_nz):
zcorn[
n_surface_points * 2 * idx : n_surface_points * (2 * idx + 1)
] = zcorn[n_surface_points * (2 * idx - 1) : n_surface_points * (2 * idx)]
zcorn[n_surface_points * 2 * idx : n_surface_points * (2 * idx + 1)] = (
zcorn[n_surface_points * (2 * idx - 1) : n_surface_points * (2 * idx)]
)
zcorn[
n_surface_points * (2 * idx + 1) : 2 * n_surface_points * (idx + 1)
] = (
Expand Down
3 changes: 2 additions & 1 deletion src/subscript/casegen_upcars/udf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Supporting functions/class for casegen_upcars """
"""Supporting functions/class for casegen_upcars"""

import numpy as np
from scipy.stats import uniform

Expand Down
2 changes: 1 addition & 1 deletion src/subscript/casegen_upcars/udf_arg_parser.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python
""" Argument parser for casegen_upcars """
"""Argument parser for casegen_upcars"""

from subscript import __version__

Expand Down
7 changes: 4 additions & 3 deletions src/subscript/check_swatinit/check_swatinit.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""SWATINIT qc tool"""

import argparse
import sys
from typing import Any, Dict, List
Expand Down Expand Up @@ -353,9 +354,9 @@ def qc_flag(qc_frame: pd.DataFrame) -> pd.DataFrame:
# Below a nonzero capillary entry pressure but above the contact,
# SWAT and SWATINIT should be 1.
if "PPCW" in qc_frame:
qc_col[
np.isclose(qc_frame["SWAT"], 1) & np.isclose(qc_frame["PPCW"], 0)
] = __PC_SCALED__
qc_col[np.isclose(qc_frame["SWAT"], 1) & np.isclose(qc_frame["PPCW"], 0)] = (
__PC_SCALED__
)

# PC is scaled (including "scaling" using PC_SCALING=1), but
# SWAT!=SWATINIT, this must be due to EQUIL item 9 being nonzero.
Expand Down
1 change: 1 addition & 0 deletions src/subscript/csv_stack/csv_stack.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Tool to stack/pivot CSV files, exposed as command line client,
ERT workflow and ERT forward model"""

import argparse
import logging
import re
Expand Down
3 changes: 2 additions & 1 deletion src/subscript/fmu_copy_revision/fmu_copy_revision.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
""" The fmu_copy_revision script.
"""The fmu_copy_revision script.
Purpose is fast and secure copy for fmu revisions using rsync as engine,
with xargs to speed up multithreading.
"""

import argparse
import getpass
import shutil
Expand Down
1 change: 1 addition & 0 deletions src/subscript/fmuobs/fmuobs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""fmuobs is a converter tool for observation files used in assisted
history matching"""

import argparse
import logging
import os
Expand Down
1 change: 1 addition & 0 deletions src/subscript/fmuobs/parsers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Module for parsing and writing ERT observation files into/from an
equivalent DataFrame representation"""

import datetime
import re
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions src/subscript/presentvalue/presentvalue.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""NPV calculation of oil and gas production income"""

import argparse
import datetime
import logging
Expand Down
1 change: 1 addition & 0 deletions src/subscript/prtvol2csv/prtvol2csv.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Extract volumes from Eclipse PRT files, augmenting with region and zone
metadata"""

import argparse
import logging
import re
Expand Down
1 change: 1 addition & 0 deletions src/subscript/restartthinner/restartthinner.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Restart file (UNRST) thinner, command line application"""

import argparse
import datetime
import glob
Expand Down
1 change: 1 addition & 0 deletions src/subscript/rmsecl_volumetrics/rmsecl_volumetrics.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Script for comparing RMS vs Eclipse volumetrics, provided
a mapping between Region and Zones in RMS, to FIPNUMs in Eclipse"""

import argparse
import logging
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions src/subscript/runrms/runrms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
See also the assosiated runrms.yml YAML file paths in SETUP variable.
"""

import argparse
import datetime
import getpass
Expand Down
1 change: 0 additions & 1 deletion src/subscript/sector2fluxnum/datafile_obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class Datafile:

"""
Class containing parsers and write routines for
DATA files and local executions of DATA files
Expand Down
1 change: 0 additions & 1 deletion src/subscript/sector2fluxnum/flux_obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@


class Fluxnum:

"""Superclass"""

def __init__(self, grid):
Expand Down
1 change: 1 addition & 0 deletions tests/test_casegen_upcars.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test that casegen_upcars is installed and launched with given demo cases"""

import os
import shutil
import subprocess
Expand Down
1 change: 1 addition & 0 deletions tests/test_csv_merge.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test csv_merge"""

import os
import subprocess
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions tests/test_csv_stack.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test module for csv_stack"""

import os
import re
import subprocess
Expand Down
1 change: 1 addition & 0 deletions tests/test_fmuobs_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
They all parse and transform the data into the internal dataframe
representation."""

import datetime
import os
from pathlib import Path
Expand Down
1 change: 1 addition & 0 deletions tests/test_fmuobs_writers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Test the fmuobs writers, these convert from the internal dataframe
representation to various other formats, csv, ert-observations format,
resinsight and yaml (webviz)"""

import datetime

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions tests/test_prtvol2csv.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test prtvol2csv, both as library and as command line"""

import os
import subprocess
import sys
Expand Down
1 change: 1 addition & 0 deletions tests/test_runrms.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test runrms script, but manual interactive testing is also needed."""

import os
import shutil
import stat
Expand Down

0 comments on commit 891dd48

Please sign in to comment.