Skip to content

Commit 5a64a7e

Browse files
authored
Merge pull request #146 from MiraGeoscience/release/0.1.5
GEOPY-331 Release geoh5py 0.1.5
2 parents 94706fb + 3e1e1c0 commit 5a64a7e

34 files changed

+827
-76
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
- main
8+
- code-ql
9+
- release/**
10+
- feature/**
11+
- hotfix/**
12+
pull_request:
13+
# The branches below must be a subset of the branches above
14+
branches:
15+
- main
16+
schedule:
17+
- cron: '22 21 * * 2'
18+
19+
jobs:
20+
analyze:
21+
name: Analyze
22+
defaults:
23+
run:
24+
shell: bash
25+
runs-on: windows-latest
26+
env:
27+
POETRY_VIRTUALENVS_CREATE: true
28+
POETRY_VIRTUALENVS_IN_PROJECT: true
29+
permissions:
30+
actions: read
31+
contents: read
32+
security-events: write
33+
34+
steps:
35+
- name: Checkout repository
36+
uses: actions/checkout@v2
37+
- name: Set up Python version
38+
uses: actions/setup-python@v2
39+
with:
40+
python-version: '3.7'
41+
- name: Get full Python version
42+
id: full-python-version
43+
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
44+
- name: Install Poetry
45+
run: curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
46+
- name: Environment
47+
run: echo "$HOME/.poetry/bin" >> $GITHUB_PATH
48+
- name: Set up cache
49+
uses: actions/cache@v2
50+
id: cache
51+
with:
52+
path: .venv
53+
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
54+
- name: Ensure cache is healthy
55+
if: steps.cache.outputs.cache-hit == 'true'
56+
run: timeout 10s poetry run pip --version || rm -rf .venv
57+
- name: Install dependencies
58+
run: |
59+
poetry install -vvv --no-root
60+
POETRY_PYTHON=$(poetry run python -c "import shutil; print(shutil.which('python'))")
61+
echo "CODEQL_PYTHON=$POETRY_PYTHON" >> $GITHUB_ENV
62+
63+
# Initializes the CodeQL tools for scanning.
64+
- name: Initialize CodeQL
65+
uses: github/codeql-action/init@v1
66+
with:
67+
languages: python
68+
# Override the default behavior so that the action doesn't attempt
69+
# to auto-install Python dependencies
70+
setup-python-dependencies: false
71+
72+
# If you wish to specify custom queries, you can do so here or in a config file.
73+
# By default, queries listed here will override any specified in a config file.
74+
# Prefix the list here with "+" to use these queries and those in the config file.
75+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
76+
77+
- name: Perform CodeQL Analysis
78+
uses: github/codeql-action/analyze@v1

.pre-commit-config.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ci:
1010

1111
repos:
1212
- repo: https://github.com/psf/black
13-
rev: 21.7b0
13+
rev: 21.10b0
1414
hooks:
1515
- id: black
1616
types: [text]
@@ -22,7 +22,7 @@ repos:
2222
types: [text]
2323
types_or: [python, pyi]
2424
- repo: https://github.com/PyCQA/isort
25-
rev: 5.9.2
25+
rev: 5.9.3
2626
hooks:
2727
- id: isort
2828
additional_dependencies: [toml] # to read config from pyproject.toml
@@ -35,25 +35,26 @@ repos:
3535
types: [text]
3636
types_or: [python, pyi]
3737
- repo: https://github.com/PyCQA/flake8
38-
rev: 3.9.2
38+
rev: 4.0.1
3939
hooks:
4040
- id: flake8
4141
types: [text]
4242
types_or: [python, pyi]
4343
- repo: https://github.com/asottile/pyupgrade
44-
rev: v2.23.0
44+
rev: v2.29.0
4545
hooks:
4646
- id: pyupgrade
4747
args: [--py37-plus]
4848
types: [text]
4949
types_or: [python, pyi]
5050
- repo: https://github.com/pre-commit/mirrors-mypy
51-
rev: v0.910
51+
rev: v0.910-1
5252
hooks:
5353
- id: mypy
5454
additional_dependencies: [types-toml]
5555
args: [--ignore-missing-imports, --scripts-are-modules, --show-error-context,
5656
--show-column-numbers]
57+
exclude: geoh5py/interfaces/__init__\.py
5758
- repo: local
5859
hooks:
5960
- id: pylint

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@
8080
project = "geoh5py"
8181

8282
# The short X.Y version.
83-
version = "0.1.4"
83+
version = "0.1.5"
8484
# The full version, including alpha/beta/rc tags.
85-
release = "0.1.4"
85+
release = "0.1.5"
8686

8787
# List of patterns, relative to source directory, that match files and
8888
# directories to ignore when looking for source files.

docs/content/geoh5_format/analyst/objects.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _analyst_objects:
2+
13
ANALYST Objects
24
===============
35

docs/content/release_notes.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
Release Notes
22
=============
33

4+
Release 0.1.5 - 2021/11/05
5+
--------------------------
6+
7+
- Fix for copying of direct-current survey.
8+
- Fix documentation.
9+
10+
411
Release 0.1.4 - 2021/08/31
512
--------------------------
613

3.01 KB
Loading
Loading
6.33 KB
Loading
Loading
Loading
Loading
Loading
Loading
Loading
2.51 KB
Loading
Loading
2.71 KB
Loading
Loading
2.09 KB
Loading

docs/content/uijson_format/index.rst

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
UI.JSON Format
2+
==============
3+
4+
About
5+
^^^^^
6+
7+
The **ui.json** format provides a User Interface (UI) between geoh5py and `Geoscience ANALYST Pro
8+
<http://www.mirageoscience.com/our-products/software-product/geoscience-analyst>`_. The file structure is built on an array of `JSON objects <https://json-schema.org/specification.html>`_, each representing a parameter that is used in a python script. An object contains members that control the style and behaviour of the UI. In general only a **label** and **value** member is required in each object, however as outlined below, there are many types of input and dependencies that can be drawn on throughout the file. On output from Geoscience ANALYST, the value and whether the parameter is enabled will be updated or added to each JSON. Extra objects in the JSON are allowed and are ignored, but written out by Geoscience ANALYST. In general, objects will be put in order that they are set in the JSON. The exception is data parameters that depend on object parameters. Placing those parameters in the same group will ensure that they are close in the UI.
9+
10+
11+
Input Objects
12+
^^^^^^^^^^^^^
13+
Within the **ui.json** file, each JSON object with **value** and **label** members will be considered a parameter to the UI. The following JSON objects could also be present:
14+
15+
run_command ``str``
16+
Name of python script excluding the .py extension (i.e., "run_me" for run_me.py) required for Geoscience ANALYST Pro to run on save or auto-load.
17+
conda_environment ``str``
18+
Optional name of conda environment to activate when running the python script in *run_command*
19+
title ``str``
20+
Optional title of user interface window
21+
22+
Object Members
23+
^^^^^^^^^^^^^^
24+
Each JSON object with the following members become a parameter in the user interface. Each object must have the members ``label`` and ``value``. Each member will contribute to the appearence and behaviour within Geoscience ANALYST>. The possible members that can be given to all parameter objects are:
25+
26+
label ``str``
27+
Required string describing parameter. A colon will automatically be added within Geoscience ANALYST, so this should be omitted.
28+
value ``str``, ``int``, ``bool`` , or ``float``
29+
This require member takes a different form, including empty, depending on the :ref:`parameter type <json_param_examples>`. The value is updated when written from Geoscience ANALYST.
30+
main ``bool``
31+
If set to true, the parameter is shown in the first tab and will throw an error if not given and not optional. Optional parameters may be set to main. When main is not given or is false, the parameter will be under the *Optional Parameters* tab.
32+
tooltip ``str``
33+
String describing the parameter in detail that appears when the mouse hovers over it.
34+
optional ``bool``
35+
*true* or *false* on whether the parameter is optional. On output, check if *enabled* is set to true.
36+
enabled ``bool``
37+
*true* or *false* if the parameter is enabled. The default is true. If a parameter is optional and not enabled, it will start as disabled (grey and inactive in the UI).
38+
group ``str``
39+
Name of the group to which the parameter belongs. Adds a box and name around the parameters with the same case-sensitive group name.
40+
groupOptional ``bool``
41+
If true, adds a checkbox in the top of the group box next to the name. The group parameters will be disabled if not checked. The initial statedpends on the **groupDependency** and **groupDependencyType** members and the **enabled** member of the group's parameters.
42+
dependency ``str``
43+
The name of the object of which this object is dependent upon. The dependency parameter should be optional or boolean parameter (i.e., has a checkbox).
44+
dependencyType ``str``
45+
What happens when the dependency member is checked. Options are ``enabled`` or ``disabled``
46+
groupDependency ``str``
47+
The name of the object of which the group of the parameter is dependent upon. This member will also require the **groupOptional** member to be present and set to ``true``. Be sure that the object is not within the group.
48+
groupDependencyType ``str``
49+
What happens when the group's dependency parameter is checked. Options are ``enabled`` or ``disabled``.
50+
51+
52+
.. _json_param_examples:
53+
54+
Parameter Types
55+
^^^^^^^^^^^^^^^
56+
There are other JSON members that may be available or required based on the parameter type. The following sections define different parameter types that can be found in the **ui.json** format.
57+
58+
.. toctree::
59+
:maxdepth: 1
60+
61+
json_objects.rst
62+
63+
64+
Exporting from Geoscience ANALYST
65+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66+
When a **ui.json** is saved with Geoscience ANALYST Pro, the following object members are updated or added:
67+
68+
- The **value** member with the appropriate type
69+
- The **enabled** member ``bool`` for whether the parameter is enabled
70+
- The :ref:`Data parameter <data_parameter>` will also have updated **isValue** and **property** members. The **isValue** ``bool`` member is *true* if the **value** member was selected and *false* if the **property** member was selected.
71+
72+
The following JSON objects will be written (and overwritten if given) upon export from Geoscience ANALYST Pro:
73+
74+
- monitoring_directory ``str`` the absolute path of a monitoring directory. Workspace files written to this folder will be automatically processed by Geoscience ANALYST.
75+
- workspace_geoh5 ``str`` the absolute path to the current workspace (if previously saved) being used
76+
- geoh5 ``str`` the absolute path to the geoh5 written containing all the objects of the workspace within the parameters of the **ui.json**. One only needs to use this workspace along with the JSON file to access the objects with geoh5py.
77+
78+
79+
Tips on creating UIs
80+
^^^^^^^^^^^^^^^^^^^^
81+
Here are a few tips on creating good looking UIs:
82+
83+
- Keep labels short and concise. Be consistent with capitalization and do not include the colons. Geoscience ANALYST will add colons and align them.
84+
- Write detailed tooltips.
85+
- Group related objects, but do not use a group if there are fewer than 3 objects.
86+
- The **main** member is for general, required parameters. Do not include this member with every object, unless there are only a handful of objects. Objects that are in the required parameters without a valid value will invoke an error when exporting or running from Geoscience ANALYST. "Non-main" members are designated to a second page under *Optional parameters*.
87+
- Utilize **optional** object members and dependencies. If a single workspace object input is optional, use the :ref:`Object parameter <object_parameter>` rather than two parameters with a dependency.
88+
89+
90+
External Links
91+
^^^^^^^^^^^^^^
92+
93+
- `JSON Terminology <https://json-schema.org/specification.html>`_
94+
- `Universally Unique IDentifier (UUID) <https://en.wikipedia.org/wiki/Universally_unique_identifier>`_
95+
- `C++ JSON Library <https://github.com/nlohmann/JSON>`_

0 commit comments

Comments
 (0)