Skip to content

Commit

Permalink
Merge pull request #152 from hyperiongeo/synthetics2021
Browse files Browse the repository at this point in the history
Synthetics Bugs
  • Loading branch information
frank1010111 authored Dec 28, 2024
2 parents 672cefb + 022da34 commit 82b60fa
Show file tree
Hide file tree
Showing 21 changed files with 255 additions and 133 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Run tests

on:
push:
branches: [ develop, master ]
branches: [ develop, main ]
pull_request:
branches: [ develop ]
branches: [ develop, main ]

jobs:
build:
Expand All @@ -16,18 +16,17 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[test]
- name: Test with pytest
run: |
python run_tests.py
run: pytest
2 changes: 1 addition & 1 deletion AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ The following people have contributed to the project (in alphabetical order):
- [Thomas Martin](https://github.com/ThomasMGeo), Colorado, USA
- [Steve Purves](https://github.com/stevejpurves), Curvenote, Spain
- [Patrick Reinhard](https://github.com/patrick-reinhard), Shell, The Netherlands
- [DC Slagel](https://github.com/dcslagel), Shell, The Netherlands
- [DC Slagel](https://github.com/dcslagel), Code Farm, Colorado, USA
- [Miguel de la Varga](https://github.com/Leguark), Germany
- [Wenting Xiong](https://github.com/wenting-x), Shell, The Netherlands
79 changes: 79 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Racist or racially biased remarks, attacks, or content.
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting any of the following people:

- Matt Hall, [[email protected]](mailto:[email protected])
- Evan Bianco, [[email protected]](mailto:[email protected])

All complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/), version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
63 changes: 57 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,62 @@
[build-system]
requires = [
"setuptools>=48",
"setuptools_scm[toml] >= 4, <6",
"setuptools_scm_git_archive",
"wheel >= 0.29.0",
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "welly"
dynamic = ["version"]
authors = [{ name = "The Welly Authors", email = "[email protected]" }]
description = "Tools for making and managing well data."
readme = "README.md"
readme-content-type = "text/markdown"
homepage = "https://github.com/agilescientific/welly"
classifiers = [
"Intended Audience :: Science/Research",
"Development Status :: 4 - Beta",
"Natural Language :: English",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent"
]
dependencies = [
"numpy",
"scipy",
"pandas",
"matplotlib",
"lasio",
"striplog",
"tqdm",
"wellpathpy",
"requests"
]

[project.optional-dependencies]
docs = ["sphinx", "sphinxcontrib-apidoc", "myst_nb", "furo"]
test = ["pytest", "pytest-cov", "pytest-mpl"]
dev = ["build", "pytest", "pytest-cov", "pytest-mpl", "sphinx", "sphinxcontrib-apidoc", "myst_nb", "furo"]

[tool.hatch.metadata]
packages = ["welly"]

[tool.hatch.version]
source = "vcs"

[tool.hatch.build.hooks.vcs]
version-file = "_version.py"

[tool.pytest.ini_options]
minversion = "6.0"
addopts = [
"--cov=welly",
"--cov-config=pyproject.toml",
"--mpl",
"--mpl-baseline-path=tests/baseline",
]
build-backend = "setuptools.build_meta"
testpaths = ["tests"]

[tool.setuptools_scm]
write_to = "welly/_version.py"
Expand Down
20 changes: 0 additions & 20 deletions run_tests.py

This file was deleted.

39 changes: 0 additions & 39 deletions setup.cfg

This file was deleted.

6 changes: 0 additions & 6 deletions setup.py

This file was deleted.

Binary file modified tests/baseline/test_curve_2d_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/baseline/test_well_synthetic_plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions tests/test_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
https://pypi.python.org/pypi/pytest-mpl/0.3
"""
import matplotlib.pyplot as plt
import pytest

from welly import Well
Expand Down Expand Up @@ -114,7 +115,8 @@ def test_synthetic_plot():
test_params = {'dt': 0.004}
s = Synthetic(data, params=test_params)

fig = s.plot().get_figure()
fig, ax = plt.subplots(figsize=(2, 10))
s.plot(ax)

return fig

Expand All @@ -127,7 +129,8 @@ def test_well_synthetic_plot():
w = Well.from_las(FNAME)
w.make_synthetic()

fig = w.data['Synthetic'].plot().get_figure()
fig, ax = plt.subplots(figsize=(2, 10))
w.data['Synthetic'].plot(ax)

return fig

Expand Down
17 changes: 16 additions & 1 deletion tests/test_synthetic.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf 8 -*-
"""
Define a suite a tests for the Curve module.
Define a suite a tests for the Synthetic class.
"""
import numpy as np

Expand All @@ -17,3 +17,18 @@ def test_synthetic():

assert s.dt == 0.004
assert s.name == 'Synthetic'


def test_synthetic_as_curve():
"""
Test synthetic to curve.
"""
data = np.array([4, 2, 0, -4, -2, 1, 3, 6, 3, 1, -2, -5, -1, 0])
params = {'dt': 0.004}
s = Synthetic(data, params=params)

crv = s.as_curve(0, 500, 0.1, mnemonic="SYNTH_CRV")

assert crv.index[0] == 0
assert round((crv.index[1]-crv.index[0]),2) == 0.1
assert crv.mnemonic == 'SYNTH_CRV'
10 changes: 10 additions & 0 deletions tests/test_well.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import os
from pathlib import Path

import pandas as pd

import welly
from welly import Well

Expand Down Expand Up @@ -148,3 +150,11 @@ def test_iter_well(well):
for curve in well:
assert curve == well.data['CALI']
break

def test_df_object_cols(df):

df["Test object"] = "54"
df["test_str"] = '1z'
well = Well.from_df(df)
assert all(well.df()["Test object"] == 54)
assert all(well.df()["test_str"] == "1z")
24 changes: 10 additions & 14 deletions welly/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
welly
==================
"""
import sys

from .project import Project
from .well import Well
from .header import Header
Expand All @@ -12,6 +14,7 @@
from .crs import CRS
from . import tools
from . import quality
from . import defaults


def read_las(path, **kwargs):
Expand Down Expand Up @@ -66,17 +69,10 @@ def read_df(df, **kwargs):
]


from pkg_resources import get_distribution, DistributionNotFound

try:
VERSION = get_distribution(__name__).version
except DistributionNotFound:
try:
from ._version import version as VERSION
except ImportError:
raise ImportError(
"Failed to find (autogenerated) _version.py. "
"This might be because you are installing from GitHub's tarballs, "
"use the PyPI ones."
)
__version__ = VERSION
if sys.version_info >= (3, 8):
from importlib import metadata
else:
import importlib_metadata as metadata

__version__ = metadata.version(__name__)

Loading

0 comments on commit 82b60fa

Please sign in to comment.