Changeset 3097
- Timestamp:
- 01/25/17 16:51:45 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TOOLS/INTERP_NUDGE/interp_from_era.ksh
r2172 r3097 13 13 14 14 # gridfile : file grilles_gcm.nc containing longitudes and latitudes of the destination grid 15 gridfile=/ccc/store/cont003/dsm/p86ghatt/IGCM_OUT/LMDZ/EL C-128x118x39/ATM/Output/Grid/ELC-128x118x39_grilles_gcm.nc15 gridfile=/ccc/store/cont003/dsm/p86ghatt/IGCM_OUT/LMDZ/ELI-144x142x79/ATM/Output/Grid/ELI-144x142x79_1979_grilles_gcm.nc 16 16 17 17 # indir : path for directory containing the files to interpolate 18 18 #indir=/u/rech/psl/rpsl376/ERAI/NETCDF/GLOBAL_075/4xdaily/AN_PL 19 indir=/ccc/ store/cont003/subipsl/subipsl/dmf_import/ERAI/NETCDF/GLOBAL_075/4xdaily/AN_PL19 indir=/ccc/work/cont003/subipsl/subipsl/ERAI/NETCDF/GLOBAL_075/4xdaily/AN_PL/ 20 20 # insuffix : suffix in input files 21 21 insuffix=.aphei.GLOBAL_075.nc … … 26 26 # Variables for output : 27 27 # outdir : directory to store output files 28 outdir=$WORKDIR/NUDGEFILES/ERAI-1 28x118x3928 outdir=$WORKDIR/NUDGEFILES/ERAI-144x142x79 29 29 # outsuffix : suffix to output files 30 30 outsuffix=_erai.nc … … 32 32 # Time variables : 33 33 # first_year : first year to interpolate 34 first_year= 200034 first_year=1979 35 35 # last_year : last year to interpolate 36 last_year=20 0036 last_year=2016 37 37 38 # Frequency of output files : yearly or monthly 39 # OutFreq='monthly' or OutFrequ='yearly' 40 OutFreq='yearly' 41 38 42 # rundir : temporary run directory 39 43 rundir=`pwd`/rundir … … 99 103 100 104 105 # Do different treatement if monthly or yearly output files are wanted 106 if [[ $OutFreq = 'monthly' ]] ; then 101 107 # 2 - Loop over all files and add a time step : 102 108 # take the first time step from next coming month and add last in current month … … 139 145 done 140 146 147 elif [[ $OutFreq = 'yearly' ]] ; then 148 # 3a. Concate the monthly files into yearly files 149 mkdir -p ${outdir}/allyears 150 151 year=$first_year 152 while [[ ${year} -le ${last_year} ]] ; do 153 echo Now merge year=$year for variable $var 154 cdo mergetime ${outdir}/${year}/${var}_${year}* ${outdir}/allyears/${var}_${year}${outsuffix} 155 year=`expr $year + 1` 156 done 141 157 158 # 3b.Add a last timestep in the end of the yearly files from next coming year 159 year=$first_year 160 while [[ ${year} -le ${last_year} ]] ; do 161 # Find next month and year 162 nextyear=`expr $year + 1` 163 164 file=${outdir}/allyears/${var}_${year}${outsuffix} 165 nextfile=${outdir}/allyears/${var}_${nextyear}${outsuffix} 166 if [ -f ${nextfile} ] ; then 167 echo First time step from file ${nextfile} will be added last in file ${file} 168 cp -f $file file.nc 169 cp -f $nextfile next.nc 170 ncks -O -d TIME,0,0 next.nc tmp.nc 171 ncrcat -O file.nc tmp.nc tmptot.nc 172 mv tmptot.nc $file 173 else 174 echo Next file ${nextfile} does not exist. Nothing will be done for ${file} 175 fi 176 177 # Update month and year 178 year=$nextyear 179 done 180 fi 142 181 143 182 # End of loop variable list
Note: See TracChangeset
for help on using the changeset viewer.