Currently I use global precipitation (ppt) and potential evapotranspiration (pet) data to calculate SPEI. As I have limited hardware resources, I divided global ppt and ppt data into 32 parts, each file covering 45x45deg and contains 756 data - monthly from 1958-2020 (tile01.nc, tile02.nc, ... tile32.nc)
- For example to do this, I use
cdo sellonlatbox,-180,-135,45,90 in.nc out.nc
orncks -d lat,45.,90. -d lon,-180.,-135. in.nc -O out.nc
- As required by SPEI script, I reorder and fixed the dimension from
time,lat,lon
tolat,lon,time
usingncpdq
andncks
. - From the SPEI output, I got the output in
lat,lon,time
. So I did reorder the dimension so that it becomestime,lat,lon
usingncpdq
. - Each tile SPEI output covering 45x45deg and contains 756 SPEI data - monthly from 1958-2020
Finally I need to merge all the output together (32 files) into one, so I will get the global SPEI output. I have try to use cdo mergegrid
but the result is not what I expected. Is there any command from cdo
or nco
to solve this problem that has function similar to gdal_merge
if we are dealing with geoTIFF format?
Below is the example of the SPEI output
UPDATE
I managed to merge all the data using cdo collgrid
as suggested by Robert below. And here's the result: