Skip to content

Commit

Permalink
Merge pull request #52 from kamangir/refactors-2024-12-03-22318
Browse files Browse the repository at this point in the history
refactors
  • Loading branch information
kamangir authored Dec 7, 2024
2 parents b52e695 + ca15941 commit 43ac5e1
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 22 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ pip install blue-geo

[![pylint](https://github.com/kamangir/blue-geo/actions/workflows/pylint.yml/badge.svg)](https://github.com/kamangir/blue-geo/actions/workflows/pylint.yml) [![pytest](https://github.com/kamangir/blue-geo/actions/workflows/pytest.yml/badge.svg)](https://github.com/kamangir/blue-geo/actions/workflows/pytest.yml) [![bashtest](https://github.com/kamangir/blue-geo/actions/workflows/bashtest.yml/badge.svg)](https://github.com/kamangir/blue-geo/actions/workflows/bashtest.yml) [![PyPI version](https://img.shields.io/pypi/v/blue-geo.svg)](https://pypi.org/project/blue-geo/) [![PyPI - Downloads](https://img.shields.io/pypi/dd/blue-geo)](https://pypistats.org/packages/blue-geo)

built by 🌀 [`blue_options-4.171.1`](https://github.com/kamangir/awesome-bash-cli), based on 🌐 [`blue_geo-4.810.1`](https://github.com/kamangir/blue-geo).
built by 🌀 [`blue_options-4.173.1`](https://github.com/kamangir/awesome-bash-cli), based on 🌐 [`blue_geo-4.815.1`](https://github.com/kamangir/blue-geo).
2 changes: 2 additions & 0 deletions blue_geo/.abcli/watch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ function blue_geo_watch() {

local job_name="$object_name-job-$(abcli_string_timestamp_short)"

abcli_mlflow_tags_set $object_name job=$job_name

abcli_log "🌐 @geo: watch: $query_object_name: -[ $workflow_options @ $map_options + $reduce_options @ $job_name]-> $object_name"

abcli_clone \
Expand Down
2 changes: 1 addition & 1 deletion blue_geo/.abcli/watch/algo/diff/map.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function blue_geo_watch_algo_diff_map() {
local do_dryrun=$(abcli_option_int "$options" dryrun 0)
local depth=$(abcli_option "$options" depth 2)
local offset=$(abcli_option "$options" offset 0)
local dynamic_range=$(abcli_option "$options" range 100)
local dynamic_range=$(abcli_option "$options" range $BLUE_GEO_WATCH_ALGO_DIFF_MAP_DYNAMIC_RANGE)
local suffix=$(abcli_option "$options" suffix $(abcli_string_timestamp_short))
local do_upload=$(abcli_option_int "$options" upload $(abcli_not do_dryrun))

Expand Down
2 changes: 1 addition & 1 deletion blue_geo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

DESCRIPTION = f"{ICON} AI for a Blue Planet."

VERSION = "4.810.1"
VERSION = "4.815.1"

REPO_NAME = "blue-geo"

Expand Down
1 change: 1 addition & 0 deletions blue_geo/config.env
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ BLUE_GEO_QGIS_TEMPLATE_DATACUBE_SKYFOX_VENUS=SkyFox-Venus-template-v1

BLUE_GEO_TEST_DATACUBE_UKRAINE_TIMEMAP=datacube-ukraine_timemap-v1

BLUE_GEO_WATCH_ALGO_DIFF_MAP_DYNAMIC_RANGE=250
5 changes: 5 additions & 0 deletions blue_geo/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,8 @@
"BLUE_GEO_TEST_DATACUBE_UKRAINE_TIMEMAP",
"",
)

BLUE_GEO_WATCH_ALGO_DIFF_MAP_DYNAMIC_RANGE = os.getenv(
"BLUE_GEO_WATCH_ALGO_DIFF_MAP_DYNAMIC_RANGE",
"250.0",
)
2 changes: 2 additions & 0 deletions blue_geo/tests/test_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ def test_blue_geo_env():
assert env.SKYFOX_ACCESS_TOKEN_URL
assert env.SKYFOX_CLIENT_ID
assert env.SKYFOX_CLIENT_SECRET

assert env.BLUE_GEO_WATCH_ALGO_DIFF_MAP_DYNAMIC_RANGE
22 changes: 11 additions & 11 deletions blue_geo/watch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ watch the planet's story unfold.
- [Google Maps](https://maps.app.goo.gl/kHypmxiEeqdVrBi77): `lat: 56.2036"N`, `lon: 120.8943"W`.
- [reddit](https://www.reddit.com/r/britishcolumbia/comments/1fho5vq/10_days_of_reservoir_filling_at_cache_creek_site/): 10 Days of reservoir filling at Cache Creek - Site C Hydroelectric Project, British Columbia, Canada.

![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-Cache-Creek-2x-wider-2024-11-05/geo-watch-Cache-Creek-2x-wider-2024-11-05-4X.gif?raw=true&random=rn6HImvFsiZgouTK)
![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-Cache-Creek-2x-wider-2024-11-05/geo-watch-Cache-Creek-2x-wider-2024-11-05-4X.gif?raw=true&random=ftza3CzZp09kB4My)
- [`geo-watch-Cache-Creek-2024-10-06-a`](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-Cache-Creek-2024-10-06-a.tar.gz), [gif](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-Cache-Creek-2024-10-06-a/geo-watch-Cache-Creek-2024-10-06-a.gif).
- [`geo-watch-Cache-Creek-2x-wider-2024-10-06-a`](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-Cache-Creek-2x-wider-2024-10-06-a.tar.gz), [gif](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-Cache-Creek-2x-wider-2024-10-06-a/geo-watch-Cache-Creek-2x-wider-2024-10-06-a.gif).
- [`geo-watch-Cache-Creek-2024-11-05`](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-Cache-Creek-2024-11-05.tar.gz), [gif](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-Cache-Creek-2024-11-05/geo-watch-Cache-Creek-2024-11-05.gif).
Expand All @@ -142,30 +142,30 @@ watch the planet's story unfold.
- [RCMP](https://bc-cb.rcmp-grc.gc.ca/ViewPage.action?siteNodeId=2087&languageId=1&contentId=85957): Federal Investigators take down the largest, most sophisticated drug superlab in Canada
- [YouTube](https://youtu.be/t-POttDl8UQ?t=1876)

![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-DrugSuperLab-2024-11-19-13954/geo-watch-DrugSuperLab-2024-11-19-13954-4X.gif?raw=true&random=uNcTT6eiU79qpjul)
![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-DrugSuperLab-2024-11-19-13954/geo-watch-DrugSuperLab-2024-11-19-13954-4X.gif?raw=true&random=GE6O2ON6Ak1FR7KH)
- [`geo-watch-DrugSuperLab-2024-11-19-13954`](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-DrugSuperLab-2024-11-19-13954.tar.gz), [gif](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-DrugSuperLab-2024-11-19-13954/geo-watch-DrugSuperLab-2024-11-19-13954.gif).

## [`Fagradalsfjall`](./targets/md/Fagradalsfjall.md)
- [Google Maps](https://maps.app.goo.gl/zkdc2DNLahc598k48): `lat: 63.9000"N`, `lon: 22.2667"W`.
- [Wikipedia](https://en.wikipedia.org/wiki/Fagradalsfjall): An active tuya volcano formed in the Last Glacial Period on the Reykjanes Peninsula.

![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-2024-09-04-Fagradalsfjall-a/geo-watch-2024-09-04-Fagradalsfjall-a-2X.gif?raw=true&random=pHWe8DacDqZm5LQ0)
![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-2024-09-04-Fagradalsfjall-a/geo-watch-2024-09-04-Fagradalsfjall-a-2X.gif?raw=true&random=uag1Brx3cyQ3SBRV)
- [`geo-watch-2024-09-04-Fagradalsfjall-a`](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-2024-09-04-Fagradalsfjall-a.tar.gz), [gif](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-2024-09-04-Fagradalsfjall-a/geo-watch-2024-09-04-Fagradalsfjall-a.gif).

## [`Jasper`](./targets/md/Jasper.md)
- [Google Maps](https://maps.app.goo.gl/o5tGW4tH5S6j4vso9): `lat: 52.8734"N`, `lon: 118.0814"W`.
- [Parks Canada](https://parks.canada.ca/pn-np/ab/jasper/visit/feu-alert-fire/feudeforet-wildfire): Wildfire status, Jasper Wildfire Complex.
- [Wikipedia](https://en.wikipedia.org/wiki/2024_Jasper_wildfire)

![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-Jasper-2024-11-03/geo-watch-Jasper-2024-11-03-2X.gif?raw=true&random=ARH2RETtBoEF7EpQ)
![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-Jasper-2024-11-03/geo-watch-Jasper-2024-11-03-2X.gif?raw=true&random=rPEHGzMSeLeVXdFL)
- [`geo-watch-2024-09-06-Jasper-a`](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-2024-09-06-Jasper-a.tar.gz), [gif](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-2024-09-06-Jasper-a/geo-watch-2024-09-06-Jasper-a.gif).
- [`geo-watch-Jasper-2024-11-03`](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-Jasper-2024-11-03.tar.gz), [gif](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-Jasper-2024-11-03/geo-watch-Jasper-2024-11-03.gif).

## [`Leonardo`](./targets/md/Leonardo.md)
- [Google Maps](https://maps.app.goo.gl/Zpnj53kVcQQ4fNA17): `lat: 41.8150"N`, `lon: 12.2550"E`.
- [Wikipedia](https://en.wikipedia.org/wiki/Rome_Fiumicino_Airport): The 9th busiest airport in Europe and the world's 46th-busiest airport with over 40.5 million passengers served in 2023.

![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-2024-10-27-16-17-36-12059/geo-watch-2024-10-27-16-17-36-12059-4X.gif?raw=true&random=l3wIeOCuLV8iu1Gg)
![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-2024-10-27-16-17-36-12059/geo-watch-2024-10-27-16-17-36-12059-4X.gif?raw=true&random=YfRQRQq7s6JCHUNe)
- [`test_blue_geo_watch_v4-diff-Leonardo-test`](https://kamangir-public.s3.ca-central-1.amazonaws.com/test_blue_geo_watch_v4-diff-Leonardo-test.tar.gz), [gif](https://kamangir-public.s3.ca-central-1.amazonaws.com/test_blue_geo_watch_v4-diff-Leonardo-test/test_blue_geo_watch_v4-diff-Leonardo-test.gif), [![bashtest](https://github.com/kamangir/blue-geo/actions/workflows/bashtest.yml/badge.svg)](https://github.com/kamangir/blue-geo/actions/workflows/bashtest.yml).
- [`test_blue_geo_watch_v4-modality-Leonardo-test`](https://kamangir-public.s3.ca-central-1.amazonaws.com/test_blue_geo_watch_v4-modality-Leonardo-test.tar.gz), [gif](https://kamangir-public.s3.ca-central-1.amazonaws.com/test_blue_geo_watch_v4-modality-Leonardo-test/test_blue_geo_watch_v4-modality-Leonardo-test.gif), [![bashtest](https://github.com/kamangir/blue-geo/actions/workflows/bashtest.yml/badge.svg)](https://github.com/kamangir/blue-geo/actions/workflows/bashtest.yml).
- [`geo-watch-2024-09-30-Leonardo-g`](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-2024-09-30-Leonardo-g.tar.gz), [gif](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-2024-09-30-Leonardo-g/geo-watch-2024-09-30-Leonardo-g.gif).
Expand All @@ -177,21 +177,21 @@ watch the planet's story unfold.
- [Google Maps](https://maps.app.goo.gl/vcCRk16tHBPxB3a47): `lat: 37.7510"N`, `lon: 14.9934"E`.
- [Wikipedia](https://en.wikipedia.org/wiki/Mount_Etna): An active stratovolcano on the east coast of Sicily, Italy.

![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-2024-09-04-Mount-Etna-a/geo-watch-2024-09-04-Mount-Etna-a-2X.gif?raw=true&random=O0T8uUy8c0cm6s64)
![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-2024-09-04-Mount-Etna-a/geo-watch-2024-09-04-Mount-Etna-a-2X.gif?raw=true&random=vLXEZc9C0YgSLLta)
- [`geo-watch-2024-09-04-Mount-Etna-a`](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-2024-09-04-Mount-Etna-a.tar.gz), [gif](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-2024-09-04-Mount-Etna-a/geo-watch-2024-09-04-Mount-Etna-a.gif).

## `Silver-Peak`
- [Google Maps](https://maps.app.goo.gl/SxT1z4LgLUTSVNp89): `lat: 46.1101"N`, `lon: 81.2822"W`.
- [Wikipedia](https://en.wikipedia.org/wiki/Silver_Peak_(Ontario)): Silver Peak is a mountain located at Killarney Provincial Park, Ontario, Canada.
- [pdf](https://files.ontario.ca/ndmnrf-geotours-1/ndmnrf-geotours-killarney-en-2021-12-13.pdf): Famous Canadian Shield White Mountains and Pink Shores.

![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-Silver-Peak-2024-10-12-a/geo-watch-Silver-Peak-2024-10-12-a-4X.gif?raw=true&random=kVTD8p3A2BeSG0ub)
![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-Silver-Peak-2024-10-12-a/geo-watch-Silver-Peak-2024-10-12-a-4X.gif?raw=true&random=bq4RKZHVF4h7AZKs)
- [`geo-watch-Silver-Peak-2024-10-12-a`](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-Silver-Peak-2024-10-12-a.tar.gz), [gif](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-Silver-Peak-2024-10-12-a/geo-watch-Silver-Peak-2024-10-12-a.gif).

## `bellingcat-2024-09-27-nagorno-karabakh`
- [Bellingcat](https://www.bellingcat.com/news/mena/2024/09/27/nagorno-karabakh-satellite-imagery-shows-city-wide-ransacking/): In the regional capital of Nagorno-Karabakh, satellite imagery reveals hundreds of incidents of what appears to be ransacking across the city of Khankendi, known as Stepanakert to Armenians.

![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-bellingcat-2024-09-27-nagorno-karabakh-6X-2024-10-06-a/geo-watch-bellingcat-2024-09-27-nagorno-karabakh-6X-2024-10-06-a-4X.gif?raw=true&random=NNaPj59fl9glVjJu)
![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-bellingcat-2024-09-27-nagorno-karabakh-6X-2024-10-06-a/geo-watch-bellingcat-2024-09-27-nagorno-karabakh-6X-2024-10-06-a-4X.gif?raw=true&random=IdtL0XKzdXyq1UAt)
- [`bellingcat-2024-09-27-nagorno-karabakh-2024-10-01-c-b`](https://kamangir-public.s3.ca-central-1.amazonaws.com/bellingcat-2024-09-27-nagorno-karabakh-2024-10-01-c-b.tar.gz), [gif](https://kamangir-public.s3.ca-central-1.amazonaws.com/bellingcat-2024-09-27-nagorno-karabakh-2024-10-01-c-b/bellingcat-2024-09-27-nagorno-karabakh-2024-10-01-c-b.gif).
- [`bellingcat-2024-09-27-nagorno-karabakh-b`](https://kamangir-public.s3.ca-central-1.amazonaws.com/bellingcat-2024-09-27-nagorno-karabakh-b.tar.gz), [gif](https://kamangir-public.s3.ca-central-1.amazonaws.com/bellingcat-2024-09-27-nagorno-karabakh-b/bellingcat-2024-09-27-nagorno-karabakh-b.gif).
- [`bellingcat-2024-09-27-nagorno-karabakh-6X-a`](https://kamangir-public.s3.ca-central-1.amazonaws.com/bellingcat-2024-09-27-nagorno-karabakh-6X-a.tar.gz), [gif](https://kamangir-public.s3.ca-central-1.amazonaws.com/bellingcat-2024-09-27-nagorno-karabakh-6X-a/bellingcat-2024-09-27-nagorno-karabakh-6X-a.gif).
Expand All @@ -201,7 +201,7 @@ watch the planet's story unfold.
## [`burning-man-2024`](./targets/md/burning-man-2024.md)
- [Google Maps](https://maps.app.goo.gl/e58UsDThr8ryqCRa8): `lat: 40.7864"N`, `lon: 119.2065"W`.

![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-2024-09-04-burning-man-2024-a/geo-watch-2024-09-04-burning-man-2024-a-2X.gif?raw=true&random=gffY9il9stqnnizJ)
![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-2024-09-04-burning-man-2024-a/geo-watch-2024-09-04-burning-man-2024-a-2X.gif?raw=true&random=BPknNFWgbX7XJ5CQ)
- [`geo-watch-2024-09-04-burning-man-2024-a`](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-2024-09-04-burning-man-2024-a.tar.gz), [gif](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-2024-09-04-burning-man-2024-a/geo-watch-2024-09-04-burning-man-2024-a.gif).

## [`chilcotin-river-landslide`](./targets/md/chilcotin-river-landslide.md)
Expand All @@ -210,7 +210,7 @@ watch the planet's story unfold.
- [Reddit](https://www.reddit.com/r/britishcolumbia/comments/1eh9eql/before_and_after_satellite_images_of_the/): Before and after satellite images of the Chilcotin River landslide.
- [portal](https://chilcotin-river-landslide-2024-bcgov03.hub.arcgis.com/): Chilcotin River Landslide Information Portal, source of ⬆️ image.

![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-Chilcotin-2024-11-03/geo-watch-Chilcotin-2024-11-03-4X.gif?raw=true&random=pLv7CUIJ7mabEiPt)
![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-Chilcotin-2024-11-03/geo-watch-Chilcotin-2024-11-03-4X.gif?raw=true&random=yWhiHCUyqC0Z205n)
- [`test_blue_geo_watch_v4-modality-chilcotin-river-landslide-test`](https://kamangir-public.s3.ca-central-1.amazonaws.com/test_blue_geo_watch_v4-modality-chilcotin-river-landslide-test.tar.gz), [gif](https://kamangir-public.s3.ca-central-1.amazonaws.com/test_blue_geo_watch_v4-modality-chilcotin-river-landslide-test/test_blue_geo_watch_v4-modality-chilcotin-river-landslide-test.gif), [![bashtest](https://github.com/kamangir/blue-geo/actions/workflows/bashtest.yml/badge.svg)](https://github.com/kamangir/blue-geo/actions/workflows/bashtest.yml).
- [`geo-watch-2024-08-31-chilcotin-c`](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-2024-08-31-chilcotin-c.tar.gz), [gif](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-2024-08-31-chilcotin-c/geo-watch-2024-08-31-chilcotin-c.gif), L1C and L2A mixed, `2024-07-30/2024-08-09`.
- [`geo-watch-2024-09-01-chilcotin-a`](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-2024-09-01-chilcotin-a.tar.gz), [gif](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-2024-09-01-chilcotin-a/geo-watch-2024-09-01-chilcotin-a.gif).
Expand All @@ -219,7 +219,7 @@ watch the planet's story unfold.

## `elkhema ⛺️`

![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-elkhema-2024-2024-10-05-a-b/geo-watch-elkhema-2024-2024-10-05-a-b-4X.gif?raw=true&random=5OzWy5IHGvlLNQMW)
![image](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-elkhema-2024-2024-10-05-a-b/geo-watch-elkhema-2024-2024-10-05-a-b-4X.gif?raw=true&random=EmtMcyPC4jvSN6CK)
- [`geo-watch-elkhema-2024-2024-10-05-a-b`](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-elkhema-2024-2024-10-05-a-b.tar.gz), [gif](https://kamangir-public.s3.ca-central-1.amazonaws.com/geo-watch-elkhema-2024-2024-10-05-a-b/geo-watch-elkhema-2024-2024-10-05-a-b.gif).


3 changes: 2 additions & 1 deletion blue_geo/watch/algo/diff/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from blueness.argparse.generic import sys_exit

from blue_geo import NAME
from blue_geo.env import BLUE_GEO_WATCH_ALGO_DIFF_MAP_DYNAMIC_RANGE
from blue_geo.watch.algo.diff.map import map_function
from blue_geo.watch.algo.modality.reduce import reduce_function
from blue_geo.logger import logger
Expand Down Expand Up @@ -44,7 +45,7 @@
parser.add_argument(
"--dynamic_range",
type=float,
default=100.0,
default=float(BLUE_GEO_WATCH_ALGO_DIFF_MAP_DYNAMIC_RANGE),
)
args = parser.parse_args()

Expand Down
26 changes: 19 additions & 7 deletions blue_geo/watch/algo/diff/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
from tqdm import trange
import numpy as np
import cv2
import math

from blueness import module
from blue_options import string
from blue_objects.logger.matrix import log_matrix, log_matrix_hist
from blue_objects import file, objects
from blue_objects.metadata import post_to_object
from blue_objects.graphics.signature import add_signature
from blueflow import fullname as blueflow_fullname

from blue_geo import fullname
from blue_geo import NAME
from blue_geo.host import signature
from blue_geo.env import BLUE_GEO_WATCH_ALGO_DIFF_MAP_DYNAMIC_RANGE
from blue_geo.catalog.generic import GenericDatacube
from blue_geo.watch.workflow.common import load_watch
from blue_geo.logger import logger
Expand All @@ -26,7 +26,7 @@ def map_function(
suffix: str,
offset: str,
depth: int,
dynamic_range: float = 100.0,
dynamic_range: float = float(BLUE_GEO_WATCH_ALGO_DIFF_MAP_DYNAMIC_RANGE),
line_width: int = 80,
colorbar_width: int = 20,
min_width: int = 1200,
Expand Down Expand Up @@ -88,6 +88,16 @@ def map_function(
else:
target_filename = filename

if not file.copy(
filename,
objects.path_of(
file.name_and_extension(filename),
object_name,
),
):
success = False
break

baseline_metadata = {}
if success:
success, baseline_image, baseline_metadata = GenericDatacube.load_geoimage(
Expand All @@ -105,8 +115,6 @@ def map_function(
diff_image = np.squeeze(
target_image.astype(np.float32) - baseline_image.astype(np.float32)
)
diff_image[diff_image < -dynamic_range] = -dynamic_range
diff_image[diff_image > dynamic_range] = dynamic_range

diff_image_pretty_shape = string.pretty_shape_of_matrix(diff_image)

Expand Down Expand Up @@ -168,7 +176,11 @@ def map_function(
)
),
],
footer=[target.one_liner],
footer=[
target.one_liner,
fullname(),
blueflow_fullname(),
],
filename=diff_filename,
dynamic_range=(-dynamic_range, dynamic_range),
line_width=line_width,
Expand Down

0 comments on commit 43ac5e1

Please sign in to comment.