Thredds role: add some customisations options, needed by the aquamaps service. See https://support.d4science.org/issues/12927

This commit is contained in:
Andrea Dell'Amico 2018-12-05 19:01:06 +01:00
parent 15c60e25bf
commit 01b4af1673
5 changed files with 125 additions and 1 deletions

View File

@ -19,3 +19,4 @@ thredds_email: ''
thredds_host_institution_name: 'ORG'
thredds_host_institution_web: ''
thredds_force_ssl_for_user_data: False
thredds_palettes_customisation: False

Binary file not shown.

View File

@ -26,7 +26,7 @@
template: src={{ item[1] }}.j2 dest={{ thredds_data_content_dir }}/thredds/{{ item[1] }} owner={{ item.0.user }} group={{ item.0.user }} mode=644
with_nested:
- '{{ tomcat_m_instances }}'
- ['threddsConfig.xml','catalog.xml']
- [ 'threddsConfig.xml', 'catalog.xml', 'wmsConfig.xml' ]
notify: tomcat instances restart
when: not thredds_skip_conf.stat.exists
tags: [ 'thredds', 'tomcat', 'thredds_conf' ]
@ -36,6 +36,21 @@
register: thredds_skip_conf
tags: [ 'thredds', 'tomcat', 'thredds_conf' ]
- name: Create the custom palettes directory
file: dest={{ thredds_data_content_dir }}/thredds/customPalettes state=directory owner={{ item.user }} group={{ item.user }}
when: thredds_palettes_customisation
with_items: '{{ tomcat_m_instances }}'
tags: [ 'thredds', 'tomcat', 'thredds_custom_palettes' ]
- name: Install the custom palettes
unarchive: src=customPalettes.tar.gz dest={{ thredds_data_content_dir }}/thredds/customPalettes/ remote_src=no owner={{ item.user }} group={{ item.user }}
args:
creates: '{{ thredds_data_content_dir }}/thredds/customPalettes/occam.pal'
with_items: '{{ tomcat_m_instances }}'
notify: tomcat instances restart
when: thredds_palettes_customisation
tags: [ 'thredds', 'tomcat', 'thredds_custom_palettes' ]
- name: Get the thredds war file
maven_artifact: artifact_id={{ thredds_name }} version={{ thredds_version | default(omit) }} group_id={{ thredds_group_id }} extension={{ thredds_extension | default('war') }} repository_url={{ thredds_repository_url }} dest={{ thredds_download_directory }}/{{ thredds_file }}

View File

@ -200,6 +200,9 @@
<allowRemote>false</allowRemote>
<maxImageWidth>2048</maxImageWidth>
<maxImageHeight>2048</maxImageHeight>
{% if thredds_palettes_customisation %}
<paletteLocationDir>customPalettes</paletteLocationDir>
{% endif %}
</WMS>

View File

@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Detailed configuration of the WMS service. This config file can be used to
set default styling parameters for each dataset/variable, and to enable or disable
the GetFeatureInfo operation.
See http://www.resc.reading.ac.uk/trac/myocean-tools/wiki/WmsDetailedConfiguration
for more information.
-->
<!DOCTYPE wmsConfig [
<!ELEMENT wmsConfig (global, overrides?)>
<!ELEMENT global (defaults, standardNames?)>
<!ELEMENT defaults (allowFeatureInfo, defaultColorScaleRange, defaultPaletteName, defaultNumColorBands, logScaling)>
<!ELEMENT standardNames (standardName*)>
<!ELEMENT standardName (defaultColorScaleRange?, defaultPaletteName?, defaultNumColorBands?, logScaling?)>
<!ATTLIST standardName name CDATA #REQUIRED>
<!ATTLIST standardName units CDATA #REQUIRED>
<!ELEMENT overrides (datasetPath*)>
<!ELEMENT datasetPath (pathDefaults?, variables?)>
<!ATTLIST datasetPath pathSpec CDATA #REQUIRED>
<!ELEMENT pathDefaults (allowFeatureInfo?, defaultColorScaleRange?, defaultPaletteName?, defaultNumColorBands?, logScaling?)>
<!ELEMENT variables (variable*)>
<!ELEMENT variable (defaultColorScaleRange?, defaultPaletteName?, defaultNumColorBands?, logScaling?)>
<!ATTLIST variable id CDATA #REQUIRED>
<!ELEMENT allowFeatureInfo (#PCDATA)>
<!ELEMENT defaultColorScaleRange (#PCDATA)>
<!ELEMENT defaultPaletteName (#PCDATA)>
<!ELEMENT defaultNumColorBands (#PCDATA)>
<!ELEMENT logScaling (#PCDATA)>
]>
<wmsConfig>
<global>
<!-- These settings apply to all datasets unless overridden below -->
<defaults>
<!-- The global defaults. All elements are mandatory -->
<allowFeatureInfo>true</allowFeatureInfo>
<defaultColorScaleRange>-50 50</defaultColorScaleRange>
<defaultPaletteName>rainbow</defaultPaletteName>
<defaultNumColorBands>20</defaultNumColorBands>
<logScaling>false</logScaling>
</defaults>
<standardNames>
<!-- Use this section to set defaults per standard name -->
<!-- Units must come from the UDUNITS vocabulary -->
<standardName name="sea_water_potential_temperature" units="K">
<defaultColorScaleRange>268 308</defaultColorScaleRange>
</standardName>
<standardName name="sea_water_temperature" units="K">
<defaultColorScaleRange>268 308</defaultColorScaleRange>
</standardName>
<standardName name="mass_concentration_of_chlorophyll_in_sea_water" units="kg m-3">
<logScaling>true</logScaling>
</standardName>
<!-- TODO: how about allowing "*fraction" to map to 0:1? -->
<!-- TODO: how about allowing multiple standard names to map to the same settings,
either through a glob expression or through a list? -->
</standardNames>
</global>
<overrides>
<datasetPath pathSpec="testAll/*eta_211.nc">
<!-- Will apply to all paths that match the path spec above -->
<pathDefaults>
<!-- These will apply to all variables in this path unless overridden below -->
<allowFeatureInfo>false</allowFeatureInfo>
<defaultPaletteName>occam</defaultPaletteName>
</pathDefaults>
<variables>
<!-- Configure variables individually according to their internal ID.
This is the most specific setting and will override any others -->
<variable id="Z_sfc">
<defaultColorScaleRange>10 20</defaultColorScaleRange>
</variable>
</variables>
</datasetPath>
{% if thredds_palettes_customisation %}
<datasetPath pathSpec="public/netcdf/AquaMaps*/*.nc">
<pathDefaults>
<defaultColorScaleRange>0 1</defaultColorScaleRange>
<defaultPaletteName>aquamaps</defaultPaletteName>
<defaultNumColorBands>5</defaultNumColorBands>
</pathDefaults>
</datasetPath>
{% endif %}
</overrides>
</wmsConfig>