-2

I have multiple time series of a characteristic over the same time period stored in separate netCDF files, and I would like to store these time series in a matrix accessible from one netCDF file. So, I would like to transform the data from the vectors in multiple files to the matrix in one file.

I have found that standard CDO commands for merging the files are not appropriate in this case. For example, if there are two time series, the operators 'mergetime' or 'cat' append the second time series to the first one, whereas I need to concatenate them in the matrix form, i.e., columnwise.

  • I am not sure if I follow your question. You are going from 1D to 2D. Does this mean each file is a separate location? You will probably need to provide more info on the files. – Robert Wilson Jul 21 '20 at 15:53
  • @RobertWilson I have clarified the question. Each file is a time series, and I need to store all time series columnwise as a matrix written in a single netCDF file. – Mikhail Latonin Jul 21 '20 at 20:37
  • You might want to try `ncecat *nc -O merged.nc`, which will merge the files and add a dimension, assuming you have NCO installed. But if that doesn't work you should experiment with the methods discussed here: http://dvalts.io/data/modelling/2018/01/16/NetCDF-merging.html – Robert Wilson Jul 21 '20 at 20:46

1 Answers1

1

ncecat would automatically name the new dimension "column" with

ncecat -u column in*.nc out.nc 
Charlie Zender
  • 5,929
  • 14
  • 19