Next: , Previous: UDUnits Support, Up: Common features


3.20 Rebasing Time Coordinate

Availability: ncra, ncrcat Short options: None

Time re-basing is performed automatically when UDUnits is installed. Time rebasing is invoked when numerous files share a common time-based record coordinate, and the record coordinate is in the same time units in each file, but the date offset differs among files. For example suppose the time coordinate is in hours and each day in January is stored in its own daily file. Each daily file records the temperature variable tpt(time) with an (unadjusted) time coordinate value between 0–23 hours, and uses the units attribute to advance the base time:

     file01.nc time:units="hours since 1990-1-1"
     file02.nc time:units="hours since 1990-1-2"
     ...
     file31.nc time:units="hours since 1990-1-31"

     // Find mean noontime temperature in January
     ncra -v tpt -d time,"1990-1-1 12:00:00","1990-1-31 23:59:59",24 \
           file??.nc noon.nc
     
     // Concatenate day2 noon through day3 noon records
     ncrcat -v tpt -d time,"1990-1-2 12:00:00","1990-1-3 11:59:59" \
           file01.nc file02.nc file03.nc noon.nc
     
     // Results: time is "re-based" to the time units in "file01.nc"
     time=36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
          53, 54, 55, 56, 57, 58, 59 ;
     
     // If we repeat the above command but with only two input files...
     ncrcat -v tpt -d time,"1990-1-2 12:00:00","1990-1-3 11:59:59" \
           file02.nc file03 noon.nc
     
     // ...then the output time coordinate is based on the time units in "file02.nc"
     time = 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
         29, 30, 31, 32, 33, 34, 35 ;