1 | #MSUB -r moistcr1 |
---|
2 | #MSUB -o moistc.out_%I |
---|
3 | #MSUB -e moistc.out_%I |
---|
4 | #MSUB -n 1 |
---|
5 | #MSUB -T 36000 |
---|
6 | #MSUB -q xlarge |
---|
7 | #MSUB -c 8 |
---|
8 | #MSUB -Q normal |
---|
9 | #MSUB -A gen0239 |
---|
10 | #MSUB -m store,work,scratch |
---|
11 | ##MSUB -A ls3cmip6 |
---|
12 | set +vx |
---|
13 | |
---|
14 | # Script to create nudging file for soil moisture. |
---|
15 | # This creates a climatology of the soil moisture over 1980-2014 with daily frequency. |
---|
16 | # |
---|
17 | # 1. Daily output for the years 1980-2014 from the simulation CM61-LR-hist-03.1910 are used. |
---|
18 | # 2. The variable moistc is first splitted into moistc_1, moistc_2, moistc_3 to remove the axes on soiltiles. |
---|
19 | # 3. For years with 366 days, the 31 of decembre is removed to enable making the median over all years. |
---|
20 | # 4. The median is calculated over the whole period 1980-2014 to obtain one year climatologie file with daily frequency. |
---|
21 | # 5. The last day is duplicated to have 366 days in the file. |
---|
22 | # |
---|
23 | # $HeadURL$ |
---|
24 | # $Date$ |
---|
25 | # $Revision$ |
---|
26 | ####################################################################################################################### |
---|
27 | date |
---|
28 | JobName=CM61-LR-hist-03.1910 |
---|
29 | mkdir run_moistc_${JobName} |
---|
30 | cd run_moistc_${JobName} |
---|
31 | |
---|
32 | echo Start |
---|
33 | # 1. historical r1: CM61-LR-hist-03.1910 |
---|
34 | simulpath=/ccc/store/cont003/gencmip6/p86caub/IGCM_OUT/IPSLCM6/PROD/historical/CM61-LR-hist-03.1910/SRF/Output/DA |
---|
35 | allpack=" 19800101_19891231 19900101_19991231 20000101_20091231 20100101_20141231 " |
---|
36 | |
---|
37 | # 2. Extract moistc |
---|
38 | echo Extract variable moistc from pack files |
---|
39 | # float moistc(time_counter, soiltyp, solay, lat, lon) |
---|
40 | |
---|
41 | for pack in ${allpack} ; do |
---|
42 | echo Treat file ${simulpath}/${JobName}_${pack}_DA_sechiba_out_2.nc |
---|
43 | ncks -v moistc ${simulpath}/${JobName}_${pack}_DA_sechiba_out_2.nc moistc_${pack}_DA_sechiba_out_2.nc |
---|
44 | done |
---|
45 | |
---|
46 | echo Separate into variables per soiltile |
---|
47 | for pack in ${allpack} ; do |
---|
48 | ncks -d soiltyp,0,0 moistc_${pack}_DA_sechiba_out_2.nc moistc1_${pack}_DA_sechiba_out_2.nc |
---|
49 | ncks -d soiltyp,1,1 moistc_${pack}_DA_sechiba_out_2.nc moistc2_${pack}_DA_sechiba_out_2.nc |
---|
50 | ncks -d soiltyp,2,2 moistc_${pack}_DA_sechiba_out_2.nc moistc3_${pack}_DA_sechiba_out_2.nc |
---|
51 | |
---|
52 | ncrename -v moistc,moistc_1 moistc1_${pack}_DA_sechiba_out_2.nc |
---|
53 | ncrename -v moistc,moistc_2 moistc2_${pack}_DA_sechiba_out_2.nc |
---|
54 | ncrename -v moistc,moistc_3 moistc3_${pack}_DA_sechiba_out_2.nc |
---|
55 | done |
---|
56 | |
---|
57 | echo Remove dimension soiltyp (which is now 1) by averaging over the dimension. Put all variables in the same file. |
---|
58 | for pack in ${allpack} ; do |
---|
59 | for soiltyp in 1 2 3 ; do |
---|
60 | ncwa -A -a soiltyp moistc${soiltyp}_${pack}_DA_sechiba_out_2.nc moistc_allsoil_${pack}_DA_sechiba_out_2.nc |
---|
61 | done |
---|
62 | ncatted -a long_name,moistc_1,m,c,"Soil Moisture profile for soil tile 1" moistc_allsoil_${pack}_DA_sechiba_out_2.nc |
---|
63 | ncatted -a long_name,moistc_2,m,c,"Soil Moisture profile for soil tile 2" moistc_allsoil_${pack}_DA_sechiba_out_2.nc |
---|
64 | ncatted -a long_name,moistc_3,m,c,"Soil Moisture profile for soil tile 3" moistc_allsoil_${pack}_DA_sechiba_out_2.nc |
---|
65 | done |
---|
66 | |
---|
67 | echo Separate per year |
---|
68 | for pack in ${allpack} ; do |
---|
69 | cdo splityear moistc_allsoil_${pack}_DA_sechiba_out_2.nc moistc_ |
---|
70 | done |
---|
71 | |
---|
72 | # 3. Remove one time step in leap years |
---|
73 | echo Remove last time step 31 of december from leap years |
---|
74 | allleap=" 1980 1984 1988 1992 1996 2000 2004 2008 2012 " |
---|
75 | for year in $allleap ; do |
---|
76 | mv moistc_${year}.nc moistc_${year}.leap.nc |
---|
77 | ncks -d time_counter,0,364 moistc_${year}.leap.nc moistc_${year}.365.nc |
---|
78 | cp moistc_${year}.365.nc moistc_${year}.nc |
---|
79 | done |
---|
80 | |
---|
81 | # 4. Calculate the median |
---|
82 | echo Calculate median |
---|
83 | cdo enspctl,50 moistc_????.nc moistc_clim_1980_2014.nc |
---|
84 | |
---|
85 | # 5. Duplicate last day to make a file with 366days |
---|
86 | echo Duplicate last day to make a file with 366days |
---|
87 | # Extract last day |
---|
88 | cdo seltimestep,365 moistc_clim_1980_2014.nc moistc_clim_365.nc |
---|
89 | # Switch time axis one day ahead |
---|
90 | ncatted -O -a units,time_counter,m,c,"seconds since 1850-01-02 00:00:00" moistc_clim_365.nc |
---|
91 | # Merge with clim file |
---|
92 | ncrcat moistc_clim_1980_2014.nc moistc_clim_365.nc moistc_clim_1980_2014_366d.nc |
---|
93 | |
---|
94 | echo End |
---|
95 | |
---|