# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# + jupyter={"outputs_hidden": false} pycharm={"name": "#%%\n"}
#  Copyright (c) 2017-2022 Reveal Energy Services, Inc
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
#
# This file is part of Orchid and related technologies.
#
# -

# # Example: Plotting well trajectories

# This notebook illustrates using the Orchid* Python API and the `matplotlib` package to
# plot well trajectories.
#
# (*Orchid is a mark of Reveal Energy Services, Inc)

# ## 0.5 Import packages

# The only import needed for the Orchid Python API is `orchid` itself.

# + jupyter={"outputs_hidden": false} pycharm={"name": "#%%\n"}
import orchid
# -

# The remaining imports are standard python packages to support the analysis.

# + jupyter={"outputs_hidden": false} pycharm={"name": "#%%\n"}
import matplotlib.pyplot as plt
# The following import is included for its "side-effects" of an improved color schemes and
# plot styles. (See the "Tip" in section 9.2 of "Python for Data Analysis" for details.)
import seaborn as sns
# -

# ## 1.0 Load the .ifrac project

# + [markdown] pycharm={"name": "#%% md\n"}
# The following code simply captures the configured location of the Orchid training data. It is not needed to
# use the Orchid Python API itself, but it is used in this example to load well-known data.

# + jupyter={"outputs_hidden": false} pycharm={"name": "#%%\n"}
orchid_training_data_path = orchid.training_data_path()

# + jupyter={"outputs_hidden": false} pycharm={"name": "#%%\n"}
project = orchid.load_project(str(orchid_training_data_path.joinpath(
    'Project-frankNstein_Montney_UTM13_METERS.ifrac')))

# + [markdown] pycharm={"name": "#%% md\n"}
# ### 1.1 Get the trajectories for each well of the project

# + jupyter={"outputs_hidden": false} pycharm={"name": "#%%\n"}
all_wells = project.wells().all_objects()
wells = dict([(w.name, w) for w in all_wells])
trajectories = {wn: w.trajectory for (wn, w) in wells.items()}

# + [markdown] pycharm={"name": "#%% md\n"}
# ### 1.2 Get the eastings ond northings in the project reference frame

# + jupyter={"outputs_hidden": false} pycharm={"name": "#%%\n"}
eastings = {wn: t.get_easting_array(orchid.WellReferenceFrameXy.PROJECT) for (wn, t) in trajectories.items()}
northings = {wn: t.get_northing_array(orchid.WellReferenceFrameXy.PROJECT) for (wn, t) in trajectories.items()}

# + [markdown] pycharm={"name": "#%% md\n"}
# ## 2.0 Plot the eastings and northings for each trajectory

# + jupyter={"outputs_hidden": false} pycharm={"name": "#%%\n"}
default_well_colors = project.default_well_colors()
for (i, wn) in enumerate(wells.keys()):
    plt.plot(eastings[wn], northings[wn],
             label=f'{wells[wn].display_name}',
             color=default_well_colors[i % len(default_well_colors)])
plt.title(f'{project.name} Well Trajectories (Project Coordinates)')
plt.legend(loc='best')
plt.xlabel(f'Easting ({orchid.abbreviation(project.project_units.LENGTH)})')
plt.ylabel(f'Northing ({orchid.abbreviation(project.project_units.LENGTH)})')

plt.rcParams['figure.dpi'] = 150
plt.show()
# -



StarcoderdataJupyterScriptsDedupFiltered