Skip to content

Commit

Permalink
FIX: Remove deprecated verbosity from examples
Browse files Browse the repository at this point in the history
The example scripts generated warnings about passing the deprecated
`verbosity` keyword to fmu-dataio, and the docs also referenced it. The
scripts were modified to set the logging level to `WARNING` which seems
a reasonable example for users to follow as INFO may be more than they
care about.
  • Loading branch information
mferrera committed Jan 24, 2024
1 parent 382393b commit 5fd777e
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ venv.bak/

# setuptools_scm version
src/fmu/dataio/version.py
# aggregated examples directory
examples/s/d/nn/xcase/iter-0/

# mypy
.dmypy.json
Expand Down
3 changes: 1 addition & 2 deletions docs/preparations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,10 @@ from the Drogon workflow:
-- --sumo: If passed, case will be registered on Sumo. Use this is intention to upload data.
-- --sumo_env (str): Specify Sumo environment. Default: prod
-- --global_variables_path (str): Path to global variables relative to CONFIG path
-- --verbosity (str): Python logging level to use
--
-- NOTE! If using optional arguments, note that the "--" annotation will be interpreted
-- as comments by ERT if not wrapped in quotes. This is the syntax to use:
-- (existing arguments) "--sumo" "--sumo_env" dev "--verbosity" DEBUG
-- (existing arguments) "--sumo" "--sumo_env" dev
.. note::
Note that there are references to Sumo in the script above. You don't have to worry
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
"""Export 3D griddata with properties."""

import logging
import pathlib

import fmu.dataio as dataio
import xtgeo
from fmu.config import utilities as ut

logger = logging.getLogger(__name__)
logger.setLevel(logging.WARNING)

CFG = ut.yaml_load("../../fmuconfig/output/global_variables.yml")

FOLDER = pathlib.Path("../output/grids")
GFILE = "gg"
GNAME = "geogrid"
PROPS_SEISMIC = ["phit", "sw"]
PROPS_OTHER = ["klogh", "facies"]
VERBOSITY = "WARNING"


def export_geogrid_geometry():
Expand All @@ -30,7 +32,6 @@ def export_geogrid_geometry():
is_prediction=True,
is_observation=False,
tagname="",
verbosity=VERBOSITY,
workflow="rms structural model",
)

Expand All @@ -57,7 +58,6 @@ def export_geogrid_parameters():
timedata=None,
is_prediction=True,
is_observation=False,
verbosity=VERBOSITY,
workflow="rms property model",
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@
For the file case, CSV files are read from disk. The dataio function is the same.
"""
import logging
import pathlib

import fmu.dataio
import pandas as pd
from fmu.config import utilities as ut

logger = logging.getLogger(__name__)
logger.setLevel(logging.WARNING)

CFG = ut.yaml_load("../../fmuconfig/output/global_variables.yml")

IN_ROXAR = False
Expand All @@ -25,7 +29,6 @@


TAGNAME = "volumes"
VERBOSITY = "WARNING"

# renaming columns from RMS to FMU standard
RENAMING = {
Expand Down Expand Up @@ -86,7 +89,6 @@ def export_dataio(df, gridname):
is_prediction=True,
is_observation=False,
tagname=TAGNAME,
verbosity=VERBOSITY,
workflow="Volume calculation",
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
The input maps is poro_average.grid
"""
import logging
from pathlib import Path

import fmu.dataio as dataio
import xtgeo
from fmu.config import utilities as ut

logger = logging.getLogger(__name__)
logger.setLevel(logging.WARNING)

CFG = ut.yaml_load("../../fmuconfig/output/global_variables.yml")

FILES = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
"""Export faultpolygons via dataio with metadata."""
import logging
from pathlib import Path

import fmu.dataio as dataio
import xtgeo
from fmu.config import utilities as utils

logger = logging.getLogger(__name__)
logger.setLevel(logging.WARNING)

CFG = utils.yaml_load("../../fmuconfig/output/global_variables.yml")

HORISONNAMES = CFG["rms"]["horizons"]["TOP_RES"]
Expand All @@ -28,7 +32,6 @@ def export_faultlines():
is_prediction=True,
is_observation=False,
tagname="faultlines",
verbosity="INFO",
workflow="rms structural model",
)

Expand All @@ -46,7 +49,7 @@ def export_faultlines():
# xtgeo column names as-is while "csv" will force column names to "X Y Z ID"
for fmt in ["csv|xtgeo", "irap_ascii"]:
ed.polygons_fformat = fmt
ed.export(poly, verbosity="WARNING")
ed.export(poly)


if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@
e.g. Therys).
"""
import logging
from pathlib import Path

import fmu.dataio as dataio
import xtgeo
from fmu.config import utilities as ut

logger = logging.getLogger(__name__)
logger.setLevel(logging.WARNING)

CFG = ut.yaml_load("../../fmuconfig/output/global_variables.yml")

# property attributes, the key is "pattern" and the value is generic name to be used:
Expand Down Expand Up @@ -64,7 +68,6 @@ def main():
is_prediction=True,
is_observation=False,
tagname="average_" + attribute,
verbosity="INFO",
workflow="rms property model",
)
fname = ed.export(surf)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
The input maps is poro_average.grid
"""
import logging
from pathlib import Path

import fmu.dataio as dataio
import xtgeo
from fmu.config import utilities as ut

logger = logging.getLogger(__name__)
logger.setLevel(logging.WARNING)

CFG = ut.yaml_load("../../fmuconfig/output/global_variables.yml")

FILES = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
The input maps is poro_average.grid
"""
import logging
from pathlib import Path

import fmu.dataio as dataio
import xtgeo
from fmu.config import utilities as ut

logger = logging.getLogger(__name__)
logger.setLevel(logging.WARNING)

CFG = ut.yaml_load("../../fmuconfig/output/global_variables.yml")

FILES = {
Expand Down

0 comments on commit 5fd777e

Please sign in to comment.