Project

General

Profile

How to merge 3-hourly NetCDF files into 6-hourly NetCDF files?

Added by Alwin Bathan 4 months ago

I have downloaded MSWEP's 3-hourly rainfall data but I need to convert them into 6 hourly-data.

I understand that I can use

cdo mergetime

but the current .nc files are labeled:

2024001.00.nc
2024001.03.nc
2024001.06.nc
2024001.09.nc
2024001.12.nc
2024001.15.nc
2024001.18.nc
2024001.21.nc

If I understand correctly, doing

cdo mergetime 202400*.nc

would give me daily rainfall data.
On the other hand, doing

cdo mergetime 2024001.*.nc

would give me 12-hourly rainfall data.

Any ideas how I can get 6-hourly data? Is there also a way where I can repeat the solution for each day of my data (1979-2024)


Replies (2)

RE: How to merge 3-hourly NetCDF files into 6-hourly NetCDF files? - Added by Alwin Bathan 4 months ago

My mistake, doing

cdo mergetime 202400*.nc

merges day 1-9 data, while

cdo mergetime 2024001.*.nc

gives me daily rainfall data

RE: How to merge 3-hourly NetCDF files into 6-hourly NetCDF files? - Added by Karin Meier-Fleischer 4 months ago

If you want to convert data from 3-hourly to 6-hourly time intervall you can use the inttime operator. You can use the operator chaining to do this and the time merge in one step.

For example

cdo -O -inttime,2024-01-01,12:00:00,6hour -mergetime 2024*.nc outfile.nc
    (1-2/2)