<?xml version="1.0" encoding="UTF-8"?>
<netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2">
  <aggregation type="union">
    {% for aggregation in aggregations -%}
    {% if aggregation|length > 1 -%}
    <netcdf>
      <aggregation type="joinExisting" dimName="time">
	{% for f in aggregation %}
	<netcdf location="{{ f }}" ncoords="{{ ncoords(f, 'time') }}" />
	{% endfor %}
      </aggregation>
    </netcdf>
    {% elif aggregation|length == 1 -%}
    <netcdf location="{{ aggregation|first }}" />
    {% endif %}
    {% endfor %}
  </aggregation>
</netcdf>
