Changeset 6073 for trunk/TOOLS


Ignore:
Timestamp:
2019-06-27T17:11:27+02:00 (5 years ago)
Author:
josefine.ghattas
Message:

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

Location:
trunk/TOOLS/NUDGING_FILE
Files:
1 added
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/TOOLS/NUDGING_FILE/Job_moistc_yearly_files.sh

    r6029 r6073  
    1 #MSUB -r moistcr1 
    2 #MSUB -o moistc.out_%I 
    3 #MSUB -e moistc.out_%I 
     1#MSUB -r moistc_land-hist 
     2#MSUB -o moistc_land-hist.out_%I 
     3#MSUB -e moistc_land-hist.out_%I 
    44#MSUB -n 1 
    55#MSUB -T 36000 
     
    1313 
    1414# 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.  
     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. 
    2218# 
    2319# $HeadURL$ 
     
    2622####################################################################################################################### 
    2723date 
    28 JobName=CM61-LR-hist-03.1910 
     24JobName=CM61-LR-land-hist-02 
    2925mkdir run_moistc_${JobName} 
    3026cd run_moistc_${JobName} 
    3127 
    3228echo 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 " 
     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 
    3632 
    3733# 2. Extract moistc 
    38 echo Extract variable moistc from pack files 
     34echo Extract variable moistc from yearly files 
    3935# 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 
    4041 
    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 
     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  
    4461done 
    4562 
    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  
    9363 
    9464echo End 
Note: See TracChangeset for help on using the changeset viewer.