@@ -97,10 +97,10 @@ strds_name = "test_strds"
9797
9898# Create mapset
9999mapset_name = "test_strds_mapset"
100- locations["ECAD "].create_mapset(mapset_name)
100+ locations["nc_spm_08 "].create_mapset(mapset_name)
101101
102102# Create new STRDS
103- locations["ECAD "]
103+ locations["nc_spm_08 "]
104104 .mapsets[mapset_name]
105105 .create_strds(
106106 strds_name,
@@ -109,23 +109,57 @@ locations["ECAD"]
109109 "absolute", # temporal type of the STRDS
110110 )
111111
112+ # Create sample raster data
113+ expression = "\n".join(f"map_{i}={i} * x()" for i in range(2)
114+ pc = {
115+ "list": [
116+ {
117+ "id": "g_region_1",
118+ "module": "g.region",
119+ "flags": "p",
120+ "inputs": [
121+ {
122+ "param": "raster",
123+ "value": "elevation",
124+ },
125+ ],
126+ },
127+ {
128+ "id": "r_mapcalc_1",
129+ "module": "r.mapcalc"
130+ "inputs": [
131+ {
132+ "param": "expression",
133+ "value": expression,
134+ },
135+ ]
136+ },
137+ ],
138+ "version": 1,
139+ }
140+ locations["nc_spm_08"]
141+ .mapsets[mapset_name]
142+ .processing_async(pc)
143+
144+
145+
112146# Register raster maps in STRDS
113- locations["ECAD "]
147+ locations["nc_spm_08 "]
114148 .mapsets[mapset_name]
115- strds[strds_name].register_raster_layers(
149+ . strds[strds_name].register_raster_layers(
116150 [
117151 {
118- "name": "precipitation_yearly_mm_0@PERMANENT ",
152+ "name": "map_0 ",
119153 "start_time": "1951-01-01 00:00:00",
120154 "end_time": "1952-01-01 00:00:00",
121155 },
122156 {
123- "name": "precipitation_yearly_mm_1@PERMANENT ",
157+ "name": "map_1 ",
124158 "start_time": "1952-01-01 00:00:00",
125159 "end_time": "1953-01-01 00:00:00",
126160 },
127161 {
128- "name": "precipitation_yearly_mm_2@PERMANENT ",
162+ "name": "map_2 ",
129163 "start_time": "1953-01-01 00:00:00",
130164 "end_time": "1954-01-01 00:00:00",
131165 },
@@ -137,44 +171,56 @@ Get STRDS metadata and list raster maps
137171
138172```
139173# Get general info
140- locations["ECAD "]
174+ locations["nc_spm_08 "]
141175 .mapsets[mapset_name]
142- strds[strds_name].get_info()
176+ . strds[strds_name].get_info()
143177
144178# Get selected, registered raster maps
145- locations["ECAD "]
179+ locations["nc_spm_08 "]
146180 .mapsets[mapset_name]
147- strds[strds_name].get_strds_raster_layers(
181+ . strds[strds_name].get_strds_raster_layers(
148182 where="start_time >= '1952-01-01 00:00:00'"
149183 )
150184```
151185
152186Sample STRDS at point locations
153187
154188```
155- locations["ECAD"]
189+ # Define input points
190+ points = [
191+ ["point_1", 1, 2,],
192+ ["point_2", 3, 4,],
193+ ]
194+
195+ # Run sampling
196+ locations["nc_spm_08"]
156197 .mapsets[mapset_name]
157- strds[strds_name].sample_strds(
158- [["id", ,y], ["id",x,y]]
198+ . strds[strds_name].sample_strds(
199+ points
159200 )
160201```
161202
162203Compute univariate statistics for areas over an STRDS
163204
164205```
165- locations["ECAD"]
166- .mapsets[mapset_name]
167- strds[strds_name].compute_strds_statistics(
206+ # Define input GeoJSON
207+ geojson =
168208
209+ # Compute univariate statistics from STRDS
210+ locations["nc_spm_08"]
211+ .mapsets[mapset_name]
212+ .strds[strds_name].compute_strds_statistics(
213+ geojson
169214 )
170215```
171216
172217Render STRDS
173218
174219```
175- locations["ECAD "]
220+ locations["nc_spm_08 "]
176221 .mapsets[mapset_name]
177- strds[strds_name].render(
222+ .strds[strds_name]
223+ .render(
178224 {
179225 "n": ,
180226 "s": ,
@@ -186,10 +232,4 @@ locations["ECAD"]
186232 "end_time": "1954-01-01 00:00:00",
187233 }
188234 )
189- ```
190-
191-
192-
193- ```
194- # https://actinia.mundialis.de/latest/locations/ECAD/mapsets/PERMANENT/strds/precipitation_1950_2013_yearly_mm
195- ```
235+ ```
0 commit comments