0

I have 16 netcdf files (without a time dimension) on a global scale that contain the same amount of longitude grid points (namely 432) and the same amount of latitude grid points (namely 324). Each netcdf file contains a slice of data, for example in file 1 there is a data slice from latitude range 90 to 80 and in file 2 there is data available from latitude range 80 to 70. I want to merge these files which each contain a different slice of data to obtain a complete global dataset.

I have tried to merge the netcdf files with cdo mergegrid as described in this answer https://stackoverflow.com/a/51566286/20668027 and that worked as far as I could see, however, when looking in the cdo guidelines it was stated that cdo mergegrid is only supported for rectilinear grids. The grid that I am using is not rectilinear but since it seemed to work on my data I was wondering if I could still use cdo mergegrid? Does anyone have insights about this?

Thank you very much in advance!

Freek
  • 15
  • 4
  • 1
    CDO officially only supports rectilinear, but my understanding is that this method can still work on some other grids, but it may not be robust enough for the developers to officially support it. Have you looked at `cdo griddes infile` to check if the output is correct? If it is, then I'd assume mergegrid works with the files – Robert Wilson Jan 10 '23 at 11:05
  • Hi @RobertWilson thank you for your quick response, yes I have indeed looked at the resulting file with cdo griddes and the original grid (432 X 324) remains unchanged so then it seems to work! Thanks :) – Freek Jan 10 '23 at 11:49
  • Actually, it sounds like you want to use `collgrid`. Do you know want to end up with (424*16) x 324? – Robert Wilson Jan 10 '23 at 12:52
  • Hi @RobertWilson, the aim is to create a global dataset of 1 data variable on a grid of 432 x 324 (lon x lat) from the input files which already have the global 432 x 324 grid but in each input file only a slice of the data of the variable is represented (e.g. in file 1 there is only data for latitudes 80 to 90 and the other gridpoints contain fill values!). Hence, I want to merge the data in the files to obtain a file with variable data for all latitudes (I hope my explanation is clear!). I do not know if collgrid can do this since all gridpoints are already represented in the input files? – Freek Jan 10 '23 at 13:25
  • OK. In that case would `ensmean` not do what you want? If each grid cell only has a single non-missing value across the files, then it should do what youwant. – Robert Wilson Jan 10 '23 at 14:15
  • Hi @RobertWilson, thank you for that suggestion I had not thought of that! I think it worked for my data :) – Freek Jan 11 '23 at 08:44

1 Answers1

1

The NCO equivalent to CDO ensmean is nces described here. You could try

nces in*.nc out.nc
Charlie Zender
  • 5,929
  • 14
  • 19