I downloaded a netcdf file containing 4-5 variables but it has only 2 dimensions (lat and lon). Time is missing and this does not allow me to merge timesteps or do anything useful.
Is there any way to fix this hopefully by using CDO?
there are 100 netcdf files (without time dimension) and I want to merge them using time as the main variable for merging.
Let me expound a bit on the answer by @Ales --
ncecat is a command-line function in the NCO package that concatenates multiple netcdf files lacking a record (oftentimes "Time") dimension. The concatenated file will have a new record dimension, by default it is 'record'.
Let's say you have a list of netcdf files such as A.nc, B.nc, and C.nc, all with the dimensions lat x lon. You can concatenate them using ncecat A.nc B.nc C.nc -O new_file.nc. new_file.nc will have dimensions record x lat x lon, where record will have a size of 3 (the number of files you concatenated). The -O option is not necessary, but will explicitly create (and overwrite) the file new_file.nc...or whatever you want to call it.
You can use command:
ncecat -O -u time in.nc out.nc
to create a new time dimension from scratch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With