-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
repositioned code files, added project file, added empty click interf…
…ace #9
- Loading branch information
1 parent
5127cf2
commit a271180
Showing
13 changed files
with
165 additions
and
32 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,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.
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 @@ | ||
"""DEM blender command-line interface.""" |
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,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 |
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,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.
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 @@ | ||
[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"] |
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,7 +1,7 @@ | ||
dateutil | ||
numpy | ||
scipy | ||
rasterio>=1.3.11 | ||
python-dateutil | ||
joblib | ||
# osgeo | ||
# gdal | ||
|