generated from kamangir/blue-plugin
-
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 kamangir/markdown-2024-07-21-c
datacube refactors π§
- Loading branch information
Showing
7 changed files
with
138 additions
and
18 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
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,8 +1,8 @@ | ||
#! /usr/bin/env bash | ||
|
||
function blue_geo_action_git_before_push() { | ||
[[ "$(abcli_git get_branch)" == "main" ]] && | ||
if [[ "$(abcli_git get_branch)" == "main" ]]; then | ||
blue_geo build_README | ||
blue_geo pypi build | ||
fi | ||
} | ||
|
||
|
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,5 @@ | ||
from blue_geo import README | ||
|
||
|
||
def test_README_build(): | ||
assert README.build() |
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,90 @@ | ||
import os | ||
import abcli | ||
from abcli import file | ||
from abcli.file.functions import build_from_template | ||
from abcli.plugins import markdown | ||
from blue_geo import NAME, VERSION, ICON | ||
from blue_geo.logger import logger | ||
|
||
NAME = f"{NAME}.README" | ||
|
||
features = { | ||
"QGIS": { | ||
"description": "an AI terraform for [QGIS](https://www.qgis.org/).", | ||
"icon": "π", | ||
"thumbnail": "https://raw.githubusercontent.com/kamangir/assets/main/blue-geo/QGIS.jpg", | ||
"url": "https://github.com/kamangir/blue-geo/blob/main/blue_geo/.abcli/QGIS/README.md", | ||
}, | ||
"datacube": { | ||
"description": "a datacube for geospatial AI", | ||
"icon": "π§", | ||
"thumbnail": "https://github.com/kamangir/assets/blob/main/blue-geo/datacube.png?raw=true", | ||
"url": "https://github.com/kamangir/blue-geo/tree/main/blue_geo/.abcli/datacube", | ||
}, | ||
"firms-area": { | ||
"description": "Fire Information for Resource Management System ([FIRMS](https://firms.modaps.eosdis.nasa.gov)) datacubes.", | ||
"icon": "π", | ||
"thumbnail": "https://raw.githubusercontent.com/kamangir/assets/main/blue-geo/datacube-firms_area.jpg", | ||
"url": "https://github.com/kamangir/blue-geo/blob/main/blue_geo/.abcli/datacube/firms_area/README.md", | ||
}, | ||
"ukraine-timemap": { | ||
"description": "`ingest` for the [Bellingcat](https://www.bellingcat.com/) [Civilian Harm in Ukraine TimeMap](https://github.com/bellingcat/ukraine-timemap) dataset, available through [this UI](https://ukraine.bellingcat.com/) and [this API](https://bellingcat-embeds.ams3.cdn.digitaloceanspaces.com/production/ukr/timemap/api.json).", | ||
"icon": "πΊπ¦", | ||
"thumbnail": "https://github.com/kamangir/assets/blob/main/nbs/ukraine-timemap/QGIS.png?raw=true", | ||
"url": "https://github.com/kamangir/blue-geo/blob/main/blue_geo/.abcli/ukraine-timemap/README.md", | ||
}, | ||
"vancouver-watching": { | ||
"description": "π Vancouver watching with AI, last build: [π](https://kamangir-public.s3.ca-central-1.amazonaws.com/test_vancouver_watching_ingest/animation.gif).", | ||
"icon": "π", | ||
"thumbnail": "https://kamangir-public.s3.ca-central-1.amazonaws.com/test_vancouver_watching_ingest/animation.gif?raw=true", | ||
"url": "https://github.com/kamangir/Vancouver-Watching", | ||
}, | ||
"template": { | ||
"description": "", | ||
"icon": "", | ||
"thumbnail": "", | ||
"url": "", | ||
}, | ||
} | ||
|
||
|
||
def build(filename: str = ""): | ||
if not filename: | ||
filename = os.path.join(file.path(__file__), "../README.md") | ||
|
||
logger.info(f"{NAME}.build: {filename}") | ||
|
||
items = [ | ||
"{}[`{}`]({}) [![image]({})]({}) {}".format( | ||
details["icon"], | ||
feature, | ||
details["url"], | ||
details["thumbnail"], | ||
details["url"], | ||
details["description"], | ||
) | ||
for feature, details in features.items() | ||
if feature != "template" | ||
] | ||
|
||
table = markdown.generate_table(items) | ||
|
||
signature = [ | ||
"---", | ||
"built by [`{}`]({}), based on [`{}-{}`]({}).".format( | ||
abcli.fullname(), | ||
"https://github.com/kamangir/awesome-bash-cli", | ||
NAME, | ||
VERSION, | ||
"https://github.com/kamangir/blue_plugin", | ||
), | ||
] | ||
|
||
return file.build_from_template( | ||
os.path.join(file.path(__file__), "./assets/README.md"), | ||
{ | ||
"--table--": table, | ||
"--signature": signature, | ||
}, | ||
filename, | ||
) |
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
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,9 +1,17 @@ | ||
from blue_geo import NAME, VERSION, DESCRIPTION, ICON | ||
from blue_geo.logger import logger | ||
from blue_geo import README | ||
from blueness.argparse.generic import main | ||
|
||
success, message = main(__file__, NAME, VERSION, DESCRIPTION, ICON) | ||
success, message = main( | ||
__file__, | ||
NAME, | ||
VERSION, | ||
DESCRIPTION, | ||
ICON, | ||
{ | ||
"build_README": lambda _: README.build(), | ||
}, | ||
) | ||
if not success: | ||
logger.error(message) | ||
|
||
|
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,21 @@ | ||
# π Blue-GEO | ||
|
||
AI for precise geospatial data analysis and visualization. | ||
|
||
```bash | ||
pip install blue-geo | ||
``` | ||
|
||
--table-- | ||
|
||
--- | ||
|
||
[![PyPI version](https://img.shields.io/pypi/v/blue-geo.svg)](https://pypi.org/project/blue-geo/) | ||
|
||
π [metadata](./metadata.yaml) | ||
|
||
--- | ||
|
||
To use on [AWS SageMaker](https://aws.amazon.com/sagemaker/) replace `<plugin-name>` with the name of the plugin and follow [these instructions](https://github.com/kamangir/notebooks-and-scripts/blob/main/SageMaker.md). | ||
|
||
--signature-- |