blue-sandbox 5.27.1__py3-none-any.whl → 5.38.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,11 @@
2
2
 
3
3
  function abcli_install_blue_sandbox() {
4
4
  abcli_git_clone https://github.com/microsoft/building-damage-assessment.git
5
+
6
+ [[ "$abcli_is_mac" == true ]] &&
7
+ brew install wget
8
+
9
+ return 0
5
10
  }
6
11
 
7
12
  abcli_install_module blue_sandbox 1.1.1
@@ -0,0 +1,67 @@
1
+ #! /usr/bin/env bash
2
+
3
+ function blue_sandbox_microsoft_building_damage_assessment_ingest() {
4
+ local options=$1
5
+ local do_dryrun=$(abcli_option_int "$options" dryrun 0)
6
+ local do_download=$(abcli_option_int "$options" download $(abcli_not $do_dryrun))
7
+ local do_gdal=$(abcli_option_int "$options" gdal 1)
8
+ local do_rm=$(abcli_option_int "$options" rm 1)
9
+ local do_upload=$(abcli_option_int "$options" upload $(abcli_not $do_dryrun))
10
+ local event_name=$(abcli_option "$options" event default)
11
+
12
+ local object_name=$(abcli_clarify_object $2 $event_name-ingest-$(abcli_string_timestamp_short))
13
+
14
+ abcli_log "ingesting $event_name -> $object_name ..."
15
+
16
+ local object_path=$ABCLI_OBJECT_ROOT/$object_name
17
+ mkdir -pv $object_path
18
+
19
+ pushd $object_path >/dev/null
20
+
21
+ # https://github.com/microsoft/building-damage-assessment/blob/main/SATELLITE_WORKFLOW.md#1-image-acquisition-and-label-generation
22
+ mkdir -pv data/demo/raw/
23
+ cd data/demo/raw/
24
+
25
+ if [[ "$do_download" == 1 ]]; then
26
+ abcli_eval ,$options \
27
+ wget https://maxar-opendata.s3.amazonaws.com/events/Maui-Hawaii-fires-Aug-23/ard/04/122000330002/2023-08-12/10300100EB15FF00-visual.tif
28
+ [[ $? -ne 0 ]] && return 1
29
+
30
+ abcli_eval ,$options \
31
+ wget https://maxar-opendata.s3.amazonaws.com/events/Maui-Hawaii-fires-Aug-23/ard/04/122000330020/2023-08-12/10300100EB15FF00-visual.tif
32
+ [[ $? -ne 0 ]] && return 1
33
+ fi
34
+
35
+ if [[ "$do_gdal" == 1 ]]; then
36
+ abcli_eval ,$options \
37
+ gdalbuildvrt maxar_lahaina_8_12_2023-visual.vrt *.tif*
38
+ [[ $? -ne 0 ]] && return 1
39
+
40
+ abcli_eval ,$options \
41
+ gdalwarp -co BIGTIFF=YES -co NUM_THREADS=ALL_CPUS -co COMPRESS=LZW -co PREDICTOR=2 -of COG maxar_lahaina_8_12_2023-visual.vrt maxar_lahaina_8_12_2023-visual.tif
42
+ [[ $? -ne 0 ]] && return 1
43
+ fi
44
+
45
+ if [[ "$do_rm" == 1 ]]; then
46
+ abcli_log "removing raw data ..."
47
+ rm -v 10300100EB15FF00-visual.tif*
48
+ rm -v maxar_lahaina_8_12_2023-visual.vrt
49
+ fi
50
+
51
+ cd ../../..
52
+
53
+ popd >/dev/null
54
+
55
+ abcli_eval dryrun=$do_dryrun \
56
+ python3 -m blue_sandbox.microsoft_building_damage_assessment \
57
+ ingest \
58
+ --event_name $event_name \
59
+ --object_name $object_name \
60
+ "${@:3}"
61
+ local status="$?"
62
+
63
+ [[ "$do_upload" == 1 ]] &&
64
+ abcli_upload - $object_name
65
+
66
+ return $status
67
+ }
@@ -0,0 +1,15 @@
1
+ #! /usr/bin/env bash
2
+
3
+ function blue_sandbox_microsoft_building_damage_assessment() {
4
+ local task=$(abcli_unpack_keyword $1 help)
5
+
6
+ local function_name=blue_sandbox_microsoft_building_damage_assessment_$task
7
+ if [[ $(type -t $function_name) == "function" ]]; then
8
+ $function_name "${@:2}"
9
+ return
10
+ fi
11
+
12
+ python3 -m blue_sandbox.microsoft_building_damage_assessment "$@"
13
+ }
14
+
15
+ abcli_source_caller_suffix_path /microsoft_building_damage_assessment
@@ -0,0 +1,13 @@
1
+ #! /usr/bin/env bash
2
+
3
+ function test_blue_sandbox_microsoft_building_damage_assessment_ingest() {
4
+ local options=$1
5
+
6
+ abcli_eval ,$options \
7
+ blue_sandbox_microsoft_building_damage_assessment \
8
+ ingest \
9
+ event=Maui-Hawaii-fires-Aug-23,~upload,$options \
10
+ test_blue_sandbox_microsoft_building_damage_assessment_ingest-$(abcli_string_timestamp_short) \
11
+ --verbose 1 \
12
+ "${@:2}"
13
+ }
blue_sandbox/README.py CHANGED
@@ -3,6 +3,9 @@ import os
3
3
  from blue_objects import file, README
