I have a directory, let's call it Simulation
and a number of folder in the directory with some NetCDF file in each folder.
Simulation [Directory]:
----ACCESS [Folder]:
------ Rootzone_ACCESS_rcp26_xyz.nc
------ Rootzone_ACCESS_rcp45_xyz.nc
------ Rootzone_ACCESS_rcp85_xyz.nc
----CCSM4 [Folder]:
------ Rootzone_CCSM4_rcp45_xyz.nc
------ Rootzone_CCSM4_rcp85_xyz.nc
----- [Other folders with NetCDF files]
I want to perform 2 operations on each file in all the folders. The operations are defined below.
#lets say test.nc is the each individual file
ncatted -O -a units,lon,c,c,"degrees_east" -a units,lat,a,c,"degrees_north" test.nc
# and I want to add '0.25res' at the end of each re-gridded file
cdo remapnn,r1440x720 test.nc test_0.25res.nc
Finally, I want to store all the re-gridded files in a different folder (let's call that folder Regridded_0.25
) in the same 'Simulation` directory. The final result should look something like this.
Simulation [Directory]:
----ACCESS [Folder]:
------ Rootzone_ACCESS_rcp26_xyz.nc
------ Rootzone_ACCESS_rcp45_xyz.nc
------ Rootzone_ACCESS_rcp85_xyz.nc
----CCSM4 [Folder]:
------ Rootzone_CCSM4_rcp45_xyz.nc
------ Rootzone_CCSM4_rcp85_xyz.nc
----- [Other folders with NetCDF files]
-----Regridded_0.25 [Folder]:
------ Rootzone_ACCESS_rcp26_xyz_0.25res.nc
------ Rootzone_ACCESS_rcp45_xyz_0.25res.nc
------ Rootzone_ACCESS_rcp85_xyz_0.25res.nc
------ Rootzone_CCSM4_rcp45_xyz_0.25res.nc
------ Rootzone_CCSM4_rcp85_xyz_0.25res.nc
------ [Other NetCDF files]
Can someone help me create a shell script
which can perform the following operations? I am quite inexperienced in large data operations in the shell
, but this would significantly reduce the time. Greatly appreciated.