When in doubt, resort to the free NCAR's NCL language for this fix:
a =3D addfile("file.nc","r") ; read in file
var =3D a->var ; let's say var is (time, lat, lon)
var!0 =3D "time"
Time =3D (/0,1,2,3,4,5,6,7,8,9,10/) ; or Time =3D ispan(0,10,1) or... Time
=3D <some string>
var&time =3D Time
..
<snip>
..
;write out to netcdf file
b =3D addfile("out_file.nc","c")
b->var=3Dvar
There are also other time fixes one may do.
http://www.ncl.ucar.edu/
Erik
On Oct 29, 6:13=A0am, Stephanie <ee...@leeds.ac.uk> wrote:
> Dear all,
>
> I struggle to create netCDF output that has the correctly time axis
> for further post-processing. I thought/tried different ways: (1)
> writing the time variable, read in from a correct netCDF file,
> directly to the output file, but it does not let me set the attribute.
> (2) creating a date-time axis myself, which does not seem trivial.
>
> Can you give advice or a code example on how to manage this issue?
>
> Thanks,
> Steph
|