I have a script that requires a 'time' variable within the ncfiles I am analyzing. My ncfiles did not include a time dimension at first, and I have successfully added one (the time dimension was created by reading a timestamp from the nc filename). Now I am trying to create a variable 'time' in my ncfile, taking information from the time dimension that is already there.
This timeVar_inFile.nc includes time as a variable, and shows here:
$cdo showname timeVar_inFile.nc
time albedo
But this needTime_asVar.nc does not show time as a variable (how do I do this?), it only has it as a dimension.
$cdo showname needTime_asVar
albedo
More information from ncdump which shows time as a dimension:
File that has time as variable:
ncdump -h timeVar_inFile.nc
netcdf timeVar_inFile {
dimensions:
t = 217 ;
variables:
double time(t) ;
File I want to create time as variable from its time dimension:
ncdump -h needTime_asVar.nc
netcdf needTime_asVar {
dimensions:
x = 83 ;
y = 94 ;
time = UNLIMITED ; // (4 currently)
variables:
double time(time) ;
time:standard_name = "time" ;
time:long_name = "Time" ;
time:units = "hours since 1979-1-2 00:00:00" ;
time:calendar = "standard" ;
time:axis = "T" ;
