Skip to content

Commit

Permalink
repositioned code files, added project file, added empty click interf…
Browse files Browse the repository at this point in the history
…ace #9
  • Loading branch information
hcwinsemius committed Oct 11, 2024
1 parent 5127cf2 commit a271180
Show file tree
Hide file tree
Showing 13 changed files with 165 additions and 32 deletions.
31 changes: 0 additions & 31 deletions dem_blender.py

This file was deleted.

11 changes: 11 additions & 0 deletions dem_blender/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""DEM Blender. Seamless merging of Digital Terrain Models with overlap from different sources."""

__version__ = "0.1.0"

from .cli import *
from . import dem_blender

__all__ = [
"dem_blender",
"cli"
]
File renamed without changes.
1 change: 1 addition & 0 deletions dem_blender/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""DEM blender command-line interface."""
40 changes: 40 additions & 0 deletions dem_blender/cli/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import click
from pathlib import Path
from dem_blender import dem_blender

def print_info(ctx, param, value):
if not value:
return {}
click.echo(f"DEM Blender, Copyright Localdevices, OpenDroneMap.org")
ctx.exit()

def print_license(ctx, param, value):
if not value:
return {}
click.echo(f"GNU Affero General Public License v3 (AGPLv3). See https://www.gnu.org/licenses/agpl-3.0.en.html")
ctx.exit()

path_opt = click.option(
"-p",
"--path",
type=click.Path(exists=True, resolve_path=True, dir_okay=True, file_okay=False),
help="Path to directory containing terrain models",
# callback=validate_files_in_dir, # TODO: write a validator that confirms that all files in folder are valid geospatial raster files
required=True
)

@click.command()
@click.argument(
'OUTPUT',
type=click.Path(resolve_path=True, dir_okay=False, file_okay=True),
required=True
)
@path_opt
def merge(
output: Path,
path: Path,
):
"""Single CLI command for blending terrain models."""
print(f"Input path: {path}")
print(f"Output path file: {output}")
raise NotImplementedError
30 changes: 30 additions & 0 deletions dem_blender/dem_blender.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""Main API to DEM blender."""
import os
import glob
import sys
sys.path.insert(0, os.path.join("..", "..", os.path.dirname(__file__)))

import argparse
import merge

# TODO: modify to API callend from click interface

######
# parser = argparse.ArgumentParser(description='Merge and blend DEMs using OpenDroneMap\'s approach.')
# parser.add_argument('input_dems',
# type=str,
# help='Path to input dems (.tif)')
#
# args = parser.parse_args()

# if not os.path.exists(args.input_dems):
# print("%s does not exist" % args.input_dems)
# exit(1)

# output_dem = os.path.join(args.input_dems, 'merged_blended_dem.tif')
# input_dem_path = os.path.join(args.input_dems, '*.tif')
# input_dems = glob.glob(input_dem_path)
#
# merge.euclidean_merge_dems(input_dems
# ,output_dem=output_dem
# )
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
82 changes: 82 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
[build-system]
requires = ["flit_core >=3.4.0,<4"]
build-backend = "flit_core.buildapi"

[project]
name = "dem_blender"
authors = [
{ name = "Stephen Mather", email = "[email protected]" },
]
packages = [
{ include = "dem_blender" }
]

dependencies = [
"click",
"numpy",
"scipy",
"rasterio>=1.3.11",
"python-dateutil",
"joblib"
]

requires-python =">=3.9"
readme = "README.md"
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering :: Hydrology",
"Topic :: Scientific/Engineering :: Image Processing",
"License :: OSI Approved :: GNU Affero General Public License v3",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11"
]
dynamic = ['version', 'description']

[project.optional-dependencies]
extra = [
"matplotlib",
"notebook"
]
test = [
"pytest",
"pytest-cov",
]

full = ["dem_blender[extra,test]"]

[project.scripts]
dem_blender = "dem_blender.cli.main:merge"

[project.urls]
Source = "https://github.com/localdevices/dem_blender"

[tool.flit.sdist]
include = ["dem_blender"]

[tool.flit.module]
name = "dem_blender"

[tool.pytest.ini_options]
addopts = "--ff "
testpaths = ["tests"]
filterwarnings = [
]

# [tool.ruff]
# line-length = 120
# target-version = "py39"
# exclude = ["docs"]
#
# [tool.ruff.lint]
# # enable pydocstyle (E), pyflake (F) and isort (I), pytest-style (PT), bugbear (B)
# select = ["E", "F", "I", "PT", "D", "B", "ICN", "TID"]
# ignore = ["D211", "D213", "D206", "E741", "D105", "D203", "E712", "B904"] # "E501" line length
#
# [tool.ruff.lint.per-file-ignores]
# "tests/**" = ["D100", "D101", "D102", "D103", "D104"]
# "pivnumba/__init__.py" = ["E402", "F401", "F403"]
# "tests/conftest.py" = ["E402"]
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dateutil
numpy
scipy
rasterio>=1.3.11
python-dateutil
joblib
# osgeo
# gdal
Expand Down

0 comments on commit a271180

Please sign in to comment.