'Merge nc files with different longitude and latitude but same timestamps

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?



Solution 1:[1]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Robert Wilson