4
4
 
5
5
  from blue_sandbox import NAME, VERSION, ICON, REPO_NAME
6
+ from blue_sandbox.microsoft_building_damage_assessment import (
7
+ README as microsoft_building_damage_assessment_README,
8
+ )
6
9
 
7
10
 
8
11
  items = [
@@ -34,6 +37,8 @@ def build():
34
37
  VERSION=VERSION,
35
38
  REPO_NAME=REPO_NAME,
36
39
  ) and README.build(
40
+ items=microsoft_building_damage_assessment_README.items,
41
+ cols=len(microsoft_building_damage_assessment_README.list_of_steps),
37
42
  path=os.path.join(file.path(__file__), "microsoft_building_damage_assessment"),
38
43
  ICON=ICON,
39
44
  NAME=NAME,
blue_sandbox/__init__.py CHANGED
@@ -4,7 +4,7 @@ ICON = "🌀"
4
4
 
5
5
  DESCRIPTION = f"{ICON} A sandbox for ideas and experiments."
6
6
 
7
- VERSION = "5.27.1"
7
+ VERSION = "5.38.1"
8
8
 
9
9
  REPO_NAME = "blue-sandbox"
10
10
 
@@ -2,12 +2,20 @@ from typing import List
2
2
 
3
3
  from blue_options.terminal import show_usage, xtra
4
4
 
5
+ list_of_events = ["Maui-Hawaii-fires-Aug-23"]
6
+
5
7
 
6
8
  def help_ingest(
7
9
  tokens: List[str],
8
10
  mono: bool,
9
11
  ) -> str:
10
- options = xtra("~download,~upload", mono=mono)
12
+ options = "".join(
13
+ [
14
+ xtra("~download,dryrun,", mono=mono),
15
+ "event=<event>",
16
+ xtra(",~gdal,~rm,~upload", mono=mono),
17
+ ]
18
+ )
11
19
 
12
20
  args = [
13
21
  "[--verbose 1]",
@@ -21,7 +29,10 @@ def help_ingest(
21
29
  "[-|<object-name>]",
22
30
  ]
23
31
  + args,
24
- "ingest @damage data.",
32
+ "ingest <event> -> <object-name>.",
33
+ {
34
+ "event: {}".format(" | ".join(list_of_events)): [],
35
+ },
25
36
  mono=mono,
26
37
  )
27
38
 
@@ -0,0 +1,34 @@
1
+ from typing import Dict
2
+
3
+ list_of_steps: Dict[str, Dict] = {
4
+ "ingest": "Maui-Hawaii-fires-Aug-23-damage-2025-01-09-GgnjQC",
5
+ "label": "",
6
+ "train": "",
7
+ "predict": "",
8
+ "summarize": "",
9
+ }
10
+
11
+ items = (
12
+ [f"`{step}`" for step in list_of_steps]
13
+ + [
14
+ (
15
+ "[`{}`](https://kamangir-public.s3.ca-central-1.amazonaws.com/{}.tar.gz)".format(
16
+ object_name,
17
+ object_name,
18
+ )
19
+ if object_name
20
+ else ""
21
+ )
22
+ for object_name in list_of_steps.values()
23
+ ]
24
+ + [
25
+ (
26
+ "[![image](https://github.com/kamangir/assets/blob/main/blue-sandbox/{}.png?raw=true)](#)".format(
27
+ object_name,
28
+ )
29
+ if object_name
30
+ else ""
31
+ )
32
+ for object_name in list_of_steps.values()
33
+ ]
34
+ )
@@ -0,0 +1,47 @@
1
+ import argparse
2
+
3
+ from blueness import module
4
+ from blueness.argparse.generic import sys_exit
5
+
6
+ from blue_sandbox import NAME
7
+ from blue_sandbox.microsoft_building_damage_assessment.ingest import ingest
8
+ from blue_sandbox.help.microsoft_building_damage_assessment import list_of_events
9
+ from blue_sandbox.logger import logger
10
+
11
+ NAME = module.name(__file__, NAME)
12
+
13
+ parser = argparse.ArgumentParser(NAME)
14
+ parser.add_argument(
15
+ "task",
16
+ type=str,
17
+ help="ingest",
18
+ )
19
+ parser.add_argument(
20
+ "--object_name",
21
+ type=str,
22
+ )
23
+ parser.add_argument(
24
+ "--event_name",
25
+ type=str,
26
+ default=list_of_events[0],
27
+ help=" | ".join(list_of_events),
28
+ )
29
+ parser.add_argument(
30
+ "--verbose",
31
+ type=bool,
32
+ default=0,
33
+ help="0|1",
34
+ )
35
+ args = parser.parse_args()
36
+
37
+ success = False
38
+ if args.task == "ingest":
39
+ success = ingest(
40
+ object_name=args.object_name,
41
+ event_name=args.event_name,
42
+ verbose=args.verbose == 1,
43
+ )
44
+ else:
45
+ success = None
46
+
47
+ sys_exit(logger, NAME, args.task, success)
@@ -0,0 +1,19 @@
1
+ from blueness import module
2
+
3
+ from blue_sandbox import NAME
4
+ from blue_sandbox.logger import logger
5
+
6
+
7
+ NAME = module.name(__file__, NAME)
8
+
9
+
10
+ def ingest(
11
+ event_name: str,
12
+ object_name: str,
13
+ verbose: bool = False,
14
+ ) -> bool:
15
+ logger.info(f"{NAME}.ingest({event_name}) -> {object_name}")
16
+
17
+ logger.info("🪄")
18
+
19
+ return True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: blue_sandbox
3
- Version: 5.27.1
3
+ Version: 5.38.1
4
4
  Summary: 🌀 A sandbox for ideas and experiments.
5
5
  Home-page: https://github.com/kamangir/blue-sandbox
6
6
  Author: Arash Abadpour (Kamangir)
@@ -54,4 +54,4 @@ pip install blue-sandbox
54
54
 
55
55
  [![pylint](https://github.com/kamangir/blue-sandbox/actions/workflows/pylint.yml/badge.svg)](https://github.com/kamangir/blue-sandbox/actions/workflows/pylint.yml) [![pytest](https://github.com/kamangir/blue-sandbox/actions/workflows/pytest.yml/badge.svg)](https://github.com/kamangir/blue-sandbox/actions/workflows/pytest.yml) [![bashtest](https://github.com/kamangir/blue-sandbox/actions/workflows/bashtest.yml/badge.svg)](https://github.com/kamangir/blue-sandbox/actions/workflows/bashtest.yml) [![PyPI version](https://img.shields.io/pypi/v/blue-sandbox.svg)](https://pypi.org/project/blue-sandbox/) [![PyPI - Downloads](https://img.shields.io/pypi/dd/blue-sandbox)](https://pypistats.org/packages/blue-sandbox)
56
56
 
57
- built by 🌀 [`blue_options-4.177.1`](https://github.com/kamangir/awesome-bash-cli), based on 🌀 [`blue_sandbox-5.27.1`](https://github.com/kamangir/blue-sandbox).
57
+ built by 🌀 [`blue_options-4.177.1`](https://github.com/kamangir/awesome-bash-cli), based on 🌀 [`blue_sandbox-5.38.1`](https://github.com/kamangir/blue-sandbox).
@@ -1,5 +1,5 @@
1
- blue_sandbox/README.py,sha256=L3WYBjMK8BGjfdumjgK54fbPrKjuKyOMl-PzIMRa6P4,1295
2
- blue_sandbox/__init__.py,sha256=b5BBC1dNc5cD99i_6w_VV4VePW-VlE55trTdlYLD4NM,322
1
+ blue_sandbox/README.py,sha256=gHxb5Czp9oyNZykiCKtI9Qnx08QJab8Ht9znKxHMkPs,1562
2
+ blue_sandbox/__init__.py,sha256=_N0iUwbHqVqnTGp3O8uMiPUAU9GeVQSbWbrQ783mnrc,322
3
3
  blue_sandbox/__main__.py,sha256=aPRHSpGpk-bDbzhHpfLNsd3y1gGEHpnhoTF-RBweNwc,361
4
4
  blue_sandbox/config.env,sha256=89ao50sGXYWiU-NMV_fUVXAXdTHKKfWV03BY3_p6EOE,25
5
5
  blue_sandbox/env.py,sha256=ljEErQJNy0cdSvPpJ_ziMNvXK6Qlvi_8VBgTqjSm2uk,173
@@ -14,16 +14,23 @@ blue_sandbox/.abcli/aka.sh,sha256=RHDU_JbEEL2B0vvvRJ3NVSsRSEjSu09jNY85n7DLe-k,21
14
14
  blue_sandbox/.abcli/alias.sh,sha256=A2Q2VBfKuAiWc0yRXeDj95lL70elSdDKZTKWPTK-590,117
15
15
  blue_sandbox/.abcli/blue_sandbox.sh,sha256=PGRJOgNGlC3XL5cw4ecZH40LDuc_6NVazTKhCWtZ-3g,233
16
16
  blue_sandbox/.abcli/browse.sh,sha256=f8qa4qDVts2Am6_ldDwNeJXzhBQTk9PUKl0-a9wW1ww,287
17
- blue_sandbox/.abcli/install.sh,sha256=6JWSnXjbNPmEEFUsZrvZEb8VVRiJ_xMzDgu_YBPOAyo,185
17
+ blue_sandbox/.abcli/install.sh,sha256=gRbmZfSMWd7RlmQaaXqQKuzuG9EXXA4at1R3KUfQ-qU,263
18
+ blue_sandbox/.abcli/microsoft_building_damage_assessment.sh,sha256=wIP7BvltFj3Gx5VmSgT6hY67K1BnubELef93HHwKOU0,470
19
+ blue_sandbox/.abcli/microsoft_building_damage_assessment/ingest.sh,sha256=mnBwT7Y5NgGhfcz9q6G56Lya33hrj6qw9gPFHShSRXM,2405
18
20
  blue_sandbox/.abcli/tests/README.sh,sha256=rmJM-BPnTcmpPbJ5GXsF8vd_a84JKryeKkZyVScUing,145
19
21
  blue_sandbox/.abcli/tests/help.sh,sha256=uDJRh3G8LghgFZC_1L5fuRChudpVDDxRLZbovHbyqjY,372
22
+ blue_sandbox/.abcli/tests/microsoft_building_damage_assessment_ingest.sh,sha256=oUUF8Kuyohxiqxo9FLY9EO0qlgkagntgfuFda6niHeM,426
20
23
  blue_sandbox/.abcli/tests/version.sh,sha256=jF8zoJN1eKE3LfDeRVG9uHEosmEVJX6RtKfdioyeN-o,150
21
24
  blue_sandbox/help/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
22
25
  blue_sandbox/help/__main__.py,sha256=3Cqp5oISrZCOUApmwoQoCj_0sQgtkiEkm_ob3LFKzRE,234
23
26
  blue_sandbox/help/functions.py,sha256=Ki0nUGyHKDo2t0WnIVzBwxEVJHyRmHh-hIRv3ohJK3c,431
24
- blue_sandbox/help/microsoft_building_damage_assessment.py,sha256=ebpXrq4SNUx-6h8QNLpmCVMMvQH93L18baapf2OCzcQ,513
25
- blue_sandbox-5.27.1.dist-info/LICENSE,sha256=ogEPNDSH0_dhiv_lT3ifVIdgIzHAqNA_SemnxUfPBJk,7048
26
- blue_sandbox-5.27.1.dist-info/METADATA,sha256=xyt-ZXYkKIOwvQi1BH7jxQSzGSrfsKoJY3oK2YKR67A,2756
27
- blue_sandbox-5.27.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
28
- blue_sandbox-5.27.1.dist-info/top_level.txt,sha256=4D9Cb9QUCaqdYAmBiCwvtlaYBtUYVVxv0Sxcr_pzgS8,13
29
- blue_sandbox-5.27.1.dist-info/RECORD,,
27
+ blue_sandbox/help/microsoft_building_damage_assessment.py,sha256=3Q9oEVe8EyniQ1eue3SN_S95Akr-Yo9jvOHmypLB2uc,785
28
+ blue_sandbox/microsoft_building_damage_assessment/README.py,sha256=AyZs8uYpZ7XSYs--5HkMHwgCfZZM1n_E-YWNZ6ncaO4,842
29
+ blue_sandbox/microsoft_building_damage_assessment/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
30
+ blue_sandbox/microsoft_building_damage_assessment/__main__.py,sha256=rjjr-csHJd2jgO2GDlnAbbQAO_zbaXwA7n6Ce0UX0lM,1009
31
+ blue_sandbox/microsoft_building_damage_assessment/ingest.py,sha256=F5GBHZ6s6QebC-w9e4QsRiQ6ZKxXjFbqckZqV8HDU1s,337
32
+ blue_sandbox-5.38.1.dist-info/LICENSE,sha256=ogEPNDSH0_dhiv_lT3ifVIdgIzHAqNA_SemnxUfPBJk,7048
33
+ blue_sandbox-5.38.1.dist-info/METADATA,sha256=3GdydAPlu3fFv0Xms37GuXMDpMtTGqyTL1mV7pr0DBc,2756
34
+ blue_sandbox-5.38.1.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
35
+ blue_sandbox-5.38.1.dist-info/top_level.txt,sha256=4D9Cb9QUCaqdYAmBiCwvtlaYBtUYVVxv0Sxcr_pzgS8,13
36
+ blue_sandbox-5.38.1.dist-info/RECORD,,