Skip to content

Commit

Permalink
opendatacube#656 Apply PR review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Tisham Dhar <[email protected]>
  • Loading branch information
whatnick committed Jul 15, 2021
1 parent b1af397 commit bee61ca
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 13 deletions.
2 changes: 1 addition & 1 deletion datacube_ows/ogc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,4 +608,4 @@ def render_frame(img_data, mask, width, height):
else:
alpha_mask = numpy.where(mask, 255, 0).astype('uint8')
buffer[3, :, :] = alpha_mask
return buffer
return buffer.transpose()
64 changes: 53 additions & 11 deletions datacube_ows/ows_cfg_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -993,17 +993,59 @@
"aggregator_function": {
"function": "datacube_ows.band_utils.multi_date_pass"
},
# 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",
# 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",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ogc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def test_png_loop_over_anim():
"alpha": dummy_da(200, "alpha", xyt_coords, dtype="uint8"),
})
imgs = datacube_ows.ogc_utils.xarray_image_as_png(data, None, loop_over="time", animate=True)
assert len(imgs) == 223
assert len(imgs) == 173
assert imgs.find(b"\x89PNG") == 0

def test_time_call(monkeypatch):
Expand Down

0 comments on commit bee61ca

Please sign in to comment.