source: trunk/TOOLS/NUDGING_FILE/Job_moistc_yearly_files.sh @ 6073

Last change on this file since 6073 was 6073, checked in by josefine.ghattas, 5 years ago

Added script to create soil moisture nudging files from daily output.

  • Property svn:executable set to *
  • Property svn:keywords set to Date Revision HeadURL
File size: 2.4 KB
Line 
1#MSUB -r moistc_land-hist
2#MSUB -o moistc_land-hist.out_%I
3#MSUB -e moistc_land-hist.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
12set +vx
13
14# Script to create nudging file for soil moisture.
15# This extracts moistc variable from sechiba_out_2.nc output files from a previsous simulation.
16# The moistc variable is separated into 3 variables depending on the soiltiles moistc_1,
17# moistc_2 and moistc_3.
18#
19# $HeadURL$
20# $Date$
21# $Revision$
22#######################################################################################################################
23date
24JobName=CM61-LR-land-hist-02
25mkdir run_moistc_${JobName}
26cd run_moistc_${JobName}
27
28echo Start
29# 1. Path to simulation land-hist
30#    Note: the files are daily output frequency even if the folder and file name contain HF
31simulpath=/ccc/store/cont003/gencmip6/p529vui/IGCM_OUT//PROD/land-hist/CM61-LR-land-hist-02/SRF/Output/HF
32
33# 2. Extract moistc
34echo Extract variable moistc from yearly files
35# float moistc(time_counter, soiltyp, solay, lat, lon)
36year=1850
37lastyear=2014
38while [ ${year} -le ${lastyear} ] ; do
39  pack=${year}0101_${year}1231
40  echo Treat file ${simulpath}/${JobName}_${pack}_HF_sechiba_out_2.nc
41
42  # Extract the variable moistc
43  ncks -v moistc ${simulpath}/${JobName}_${pack}_HF_sechiba_out_2.nc moistc_${year}_sechiba_out_2.nc
44
45  # Separate into variables per soiltile
46  ncks -d soiltyp,0,0 moistc_${year}_sechiba_out_2.nc moistc1_${year}_sechiba_out_2.nc
47  ncks -d soiltyp,1,1 moistc_${year}_sechiba_out_2.nc moistc2_${year}_sechiba_out_2.nc
48  ncks -d soiltyp,2,2 moistc_${year}_sechiba_out_2.nc moistc3_${year}_sechiba_out_2.nc
49
50  ncrename -v moistc,moistc_1 moistc1_${year}_sechiba_out_2.nc
51  ncrename -v moistc,moistc_2 moistc2_${year}_sechiba_out_2.nc
52  ncrename -v moistc,moistc_3 moistc3_${year}_sechiba_out_2.nc
53
54  # Remove dimension soiltyp (which is now 1) by averaging over the dimension. Put all variables in the same file.
55  for soiltyp in 1 2 3 ; do
56    ncwa -A -a soiltyp  moistc${soiltyp}_${year}_sechiba_out_2.nc moistc_allsoil_${year}_sechiba_out_2.nc
57  done
58  ncatted -a long_name,moistc_1,m,c,"Soil Moisture profile for soil tile 1" moistc_daily_${year}.nc
59  ncatted -a long_name,moistc_2,m,c,"Soil Moisture profile for soil tile 2" moistc_daily_${year}.nc
60  ncatted -a long_name,moistc_3,m,c,"Soil Moisture profile for soil tile 3" moistc_daily_${year}.nc
61done
62
63
64echo End
65
Note: See TracBrowser for help on using the repository browser.