Shell script to do 'cdo' operation on multiple Netcdf file embedded in multiple folders
0
votes
0
answers
180
views
I have a directory on my Linux machine, let's name it
MYDIR
, with a number of folders labeled based on the years (1982, 1983, 1984, ..., 2022). Whithin each sub-folder, there are other folders named according to the months (01, 02, 03, ..., 12) and several NetCDF daily data inside each of these folders as well:
MYDIR [directory]
--1982[folder]
----01[folder]
----02[folder]
----03[folder]
----12[folder]
--1982[folder]
----01[folder]
----02[folder]
----12[folder]
I want to perform 2 operations on each file in all the folders. The operations are defined below.
cdo mergetime *.nc outfile.nc;
cdo ymonmean outfile.nc L4_GHRSST-SSTfnd_1982_01.nc
Finally, I want to save all L4_GHRSST-SSTfnd_1982_01.nc
, L4_GHRSST-SSTfnd_1982_02.nc
, ...,L4_GHRSST-SSTfnd_2022_01.nc
, ..., L4_GHRSST-SSTfnd_2022_12.nc
in a different folder named monmean
in MYDIR
.
Can someone help me create a shell script which can perform the mentioned process?
Asked by Farshid Daryabor
(1 rep)
Jan 12, 2024, 02:11 PM
Last activity: Jan 12, 2024, 02:31 PM
Last activity: Jan 12, 2024, 02:31 PM