Skip to content

Commit

Permalink
Merge pull request #6 from kamangir/ukraine_timemap-2024-08-04-46875
Browse files Browse the repository at this point in the history
ukraine-timemap datacubes
  • Loading branch information
kamangir authored Aug 5, 2024
2 parents b3262db + 9e3dc96 commit 259c89d
Show file tree
Hide file tree
Showing 38 changed files with 512 additions and 383 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ pip install blue-geo

| | |
| --- | --- |
| 🌐[`QGIS`](https://github.com/kamangir/blue-geo/blob/main/blue_geo/.abcli/QGIS/README.md) [![image](https://raw.githubusercontent.com/kamangir/assets/main/blue-geo/QGIS.jpg)](https://github.com/kamangir/blue-geo/blob/main/blue_geo/.abcli/QGIS/README.md) an AI terraform for [QGIS](https://www.qgis.org/). | 🧊[`datacube`](https://github.com/kamangir/blue-geo/tree/main/blue_geo/.abcli/datacube) [![image](https://github.com/kamangir/assets/blob/main/blue-geo/datacube.png?raw=true)](https://github.com/kamangir/blue-geo/tree/main/blue_geo/.abcli/datacube) a datacube for geospatial AI |
| 🌐[`firms-area`](https://github.com/kamangir/blue-geo/tree/main/blue_geo/.abcli/catalog/firms) [![image](https://raw.githubusercontent.com/kamangir/assets/main/blue-geo/datacube-firms_area.jpg)](https://github.com/kamangir/blue-geo/tree/main/blue_geo/.abcli/catalog/firms) Fire Information for Resource Management System ([FIRMS](https://firms.modaps.eosdis.nasa.gov)) datacubes. | 🇺🇦[`ukraine-timemap`](https://github.com/kamangir/blue-geo/blob/main/blue_geo/.abcli/ukraine-timemap/README.md) [![image](https://github.com/kamangir/assets/blob/main/nbs/ukraine-timemap/QGIS.png?raw=true)](https://github.com/kamangir/blue-geo/blob/main/blue_geo/.abcli/ukraine-timemap/README.md) `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). |
| 🌈[`vancouver-watching`](https://github.com/kamangir/Vancouver-Watching) [![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/test_vancouver_watching_ingest/animation.gif?raw=true)](https://github.com/kamangir/Vancouver-Watching) 🌈 Vancouver watching with AI, last build: [🔗](https://kamangir-public.s3.ca-central-1.amazonaws.com/test_vancouver_watching_ingest/animation.gif). | |
| 🌐[`QGIS`](https://github.com/kamangir/blue-geo/blob/main/blue_geo/.abcli/QGIS/README.md) [![image](https://raw.githubusercontent.com/kamangir/assets/main/blue-geo/QGIS.jpg)](https://github.com/kamangir/blue-geo/blob/main/blue_geo/.abcli/QGIS/README.md) an AI terraform for [QGIS](https://www.qgis.org/). | 🧊[`datacube`](https://github.com/kamangir/blue-geo/tree/main/blue_geo/.abcli/datacube) [![image](https://github.com/kamangir/assets/blob/main/blue-geo/datacube.png?raw=true)](https://github.com/kamangir/blue-geo/tree/main/blue_geo/.abcli/datacube) a datacube for geospatial AI. |
| 🌐[`firms-area`](https://github.com/kamangir/blue-geo/tree/main/blue_geo/.abcli/catalog/firms) [![image](https://raw.githubusercontent.com/kamangir/assets/main/blue-geo/datacube-firms_area.jpg)](https://github.com/kamangir/blue-geo/tree/main/blue_geo/.abcli/catalog/firms) catalog: Fire Information for Resource Management System ([FIRMS](https://firms.modaps.eosdis.nasa.gov)). | 🇺🇦[`ukraine-timemap`](https://github.com/kamangir/blue-geo/blob/main/blue_geo/.abcli/catalog/ukraine_timemap) [![image](https://github.com/kamangir/assets/blob/main/nbs/ukraine-timemap/QGIS.png?raw=true)](https://github.com/kamangir/blue-geo/blob/main/blue_geo/.abcli/catalog/ukraine_timemap) catalog: [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). |
| 🌈[`vancouver-watching`](https://github.com/kamangir/Vancouver-Watching) [![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/test_vancouver_watching_ingest/animation.gif?raw=true)](https://github.com/kamangir/Vancouver-Watching) catalog: Vancouver watching with AI, last build: [🔗](https://kamangir-public.s3.ca-central-1.amazonaws.com/test_vancouver_watching_ingest/animation.gif). | |

---

Expand All @@ -23,4 +23,4 @@ pip install blue-geo
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).

---
built by [`abcli-9.187.1-current`](https://github.com/kamangir/awesome-bash-cli), based on [`blue_geo-4.178.1`](https://github.com/kamangir/blue-geo).
built by [`abcli-9.188.1-current`](https://github.com/kamangir/awesome-bash-cli), based on [`blue_geo-4.206.1`](https://github.com/kamangir/blue-geo).
4 changes: 0 additions & 4 deletions blue_geo/.abcli/aka.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
#! /usr/bin/env bash

function ukraine() {
ukraine_timemap "$@"
}
2 changes: 2 additions & 0 deletions blue_geo/.abcli/alias.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@

alias @catalog=blue_geo_catalog
alias @datacube=blue_geo_datacube

alias @geo=blue_geo
1 change: 0 additions & 1 deletion blue_geo/.abcli/blue_geo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ function blue_geo() {
blue_geo_catalog "$@"
blue_geo_datacube "$@"
blue_geo_QGIS "$@"
ukraine_timemap "$@"
return
fi

Expand Down
36 changes: 26 additions & 10 deletions blue_geo/.abcli/catalog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,38 @@

```bash
> @catalog help
@catalog browse \
<catalog> \
[<args>]
. browse <catalog>.
@catalog browse firms \
[map_key|area]
. browse firms.
@catalog browse ukraine_timemap \
[dataset|github]
. browse ukraine-timemap.
@catalog get \
[list_of_collections] \
[--catalog <catalog>] \
[--count 1] \
[--delim ,] \
[--log 0]
. get list of collections in <catalog>.
@catalog list \
[-] \
[--delim space] \
[--log 0]
. list catalogs.
@catalog query \
<catalog> \
@catalog query firms \
[download,ingest,select,upload] \
[-|<object-name>] \
[area,dryrun] \
[--area east|north|south|west|world]\
[--date yyyy-mm-dd]\
[--depth 1..10]\
[--source LANDSAT_NRT|MODIS_NRT|MODIS_SP|VIIRS_NOAA20_NRT|VIIRS_NOAA21_NRT|VIIRS_SNPP_NRT|VIIRS_SNPP_SP]
. firms/area -query-> <object-name>.
@catalog query ukraine_timemap \
[download,ingest,select,upload] \
[-|<object-name>] \
[<query-options>] \
[<args>]
. <catalog> -query-> <object-name>.
[dryrun]
. ukraine_timemap -query-> <object-name>.
@catalog query read \
[all,download,len] \
[.|<object-name>] \
Expand All @@ -33,4 +49,4 @@
. read query results in <object-name>.
```

supported `<catalog>`s: [firms](./firms/).
supported `<catalog>`s: [firms](./firms/), [ukraine_timemap](./ukraine_timemap/).
26 changes: 5 additions & 21 deletions blue_geo/.abcli/catalog/firms/ingest.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,9 @@
#! /usr/bin/env bash

function blue_geo_catalog_ingest_firms() {
local ingest_options=$1

local options=$2

if [ $(abcli_option_int "$options" help 0) == 1 ]; then
ingest_options=$blue_geo_datacube_ingest_options
options="dryrun"
abcli_show_usage "@datacube ingest firms$ABCUL[$ingest_options]$ABCUL[.|<object-name>]$ABCUL[$options]$ABCUL[<args>]" \
"firms -ingest-> <object-name>."
return
fi

local do_dryrun=$(abcli_option_int "$options" dryrun 0)

local object_name=$(abcli_clarify_object $2 .)

abcli_eval dryrun=$do_dryrun \
python3 -m blue_geo.catalog.firms \
ingest \
--object_name $object_name \
"${@:3}"
blue_geo_catalog_ingest_generic \
,$1 \
"$2" \
$3,catalog=firms \
"${@:4}"
}
26 changes: 26 additions & 0 deletions blue_geo/.abcli/catalog/generic/ingest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#! /usr/bin/env bash

function blue_geo_catalog_ingest_generic() {
local ingest_options=$1

local options=$3
local catalog=$(abcli_option "$options" catalog generic)

if [ $(abcli_option_int "$options" help 0) == 1 ]; then
ingest_options=$blue_geo_datacube_ingest_options
options="dryrun"
abcli_show_usage "@datacube ingest $catalog$ABCUL[$ingest_options]$ABCUL[.|<object-name>]$ABCUL[$options]$ABCUL[<args>]" \
"$catalog -ingest-> <object-name>."
return
fi

local do_dryrun=$(abcli_option_int "$options" dryrun 0)

local object_name=$(abcli_clarify_object $2 .)

abcli_eval dryrun=$do_dryrun \
python3 -m blue_geo.catalog.$catalog \
ingest \
--object_name $object_name \
"${@:4}"
}
38 changes: 38 additions & 0 deletions blue_geo/.abcli/catalog/ukraine_timemap/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 🇺🇦 ukraine-timemap

the `ukraine-timemap` catalog covers 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).

## query

```
> @catalog query ukraine_timemap help
@catalog query ukraine_timemap \
[download,ingest,select,upload] \
[-|<object-name>] \
[dryrun]
. ukraine_timemap -query-> <object-name>.
```

## example use

```bash
@catalog query ukraine_timemap \
ingest,select -

@open QGIS .
@publish tar .
```

![image](https://github.com/kamangir/assets/blob/main/nbs/ukraine-timemap/ingest_log.png?raw=true)

latest ingested object: [ukraine-timemap.tar.gz](https://kamangir-public.s3.ca-central-1.amazonaws.com/ukraine_timemap.tar.gz),

sandbox: [ukraine-timemap/sandbox.ipynb](./notebooks/ukraine-timemap/sandbox.ipynb).

last build [🔗](https://kamangir-public.s3.ca-central-1.amazonaws.com/ukraine_timemap/ukraine_timemap.png)

![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/ukraine_timemap/ukraine_timemap.png)

![image](https://github.com/kamangir/assets/blob/main/nbs/ukraine-timemap/QGIS.png?raw=true)

more: https://arash-kamangir.medium.com/%EF%B8%8F-openai-experiments-93-bf0cee062693
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#! /usr/bin/env bash

function ukraine_timemap_browse() {
function blue_geo_catalog_browse_ukraine_timemap() {
local options=$1

if [ $(abcli_option_int "$options" help 0) == 1 ]; then
options="dataset|github"
abcli_show_usage "ukraine_timemap browse$ABCUL[$options]" \
abcli_show_usage "@catalog browse ukraine_timemap$ABCUL[$options]" \
"browse ukraine-timemap."
return
fi
Expand Down
9 changes: 9 additions & 0 deletions blue_geo/.abcli/catalog/ukraine_timemap/ingest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#! /usr/bin/env bash

function blue_geo_catalog_ingest_ukraine_timemap() {
blue_geo_catalog_ingest_generic \
,$1 \
"$2" \
$3,catalog=ukraine_timemap \
"${@:4}"
}
36 changes: 36 additions & 0 deletions blue_geo/.abcli/catalog/ukraine_timemap/query.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#! /usr/bin/env bash

function blue_geo_catalog_query_ukraine_timemap() {
local options=$1

blue_geo_catalog_query_generic \
$options,catalog=ukraine_timemap \
"${@:2}"
}

function blue_geo_catalog_query_ukraine_timemap_ukraine_timemap() {
local options=$1

local catalog="ukraine_timemap"

if [ $(abcli_option_int "$options" help 0) == 1 ]; then
options="dryrun"
abcli_show_usage "@catalog query $catalog$ABCUL[$blue_geo_catalog_query_options]$ABCUL[-|<object-name>]$ABCUL[$options]" \
"$catalog -query-> <object-name>."
return
fi

local do_dryrun=$(abcli_option_int "$options" dryrun 0)

local object_name=$(abcli_clarify_object $2 -)

abcli_log "🌐 query: $catalog -> $object_name"

abcli_eval dryrun=$do_dryrun \
python3 -m blue_geo.catalog.$catalog \
query \
--object_name $object_name \
"${@:3}"

return 0
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,27 @@

function test_blue_geo_ukraine_timemap() {
local options=$1
local do_dryrun=$(abcli_option_int "$options" dryrun 0)
local do_upload=$(abcli_option_int "$options" upload 0)

local object_name=ukraine-timemap-$(abcli_string_timestamp_short)

abcli_eval dryrun=$do_dryrun \
ukraine_timemap ingest \
upload=$do_upload,$2 \
$object_name \
"${@:3}"
blue_geo catalog query ukraine_timemap \
ingest \
$object_name
[[ $? -ne 0 ]] && return 1

abcli_assert \
$(blue_geo catalog query read len $object_name) \
1
[[ $? -ne 0 ]] && return 1

local datacube_id=$(blue_geo catalog query read - $object_name)

abcli_publish \
as=ukraine_timemap,tar \
$object_name
$datacube_id
[[ $? -ne 0 ]] && return 1

abcli_publish \
as=ukraine_timemap,suffix=.png \
$object_name
$datacube_id
}
4 changes: 4 additions & 0 deletions blue_geo/.abcli/tests/datacube_get.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@ function test_blue_geo_datacube_get_template() {
abcli_assert \
$(blue_geo_datacube_get template $BLUE_GEO_TEST_DATACUBE_FIRMS_AREA) \
$BLUE_GEO_FIRMS_AREA_QGIS_TEMPLATE

abcli_assert \
$(blue_geo_datacube_get template $BLUE_GEO_TEST_DATACUBE_UKRAINE_TIMEMAP) \
$BLUE_GEO_UKRAINE_TIMEMAP_QGIS_TEMPLATE
}
3 changes: 1 addition & 2 deletions blue_geo/.abcli/tests/help.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ function test_blue_geo_help() {
"blue_geo datacube ingest" \
"blue_geo QGIS" \
"blue_geo QGIS_expressions" \
"blue_geo QGIS_server" \
"ukraine_timemap"; do
"blue_geo QGIS_server"; do
abcli_eval ,$options \
$module help
[[ $? -ne 0 ]] && return 1
Expand Down
27 changes: 0 additions & 27 deletions blue_geo/.abcli/ukraine-timemap.sh

This file was deleted.

40 changes: 0 additions & 40 deletions blue_geo/.abcli/ukraine-timemap/README.md

This file was deleted.

Loading

0 comments on commit 259c89d

Please sign in to comment.