John,
Since the files you want to join have different time coordinates but have the same name, you need to rename one of them. I would have thought that this simple NcML would have worked, simply renaming the dimension and name of the time dimension and time variable in the 3D data
<?xml version="1.0" encoding="UTF-8"?>
<netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2">
<attribute name="title" value="HYCOM test aggregation #1"/>
<aggregation type="union">
<!-- These are the 3D variables: -->
<netcdf location="dods://apdrc.soest.hawaii.edu:80/dods/public_data/Model_output/HYCOM/global/hycom2d">
<dimension name="time2d" orgName="time"/>
<variable name="time2d" orgName="time"/>
</netcdf>
<!-- These are the 4D variables: -->
<netcdf location="dods://apdrc.soest.hawaii.edu:80/dods/public_data/Model_output/HYCOM/global/hycomT"/>
<netcdf location="dods://apdrc.soest.hawaii.edu:80/dods/public_data/Model_output/HYCOM/global/hycomS"/>
<netcdf location="dods://apdrc.soest.hawaii.edu:80/dods/public_data/Model_output/HYCOM/global/hycomU"/>
<netcdf location="dods://apdrc.soest.hawaii.edu:80/dods/public_data/Model_output/HYCOM/global/hycomV"/>
</aggregation>
</netcdf>
but it does not, because somehow NetCDF-Java seems to be adding an attribute _CoordinateAxes
with the values "time lon lat" before we change the variable and dimension names. So if we remove that attribute from the 3D data, it works:
<?xml version="1.0" encoding="UTF-8"?>
<netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2">
<attribute name="title" value="HYCOM test aggregation #1"/>
<aggregation type="union">
<!-- These are the 3D variables: -->
<netcdf location="dods://apdrc.soest.hawaii.edu:80/dods/public_data/Model_output/HYCOM/global/hycom2d">
<dimension name="time2d" orgName="time"/>
<variable name="time2d" orgName="time"/>
<variable name="qtot">
<remove type="attribute" name="_CoordinateAxes"/>
</variable>
<variable name="emp">
<remove type="attribute" name="_CoordinateAxes"/>
</variable>
<variable name="t_trend">
<remove type="attribute" name="_CoordinateAxes"/>
</variable>
<variable name="s_trend">
<remove type="attribute" name="_CoordinateAxes"/>
</variable>
<variable name="ssh">
<remove type="attribute" name="_CoordinateAxes"/>
</variable>
<variable name="mld">
<remove type="attribute" name="_CoordinateAxes"/>
</variable>
<variable name="mlp">
<remove type="attribute" name="_CoordinateAxes"/>
</variable>
</netcdf>
<!-- These are the 4D variables: -->
<netcdf location="dods://apdrc.soest.hawaii.edu:80/dods/public_data/Model_output/HYCOM/global/hycomT"/>
<netcdf location="dods://apdrc.soest.hawaii.edu:80/dods/public_data/Model_output/HYCOM/global/hycomS"/>
<netcdf location="dods://apdrc.soest.hawaii.edu:80/dods/public_data/Model_output/HYCOM/global/hycomU"/>
<netcdf location="dods://apdrc.soest.hawaii.edu:80/dods/public_data/Model_output/HYCOM/global/hycomV"/>
</aggregation>
</netcdf>
Here's a a screenshot from ToolsUI of the resulting dataset, where you can see the 3D and 4D variables: