From e3dd53a9d082d1a86bcee1230dfa977cce196ed7 Mon Sep 17 00:00:00 2001 From: ninsbl Date: Fri, 5 Dec 2025 15:36:13 +0100 Subject: [PATCH 1/3] add first STRDS docs --- docs/docs/06_raster_vector_strds_managment.md | 111 +++++++++++++++++- 1 file changed, 109 insertions(+), 2 deletions(-) diff --git a/docs/docs/06_raster_vector_strds_managment.md b/docs/docs/06_raster_vector_strds_managment.md index ea681e5..3cb9cfa 100644 --- a/docs/docs/06_raster_vector_strds_managment.md +++ b/docs/docs/06_raster_vector_strds_managment.md @@ -71,14 +71,14 @@ mapset_name = "test_mapset" # mapset creation locations["nc_spm_08"].create_mapset(mapset_name) -# upload tif +# Upload GeoJSON vector_layer_name = "test" file = "/home/testuser/data/firestations.geojson" locations["nc_spm_08"].mapsets[mapset_name].upload_vector(vector_layer_name, file) print(locations["nc_spm_08"].mapsets[mapset_name].vector_layers.keys()) ``` -Delete a raster layer +Delete a vector layer ``` locations["nc_spm_08"].mapsets[mapset_name].delete_vector(vector_layer_name) print(locations["nc_spm_08"].mapsets[mapset_name].vector_layers.keys()) @@ -86,3 +86,110 @@ print(locations["nc_spm_08"].mapsets[mapset_name].vector_layers.keys()) # delete mapset locations["nc_spm_08"].delete_mapset(mapset_name) ``` + +## Space-Time-Raster-Dataset (STRDS) management + +Create a new, empty STRDS and register raster maps +(here the user mapset will be created before) + +``` +strds_name = "test_strds" + +# Create mapset +mapset_name = "test_strds_mapset" +locations["ECAD"].create_mapset(mapset_name) + +# Create new STRDS +locations["ECAD"] + .mapsets[mapset_name] + .create_strds( + strds_name, + "Title of the STRDS", + "Longer description description of the STRDS", + "absolute", # temporal type of the STRDS + ) + +# Register raster maps in STRDS +locations["ECAD"] + .mapsets[mapset_name] + strds[strds_name].register_raster_layers( + [ + { + "name": "precipitation_yearly_mm_0@PERMANENT", + "start_time": "1951-01-01 00:00:00", + "end_time": "1952-01-01 00:00:00", + }, + { + "name": "precipitation_yearly_mm_1@PERMANENT", + "start_time": "1952-01-01 00:00:00", + "end_time": "1953-01-01 00:00:00", + }, + { + "name": "precipitation_yearly_mm_2@PERMANENT", + "start_time": "1953-01-01 00:00:00", + "end_time": "1954-01-01 00:00:00", + }, + ], + ) +``` + +Get STRDS metadata and list raster maps + +``` +# Get general info +locations["ECAD"] + .mapsets[mapset_name] + strds[strds_name].get_info() + +# Get selected, registered raster maps +locations["ECAD"] + .mapsets[mapset_name] + strds[strds_name].get_strds_raster_layers( + where="start_time >= '1952-01-01 00:00:00'" + ) +``` + +Sample STRDS at point locations + +``` +locations["ECAD"] + .mapsets[mapset_name] + strds[strds_name].sample_strds( + [["id", ,y], ["id",x,y]] + ) +``` + +Compute univariate statistics for areas over an STRDS + +``` +locations["ECAD"] + .mapsets[mapset_name] + strds[strds_name].compute_strds_statistics( + + ) +``` + +Render STRDS + +``` +locations["ECAD"] + .mapsets[mapset_name] + strds[strds_name].render( + { + "n": , + "s": , + "e": , + "w": , + "width": 800, + "height": 600, + "start_time": "1952-01-01 00:00:00", + "end_time": "1954-01-01 00:00:00", + } + ) +``` + + + +``` +# https://actinia.mundialis.de/latest/locations/ECAD/mapsets/PERMANENT/strds/precipitation_1950_2013_yearly_mm +``` From a66c9b1b263db807bbefa796e7209bd02d3b91af Mon Sep 17 00:00:00 2001 From: ninsbl Date: Wed, 4 Mar 2026 12:15:02 +0100 Subject: [PATCH 2/3] bump version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 86227b9..4e82a4c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "actinia-python-client" -version = "0.4.5" +version = "0.5.0" authors = [ { name="Anika Weinmann", email="weinmann@mundialis.de" }, ] From 986f53d7c8fe4afda8a6377a15fef8c86c421c59 Mon Sep 17 00:00:00 2001 From: ninsbl Date: Wed, 4 Mar 2026 12:17:40 +0100 Subject: [PATCH 3/3] use NC as base for examples --- docs/docs/06_raster_vector_strds_managment.md | 92 +++++++++++++------ 1 file changed, 66 insertions(+), 26 deletions(-) diff --git a/docs/docs/06_raster_vector_strds_managment.md b/docs/docs/06_raster_vector_strds_managment.md index 3cb9cfa..b20a4c7 100644 --- a/docs/docs/06_raster_vector_strds_managment.md +++ b/docs/docs/06_raster_vector_strds_managment.md @@ -97,10 +97,10 @@ strds_name = "test_strds" # Create mapset mapset_name = "test_strds_mapset" -locations["ECAD"].create_mapset(mapset_name) +locations["nc_spm_08"].create_mapset(mapset_name) # Create new STRDS -locations["ECAD"] +locations["nc_spm_08"] .mapsets[mapset_name] .create_strds( strds_name, @@ -109,23 +109,57 @@ locations["ECAD"] "absolute", # temporal type of the STRDS ) +# Create sample raster data +expression = "\n".join(f"map_{i}={i} * x()" for i in range(2) +pc = { + "list": [ + { + "id": "g_region_1", + "module": "g.region", + "flags": "p", + "inputs": [ + { + "param": "raster", + "value": "elevation", + }, + ], + }, + { + "id": "r_mapcalc_1", + "module": "r.mapcalc" + "inputs": [ + { + "param": "expression", + "value": expression, + }, + ] + }, + ], + "version": 1, +} +locations["nc_spm_08"] + .mapsets[mapset_name] + .processing_async(pc) + + + # Register raster maps in STRDS -locations["ECAD"] +locations["nc_spm_08"] .mapsets[mapset_name] - strds[strds_name].register_raster_layers( + .strds[strds_name].register_raster_layers( [ { - "name": "precipitation_yearly_mm_0@PERMANENT", + "name": "map_0", "start_time": "1951-01-01 00:00:00", "end_time": "1952-01-01 00:00:00", }, { - "name": "precipitation_yearly_mm_1@PERMANENT", + "name": "map_1", "start_time": "1952-01-01 00:00:00", "end_time": "1953-01-01 00:00:00", }, { - "name": "precipitation_yearly_mm_2@PERMANENT", + "name": "map_2", "start_time": "1953-01-01 00:00:00", "end_time": "1954-01-01 00:00:00", }, @@ -137,14 +171,14 @@ Get STRDS metadata and list raster maps ``` # Get general info -locations["ECAD"] +locations["nc_spm_08"] .mapsets[mapset_name] - strds[strds_name].get_info() + .strds[strds_name].get_info() # Get selected, registered raster maps -locations["ECAD"] +locations["nc_spm_08"] .mapsets[mapset_name] - strds[strds_name].get_strds_raster_layers( + .strds[strds_name].get_strds_raster_layers( where="start_time >= '1952-01-01 00:00:00'" ) ``` @@ -152,29 +186,41 @@ locations["ECAD"] Sample STRDS at point locations ``` -locations["ECAD"] +# Define input points +points = [ + ["point_1", 1, 2,], + ["point_2", 3, 4,], + ] + +# Run sampling +locations["nc_spm_08"] .mapsets[mapset_name] - strds[strds_name].sample_strds( - [["id", ,y], ["id",x,y]] + .strds[strds_name].sample_strds( + points ) ``` Compute univariate statistics for areas over an STRDS ``` -locations["ECAD"] - .mapsets[mapset_name] - strds[strds_name].compute_strds_statistics( +# Define input GeoJSON +geojson = +# Compute univariate statistics from STRDS +locations["nc_spm_08"] + .mapsets[mapset_name] + .strds[strds_name].compute_strds_statistics( + geojson ) ``` Render STRDS ``` -locations["ECAD"] +locations["nc_spm_08"] .mapsets[mapset_name] - strds[strds_name].render( + .strds[strds_name] + .render( { "n": , "s": , @@ -186,10 +232,4 @@ locations["ECAD"] "end_time": "1954-01-01 00:00:00", } ) -``` - - - -``` -# https://actinia.mundialis.de/latest/locations/ECAD/mapsets/PERMANENT/strds/precipitation_1950_2013_yearly_mm -``` +``` \ No newline at end of file