Several properties related to the generation of images from the WMS service can be configured using the wmsConfig.xml file. By default, this file is located in the ${tds.content.root.path}/thredds directory. An example wmsConfig.xml file is shipped with the TDS, which looks like:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE wmsConfig SYSTEM "https://schemas.unidata.ucar.edu/thredds/dtd/ncwms/wmsConfig.dtd">
<!--
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.
-->
<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>psu-viridis</defaultPaletteName>
            <defaultNumColorBands>20</defaultNumColorBands>
            <logScaling>false</logScaling>
            <intervalTime>false</intervalTime>
        </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>
        </standardNames>
    </global>
    <overrides>
        <datasetPath pathSpec="testAll/20040503*_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>x-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>0 2920</defaultColorScaleRange>
                </variable>
            </variables>
        </datasetPath>
        <datasetPath pathSpec="testAll/20040504*_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>true</allowFeatureInfo>
                <defaultPaletteName>seq-Reds</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>0 3170</defaultColorScaleRange>
                </variable>
            </variables>
        </datasetPath>
    </overrides>
</wmsConfig>

This file provides a way to set default values for WMS parameters when they are missing from a request. In general, you can provide default values for the following properties:

  • allowFeatureInfo: Allow GetFeatureInfo requests.
  • defaultColorScaleRange: Range of values to when generating images.
  • defaultPaletteName: A color palette name (see the ncWMS User Guide for options).
  • defaultNumColorBands: The number of colour bands to use.
  • logScaling: Use a logarithmic scale when generating images.
  • intervalTime: Use time ranges instead of lists of individual times in the capabilities documents.

There are two main elements to the wmsConfig.xml file - the <global>, and the <overrides>. Each controls the level of granularity at which default values are chosen. Settings in <overrides> take precedence over settings in <global>.

Global

The <global> element contains one <defaults> and one <standardNames> child element. It is within these elements that you can control default settings at a global level.

Default

All options must be configured in this section. These set the default values for all WMS requests.

Standard Names

Values set under <defaults> can be overridden by matching on the value of a standard_name attribute of a variable. With the exception of allowFeatureInfo, all other properties can be set based on standard_name. Because this is global, you must include information about the units used to define the <colorScaleRange>. This allows the WMS service to deal with variables that have the same standard_name yet have different, but comparable, units. The units must be defined using a udunits compatible string. The current set of unit strings support can be found in this xml document. A more user-friendly version can be found at this very helpful site, which is maintained by the North Carolina Institute for Climate Studies.

Overrides

The <overrides> element contains a series of <datasetPath> children. The pathSpec attribute of a <datasetPath> element allows for applying default settings based on the dataset path as seen in the TDS url (i.e. the dataset ID). Default values can be set for all properties based on the path. With the exception of allowFeatureInfo, these can be overridden on a variable by variable basis based on the name of the variable.

Default Precedence Summary

Default values for a given property are selected based on matches (lowest to highest precedence):

global/defaults < global/standardName < overrides/pathDefaults < overrides/variable