SNOWPACK 20241007.306a770
CAAML

Format

This plugin reads the CAAML files as generated according CAAML V6.0.3's specification. In order to validate a CAAML file, download the xsd file and use either an online XML validator or an offline tool (such as Notepad++'s XML tool).

Keywords

This plugin uses the following keywords (all specified in the [Input] section):

  • COORDSYS: input coordinate system (see Coords)
  • SNOW: specify CAAML to read in a caaml file
  • SNOWPATH: string containing the path to the caaml files to be read
  • SNOWFILE: specify the caaml file to read the data from
  • XML_ENCODING: force the input file encoding, overriding the file's own encoding declaration (optional, see XML encoding below)
  • CAAML_MAX_ELEMENT_THICKNESS: if set (and non-zero), the thickness of the elements will be set to this value, otherwise each element will correspond to one stratigraphic layer. Recommendation: set this value to 0.002 (= 2 mm)
  • CAAML_WRITEOUT_AS_READIN: if set to true, a caaml will be written just after reading in, to check if the reading of the caaml was correct.

Reading a caaml-file

Data which is important for a snowpack-simulation but usually not given in a caaml-file (like dendricity for example), can be included in a caaml-file as snowpack-custom-data with the prefix "snp". A caaml-file written out by this plugin will contain this data. However, if this data is not available, the corresponding values will be estimated or set to default values:

  • snowpack-custom-data for the whole snowpack (like Albedo, WindScalingFactor,...) will be set to default values.
  • layer-custom-data (like dendricity, sphericity, maker,...) will be estimated from primary grain form, grain size and temperature.
  • the formation time of a layer will be estimated depending on snow type and layer location.

The liquid water content (lwc) of a layer will be read in from the lwc-profile. If there is no lwc-profile in the caaml-file, the lwc will be estimated from the wetness-codes (D, M, W,...) given in the stratigraphic profile.

Besides the lwc-profile the density- and temperature-profile are read in from the caaml-file. The lwc-profile is optional, but the temperature- and density-profile have to be given in the caaml-file.

Consistency checks

When reading in a caaml-file, the data will be checked for consistency. If there is an inconsistency a warning will be printed and values will be adjusted, if possible. Otherwise an exception is thrown.

Warnings:

  • total snow height given in <caaml:snowPackCond> is different from the sum of the layer-thicknesses. The snow height given in <caaml:snowPackCond> will be ignored.
  • grain size of a surface-hoar-layer differs from the surface-hoar-layer-thickness. Adjustment: Grain size will be set to layer thickness.
  • temperature of a layer is above 0°C. Adjustment: Set temperature to 0°C.
  • liquid water content (lwc) is greater than 0 and temperature is below 0°C. Adjustment: Set lwc to 0.
  • grain form is "FC" and grain size is above 1.6 mm. Adjustment: nothing.
  • grain form is "DH" and grain size is below 1.4 mm. Adjustment: nothing.

Exceptions:

  • grain size is 0 and grain form is not "IF"
  • slope angle is > 0° and no azimuth is given. (If the slope angle is not given, the slope angle is set to 0°.)
  • missing data / wrong camml-version ( != 6.0.3)
  • wrong syntax in caaml-file (pointy brackets, matching quotes,...)

XML encoding

Each XML document should specify its encoding. However this information might sometimes be missing or even worse, be false. This makes the XML document non-compliant. Normally, CAAML reads the file encoding in the file itself. If this does not work (one of the two cases given above), it is possible to force the encoding of the input file by using the "XML_ENCODING" option. This option takes one of the following values ("LE" stands for "Little Endian" and "BE" for "Big Endian"): UTF-8, UTF-16, UTF-16-LE, UTF-16-BE, UTF-32, UTF-32-LE, UTF-32-BE, LATIN1, ISO-8859-1, WCHAR

Writing a caaml-file

This is an example of a caaml-file written with this plugin:

<?xml version="1.0" encoding="UTF-8"?>
<caaml:SnowProfile gml:id="SLF_WFJ2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml" xmlns:caaml="http://caaml.org/Schemas/SnowProfileIACS/v6.0.3" xmlns:snp="http://www.slf.ch/snowpack/1.0" xmlns:slf="http://www.slf.ch/snowprofile/1.0">
<caaml:timeRef>
<caaml:recordTime>
<caaml:TimeInstant>
<caaml:timePosition>2008-05-16T09:00:00+02:00</caaml:timePosition>
</caaml:TimeInstant>
</caaml:recordTime>
<caaml:dateTimeReport>2018-12-18T17:38:41+01:00</caaml:dateTimeReport>
</caaml:timeRef>
<caaml:srcRef>
<caaml:Operation gml:id="OPERATION_ID">
<caaml:name>SNOWPACK v3.45 compiled on Dec 10 2018, 15:45:05. user: theile</caaml:name>
</caaml:Operation>
</caaml:srcRef>
...

Furthermore some data about the profile location and following profiles will be written:

  • stratigraphic profile
  • temperature profile
  • density profile
  • lwc profile
  • specific surface area profile
  • strength profile

Example

[Input]
COORDSYS = CH1903
SNOW = CAAML
SNOWPATH = ./input/snowCAAMLdata
SNOWFILE = 5WJ_20120229.caaml
CAAML_MAX_ELEMENT_THICKNESS = 0.002