Sorting Variables
By default the list of variables that pops up in the data set selection tool is ordered alphabetically. Sometimes, it makes more sense to organize the commonly used variables at the top of the list. Any variable in the XML configuration can be tagged with a sort_order attribute. If present the value of that attribute will be used to determine the position in the list relative to the other sort_order attributes in the list of variables. If two variables have the same sort_order value, the name will be used to break the tie.
Categories
By default, the hierarchy of the data sets and variables presented in the user interface only one level deep and matches the data sets and variables included in the las.xml configuration file. The data set selection widget lists each dataset and clicking the "+" opens a display of all of the variables in that dataset.
LAS allows you to change the way datasets and variables are presented in the LAS user interface.You can change this presentation of datasets and variables by creating a XML categories file. The category file allows you to sort the variables into a set of hierarchical categories; each of these categories is displayed as new entry in the hierarchical data set widget and will contain other categories or, at the bottom of the hierarchy, a list of variables contained in the category.
Sorting Categories
Again, by default the sub-categories of any category are listed in alphabetical order. As with variables, you can change the order using the sort_order attribute. So for example:
<las_categories>
<category name="COADS">
<category name="Windy COADS" sort_order="001">
<filter action="apply-variable" contains="Wind"/>
</category>
<category name="Sticky COADS" sort_order="002">
<filter action="apply-variable" contains="Humidity"/>
</category>
</category>
</las_categories>
would result in a listing of "Windy COADS" followed by "Stickey COADS" instead of the alphabetical list.
The category file is generally included as an XML include as a child of the <lasdata> tag in the main LAS configuration file. For example, you would include the file category.xml in the LAS configuration file as follows:
<?xml version='1.0' ?>
<!DOCTYPE spec SYSTEM "spec.dtd" [
<!ENTITY category SYSTEM "categories.xml">
]>
<lasdata>
&categories;
...
Suppose you have one dataset that contains a set of variables as below:
<coads_climatology_cdf name="COADS Climatology" url="file:coads_climatology" doc="doc/coads_climatology.html">
<variables>
<airt name="Air Temperature" units="DEG C">
<link match="/lasdata/grids/coads_climatology_cdf_grid"/>
</airt>
<speh name="Specific Humidity" units="G/KG">
<link match="/lasdata/grids/coads_climatology_cdf_grid"/>
</speh>
<sst name="Sea Surface Temperature" units="Deg C">
<link match="/lasdata/grids/coads_climatology_cdf_grid"/>
</sst>
<uwnd name="Zonal Wind" units="M/S">
<link match="/lasdata/grids/coads_climatology_cdf_grid"/>
</uwnd>
<wspd name="Wind Speed" units="M/S">
<link match="/lasdata/grids/coads_climatology_cdf_grid"/>
</wspd>
<vwnd name="Meridional Wind" units="M/S">
<link match="/lasdata/grids/coads_climatology_cdf_grid"/>
</vwnd>
<slp name="Sea Level Pressure" units="MB">
<link match="/lasdata/grids/coads_climatology_cdf_grid"/>
</slp>
</variables>
The default presentation of this XML in the user interface will consist of a page listing the datasets (COADS Climatology), and a page listing all of the variables in this dataset (Air Temperature, Specific Humidity, ...). Suppose you aren't interested in the temperature variables, and you want to display the wind and humidity variables variables as separate categories. The following XML categories file will accomplish this:
<las_categories>
<category name="COADS">
<category name="Windy COADS">
<filter action="apply-variable" contains="Wind"/>
</category>
<category name="Sticky COADS">
<filter action="apply-variable" contains="Humidity"/>
</category>
</category>
</las_categories>
The UI will contain three levels: the first page will list a COADS link; clicking on COADS will cause a page to be displayed listing Windy COADS and Sticky COADS; Windy COADS and Sticky COADS will link to pages listing all variables that contains the string "Wind" and "Humidity" respectively.
The <filter> tag is used to determine the set of variables that will be included in a category. A <filter> tag must have an action attribute that specifies whether the filter will be applied at the dataset level or the variable level. A <filter> tag can contain one of two optional attributes for string matching: the equals attribute causes a filter to include a variable or dataset only if the name of the variable or dataset exactly (case sensitive) matches the attribute value. The contains attribute will include a variable or dataset if the attribute value is a substring of the name of the variable or dataset. If neither of these attributes are present, then all datasets or variables will be included. A boolean AND of two filters occurs if a filter is contained in another filter. A boolean OR of two filters occurs if the filters are siblings in the XML tree. Examples:
<!-- Include all variables in all datasets in one category -->
<category name="The works">
<filter action="apply-dataset"/>
</category>
<!--Same results as above because the action is only applied if equals or match attribute is present -->
<category name="The works">
<filter action="apply-variable"/>
</category>
<!-- Include all variables from the datasets that exactly match the string "National League" -->
<category name="Teams in the National League">
<filter action="apply-dataset" equals="National League"/>
</category>
<!-- Include all variables from the datasets that contain the string "West" -->
<category name="Teams in the National or American League West">
<filter action="apply-dataset" contains="West"/>
</category>
<!-- Include all variables from the variables that contain the string "Yankees" -->
<category name="Most unpopular baseball team in Seattle">
<filter action="apply-variables" contains="Yankees"/>
</category>
<!-- Include all variables from datasets with the name "American League West" that contain variables
with the substring "Mariners" -->
<category name="Most popular baseball team in Seattle">
<filter action="apply-datasets" equals="American League West">
<filter action="apply-variables" contains="Mariners"/>
</filter>
</category>
<!-- Include all variables from datasets that:
1) are in datasets that are named "American League East" that have variables that contain "Yankees" OR
2) are in datasets that are named "American League West" that have variables that contain "Rangers"
-->
<category name="Overpaid baseball teams">
<filter action="apply-datasets" equals="American League East">
<filter action="apply-variables" contains="Yankees"/>
</filter>
<filter action="apply-datasets" equals="American League West">
<filter action="apply-variables" contains="Rangers"/>
</filter>
</category>
The <category> tag controls the display of the categories in the user interface. Every category has a mandatory name attribute. The parent of the category will display this name as a link to the Web page generated for the category. Categories can contain other categories or filters. If a category has childen (i.e. contains other categories), then the page representing the category will contain links to the child categories of the current category. If a category has no children, then all variables that are remaining from any filters that have been applied will be displayed. For example, suppose we have a group of datasets where each dataset represents an American corporation and each variable represents a corporate officer of that corporation. The following XML:
<category name="Unethical corporate officers">
<category name="By position">
<category name="CEO">
<filter action="apply-variable" equals="Kenneth Lay"/>
</category>
</category>
<category name="By company">
<filter action="apply-dataset" contains="Enron">
<category name="Enron"/>
</filter>
</category>
</category>
will create a user interface with three levels of hierarchy. Since variables are only listed for categories that have no children, variables will be listed for the "CEO" and "Enron" categories. The "CEO" category will contain one variable (assuming that there is only one CEO named Kenneth Lay), and the "Enron" category will contain all of the corporate officers at Enron.
Category XML reference
Element | Tag | Required? | Children | Description |
las_categories | <las_categories> | yes | category+ | Root element of XML category file |
Category element
A category element can be either a branch with sub categories or a leaf -- a virtual dataset with its own filtered set of variables. A category should contain either categories or filters but not both. The optional 'include' files allow for an LAS installer to hand build html pages that provide the most attractive possible presentation of their data.
Element | Tag | Required? | Children | Description |
category | <category> | no | category*|filter* | Defines a Web page in the display of datasets of variables |
Attribute | Type | Required? | Description |
name | string | yes | Display name of category. |
doc | string | no | URL of documentation associated with the category. This is functionally identical to the doc attribute associated with the dataset tag. |
Filter elemen
Element | Tag | Required? | Children | Description |
filter | <filter> | no | category*|filter* | Filters the set of variables applied to a leaf category node |
Attribute | Type | Required? | Description |
action | string | yes |
Value must be apply-variable | apply-dataset apply-variable applies an optional action to all variable names that match the specified conditions (see contains or equals attribute). apply-dataset applies an optional cation to all dataset names that match the specified conditions (see contains or equals attribute). |
contains | string | no | Include the variable or dataset in the filter set if the attribute is a substring of the name of the variable or dataset. You cannot use both the contains attribute and the equals attribute. |
equals | string | no | Include the variable or dataset in the filter set if the attribute exactly matches the name of the variable or dataset. You cannot use both the contains attribute and the equals attribute. |
category_include | string | no | Template to replace standard dataset display for a category |
variable_include | string | no | Template to replace standard variable display for a variable |
constrain_include | string | no | Template to replace standard constraint display for a constraint associated with a variable |
category_include_header | string | no | Template to include immediately beneath the help information for dataset/category |
variable_include_header | string | no | Template to include immediately beneath the help information for variable |
constrain_include_header | string | no | Template to include immediately beneath the help information for constraint associated with selected variable |