xmlnetcdfncml

Using ncml to aggregate netcdf files?


We have hourly output from an ocean model stored in a series of netcdf files, one for each month.

We store the first and last hour of the month in each file. We would like to aggregate these files using NcML, but we don't want to get duplicate time values in the aggregation.

Is there a way to accomplish this?


Solution

  • In NCML, you can use NCOORDS to specify exactly the number of records you want to use. So to avoid the duplicate time values, you can specify NCOORDS for each month to be one less than what you currently have. So for a non-leap year, your aggregation might be specified like this:

    <netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2">
        <aggregation dimName="time" type="joinExisting">
            <netcdf location="/Data/wave/2010/Jan/gom01_0001.nc" ncoords="744"/>
            <netcdf location="/Data/wave/2010/Feb/gom01_0001.nc" ncoords="672"/>
            <netcdf location="/Data/wave/2010/Mar/gom01_0001.nc" ncoords="744"/>
            <netcdf location="/Data/wave/2010/Apr/gom01_0001.nc" ncoords="720"/>
            <netcdf location="/Data/wave/2010/May/gom01_0001.nc" ncoords="744"/> 
            <netcdf location="/Data/wave/2010/Jun/gom01_0001.nc" ncoords="720"/>
            <netcdf location="/Data/wave/2010/Jul/gom01_0001.nc" ncoords="744"/>      
            <netcdf location="/Data/wave/2010/Aug/gom01_0001.nc" ncoords="744"/>    
            <netcdf location="/Data/wave/2010/Sep/gom01_0001.nc" ncoords="720"/>
            <netcdf location="/Data/wave/2010/Oct/gom01_0001.nc" ncoords="744"/>
            <netcdf location="/Data/wave/2010/Nov/gom01_0001.nc" ncoords="720"/>
            <netcdf location="/Data/wave/2010/Dec/gom01_0001.nc" ncoords="744"/>
        </aggregation>       
    </netcdf>
    

    In a leap year, you would specify ncoords="696" for February.