-
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 pull request #4 from AgPipeline/develop
Merging develop to main branch - no review
- Loading branch information
Showing
9 changed files
with
459 additions
and
236 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
cp ./.github/workflows/*.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,62 @@ | ||
"""My nifty plot-level RGB algorithm | ||
""" | ||
|
||
# Importing modules. Please add any additional import statements below | ||
import numpy as np | ||
|
||
# Definitions | ||
# Please replace these definitions' values with the correct ones | ||
VERSION = '1.0' | ||
|
||
# Information on the creator of this algorithm | ||
ALGORITHM_AUTHOR = 'Unknown' | ||
ALGORITHM_AUTHOR_EMAIL = '' | ||
ALGORITHM_CONTRIBUTORS = [""] | ||
|
||
ALGORITHM_NAME = 'my nifty one' | ||
ALGORITHM_DESCRIPTION = 'This algorithm calculates the niftyness of RGB plot-level images' | ||
|
||
# Citation information for publication (more information in HOW_TO.md) | ||
CITATION_AUTHOR = 'unknown' | ||
CITATION_TITLE = '' | ||
CITATION_YEAR = '' | ||
|
||
# The name of one or more variables returned by the algorithm, separated by commas (more information in HOW_TO.md) | ||
# If only one name is specified, no comma's are used. | ||
# Note that variable names cannot have comma's in them: use a different separator instead. Also, | ||
# all white space is kept intact; don't add any extra whitespace since it may cause name comparisons | ||
# to fail. | ||
# !! Replace the content of this string with your variable names | ||
VARIABLE_NAMES = 'size of image channels' | ||
|
||
# Variable units matching the order of VARIABLE_NAMES, also comma-separated. | ||
# For each variable name in VARIABLE_NAMES add the unit of measurement the value represents. | ||
# !! Replace the content of this string with your variables' unit | ||
VARIABLE_UNITS = 'pixels' | ||
|
||
# Variable labels matching the order of VARIABLE_NAMES, also comma-separated. | ||
# This is an optional definition and can be left empty. | ||
VARIABLE_LABELS = '' | ||
|
||
# Optional override for the generation of a BETYdb compatible csv file | ||
# Set to False to suppress the creation of a compatible file | ||
WRITE_BETYDB_CSV = True | ||
|
||
# Optional override for the generation of a TERRA REF Geostreams compatible csv file | ||
# Set to False to suppress the creation of a compatible file | ||
WRITE_GEOSTREAMS_CSV = True | ||
|
||
|
||
# Entry point for plot-level RBG algorithm | ||
def calculate(pxarray: np.ndarray): | ||
"""Calculates one or more values from plot-level RGB data | ||
Arguments: | ||
pxarray: Array of RGB data for a single plot | ||
Return: | ||
Returns one or more calculated values | ||
""" | ||
# ALGORITHM: replace the following lines with your algorithm | ||
channel_size = pxarray[:, :, 1].size | ||
|
||
# RETURN: replace the following return with your calculated values. Be sure to order them as defined in VARIABLE_NAMES above | ||
return channel_size |
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,82 @@ | ||
name: Enforcing pylint checks | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- develop | ||
pull_request: | ||
branches: | ||
- master | ||
- develop | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
update_python: | ||
runs-on: ubuntu-latest | ||
name: Running pylint checks | ||
steps: | ||
- name: Current python version | ||
run: python3 --version || echo python3 not installed | ||
- name: Install Python 3.7 | ||
run: sudo apt-get install -y --no-install-recommends python3.7 python3-pip && sudo ln -sfn /usr/bin/python3.7 /usr/bin/python3 | ||
id: install_python_3_7 | ||
- name: Updated python version | ||
run: python3 --version | ||
- name: PYTHONPATH environment variable | ||
run: echo ${PYTHONPATH} | ||
- name: Update pip | ||
run: python3 -m pip install --upgrade --no-cache-dir pip | ||
id: pip-install | ||
- name: Fetch/update setuptools | ||
run: python3 -m pip install --upgrade --no-cache-dir setuptools | ||
id: setuptools-install | ||
- name: Install python-apt | ||
run: sudo apt-get install -y python-apt | ||
- name: HACK to fix apt-get update problem w/ different python versions | ||
run: 'cd /usr/lib/python3/dist-packages && sudo cp apt_pkg.cpython-36m-x86_64-linux-gnu.so apt_pkg.so' | ||
- name: Update apt-get | ||
run: sudo apt-get update | ||
- name: Fetch/update pylint | ||
run: python3 -m pip install --upgrade --no-cache-dir pylint | ||
id: pylint-install | ||
- name: Fetch source code | ||
uses: actions/checkout@v2 | ||
id: fetch-source | ||
- name: Finding files | ||
run: find . -type f -name "*.py" > action_pylint_files.txt | ||
id: find-python-files | ||
- name: Install system requirements | ||
shell: bash | ||
run: 'sudo apt-get install -y python3-gdal gdal-bin libgdal-dev gcc g++ python3.7-dev' | ||
id: install-gdal-other-reqs | ||
- name: Install Python numpy | ||
shell: bash | ||
run: 'python3 -m pip install --upgrade --no-cache-dir numpy wheel terrautils' | ||
id: install-python-numpy | ||
- name: Install Python pygdal | ||
shell: bash | ||
run: 'sudo python3 -m pip install --no-cache-dir pygdal==2.2.3.5' | ||
id: install-python-pygdal | ||
- name: Install system requirements from source | ||
shell: bash | ||
run: '[ -s "packages.txt" ] && (cat packages.txt | xargs apt-get install -y --no-install-recommends) || (echo "No addtional packages to install")' | ||
id: install-system-reqs | ||
- name: Install Python requirements from source | ||
shell: bash | ||
run: '[ -s "requirements.txt" ] && (python3 -m pip install --no-cache-dir -r requirements.txt) || (echo "No Python packages to install")' | ||
id: install-python-reqs | ||
- name: Run action pylint script | ||
shell: bash | ||
run: '[ -s ".github/workflows/action_pylint.sh" ] && (chmod +x ".github/workflows/action_pylint.sh" && ./.github/workflows/action_pylint.sh) || (echo "Error running shell script")' | ||
id: run-special-action-script | ||
- name: Fetching pylint.rc file | ||
run: wget https://raw.githubusercontent.com/AgPipeline/Organization-info/master/pylint.rc | ||
id: fetch_pylint_resource | ||
- name: Listing | ||
run: ls -la | ||
- name: Files to be linted | ||
run: cat action_pylint_files.txt | ||
- name: Running pylint | ||
run: cat action_pylint_files.txt | xargs python3 -m pylint --rcfile ./pylint.rc | ||
|
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,49 @@ | ||
"""Class instance for Transformer | ||
""" | ||
|
||
import argparse | ||
|
||
# pylint: disable=unused-argument | ||
class Transformer(): | ||
"""Generic class for supporting transformers | ||
""" | ||
def __init__(self, **kwargs): | ||
"""Performs initialization of class instance | ||
Arguments: | ||
kwargs: additional parameters passed into Transformer instance | ||
""" | ||
self.args = None | ||
|
||
def add_parameters(self, parser: argparse.ArgumentParser) -> None: | ||
"""Adds processing parameters to existing parameters | ||
Arguments: | ||
parser: instance of argparse | ||
""" | ||
|
||
# pylint: disable=no-self-use | ||
def get_transformer_params(self, args: argparse.Namespace, metadata: list) -> dict: | ||
"""Returns a parameter list for processing data | ||
Arguments: | ||
args: result of calling argparse.parse_args | ||
metadata: the list of loaded metadata | ||
Return: | ||
A dictionary of parameter names and value to pass to transformer | ||
""" | ||
self.args = args | ||
|
||
params = {} | ||
return params | ||
|
||
# pylint: disable=no-self-use | ||
def retrieve_files(self, transformer_params: dict, metadata: list) -> tuple: | ||
"""Retrieves files as needed to make them available for processing | ||
Arguments: | ||
transformer_params: the values returned from get_transformer_params() call | ||
metadata: the loaded metadata | ||
Return: | ||
A tuple consisting of the return code and an optional error message. | ||
Notes: | ||
A negative return code is considered an error and an associated message, if specified, | ||
will be treated as such. | ||
""" | ||
return 0, "everything's in order" |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM agdrone/drone-base-image:1.2 | ||
FROM agdrone/agpypeline:1.0 | ||
LABEL maintainer="Chris Schnaufer <[email protected]>" | ||
|
||
COPY requirements.txt packages.txt /home/extractor/ | ||
|
@@ -25,6 +25,9 @@ RUN [ -s /home/extractor/requirements.txt ] && \ | |
(echo "No python modules to install" && \ | ||
rm /home/extractor/requirements.txt) | ||
|
||
USER extractor | ||
|
||
COPY *.py /home/extractor/ | ||
RUN chmod a+x /home/extractor/transformer.py | ||
|
||
USER extractor | ||
ENTRYPOINT ["/home/extractor/transformer.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 |
---|---|---|
@@ -1,29 +1,35 @@ | ||
"""Contains transformer configuration information | ||
""" | ||
from agpypeline.configuration import Configuration | ||
|
||
# The version number of the transformer | ||
TRANSFORMER_VERSION = '1.0' | ||
|
||
# The transformer description | ||
TRANSFORMER_DESCRIPTION = 'Base for plot-level RGB-based algorithm transformers' | ||
class ConfigurationRgbBase(Configuration): | ||
"""Configuration for RGB Plot base transformer template""" | ||
# Silence this error until we have public methods | ||
# pylint: disable=too-few-public-methods | ||
# The version number of the transformer | ||
transformer_version = '1.0' | ||
|
||
# Short name of the transformer | ||
TRANSFORMER_NAME = 'rgb-plot-level-base' | ||
# The transformer description | ||
transformer_description = 'Base for plot-level RGB-based algorithm transformers' | ||
|
||
# The sensor associated with the transformer | ||
TRANSFORMER_SENSOR = 'stereoTop' | ||
# Short name of the transformer | ||
transformer_name = 'rgb-plot-level-base' | ||
|
||
# The transformer type (eg: 'rgbmask', 'plotclipper') | ||
TRANSFORMER_TYPE = 'rgb.algorithm.base' | ||
# The sensor associated with the transformer | ||
transformer_sensor = 'stereoTop' | ||
|
||
# The name of the author of the extractor | ||
AUTHOR_NAME = 'Chris Schnaufer' | ||
# The transformer type (eg: 'rgbmask', 'plotclipper') | ||
transformer_type = 'rgb.algorithm.base' | ||
|
||
# The email of the author of the extractor | ||
AUTHOR_EMAIL = '[email protected]' | ||
# The name of the author of the extractor | ||
author_name = 'Chris Schnaufer' | ||
|
||
# Contributors to this transformer | ||
CONTRUBUTORS = [] | ||
# The email of the author of the extractor | ||
author_email = '[email protected]' | ||
|
||
# Repository URI of where the source code lives | ||
REPOSITORY = 'https://github.com/AgPipeline/drone-pipeline-transformer' | ||
# Contributors to this transformer | ||
contributors = [] | ||
|
||
# Repository URI of where the source code lives | ||
repository = 'https://github.com/AgPipeline/plot-base-rgb' |
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 @@ | ||
liblas-bin |
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,2 @@ | ||
liblas | ||
agpypeline==0.0.20 |
Oops, something went wrong.