forked from equinor/webviz
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'equinor/main' into 2d-viewer-module
- Loading branch information
Showing
177 changed files
with
8,084 additions
and
3,660 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
backend_py/primary/primary/routers/flow_network/schemas.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from enum import Enum, StrEnum | ||
|
||
from pydantic import BaseModel, ConfigDict | ||
from primary.services.flow_network_assembler.flow_network_types import DatedFlowNetwork, FlowNetworkMetadata | ||
|
||
|
||
class Frequency(str, Enum): | ||
DAILY = "DAILY" | ||
WEEKLY = "WEEKLY" | ||
MONTHLY = "MONTHLY" | ||
QUARTERLY = "QUARTERLY" | ||
YEARLY = "YEARLY" | ||
|
||
|
||
class StatOption(str, Enum): | ||
MEAN = "MEAN" | ||
P10 = "P10" | ||
P90 = "P90" | ||
P50 = "P50" | ||
MIN = "MIN" | ||
MAX = "MAX" | ||
|
||
|
||
# ! Copy of the flow network service NodeType enum | ||
class NodeType(StrEnum): | ||
PROD = "prod" | ||
INJ = "inj" | ||
OTHER = "other" | ||
|
||
|
||
class FlowNetworkData(BaseModel): | ||
model_config = ConfigDict(revalidate_instances="always") | ||
|
||
edgeMetadataList: list[FlowNetworkMetadata] | ||
nodeMetadataList: list[FlowNetworkMetadata] | ||
datedNetworks: list[DatedFlowNetwork] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from typing import List | ||
|
||
import orjson | ||
import numpy as np | ||
import xtgeo | ||
|
||
from . import schemas | ||
|
||
|
||
def surface_to_float32_array(values: np.ndarray) -> List[float]: | ||
values = values.astype(np.float32) | ||
np.ma.set_fill_value(values, np.nan) | ||
values = np.ma.filled(values) | ||
|
||
# Rotate 90 deg left. | ||
# This will cause the width of to run along the X axis | ||
# and height of along Y axis (starting from bottom.) | ||
values = np.rot90(values) | ||
|
||
return values.flatten().tolist() | ||
|
||
|
||
def to_api_surface_data( | ||
xtgeo_surf: xtgeo.RegularSurface, property_values: np.ndarray | ||
) -> schemas.SurfaceMeshAndProperty: | ||
""" | ||
Create API SurfaceData from xtgeo regular surface | ||
""" | ||
float32_mesh = surface_to_float32_array(xtgeo_surf.values) | ||
float32_property = surface_to_float32_array(property_values) | ||
|
||
return schemas.SurfaceMeshAndProperty( | ||
x_ori=xtgeo_surf.xori, | ||
y_ori=xtgeo_surf.yori, | ||
x_count=xtgeo_surf.ncol, | ||
y_count=xtgeo_surf.nrow, | ||
x_inc=xtgeo_surf.xinc, | ||
y_inc=xtgeo_surf.yinc, | ||
x_min=xtgeo_surf.xmin, | ||
x_max=xtgeo_surf.xmax, | ||
y_min=xtgeo_surf.ymin, | ||
y_max=xtgeo_surf.ymax, | ||
mesh_value_min=xtgeo_surf.values.min(), | ||
mesh_value_max=xtgeo_surf.values.max(), | ||
property_value_min=property_values.min(), | ||
property_value_max=property_values.max(), | ||
rot_deg=xtgeo_surf.rotation, | ||
mesh_data=orjson.dumps(float32_mesh).decode("utf-8"), # pylint: disable=maybe-no-member | ||
property_data=orjson.dumps(float32_property).decode("utf-8"), # pylint: disable=maybe-no-member | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.