2013-11-04 44 views
4

我有40個NetCDF文件,都是由海洋模型構成的一個模擬。時間序列爲每個變量的數據被分成多個文件,使目錄列表如下:可以使用NcML來彙集多個NetCDF文件集合嗎?

$ ls ./output/*.nc 
1_hvel.nc   3_hvel.nc   5_hvel.nc   7_hvel.nc 
1_MeanPeriod.nc  3_MeanPeriod.nc  5_MeanPeriod.nc  7_MeanPeriod.nc 
1_PeakPeriod.nc  3_PeakPeriod.nc  5_PeakPeriod.nc  7_PeakPeriod.nc 
1_pwd.nc   3_pwd.nc   5_pwd.nc   7_pwd.nc 
1_SigWaveHeight.nc 3_SigWaveHeight.nc 5_SigWaveHeight.nc 7_SigWaveHeight.nc 
1_WaterLevel.nc  3_WaterLevel.nc  5_WaterLevel.nc  7_WaterLevel.nc 
2_hvel.nc   4_hvel.nc   6_hvel.nc   8_hvel.nc 
2_MeanPeriod.nc  4_MeanPeriod.nc  6_MeanPeriod.nc  8_MeanPeriod.nc 
2_PeakPeriod.nc  4_PeakPeriod.nc  6_PeakPeriod.nc  8_PeakPeriod.nc 
2_pwd.nc   4_pwd.nc   6_pwd.nc   8_pwd.nc 
2_SigWaveHeight.nc 4_SigWaveHeight.nc 6_SigWaveHeight.nc 8_SigWaveHeight.nc 
2_WaterLevel.nc  4_WaterLevel.nc  6_WaterLevel.nc  8_WaterLevel.nc 

是否有可能聚集沿着時間維度的每個變量,然後加入所有這些聚集在一起呢?

回答

5

是的,您可以使用NcML嵌套聚合,因此您可以在time的幾個類型join_existing聚合上使用類型union聚合。

如果timejoin_existing聚合變成具有不同的時基,可以只在聚合的一個重命名time變量和尺寸time2,然後改變這些變量的屬性來使用新命名的座標。

一個例子會更好理解:

<netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2"> 
<attribute name="title" type="string" value="SELFE - Ike - Ultralite - Variable Drag - Waves - 3D"/> 
<attribute name="institution" type="string" 
    value="Virginia Institute of Marine Science -- http://web.vims.edu/physical/"/> 
<attribute name="source" type="string" 
    value="SELFE run (version v.vvv compiled yyyy-mm-dd) for Hurricane Ike on the Ultralight mesh using variable drag, wind waves from WWM and 3D depth-averaged physics"/> 
<attribute name="history" type="string" value="ncml aggregation of .../whole_domain/ datafiles"/> 
<attribute name="references" type="string" 
    value="testbed.sura.org:/data/ftp/upload/Inundation/vims/selfe_tropical/runs/Ike/3D_varied_roughness_windstress_with_wave/Inundation_Model_Metadata_Template_v3_for_3D_windstress_sv_with_wave_Rita.docx"/> 
<variable name="selfe_mesh" shape="" type="int"> 
    <attribute name="cf_role" value="mesh_topology"/> 
    <attribute name="topology_dimension" type="int" value="2"/> 
    <attribute name="node_coordinates" value="x y"/> 
    <attribute name="face_node_connectivity" value="ele"/> 
</variable> 
<variable name="time"> 
    <attribute name="units" value="seconds since 2005-09-18 00:00:00"/> 
    <attribute name="standard_name" value="time"/> 
</variable> 
<variable name="ele" shape="nface nele" type="int"> 
    <attribute name="cf_role" value="face_node_connnectivity"/> 
    <attribute name="start_index" type="short" value="1"/> 
</variable> 
<variable name="x" shape="node" type="float"> 
    <attribute name="units" value="degrees_east"/> 
</variable> 
<variable name="y" shape="node" type="float"> 
    <attribute name="units" value="degrees_north"/> 
</variable> 
<variable name="depth" shape="node" type="float"> 
    <attribute name="mesh" value="selfe_mesh"/> 
    <attribute name="location" value="node"/> 
    <attribute name="coordinates" value="y x"/> 
    <attribute name="units" value="m"/> 
    <attribute name="standard_name" value="depth_below_geoid"/> 
    <remove type="attribute" name="positive"/> 
</variable> 
<variable name="sigma" shape="sigma" type="float"> 
    <attribute name="long_name" value="S coordinates at whole levels"/> 
    <attribute name="units" value="non-dimensional"/> 
    <attribute name="positive" value="up"/> 
</variable> 
<variable name="Cs" shape="sigma" type="float"> 
    <attribute name="long_name" value="Function C(s) at whole levels"/> 
    <attribute name="units" value="non-dimensional"/> 
    <attribute name="positive" value="up"/> 
</variable> 
<variable name="elev" shape="time node" type="float"> 
    <attribute name="long_name" value="free_surface_elevation"/> 
    <attribute name="standard_name" value="sea_surface_height_above_geoid"/> 
    <attribute name="missing_value" type="float" value="-999.00"/> 
    <attribute name="mesh" value="selfe_mesh"/> 
    <attribute name="location" value="node"/> 
    <attribute name="coordinates" value="y x"/> 
    <attribute name="units" value="m"/> 
</variable> 
<variable name="wwm_1" shape="time node" type="float"> 
    <attribute name="long_name" value="significant_wave_height"/> 
    <attribute name="standard_name" value="sea_surface_wave_significant_height"/> 
    <attribute name="missing_value" type="float" value="-999.00"/> 
    <attribute name="mesh" value="selfe_mesh"/> 
    <attribute name="location" value="node"/> 
    <attribute name="coordinates" value="y x"/> 
    <attribute name="units" value="m"/> 
</variable> 
<variable name="wwm_3" shape="time node" type="float"> 
    <attribute name="long_name" value="mean_period"/> 
    <attribute name="standard_name" value="sea_surface_wave_period_at_variance_spectral_density_mean"/> 
    <attribute name="missing_value" type="float" value="-999.00"/> 
    <attribute name="mesh" value="selfe_mesh"/> 
    <attribute name="location" value="node"/> 
    <attribute name="coordinates" value="y x"/> 
    <attribute name="units" value="s"/> 
</variable> 
<variable name="wwm_9" shape="time node" type="float"> 
    <attribute name="long_name" value="peak_period"/> 
    <attribute name="standard_name" 
    value="sea_surface_wave_period_at_variance_spectral_density_maximum"/> 
    <attribute name="missing_value" type="float" value="-999.00"/> 
    <attribute name="mesh" value="selfe_mesh"/> 
    <attribute name="location" value="node"/> 
    <attribute name="coordinates" value="y x"/> 
    <attribute name="units" value="s"/> 
</variable> 
<variable name="wwm_15" shape="time node" type="float"> 
    <attribute name="long_name" value="peak_direction"/> 
    <attribute name="standard_name" 
    value="sea_surface_wave_from_direction_at_variance_spectral_density_maximum"/> 
    <attribute name="missing_value" type="float" value="-999.00"/> 
    <attribute name="mesh" value="selfe_mesh"/> 
    <attribute name="location" value="node"/> 
    <attribute name="coordinates" value="y x"/> 
    <attribute name="units" value="degrees_east"/> 
</variable> 
<variable name="u" shape="time2 sigma node" type="float"> 
    <attribute name="standard_name" value="barotropic_eastward_sea_water_velocity"/> 
    <attribute name="mesh" value="selfe_mesh"/> 
    <attribute name="location" value="node"/> 
    <attribute name="coordinates" value="y x"/> 
    <attribute name="units" value="m/s"/> 
</variable> 
<variable name="v" shape="time2 sigma node" type="float"> 
    <attribute name="standard_name" value="barotropic_northward_sea_water_velocity"/> 
    <attribute name="mesh" value="selfe_mesh"/> 
    <attribute name="location" value="node"/> 
    <attribute name="coordinates" value="y x"/> 
    <attribute name="units" value="m/s"/> 
</variable> 
<aggregation type="union"> 
    <netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2"> 
    <aggregation dimName="time" type="joinExisting"> 
    <scan 
    location="/data/ftp/upload/Inundation/vims/selfe_tropical/runs/Rita/3D_varied_roughness_windstress_with_wave/output/" 
    regExp=".*[0-9]{1}_WaterLevel\.nc$"/> 
    </aggregation> 
    </netcdf> 
    <netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2"> 
    <aggregation dimName="time" type="joinExisting"> 
    <scan 
    location="/data/ftp/upload/Inundation/vims/selfe_tropical/runs/Rita/3D_varied_roughness_windstress_with_wave/output/" 
    regExp=".*[0-9]{1}_SigWaveHeight\.nc$"/> 
    </aggregation> 
    </netcdf> 
    <netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2"> 
    <aggregation dimName="time" type="joinExisting"> 
    <scan 
    location="/data/ftp/upload/Inundation/vims/selfe_tropical/runs/Rita/3D_varied_roughness_windstress_with_wave/output/" 
    regExp=".*[0-9]{1}_MeanPeriod\.nc$"/> 
    </aggregation> 
    </netcdf> 
    <netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2"> 
    <aggregation dimName="time" type="joinExisting"> 
    <scan 
    location="/data/ftp/upload/Inundation/vims/selfe_tropical/runs/Rita/3D_varied_roughness_windstress_with_wave/output/" 
    regExp=".*[0-9]{1}_PeakPeriod\.nc$"/> 
    </aggregation> 
    </netcdf> 
    <netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2"> 
    <aggregation dimName="time" type="joinExisting"> 
    <scan 
    location="/data/ftp/upload/Inundation/vims/selfe_tropical/runs/Rita/3D_varied_roughness_windstress_with_wave/output/" 
    regExp=".*[0-9]{1}_pwd\.nc$"/> 
    </aggregation> 
    </netcdf> 
    <netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2"> 
    <dimension name="time2" orgName="time"/> 
    <variable name="time2" orgName="time"/> 
    <aggregation dimName="time" type="joinExisting"> 
    <scan 
    location="/data/ftp/upload/Inundation/vims/selfe_tropical/runs/Rita/3D_varied_roughness_windstress_with_wave/output/" 
    regExp=".*[0-9]{1}_hvel\.nc$"/> 
    </aggregation> 
    </netcdf> 
</aggregation> 
</netcdf> 
+0

這是非常有趣的,因爲我想了很久一系列的部署和可變組織浮標觀測文件類似的東西,但我的時間規整有joinExisting聚集我的聯合變量聚合。我沒有想到像你似乎已經完成的那樣嘗試顛倒過來。按時間包裝JoinExisting的變量的聯合。我會嘗試這種方法。 –

+0

不錯。請注意,您不需要重新聲明嵌套的netcdf元素中的默認命名空間。 – Shane

相關問題