I want to add a new variable to an existing netcdf file which simply increases linearly with the time variable of file, that is to say, on the first time slice the variable has the number 1 everywhere, on the second timeslice it is set to 2, etc.
I know how to open the file in python or fortran and define and add the variable and write out the modified file, but I was hoping that there might be a quick and easy way to do this from the command line using nco. I also wondered if I could do it by dumping the file to CDL format with ncdump, hacking it and turning it back to netcdf with ncgen, but that seemed more longwinded and problematic than the python approach.