Availability:
ncra, ncrcat
Short options: None |
Time rebasing seeks to fix the following problem:
We have a numerous files to concatenate or average along a common record
dimension/coordinate.
Although the record coordinate is in the same time units in each file,
the date offset is different in each file.
For example suppose the time coordinate is in hours and we have 31 files
for each day in January.
Within each file is the variable temperature temp(time)
; and a
time coordinate that ranges from 0–23 hours.
The time:units
attribute from each file is
file01.nc time:units="hours since 1990-1-1" file02.nc time:units="hours since 1990-1-2" file03.nc time:units="hours since 1990-1-3" file04.nc time:units="hours since 1990-1-4" ...
// Find the mean noon day temperature in january ncra -v temp -d time,"1990-1-1 12:00:00","1990-1-31 23:59:59",24 \ file??.nc noon.nc // Concatenate day2 noon - day3 noon records ncrcat -v temp -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 temp -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 ;