-
Notifications
You must be signed in to change notification settings - Fork 37
/
ows_cfg_example.py
2103 lines (2033 loc) · 86.7 KB
/
ows_cfg_example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# pylint: skip-file
# This file is part of datacube-ows, part of the Open Data Cube project.
# See https://opendatacube.org for more information.
#
# Copyright (c) 2017-2023 OWS Contributors
# SPDX-License-Identifier: Apache-2.0
# Example configuration file for datacube_ows.
#
# The file was originally the only documentation for the configuration file format.
# Detailed and up-to-date formal documentation is now available and this this file
# is no longer actively maintained and may contain errors or obsolete elements.
#
# https://datacube-ows.readthedocs.io/en/latest/configuration.html
# THIS EXAMPLE FILE
#
# In this example file, there are some reusable code chunks defined at the top. The actual
# config tree is defined as ows_cfg below the reusable chunks.
#
# REUSABLE CONFIG FRAGMENTS - Band alias maps
landsat8_bands = {
# Supported bands, mapping native band names to a list of possible aliases.
# 1. Aliases must be unique for the product.
# 2. Band aliases can be used anywhere in the configuration that refers to bands by name.
# 3. The native band name MAY be explicitly declared as an alias for the band, but are always treated as
# a valid alias.
# 4. The band labels used in GetFeatureInfo and WCS responses will be the first declared alias (or the native name
# if no aliases are declared.)
# 5. Bands NOT listed here will not be included in the GetFeatureInfo output and cannot be referenced
# elsewhere in the configuration.
# 6. If not specified for a product, defaults to all available bands, using only their native names.
# 7. The following are reserved words that may not be used as aliases. (N.B. If they occur as a native
# band name, an alias should be declared and used in the config in preference to the native name):
# scale_range
# function
#
"red": [],
"green": [],
"blue": ["near_blue"],
"nir": ["near_infrared"],
"swir1": ["shortwave_infrared_1", "near_shortwave_infrared"],
"swir2": ["shortwave_infrared_2", "far_shortwave_infrared"],
"coastal_aerosol": ["far_blue"],
# N.B. Include pixel quality bands if they are in the main data product.
}
sentinel2_bands = {
"nbar_coastal_aerosol": ['nbar_far_blue'],
"nbar_blue": [],
"nbar_green": [],
"nbar_red": [],
"nbar_red_edge_1": [],
"nbar_red_edge_2": [],
"nbar_red_edge_3": [],
"nbar_nir_1": ["nbar_near_infrared_1"],
"nbar_nir_2": ["nbar_near_infrared_2"],
"nbar_swir_2": ["nbar_shortwave_infrared_2"],
"nbar_swir_3": ["nbar_shortwave_infrared_3"],
"nbart_coastal_aerosol": ['coastal_aerosol', 'nbart_far_blue', 'far_blue'],
"nbart_blue": ['blue'],
"nbart_green": ['green'],
"nbart_red": ['red'],
"nbart_red_edge_1": ['red_edge_1'],
"nbart_red_edge_2": ['red_edge_2'],
"nbart_red_edge_3": ['red_edge_3'],
"nbart_nir_1": ["nir_1", "nbart_near_infrared_1"],
"nbart_nir_2": ["nir_2", "nbart_near_infrared_2"],
"nbart_swir_2": ["swir_2", "nbart_shortwave_infrared_2"],
"nbart_swir_3": ["swir_3", "nbart_shortwave_infrared_3"],
# N.B. Include pixel quality bands if they are in the main data product.
"quality": [],
}
# REUSABLE CONFIG FRAGMENTS - Style definitions
# Examples of styles which are linear combinations of the available spectral bands.
style_rgb = {
# Machine readable style name. (required. Must be unique within a layer.)
"name": "simple_rgb",
# Human readable style title (required. Must be unique within a layer.)
"title": "Simple RGB",
# Abstract - a longer human readable style description. (required. Must be unique within a layer.)
"abstract": "Simple true-colour image, using the red, green and blue bands",
# Components section is required for linear combination styles.
# The component keys MUST be "red", "green" and "blue" (and optionally "alpha")
"components": {
"red": {
# Band aliases may be used here.
# Values are multipliers. The should add to 1.0 for each component to preserve overall brightness levels,
# but this is not enforced.
"red": 1.0
},
"green": {
"green": 1.0
},
"blue": {
"blue": 1.0
}
},
# The raw band value range to be compressed to an 8 bit range for the output image tiles.
# Band values outside this range are clipped to 0 or 255 as appropriate.
"scale_range": [0.0, 3000.0],
# Legend section is optional for linear combination styles. If not supplied, no legend is displayed
"legend": {
# Whether or not to display a legend for this style.
# Defaults to False for linear combination styles.
"show_legend": True,
# A legend cannot be auto-generated for a linear combination style, so a url pointing to
# legend PNG image must be supplied if 'show_legend' is True.
# Note that legend urls are proxied, not displayed directly to the user.
"url": "http://example.com/custom_style_image.png"
}
}
style_rgb_cloudmask = {
"name": "cloud_masked_rgb",
"title": "Simple RGB with cloud masking",
"abstract": "Simple true-colour image, using the red, green and blue bands, with cloud masking",
"components": {
"red": {
"red": 1.0
},
"green": {
"green": 1.0
},
"blue": {
"blue": 1.0
}
},
# PQ masking example
# Pixels with any of the listed flag values are masked out (made transparent).
"pq_masks": [
{
"flags": {
"cloud_acca": "no_cloud",
"cloud_fmask": "no_cloud",
},
},
],
"scale_range": [0.0, 3000.0]
}
style_rgb_cloud_and_shadowmask = {
"name": "cloud_and_shadow_masked_rgb",
"title": "Simple RGB with cloud and cloud shadow masking",
"abstract": "Simple true-colour image, using the red, green and blue bands, with cloud and cloud shadow masking",
"components": {
"red": {
"red": 1.0
},
"green": {
"green": 1.0
},
"blue": {
"blue": 1.0
}
},
# PQ masking example
"pq_masks": [
{
"flags": {
"cloud_acca": "no_cloud",
"cloud_fmask": "no_cloud",
"cloud_shadow_acca": "no_cloud_shadow",
"cloud_shadow_fmask": "no_cloud_shadow",
},
},
],
"scale_range": [0.0, 3000.0]
}
style_ext_rgb = {
"name": "extended_rgb",
"title": "Extended RGB",
"abstract": "Extended true-colour image, incorporating the coastal aerosol band",
"components": {
"red": {
"red": 1.0
},
"green": {
"green": 1.0
},
"blue": {
"blue": 0.6,
"coastal_aerosol": 0.4
}
},
"scale_range": [0.0, 3000.0]
}
style_ls8_allband_false_colour = {
"name": "wideband",
"title": "Wideband false-colour",
"abstract": "False-colour image, incorporating all available LS8 spectral bands",
"components": {
"red": {
"swir2": 0.255,
"swir1": 0.45,
"nir": 0.255,
},
"green": {
"nir": 0.255,
"red": 0.45,
"green": 0.255,
},
"blue": {
"green": 0.255,
"blue": 0.45,
"coastal_aerosol": 0.255,
}
},
"scale_range": [0.0, 3000.0]
}
style_infrared_false_colour = {
"name": "infra_red",
"title": "False colour multi-band infra-red",
"abstract": "Simple false-colour image, using the near and short-wave infra-red bands",
"components": {
"red": {
"swir1": 1.0,
# The special dictionary value 'scale_range' can be used to provide a component-specific
# scale_range that overrides the style scale_range below.
# (N.B. if you are unlucky enough to have a native band called "scale_range", you can access it
# by defining a band alias.)
"scale_range": [5.0, 4000.0],
},
"green": {
"swir2": 1.0,
"scale_range": [25.0, 4000.0],
},
"blue": {
"nir": 1.0,
"scale_range": [0.0, 3000.0],
}
},
# The style scale_range can be omitted if all components have a component-specific scale_range defined.
# "scale_range": [0.0, 3000.0]
}
style_mineral_content = {
"name": "mineral_content",
"title": "Multi-band mineral indexes",
"abstract": "Red: Ferric Iron. Green: Bare soil. Blue: Clay/mica",
"components": {
"red": {
# If the component dictionary contains the key "function", then the dictionary as treated as
# a function callback as follows:
# a) "function" (required): A string containing the fully qualified path to a python function
# b) "args" (optional): An array of additional positional arguments that will always be passed to the function.
# c) "kwargs" (optional): An array of additional keyword arguments that will always be passed to the function.
# d) "mapped_bands" (optional): Boolean (defaults to False). If true, a band mapping function is passed
# to the function as a keyword argument named "band_mapper". This is useful if you are passing band aliases
# to the function in the args or kwargs. The band_mapper allows the index function to convert band aliases to
# to band names.
#
# The function is assumed to take one arguments, an xarray Dataset. (Plus any additional
# arguments required by the args and kwargs values in format 3, possibly including product_cfg.)
#
# An xarray DataArray is returned containing the band data. Note that it is up to the function
# to normalise the output to 0-255.
#
"function": "datacube_ows.band_utils.norm_diff",
"mapped_bands": True,
"kwargs": {
"band1": "red",
"band2": "blue",
"scale_from": [-0.1, 1.0],
}
},
"green": {
"function": "datacube_ows.band_utils.norm_diff",
"mapped_bands": True,
"kwargs": {
"band1": "nir",
"band2": "swir1",
"scale_from": [-0.1, 1.0],
}
},
"blue": {
"function": "datacube_ows.band_utils.norm_diff",
"mapped_bands": True,
"kwargs": {
"band1": "swir1",
"band2": "swir2",
"scale_from": [-0.1, 1.0],
}
}
},
# If ANY components include a function callback, the bands that need to be passed to the callback
# MUST be declared in a "additional_bands" item:
"additional_bands": ["red", "blue", "nir", "swir1", "swir2"]
#
# The style scale_range can be omitted if all components have a component-specific scale_range defined or
# a function callback.
# "scale_range": [0.0, 3000.0]
}
# Monochrome single band layers
style_pure_ls8_coastal_aerosol = {
"name": "coastal_aerosol",
"title": "Spectral band 1 - Coastal aerosol",
"abstract": "Coastal aerosol band, approximately 435nm to 450nm",
"components": {
"red": {
"coastal_aerosol": 1.0
},
"green": {
"coastal_aerosol": 1.0
},
"blue": {
"coastal_aerosol": 1.0
}
},
"scale_range": [0.0, 3000.0]
}
style_pure_ls8_blue = {
"name": "blue",
"title": "Spectral band 2 - Blue",
"abstract": "Blue band, approximately 453nm to 511nm",
"components": {
"red": {
"blue": 1.0
},
"green": {
"blue": 1.0
},
"blue": {
"blue": 1.0
}
},
"scale_range": [0.0, 3000.0]
}
style_pure_ls8_green = {
"name": "green",
"title": "Spectral band 3 - Green",
"abstract": "Green band, approximately 534nm to 588nm",
"components": {
"red": {
"green": 1.0
},
"green": {
"green": 1.0
},
"blue": {
"green": 1.0
}
},
"scale_range": [0.0, 3000.0]
}
style_pure_ls8_red = {
"name": "red",
"title": "Spectral band 4 - Red",
"abstract": "Red band, roughly 637nm to 672nm",
"components": {
"red": {
"red": 1.0
},
"green": {
"red": 1.0
},
"blue": {
"red": 1.0
}
},
"scale_range": [0.0, 3000.0]
}
style_pure_ls8_nir = {
"name": "nir",
"title": "Spectral band 5 - Near infra-red",
"abstract": "Near infra-red band, roughly 853nm to 876nm",
"components": {
"red": {
"nir": 1.0
},
"green": {
"nir": 1.0
},
"blue": {
"nir": 1.0
}
},
"scale_range": [0.0, 3000.0]
}
style_pure_ls8_swir1 = {
"name": "swir1",
"title": "Spectral band 6 - Short wave infra-red 1",
"abstract": "Short wave infra-red band 1, roughly 1575nm to 1647nm",
"components": {
"red": {
"swir1": 1.0
},
"green": {
"swir1": 1.0
},
"blue": {
"swir1": 1.0
}
},
"scale_range": [0.0, 3000.0]
}
style_pure_ls8_swir2 = {
"name": "swir2",
"title": "Spectral band 7 - Short wave infra-red 2",
"abstract": "Short wave infra-red band 2, roughly 2117nm to 2285nm",
"components": {
"red": {
"swir2": 1.0
},
"green": {
"swir2": 1.0
},
"blue": {
"swir2": 1.0
}
},
"scale_range": [0.0, 3000.0]
}
# Examples of non-linear colour-ramped styles.
style_ndvi = {
"name": "ndvi",
"title": "NDVI",
"abstract": "Normalised Difference Vegetation Index - a derived index that correlates well with the existence of vegetation",
# The index function is continuous value from which the heat map is derived.
#
# Two formats are supported:
# 1. A string containing a fully qualified path to a python function
# e.g. "index_function": "datacube_ows.ogc_utils.not_a_real_function_name",
#
# 2. A dict containing the following elements:
# a) "function" (required): A string containing the fully qualified path to a python function
# b) "args" (optional): An array of additional positional arguments that will always be passed to the function.
# c) "kwargs" (optional): An array of additional keyword arguments that will always be passed to the function.
# d) "mapped_bands" (optional): Boolean (defaults to False). If true, a band mapping function is passed
# to the function as a keyword argument named "band_mapper". This is useful if you are passing band aliases
# to the function in the args or kwargs. The band_mapper allows the index function to convert band aliases to
# to band names.
#
# The function is assumed to take one arguments, an xarray Dataset. (Plus any additional
# arguments required by the args and kwargs values in format 3, possibly including product_cfg.)
#
"index_function": {
"function": "datacube_ows.band_utils.norm_diff",
"mapped_bands": True,
"kwargs": {
"band1": "nir",
"band2": "red"
}
},
# List of bands used by this style. The band may not be passed to the index function if it is not declared
# here, resulting in an error. Band aliases can be used here.
"needed_bands": ["red", "nir"],
# The color ramp. Values between specified entries have both their alphas and colours
# interpolated.
"color_ramp": [
# Any value less than the first entry will have colour and alpha of the first entry.
# (i.e. in this example all negative values will be fully transparent (alpha=0.0).)
{
"value": -0.0,
"color": "#8F3F20",
"alpha": 0.0
},
{
"value": 0.0,
"color": "#8F3F20",
"alpha": 1.0
},
{
# do not have to defined alpha value
# if no alpha is specified, alpha will default to 1.0 (fully opaque)
"value": 0.1,
"color": "#A35F18"
},
{
"value": 0.2,
"color": "#B88512"
},
{
"value": 0.3,
"color": "#CEAC0E"
},
{
"value": 0.4,
"color": "#E5D609"
},
{
"value": 0.5,
"color": "#FFFF0C"
},
{
"value": 0.6,
"color": "#C3DE09"
},
{
"value": 0.7,
"color": "#88B808"
},
{
"value": 0.8,
"color": "#529400"
},
{
"value": 0.9,
"color": "#237100"
},
# Values greater than the last entry will use the colour and alpha of the last entry.
# (N.B. This will not happen for this example because it is normalised so that 1.0 is
# maximum possible value.)
{
"value": 1.0,
"color": "#114D04"
}
],
# If true, the calculated index value for the pixel will be included in GetFeatureInfo responses.
# Defaults to True.
"include_in_feature_info": True,
# Legend section is optional for non-linear colour-ramped styles.
# If not supplied, a legend for the style will be automatically generated from the colour ramp.
"legend": {
# Whether or not to display a legend for this style.
# Defaults to True for non-linear colour-ramped styles.
"show_legend": True,
# Instead of using the generated color ramp legend for the style, a URL to an PNG file can
# be used instead. If 'url' is not supplied, the generated legend is used.
"url": "http://example.com/custom_style_image.png"
}
}
# Examples of non-linear colour-ramped style with multi-date support.
style_ndvi_delta = {
"name": "ndvi_delta",
"title": "NDVI Delta",
"abstract": "Normalised Difference Vegetation Index - with delta support",
"index_function": {
"function": "datacube_ows.band_utils.norm_diff",
"mapped_bands": True,
"kwargs": {
"band1": "nir",
"band2": "red"
}
},
"needed_bands": ["red", "nir"],
# The color ramp for single-date requests - same as ndvi style example above
"color_ramp": [
{
"value": -0.0,
"color": "#8F3F20",
"alpha": 0.0
},
{
"value": 0.0,
"color": "#8F3F20",
"alpha": 1.0
},
{
"value": 0.1,
"color": "#A35F18"
},
{
"value": 0.2,
"color": "#B88512"
},
{
"value": 0.3,
"color": "#CEAC0E"
},
{
"value": 0.4,
"color": "#E5D609"
},
{
"value": 0.5,
"color": "#FFFF0C"
},
{
"value": 0.6,
"color": "#C3DE09"
},
{
"value": 0.7,
"color": "#88B808"
},
{
"value": 0.8,
"color": "#529400"
},
{
"value": 0.9,
"color": "#237100"
},
{
"value": 1.0,
"color": "#114D04"
}
],
"include_in_feature_info": True,
"legend": {
# Show the legend (default True for colour ramp styles)
"show_legend": True,
# Example config for colour ramp style auto-legend generation.
# The range covered by the legend.
# Defaults to the first and last non transparent (alpha != 0.0)
# entry in the explicit colour ramp, or the values in the range parameter.
# It is recommended that values be supplied as integers or strings rather
# than floating point.
"begin": "0.0",
"end": "1.0",
# Ticks.
# One of the following alternatives. All the examples below result in the same tick behaviour, given
# the begin and end values above.
#
# 1. Regularly spaced ticks, by size, starting from the begin tick.
"ticks_every": "0.2",
# 2. Regularly spaced ticks, by number of ticks, not counting the begin tick, but including the end tick. (int)
# "tick_count": 5,
# 3. Explicit ticks
# "ticks": [ "0.0", "0.2", "0.4", "0.6". "0.8", "1.0"]
# Default is a tick_count of 1, which means only the begin and end ticks.
# Legend title. Defaults to the style name.
"title": "This is not a legend",
# Units
# added to title of legend in parenthesis, default is to not display units. To emulate
# the previous default behaviour use:
"units": "unitless",
# decimal_places. 1 for "1.0" style labels, 2 for "1.00" and 0 for "1", etc.
# (default 1)
"decimal_places": 1,
# tick_labels
# Labels for individual ticks can be customised"
"tick_labels": {
# The special entry "default" allows setting
# a prefix and/or suffix for all labels.
# Default is no prefix or suffix
"default": {
# E.g. this encloses every tick label in parentheses.
"prefix": "(",
"suffix": ")",
},
# Other entries override the label for individual ticks.
# If they do not match a tick, as defined by the tick behaviour
# described above, the entry is ignored. If you are having trouble
# getting the right tick value, use the "ticks" option to explicitly
# declare your tick locations and make sure you use strings instead of
# floats.
# The default prefix and suffix can be over-ridden.
"0.0": {
# E.g. to remove the parentheses for the 0.0 tick
"prefix": "",
"suffix": "",
},
# Or the label can changed. Note that the default prefix and suffix
# are still applied unless explicitly over-ridden.
# E.g. To display "(max)" for the 1.0 tick:
"1.0": {
"label": "max"
}
},
# MatPlotLib rcparams options.
# Defaults to {} (i.e. matplotlib defaults)
# See https://matplotlib.org/3.2.2/tutorials/introductory/customizing.html
"rcParams": {
"lines.linewidth": 2,
"font.weight": "bold",
},
# Image size (in "inches").
# Matplotlib's default dpi is 100, so measured in hundreds of pixels unless the dpi
# is over-ridden by the rcParams above.
# Default is 4x1.25, i.e. 400x125 pixels
"width": 4,
"height": 1.25,
# strip_location
# The location and size of the coloured strip, in format:
# [ left, bottom, width, height ], as passed to Matplotlib Figure.add_axes function.
# All values as fractions of the width and height. (i.e. between 0.0 and 1.0)
# The default is:
"strip_location": [0.05, 0.5, 0.9, 0.15]
},
# Define behaviour(s) for multi-date requests. If not declared, style only supports single-date requests.
"multi_date": [
# A multi-date handler. Different handlers can be declared for different numbers of dates in a request.
{
# The count range for which this handler is to be used - a tuple of two ints, the smallest and
# largest date counts for which this handler will be used. Required.
"allowed_count_range": [2, 2],
# Re-sort data returned from the ODC so the order of date coordinates in the "time" dimension
# matches the date order supplied by the user in the WMS request.
# Optional. Defaults to False (date coordinates in the "time" dimension are always sorted chronologically)
"preserve_user_date_order": True,
# A function, expressed in the standard format as described elsewhere in this example file.
# The function is assumed to take one arguments, an xarray Dataset.
# The function returns an xarray Dataset with a single band, which is the input to the
# colour ramp defined below.
"aggregator_function": {
"function": "datacube_ows.band_utils.multi_date_delta"
},
# The multi-date color ramp. May be defined as an explicit colour ramp, as shown above for the single
# date case; or may be defined with a range and unscaled color ramp as shown here.
#
# The range specifies the min and max values for the color ramp. Required if an explicit color
# ramp is not defined.
"range": [-1.0, 1.0],
# The name of a named matplotlib color ramp.
# Reference here: https://matplotlib.org/examples/color/colormaps_reference.html
# Only used if an explicit colour ramp is not defined. Optional - defaults to a simple (but
# kind of ugly) blue-to-red rainbow ramp.
"mpl_ramp": "RdBu",
"legend": {
# Legend only covers positive part of ramp.
"begin": "0.0",
"end": "1.0"
},
# The feature info label for the multi-date index value.
"feature_info_label": "ndvi_delta"
}
]
}
# Examples of non-linear colour-ramped style with multi-date animation support.
style_ndvi_anim = {
"name": "ndvi_anim",
"title": "NDVI Animation",
"abstract": "Normalised Difference Vegetation Index - with animation support",
"index_function": {
"function": "datacube_ows.band_utils.norm_diff",
"mapped_bands": True,
"kwargs": {
"band1": "nir",
"band2": "red"
}
},
"needed_bands": ["red", "nir"],
# The color ramp for single-date requests - same as ndvi style example above
"color_ramp": [
{
"value": -0.0,
"color": "#8F3F20",
"alpha": 0.0
},
{
"value": 0.0,
"color": "#8F3F20",
"alpha": 1.0
},
{
"value": 0.1,
"color": "#A35F18"
},
{
"value": 0.2,
"color": "#B88512"
},
{
"value": 0.3,
"color": "#CEAC0E"
},
{
"value": 0.4,
"color": "#E5D609"
},
{
"value": 0.5,
"color": "#FFFF0C"
},
{
"value": 0.6,
"color": "#C3DE09"
},
{
"value": 0.7,
"color": "#88B808"
},
{
"value": 0.8,
"color": "#529400"
},
{
"value": 0.9,
"color": "#237100"
},
{
"value": 1.0,
"color": "#114D04"
}
],
"include_in_feature_info": True,
"legend": {
# Show the legend (default True for colour ramp styles)
"show_legend": True,
# Example config for colour ramp style auto-legend generation.
# The range covered by the legend.
# Defaults to the first and last non transparent (alpha != 0.0)
# entry in the explicit colour ramp, or the values in the range parameter.
# It is recommended that values be supplied as integers or strings rather
# than floating point.
"begin": "0.0",
"end": "1.0",
# Ticks.
# One of the following alternatives. All the examples below result in the same tick behaviour, given
# the begin and end values above.
#
# 1. Regularly spaced ticks, by size, starting from the begin tick.
"ticks_every": "0.2",
# 2. Regularly spaced ticks, by number of ticks, not counting the begin tick, but including the end tick. (int)
# "tick_count": 5,
# 3. Explicit ticks
# "ticks": [ "0.0", "0.2", "0.4", "0.6". "0.8", "1.0"]
# Default is a tick_count of 1, which means only the begin and end ticks.
# Legend title. Defaults to the style name.
"title": "This is not a legend",
# Units
# added to title of legend in parenthesis, default is to not display units. To emulate
# the previous default behaviour use:
"units": "unitless",
# decimal_places. 1 for "1.0" style labels, 2 for "1.00" and 0 for "1", etc.
# (default 1)
"decimal_places": 1,
# tick_labels
# Labels for individual ticks can be customised"
"tick_labels": {
# The special entry "default" allows setting
# a prefix and/or suffix for all labels.
# Default is no prefix or suffix
"default": {
# E.g. this encloses every tick label in parentheses.
"prefix": "(",
"suffix": ")",
},
# Other entries override the label for individual ticks.
# If they do not match a tick, as defined by the tick behaviour
# described above, the entry is ignored. If you are having trouble
# getting the right tick value, use the "ticks" option to explicitly
# declare your tick locations and make sure you use strings instead of
# floats.
# The default prefix and suffix can be over-ridden.
"0.0": {
# E.g. to remove the parentheses for the 0.0 tick
"prefix": "",
"suffix": "",
},
# Or the label can changed. Note that the default prefix and suffix
# are still applied unless explicitly over-ridden.
# E.g. To display "(max)" for the 1.0 tick:
"1.0": {
"label": "max"
}
},
# MatPlotLib rcparams options.
# Defaults to {} (i.e. matplotlib defaults)
# See https://matplotlib.org/3.2.2/tutorials/introductory/customizing.html
"rcParams": {
"lines.linewidth": 2,
"font.weight": "bold",
},
# Image size (in "inches").
# Matplotlib's default dpi is 100, so measured in hundreds of pixels unless the dpi
# is over-ridden by the rcParams above.
# Default is 4x1.25, i.e. 400x125 pixels
"width": 4,
"height": 1.25,
# strip_location
# The location and size of the coloured strip, in format:
# [ left, bottom, width, height ], as passed to Matplotlib Figure.add_axes function.
# All values as fractions of the width and height. (i.e. between 0.0 and 1.0)
# The default is:
"strip_location": [0.05, 0.5, 0.9, 0.15]
},
# Define behaviour(s) for multi-date requests. If not declared, style only supports single-date requests.
"multi_date": [
# A multi-date handler. Different handlers can be declared for different numbers of dates in a request.
{
# The count range for which this handler is to be used - a tuple of two ints, the smallest and
# largest date counts for which this handler will be used. Required.
# For animations consider the RAM usage on OWS pods and keep the maximum time steps reasonable
"allowed_count_range": [2, 10],
# Re-sort data returned from the ODC so the order of date coordinates in the "time" dimension
# matches the date order supplied by the user in the WMS request.
# Optional. Defaults to False (date coordinates in the "time" dimension are always sorted chronologically)
"preserve_user_date_order": True,
# Flag that an animation should be generated. Without this only the most recent frame is returned. Optional.
"animate": True,
# A function, expressed in the standard format as described elsewhere in this example file.
# The function is assumed to take one arguments, an xarray Dataset.
# The function returns an xarray Dataset with a with multiple-bands per time step, output is defined
# by colour ramp below
"aggregator_function": {
"function": "datacube_ows.band_utils.multi_date_pass"
},
# The color ramp for single-date requests - same as ndvi style example above
"color_ramp": [
{
"value": -0.0,
"color": "#8F3F20",
"alpha": 0.0
},
{
"value": 0.0,
"color": "#8F3F20",
"alpha": 1.0
},
{
"value": 0.1,
"color": "#A35F18"
},
{
"value": 0.2,
"color": "#B88512"
},
{
"value": 0.3,
"color": "#CEAC0E"
},
{
"value": 0.4,
"color": "#E5D609"
},
{
"value": 0.5,
"color": "#FFFF0C"
},
{
"value": 0.6,
"color": "#C3DE09"
},
{
"value": 0.7,
"color": "#88B808"
},
{
"value": 0.8,
"color": "#529400"
},
{
"value": 0.9,
"color": "#237100"
},
{
"value": 1.0,
"color": "#114D04"
}
],
"legend": {
# Legend only covers positive part of ramp.
"begin": "0.0",
"end": "1.0"
},
# The feature info label for the multi-date animation performs a pixel drill.
"feature_info_label": "ndvi_anim"
}
]
}
# Examples of Matplotlib Color-Ramp styles
style_deform = {
"name": "deform",
"title": "InSAR Deformation",
"abstract": "InSAR Derived Deformation Map",
# The range specifies the min and max values for the color ramp. Required if an explicit color ramp is not
# defined.
"range": [-110.0, 110.0],
# The Matplotlib color ramp. Value specified is a string that indicates a Matplotlib Colour Ramp should be
# used. Reference here: https://matplotlib.org/examples/color/colormaps_reference.html
# Only used if an explicit colour ramp is not defined. Optional - defaults to a simple (but
# kind of ugly) blue-to-red rainbow ramp.
"mpl_ramp": "RdBu",
# If true, the calculated index value for the pixel will be included in GetFeatureInfo responses.
# Defaults to True.
"include_in_feature_info": True,
# Legend section is optional for non-linear colour-ramped styles.
# If not supplied, a legend for the style will be automatically generated from the colour ramp.
"legend": {
# Only use positive part of range.