远程3D和4D变量的NcML聚合?

时间:2013-04-23 19:15:41

标签: xml netcdf thredds ncml

NcML可用于聚合3D和4D网格吗?我不确定,因为它们的尺寸数量不同。例如海面高度(ssh)和水温,其中ssh有三个维度[time,lat,lon]和temp有四个维度[time,depth,lat,lon]?我的测试不成功所以我的预感是我必须将3D和4D变量分解为单独的目录。但我希望其他人可能有其他建议吗?

虽然我尝试使用下面代码段的“联合”聚合,但时间维度没有得到适当的映射,因为3D变量开始于2008-12-28,而4D变量开始于2008-05-08:

<?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"/>
    <!-- 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>

然后,我在“时间”维度上尝试了“joinExisting”聚合,但这只适用于每个数据集包含相同变量(它们不包含)的情况。根据我在聚合中首先列出的数据集,在以下示例中排除了3D或4D变量:

<?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 #2"/>
  <aggregation dimName="time" type="joinExisting">
    <!-- These are the 3D variables: -->
    <netcdf location="dods://apdrc.soest.hawaii.edu:80/dods/public_data/Model_output/HYCOM/global/hycom2d"/>
    <!-- These are the 4D variables: -->
    <aggregation type="union">
      <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>
  </aggregation>
</netcdf>

那么,有没有办法聚合这些数据集?我必须将3D和4D变量分开吗?

谢谢! 约翰毛瑞尔 太平洋岛屿海洋观测系统(PacIOOS) 夏威夷大学马诺阿分校

1 个答案:

答案 0 :(得分:1)

约翰,

由于您要加入的文件具有不同的时间坐标但名称相同,因此您需要重命名其中一个。我原以为这个简单的NcML会起作用,只需在3D数据中重命名时间维度和时间变量的维度和名称

<?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>

但事实并非如此,因为在我们更改变量和维度名称之前,NetCDF-Java似乎在某种程度上添加了值为“time lon lat”的属性_CoordinateAxes。因此,如果我们从3D数据中删除该属性,它就会起作用:

<?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>

以下是结果数据集的ToolsUI截图,您可以在其中看到3D和4D变量: