You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We've been recently running into issues creating related style definitions for WMS layers served out of the ODC, where one style definition would work, and an identical one with few changes would throw an error.
After a discussion in Slack, the solution was to create a deep copy and modify the elements needed for the new style. There are a couple of examples here in this repo.
I thought this is a bit cumbersome and not practical if you need many definitions which are related, so I've created a little function wrapper to take care of this. In the slack discussion I've been asked to share it in this issue:
style_s1p=copy_style(
template=style_template_singleband,
name='s1p',
title='SPI 1 Month',
abstract='Standard Precipitation Index over 1 Month',
bands='s1p',
color_ramp=spi_color_ramp,
)
Which then can be a template to a more closely related style.
Disclaimer:
I'm not a professional python programmer, and this function was created to mainly deal with the single band definitions that we use at the moment. I know this won't work with the multiband ones, and also it won't be able to replace nested elements aside the ones related to band.
The text was updated successfully, but these errors were encountered:
Missed this because it was added to dea-config instead of datacube-ows.
This is a great idea Val, I've been thinking about providing a similar utility function in ows. The way you are handling "bands" is very specific to the single band case, but the idea could be extended fairly easily.
We've been recently running into issues creating related style definitions for WMS layers served out of the ODC, where one style definition would work, and an identical one with few changes would throw an error.
After a discussion in Slack, the solution was to create a deep copy and modify the elements needed for the new style. There are a couple of examples here in this repo.
I thought this is a bit cumbersome and not practical if you need many definitions which are related, so I've created a little function wrapper to take care of this. In the slack discussion I've been asked to share it in this issue:
Basically, the keywords are a 1:1 match, with the exception of
bands
, so multiple bands can be specified.So, if you have a template like this:
You can create a new style like
Which then can be a template to a more closely related style.
Disclaimer:
I'm not a professional python programmer, and this function was created to mainly deal with the single band definitions that we use at the moment. I know this won't work with the multiband ones, and also it won't be able to replace nested elements aside the ones related to
band
.The text was updated successfully, but these errors were encountered: