| 1 | #!/bin/bash |
| 2 | |
| 3 | # search file names and rebuid |
| 4 | # set up working years |
| 5 | year=(1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000) |
| 6 | |
| 7 | # set the experinment name |
| 8 | exp="BCLb" |
| 9 | |
| 10 | # set the file path for searching files |
| 11 | in_dir_path="/ccc/store/cont003/dsm/p529luy/IGCM_OUT/LMDZOR/PROD/amip/"$exp"/ATM/Output/DA" |
| 12 | |
| 13 | #echo $in_dir_path |
| 14 | # move the path to search the files |
| 15 | cd $in_dir_path |
| 16 | |
| 17 | # start the loop for searching the files... |
| 18 | for index in {0..19} |
| 19 | do |
| 20 | echo "Search files on year: ${year[$index]}" |
| 21 | # use the "find" and "sort" command to find the files |
| 22 | # and sort by the numberic number appears in the filenames |
| 23 | inputfilename=( $(find -name "${exp}_${year[$index]}*" | sort -n) ) |
| 24 | echo "PROCESSING input files: "${inputfilename[@]} |
| 25 | |
| 26 | # make a outout file name based on the working "exp" and "year" |
| 27 | export outputfilename="${exp}_${year[$index]}.nc" |
| 28 | |
| 29 | # use "ncrcat" command to re-create(combine) the nc file based on the searched inputfilename |
| 30 | ncrcat ${inputfilename[@]} /ccc/store/cont003/dsm/cheny/Daily/${exp}/$outputfilename |
| 31 | |
| 32 | echo "PLEASE CHECK output file: "$outputfilename |
| 33 | done |
| 34 | |
| 35 | echo "FINISHed THE COMBINE files job.. (AH-JA...)"$outputfilename |