Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add export_grid_model() simplified export function #861

Open
7 of 8 tasks
mferrera opened this issue Oct 29, 2024 · 0 comments
Open
7 of 8 tasks

Add export_grid_model() simplified export function #861

mferrera opened this issue Oct 29, 2024 · 0 comments

Comments

@mferrera
Copy link
Collaborator

mferrera commented Oct 29, 2024

Currently grids and their properties are exported from RMS in the following way:

  1. Define a list of properties to export
  2. Export the grid
  3. For every grid property in the defined list
    i. Export the grid property with parent/geometry = the grid

Simplification

We can define a function that encapsulates this functionality and accepts strings indicating the properties to export with the grid.

def export_static_grid_model(
    project: Any,
    grid_name: str,

    porosity: str | None,
    permeabilities: list[str] | None,
    zone: str | None,
    facies: list[str| None,
    regions: list[str] | None,
    water_saturation: str | None,
    gas_saturation: str | None,
    oil_saturation: str | None,
    co2_saturation: str | None,
    net_to_gross: str | None,

    # grid_model_type: GridModelType (static, dynamic, ...) ?
    
    config_path: str | Path = "../../fmuconfig/output/global_variables.yml",
    classification: str | None = None,
) -> ExportResult:
    # @field_validator("porosity", mode="before")
    # @classmethod
    # def _validate_between_zero_and_one(cls, value: Optional[str]) -> Optional[str]:
    # """Validate the property value is in [0, 1]"""
    #     if value is None:
    #         return None
    #     prop = xtgeo.gridproperty_from_roxar(PRJ, GNAME, value)  # How to do this?
    #     if not (0 <= prop.value <= 1):
    #         raise ValueError("Porosity must be between 0 and 1, inclusive.")
    #     return value

     # Validate saturation sums to 1

This will allow us to:

  • Ensure properties are linked to a grid/geometry
  • Allow for consumers to more easily filter properties based upon metadata (i.e., knowing ahead of time which property is the porosity/a permeability/etc of a grid so it doesn't need to be selected by the user)
  • Allow validation of these properties when applicable to enhance data quality (i.e. porosity is always 0-1, permeability always > 0, etc)

Unanswered questions

  • Should we allow exporting a grid without properties?
    • A: Sure
  • How do we allow saturations to be given?
    • A: Give each supported saturation as a separate option
  • Do we allow arbitrary properties not described in the ExportGridModelProperties class?
    • A: Not yet, maybe not ever. Prefer to received feedback and support it officially
  • Is ExportGridModelProperties the best way to take properties?
    • Decided not to use
  • Do we need the grid geometry to do the validations we want?
    • It will be given using only function call
  • How do we evaluate which properties can be accepted/exported?
    • Based upon feedback, case-by-case
  • Should all properties be optional? Should some be mandatory?
    • No to mandatory
  • How do we attach which type of grid model this is?
    • How do we define the types of grid models? Can they be standardized?

Usage mitigations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant