0

I have downloaded some ERA5 data for eastern North America at noon (12:00). This means I had to download nc-files separately to match 12:00 noon for different longitudes. Hence, between longitude -52.5 and -67.5, the timestamp is 16.00, while it is 17.00 for between -67.5 and 82.5. They however all go from 2000 to 2020, a total of 7671 timestamps. On top of that, the nc-files also differ in latitudes.

data a:
Dimensions:    (latitude: 177, longitude: 61, time: 7671)
Coordinates:
  * longitude  (longitude) float32 -67.5 -67.25 -67.0 ... -53.0 -52.75 -52.5
  * latitude   (latitude) float32 90.0 89.75 89.5 89.25 ... 46.5 46.25 46.0
  * time       (time) datetime64[ns] 2000-01-01T16:00:00 ... 2020-12-31T16:00:00
Data variables:
    t2m        (time, latitude, longitude) float32 ...

data b:
Dimensions:    (latitude: 185, longitude: 61, time: 7671)
Coordinates:
  * longitude  (longitude) float32 -82.5 -82.25 -82.0 ... -68.0 -67.75 -67.5
  * latitude   (latitude) float32 90.0 89.75 89.5 89.25 ... 44.5 44.25 44.0
  * time       (time) datetime64[ns] 2000-01-01T17:00:00 ... 2020-12-31T17:00:00
Data variables:
    t2m        (time, latitude, longitude) float32 ...

I tried to use cdo cat and cdo mergetime, but I get different errors.

cdo cat temp*.nc out_temp.nc

cdo    cat:  12%
Warning: Grid size of the input parameter t2m do not match!

and

cdo mergetime temp*.nc out_temp.nc
Warning: Grid size of the input parameter t2m do not match!

How can I overcome this?

Thomas
  • 441
  • 3
  • 16

1 Answers1

0

The cdo operator collgrid is designed for collecting horizontal grids into one. Try this:

cdo collgrid temp*.nc out_temp.nc

This should work so long as you have a complete grid to merge.

Robert Wilson
  • 3,192
  • 11
  • 19
  • I get the following message: `ysize=137 differ from first file (ysize=145)!` – Thomas Mar 12 '22 at 12:06
  • They need to be equally sized rectangles for collgrid to work. Your answer suggests the latitudes vary – Robert Wilson Mar 12 '22 at 13:19
  • Yes, so collgrid does not work with files with various latitude ranges? – Thomas Mar 13 '22 at 10:31
  • Yes, it requires the grids to be collected to form a structured grid. You might be able to solve the problem using `mergegrid`. – Robert Wilson Mar 13 '22 at 13:09
  • Hi all. I have tried to edit the question as I understand why it was unclear. Unfortunately, the `collgrid` and `mergegrid` did not work. Any other solution to basically join the NC files? – Thomas Mar 14 '22 at 10:55
  • 1
    CDO is probably unsuited for this. Python would using pandas and xarray. Read everything into a pandas dataframe, merge them, then convert to xarray, then netcdf. Otherwise, you are trying to get CDO to do something it wasn't designed to do – Robert Wilson Mar 14 '22 at 11:18