[Thread Prev][Thread Next][Index]

Re: [las_users] LAS NetCDF aggregation



Anton,

NcML has a capability that exactly addresses the situation you have described.  Here's how it works:

  1. If you do not specify a coordinate variable, one must exist in each of the nested datasets, and the coordinate values will be read from it, just like any other aggregation variable. In this case, when the units of the aggregation coordinate change on the existing coordinate variables, you must add timeUnitsChange="true" on the aggregation element:
<aggregation dimName="time" type="joinExisting" timeUnitsChange="true">
  <netcdf location="file:/test/temperature/janAvgWeek.nc" />
  <netcdf location="file:/test/temperature/febAvgWeek.nc" />
</aggregation>

The timeUnitsChange feature requires that all the aggregation coordinate values will be read in when the dataset is opened.

So in your case, something like this should work:

<catalog xmlns="http://www.unidata.ucar.edu/namespaces/thredds/InvCatalog/v1.0"
         xmlns:xlink="http://www.w3.org/1999/xlink"
         name="aggregate test" version="1.0.2">
  <service name="ncdods" serviceType="OPENDAP" base="/thredds/dodsC/" />
  <dataset name="Hydro Aggregate (test)" ID="hydro_aggregate" urlPath="test/hydro_aggregate.nc">
    <serviceName>ncdods</serviceName>
    <netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2">
      <aggregation dimName="time" type="joinExisting" recheckEvery="5 sec"
timeUnitsChange="true">    
        <scan location="/hydro/test/" suffix=".nc" />
      </aggregation>
    </netcdf>
  </dataset>
</catalog>

Roland

On 02/08/2011 11:09 PM, Anton Yoel Buenavista wrote:
Hi everyone,

We have several datasets that contain the same format of data but spliced up into different dates as individual NetCDF files. Say I have 10 NetCDF files from February 11 to February 20, and I would like to aggregate them into one "February" dataset in LAS.

Below is a sample header via ncdump:

netcdf hydro_11_02_2011 {
dimensions:
        lon = 1000 ;
        lat = 1000 ;
        zaxis = 1 ;
        time = UNLIMITED ; // (49 currently)
variables:
        float lon(lon) ;
                lon:units = "degrees_east" ;
                lon:long_name = "Longitude" ;
        float lat(lat) ;
                lat:units = "degrees_north" ;
                lat:long_name = "Latitude" ;
        float time(time) ;
                time:long_name = "coordinate variables of time" ;
                time:units = "second since 2011-02-10" ;
                time:figure = "na" ;
        float va(time, lat, lon) ;
                va:units = "meter/second" ;
                va:long_name = "depth-averaged y-velocity of currents" ;
                va:figure = "vector_y" ;
                va:_FillValue = -999.f ;
        float ua(time, lat, lon) ;
                ua:units = "meter/second" ;
                ua:long_name = "depth-averaged x-velocity of currents" ;
                ua:figure = "vector_x" ;
                ua:_FillValue = -999.f ;

// global attributes:
                :title = "output 11" ;
                :institution = "test" ;
                :source = "test prg" ;
                :comment =  ;
                :format = "version 1.1" ;
                :reference_point = "none" ;
                :previous_file = "na" ;
                :next_file = "na" ;
                :first_record = "2011-02-11 00:00:00" ;
                :last_record = "2011-02-12 00:00:00" ;
data:

time = 86400, 88200, 90000, 91800, 93600, 95400, 97200, 99000, 100800,
    102600, 104400, 106200, 108000, 109800, 111600, 113400, 115200, 117000,
    118800, 120600, 122400, 124200, 126000, 127800, 129600, 131400, 133200,
    135000, 136800, 138600, 140400, 142200, 144000, 145800, 147600, 149400,
    151200, 153000, 154800, 156600, 158400, 160200, 162000, 163800, 165600,
    167400, 169200, 171000, 172800 ;

(...)

Subsequent NetCDF files contain the same header format and information. The only difference in the header will be the timestamp. (i.e. hydro_12_02_2011 will have  time:units = "second since 2011-02-11" ; )

I have made a sample aggregate configuration in THREDDS.

<catalog xmlns="http://www.unidata.ucar.edu/namespaces/thredds/InvCatalog/v1.0"
         xmlns:xlink="http://www.w3.org/1999/xlink"
         name="aggregate test" version="1.0.2">
  <service name="ncdods" serviceType="OPENDAP" base="/thredds/dodsC/" />
  <dataset name="Hydro Aggregate (test)" ID="hydro_aggregate" urlPath="test/hydro_aggregate.nc">
    <serviceName>ncdods</serviceName>
    <netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2">
      <variable name="time" shape="time" type="double">
        <attribute name="long_name" value="coordinate variables of time" />
        <values start="86400" increment="3600" />
      </variable>
      <aggregation dimName="time" type="joinExisting" recheckEvery="5 sec">
        <variableAgg name="time" />
        <scan location="/hydro/test/" suffix=".nc" />
      </aggregation>
    </netcdf>
  </dataset>S.
</catalog>

Each dataset's time data always starts at 86400, so I believe simply setting the value start="86400" with an increment of 3600 will not work since the next dataset's time data will reset back to 86400.  Is LAS able to make use of the TIME variable's UNIT attribute (containing the time origin) to facilitate calculation of the date/times?  Would it be better instead to define Ferret descriptor files instead of using THREDDS? If so, how do I aggregate in LAS7.2.x  NetCDF datasets using Ferret's file descriptor? Any advice is deeply appreciated.
--
Regards,
Anton Yoel Buenavista



[Thread Prev][Thread Next][Index]


Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement