User Tools

Site Tools


initial_conditions:oceanic

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
initial_conditions:oceanic [2016/01/08 15:56]
eexarcho [How_to_generate_new_ocean_initial_conditions_|Generation of new ocean initial condition]
initial_conditions:oceanic [2022/08/23 18:08] (current)
etourign
Line 1: Line 1:
  
-==== Brief description ====+==== Shared in EC-Earth consortium ====
  
 +Details are here https://dev.ec-earth.org/projects/ecearth3/wiki/Ocean_initial_conditions_for_climate_predictions
 +
 +==== Brief description ====
  
 Please note that Ec-Earth2 includes NEMO2.2 and Ec-Earth3 includes NEMO3.3 Please note that Ec-Earth2 includes NEMO2.2 and Ec-Earth3 includes NEMO3.3
  
 ^ ID^ OCEAN MODEL^ GRID^ FIRST^ LAST^ INTERVAL (MONTH)^ MEMBERS^ Comments^ References | ^ ID^ OCEAN MODEL^ GRID^ FIRST^ LAST^ INTERVAL (MONTH)^ MEMBERS^ Comments^ References |
-| s4| NEMO2.2 / NEMO3.2 / NEMO3.3| ORCA1 and ORCAL46| 19580101| 20141201| 02, 05, 08, 11| fc0 - f4| ocean reanalysis - mask corrected for ORCA1 - vertically interpolated and extrapolated for ORCA1L46| Mogensen et al(2011), Balmaseda et al (2012) |+| s4| NEMO3.6 | ORCA1L46| 19600101| 20160701| all months | fc0 - f4| ocean reanalysis - mask corrected for ORCA1 - vertically interpolated and extrapolated for ORCA1L75| Mogensen et al(2011), Balmaseda et al (2012) | 
 +| s4| NEMO2.2 / NEMO3.2 / NEMO3.3| ORCA1 and ORCAL46| 19580101| 20141201| 02, 05, 08, 11| fc0 - f4| ocean reanalysis - mask corrected for ORCA1 - vertically interpolated and extrapolated for ORCA1L46 and ORCA1L75| Mogensen et al(2011), Balmaseda et al (2012) |
 | GLORYS2V1| NEMO3.3| ORCA1L46| 19921101| 20091101| 05,11| fc0| Interpolated initial conditions from an ocean reanalysis| Ferry et al (2010) | | GLORYS2V1| NEMO3.3| ORCA1L46| 19921101| 20091101| 05,11| fc0| Interpolated initial conditions from an ocean reanalysis| Ferry et al (2010) |
 | GLORYS2V1| NEMO3.3| ORCA025L46| 19921101| 20091101| 05,11| fc0| Interpolated initial conditions from an ocean reanalysis| Ferry et al (2010) | | GLORYS2V1| NEMO3.3| ORCA025L46| 19921101| 20091101| 05,11| fc0| Interpolated initial conditions from an ocean reanalysis| Ferry et al (2010) |
Line 17: Line 21:
 | m01w| NEMO3.3| ORCA025L46| 19921101| 20091101| 02,05,08,11| fc0| Initial conditions produced by nudging the ocean component in EC-Earth3.0.1 toward the monthly T and S from GLORYS2V1 ocean reanalysis| no reference yet | | m01w| NEMO3.3| ORCA025L46| 19921101| 20091101| 02,05,08,11| fc0| Initial conditions produced by nudging the ocean component in EC-Earth3.0.1 toward the monthly T and S from GLORYS2V1 ocean reanalysis| no reference yet |
 | m01u| NEMO3.3| ORCA025L75| 19921101| 20091101| 02,05,08,11| fc0| Initial conditions produced by nudging the ocean component in EC-Earth3.0.1 toward the monthly T and S from GLORYS2V1 ocean reanalysis| no reference yet | | m01u| NEMO3.3| ORCA025L75| 19921101| 20091101| 02,05,08,11| fc0| Initial conditions produced by nudging the ocean component in EC-Earth3.0.1 toward the monthly T and S from GLORYS2V1 ocean reanalysis| no reference yet |
- |+| official_repro| NEMO3.6| ORCA01L75| 19500101 | 19500101 | --- | fc00-fc04| Initial conditions for the official EC-Earth reproducibility test| https://github.com/plesager/ece3-postproc#reproducibility-test | 
 +| a1e1/a1ue| NEMO3.6| ORCA1| 19600101| 20151201 | all |fc00-fc04|5-category sea ice product using DFS5.2 surface forcing fields, surface restoring and subsurface nudging to ORAS4 with EC-Earth3.2 (NEMO-LIM only sims). Member fc00 should be taken from a1ue and members fc01 to fc04 should be taken from a1e1. For 2015 only member fc00 is available, so use a22b instead for 2015. | no reference | 
 +| a1n1| NEMO3.6| ORCA025| 19600101| 20151201 | all |fc04-fc00|5-category sea ice product using DFS5.2 surface forcing fields, surface restoring and subsurface nudging to ORAS5 with EC-Earth3.2 (NEMO-LIM only sims). | In progress | 
 +| a22b| NEMO3.6| ORCA1| 20100101| 20181201 | all |fc00-fc04|5-category sea ice product using ERA-Interim surface forcing fields, surface restoring and subsurface nudging to ORAS4 with EC-Earth3.2 (NEMO-LIM only sims). | no reference | 
 +| a2fd| NEMO3.6| ORCA1| 20180101| 20191201 | all |fc01-fc05|5-category sea ice product using ERA5 surface forcing fields, surface restoring and subsurface nudging to ORAS5 with EC-Earth3.2 (NEMO-LIM only sims). | no reference |
  
  
Line 45: Line 53:
  
 Hao Z., Balmaseda M. A., Mogensen K., 2015, The new eddy-permitting ORAP5 ocean reanalysis: description, evaluation and uncertainties in climate signals. Climate Dynamics (2015): 1-21. Hao Z., Balmaseda M. A., Mogensen K., 2015, The new eddy-permitting ORAP5 ocean reanalysis: description, evaluation and uncertainties in climate signals. Climate Dynamics (2015): 1-21.
-==== How_to_generate_new_ocean_initial_conditions_|Generation of new ocean initial condition ====+==== How_to_generate_new_ocean_initial_conditions ==== 
 + 
 +== ORAS4, ORCA1L42 and ORCA1L75 ==  
 + 
 +1. Update the ecaccess-certificate-create tool, which gives 7 days of access to ECMWF repositories.  
 + 
 +2. clone the project https://earth.bsc.es/gitlab/ec-earthCPWG/Oce_IC.git 
 + 
 +3. run  export PYTHONPATH=$PYTHONPATH:$path_to_the_Oce_IC 
 + 
 +4. go into the path_to_the_Oce_IC and run fetch_ORAS4.sh after filling the start dates you want to download from EMCWF and interpolate.
  
 == ORAP5, ORCA025L75 ==  == ORAP5, ORCA025L75 == 
Line 51: Line 69:
 1. Update the ecaccess-certificate-create tool, which gives 7 days of access to ECMWF repositories.  1. Update the ecaccess-certificate-create tool, which gives 7 days of access to ECMWF repositories. 
  
-2. Fetch the data locally by running the script.sh below (in moore or amdahl with **sbatch script.sh**)+2. git clone https://earth.bsc.es/gitlab/es/cpg_tools.git -b develop-eleftheria 
  
-  #!/bin/bash +2Fetch the data locally (for example when in fat nodes
-  #SBATCH -n 1 +
-  #SBATCH -t 10-12:00:00 +
-  #SBATCH -J fetchORAP5 +
-  #SBATCH --mem=60000 +
-  #SBATCH -o fetch-orap5-%j.log    +
-       +
-  set -evx +
-  TMPDIR=/scratch/$(whoami)/$$ +
-  mkdir -p $TMPDIR +
-  cd $TMPDIR    +
-     +
-  module load ECAC    +
-    +
-  DATASOURCE="ec:/RDX/prepIFS/g0tx" # Root of the path where to find ORAS4 on ECFS +
-  YEARI=2000 # First eyar to download   +
-  YEARF=2013 # Last year to download +
-  MEMBER_LST="0" # List of members to download +
-  YEAR=$YEARI     +
-     +
-  workdir=`pwd`    +
-        +
-  echo $YEAR +
-  for year in `seq $YEARI $YEARF`; do +
-  mkdir -p /esnas/reconstructions/ecmwf/orap5/restarts/$YEAR +
-  for mem in $MEMBER_LST ; do +
-    for file in $( ecaccess-file-dir ${DATASOURCE}/opa${mem}/restart/${YEAR}/g0tx_${YEAR}*_*_restart.tar.gz ) +
-    do +
-      if [[ "$file" != "ECFS" ]];then +
-        echo $file +
-        if [[ ! -f /esnas/reconstructions/ecmwf/orap5/restarts/${YEAR}/$file ]]; then +
-          while [[ ! -f /esnas/reconstructions/ecmwf/orap5/restarts/${YEAR}/$file ]] +
-          do +
-            ecaccess-file-get -progress ${DATASOURCE}/opa${mem}/restart/${YEAR}/$file $file +
-            mv $file /esnas/reconstructions/ecmwf/orap5/restarts/${YEAR}/+
-          done +
-        fi +
-      fi +
-    done +
-  done +
-  YEAR=$((YEAR+1)) +
-  done +
-    +
-  rm -rf $TMPDIR+
  
 +  cd cpg_tools/prep_restarts/generate_restarts_orap5_HR
 +  sbatch dl_restarts.sh
 +  
 3. Copy the data using the correct naming, in the repository of the initial conditions.     3. Copy the data using the correct naming, in the repository of the initial conditions.    
                          
Line 114: Line 92:
   -rw-r--r-- 1 pbretonn Earth 4927336766 Oct  7 06:50 /esnas/reconstructions/ecmwf/orap5/restarts/1993/g0tx_19930430_00024048_restart.tar.gz   -rw-r--r-- 1 pbretonn Earth 4927336766 Oct  7 06:50 /esnas/reconstructions/ecmwf/orap5/restarts/1993/g0tx_19930430_00024048_restart.tar.gz
  
-After the manual checking, we run the following script:  +After the manual checking, we run the following script:   
- +  cd cpg_tools/prep_restarts/generate_restarts_orap5_HR 
-  #!/bin/bash +  sbatch copy_orap5.sh
-  #SBATCH -n 1 +
-  #SBATCH -t 10-12:00:00 +
-  #SBATCH -J fetchORAP5 +
-  #SBATCH --mem=60000 +
-  #SBATCH -o fetch-orap5-%j.log      +
-        +
-  set -evx +
-  TMPDIR=/scratch/$(whoami)/$$ +
-  mkdir $TMPDIR +
-  cd $TMPDIR +
-    +
-  dir=/esnas/reconstructions/ecmwf/orap5/restarts/  +
-  outdir=/esnas/releases/ic/ocean/ORCA025L75/ORAP5 +
-  curdir=`pwd`    +
-    +
-  for year in {2005..2007} ; do  +
-   ##May start dates  +
- echo $year  +
- dirin=${dir}/${year}  +
- if [ -e $dirin  ] ; then    +
- cd $dirin  +
-                for file in $( ls   g0tx_${year}0428* ) ; do  +
- inname=$(echo $file | cut -f1 -d"."+
- ofile=ORAP5_fc0_${year}0430_restart.nc.gz +
- if [ ! -e  ${outdir}/${ofile}  ]  ; then    +
- cd $curdir  +
- gunzip -c   ${dirin}/$file  >  ${inname}.tar   +
- tar xfv ${inname}.tar   +
- gzip -c ${inname}.nc >  ${outdir}/${ofile}  +
- rm -rf  ${curdir}/g0tx*tar  ${curdir}/g0t*nc  +
- fi  +
- done  +
- fi  +
-        +
-   # November start dates  +
-      echo $year  +
- dirin=${dir}/${year}  +
- if [ -e $dirin  ] ; then    +
- cd $dirin  +
-                for file in $( ls   g0tx_${year}1030* ) ; do  +
- inname=$(echo $file | cut -f1 -d"."+
- ofile=ORAP5_fc0_${year}1031_restart.nc.gz +
- if [ ! -e  ${outdir}/${ofile}  ]  ; then    +
- cd $curdir  +
- gunzip -c   ${dirin}/$file  >  ${inname}.tar   +
- tar xfv ${inname}.tar   +
- gzip -c ${inname}.nc >  ${outdir}/${ofile}  +
- rm -rf  ${curdir}/g0tx*tar  ${curdir}/g0t*nc  +
- fi  +
- done  +
- fi  +
-  done     +
-     +
-     +
-  rm -rf $TMPDIR+
      
      
 + 
 == ORAP5, ORCA1L46 ==  == ORAP5, ORCA1L46 == 
  
-We use a software called **SOSIE** [[http://sosie.sourceforge.net/]] to interpolate the data. We run the script.sh below (on moore or amdahl by **sbatch script.sh**). We need two files+We use a software called **SOSIE** [[http://sosie.sourceforge.net/]] to interpolate the data. We do the following steps (on fat nodes):
  
-- The executable sosie.x      +  cd cpg_tools/prep_restarts/generate_restarts_orap5_LR 
 +  sbatch launchscript.sh 
  
-- The weights for the interpolation ORCA025-ORCA1.map  
- 
-Both files are available on **cfutools** in branch **develop-eleftheria**, in the directory   
-  prep_restarts/sources_for_ORCA025-ORCA1   
- 
-The script.sh is:  
- 
-<code> 
    
-  #!/bin/bash 
-  #SBATCH -n 1 
-  #SBATCH -t 10-12:00:00 
-  #SBATCH -J orap5-LR  
-  #SBATCH --mem=60000 
-  #SBATCH -o orap5-LR-%j.log 
-  
- 
-  set -evx 
-  TMPDIR=/scratch/$(whoami)/$$ 
-  mkdir -p $TMPDIR 
-  cd $TMPDIR 
-  
-   
-  # Copy the masks of the input file and the output file:  
-  maskin='mesh_mask_nemo.Ec3.0_O25L75.nc'  
-  maskout='mesh_mask_nemo.Ec3.0_O1L46.nc' 
-  ln -sf  /esnas/autosubmit/con_files/$maskin  
-  ln -sf  /esnas/autosubmit/con_files/$maskout  
- 
-   
-  cp  /${cfutools}/prep_restarts/sources_for_ORCA025-ORCA1/sosie.x              
-  cp  /${cfutools}/prep_restarts/sources_for_ORCA025-ORCA1/ORCA025-ORCA1.map    
- 
-  #!/bin/bash 
-    
-  set -evx  
-  # This script extrapolates horizontally, interpolates horizontally and interpolates vertically  
-  # the scalar fields    
-  #    
-  # History : Eleftheria Exarchou  - Initial version           June 2015  
-  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
-  #                                Arguments 
-  # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
- 
-  # The masks of the input file, which here is in ORAP5 ORCA05L75  
-  # and the output file, which is the ORCA01L46 
-  maskin='mesh_mask_nemo.Ec3.0_O25L75.nc'  
-  maskout='mesh_mask_nemo.Ec3.0_O1L46.nc' 
- 
-  dirhigh=/esnas/releases/ic/ocean/ORCA025L75/ORAP5/ 
-  dirlow=/esnas/releases/ic/ocean/ORCA1L46/ORAP5/ 
-  curdir=`pwd` 
- 
- 
-  listdates=( '0430' '1031'  ) 
- 
-  for year in {1998..2000} ; do  
- echo $year  
- 
-  for date in ${listdates[@]} ; do 
-  file_final=ORAP5_fc0_${year}${date}_restart  
- 
-        # check if interpolated file exists already in esnas 
- if [ ! -e  /esnas/releases/ic/ocean/ORCA1L46/ORAP5/${file_final}.nc.gz ] ; then    
- # check if the HR file exists  
- if  [  -e ${dirhigh}/ORAP5_fc0_${year}${date}_restart.nc.gz ] ; then   
-        # check if file is locally here already (or: use gunzip -f to force overwrite, but this is slower ) 
- if [ ! -e  ${curdir}/ORAP5_fc0_${year}${date}_restart.nc ] ; then    
- gunzip -c  ${dirhigh}/ORAP5_fc0_${year}${date}_restart.nc.gz   > ${curdir}/ORAP5_fc0_${year}${date}_restart.nc 
-        fi  
- # Input/output restart file names  
- restart_in=ORAP5_fc0_${year}${date}_restart   
- restart_out=ORAP5_fc0_${year}${date}_restart_int 
- 
- 
- 
-    listvars3d=( 'en' 'avt' 'avm' 'avmu' 'avmv' 'dissl' 'un' 'vn' 'tn' 'sn' 'rotn' 'hdivn' 'rhop' 'ub' 'vb' 'tb' 'sb' 'rotb' 'hdivb' 'ssu_m' 'ssv_m' 'sst_m' 'sss_m' 'ssh_m' 'rnf_b' 'rnf_hc_b' 'rnf_sc_b' 'utau_b' 'vtau_b' 'qns_b' 'emp_b' 'emps_b' 'sshn sshb' 'gcx' 'gcxb' ) 
-   varscopy='nn_fsbc,rdt,rdttra1,kt,ndastp,adatrj,slim' 
- 
- 
-  # Create the initial restart file with the basic set of 0 dimensional variables  
-  if [[ ! -e ${restart_out}.nc ]] ; then 
-  ncks -O -v $varscopy ${restart_in}.nc ${restart_out}.nc 
-  ncks -A -v nav_lon,nav_lat,nav_lev    $maskout ${restart_out}.nc 
-  fi  
- 
-  # Specify the masks etc that correspond to each variable 
-  for var in ${listvars3d[@]} ; do 
-  case $var in 
-   'avmu'|'un'|'ub') mask='umask' ; interp3d='0'  ;; 
-   'ssu_m'|'utau_b') mask='umask' ; interp3d='1'  ;; 
-   'avmv'|'vn'|'vb') mask='vmask' ; interp3d='0'  ;; 
-   'ssv_m'|'vtau_b') mask='vmask' ; interp3d='1'  ;; 
-   'rotb'|'rotn'   mask='fmask' ; interp3d='0'  ;; 
-   'avt'|'avm'|'en'|'dissl'|'hdivb'|'hdivn'|'rhop'|'sn'|'tn'|'sb'|'tb') mask='tmask' ; interp3d=0  ;; 
-   'qns_b'|'emp_b'|'emps_b'|'sst_m'|'sss_m'|'ssh_m'|'rnf_b'|'rnf_hc_b'|'rnf_sc_b') mask='tmask' ; interp3d=1  ;; 
-   'gcx'|'gcxb'|'sshb'|'sshn' mask='tmask' ;  interp3d=1  ;; 
-  esac 
- 
- 
-  # Check if interpolation for this particular variable is already done  
-  if [ ! -e ${var}_ORCA025-ORCA1_restart_${year}${date}_miss.nc ] ;  then   
- 
-  file_in=${var}_in.nc  
-  ncks -O  -v ${var},nav_lon,nav_lat,nav_lev,time_counter ${restart_in}.nc $file_in 
-  ncrename -d t,time  $file_in 
- 
-  cat <<EOF > namelist_$var  
- 
-!! -------------------  
-!! Namelist for SOSIE  
-!! -------------------  
-!!  
-!!  
-!! ***********************  
-!! Input characteristics :  
-!! ***********************  
-!!  
-!! ivect : vector correction control on treated field [integer]  
-!!         ivect = 0 : input field is not a component of a vector  
-!!         or the target grid is regular (lregout = T)  
-!!         * if non-regular distorted target grids (like ORCAX):  
-!!         ivect = 1 : input field is a zonal (X) component of a vector  
-!!         ivect = 2 : input field is a meridional (Y) component of a vector  
-!!  
-!! lregin : is the source grid regular? [logical]  
-!!          (ie : are input longitude and latitude 1D?)  
-!!  
-!! cf_in   : file containing the input field to be interpolated [char] 
-!! cv_in   : name of treated variable (in input field file) [char] 
-!! 
-!! cv_t_in : name of time record variable in the input file [char] 
-!!           or 'missing_rec' if no time record is present in the input file 
-!! 
-!! jt1     : first time record to be interpolated 
-!! jt2     : last  time record to be interpolated 
-!!           => set jt1 and jt2 to 0 if you want to skip this option  
-!!              and interpolate the nt time steps of the current field 
-!!  
-!! jplev : level to treat if your file is 3D (spatial), has no influence if  
-!!         your file is 2D ! 
-!!         jplev > 0 = level to treat (ex : jplev = 1 will interpolate only  
-!!                     surface field corresponding to the 1st level ) 
-!!       ------------------------------------------------------------------ 
-!!       | jplev = 0 : perform 3D interpolation (if input file is 3D) !!! | 
-!!       ------------------------------------------------------------------ 
-!! 
-!! cf_x_in   : file containing the input grid (usually = cf_in) [char]  
-!! cv_lon_in : name of longitude in the input grid file [char]  
-!! cv_lat_in : name of latitude in the input grid file [char]  
-!!  
-!! cf_lsm_in : file containing the input land-sea mask [char] 
-!!             or specify 'missing_value' if a 'missing_value' netcdf 
-!!             attribute defines the mask on the input data field 
-!!             (not needed if "ldrown = .FALSE." --> '') 
- 
-!! cv_lsm_in : name of land-sea mask variable [char] 
-!!             (not needed if "ldrown = .FALSE."  
-!!              or if cf_lsm_in = 'missing_value'--> '') 
-!!             by default ocean is flagged with value 1 
-!!             and continents are flagged with value 0 
-!! 
-!! ldrown : whether we call DROWN land filling procedure [logical]  
-!! 
-!! ewper : east-west periodicity on the input file/grid [integer]  
-!!         = -1 --> no periodicity  
-!!         >= 0 --> periodicity with overlap of ewper points  
-!!  
-!! vmax : upper bound not to exceed for treated variable [real]  
-!! vmin : lower bound not to exceed for treated variable [real]  
-!!--------------------------------------------------------------------------  
-!!  
-&ninput 
-ivect     = 0 
-lregin    = F  ! F becuase the input grid is not regular  
-cf_in     = '$file_in' 
-cv_in     = '${var}' 
-cv_t_in   = 'time_counter'  
-jt1       = 0   ! sdfgdfhgdfgh 
-jt2       = 0 
-jplev     = $interp3d  ! use 0 for 3D interpolation  
-cf_x_in   = '$file_in'  
-cv_lon_in = 'nav_lon' 
-cv_lat_in = 'nav_lat' 
-cf_lsm_in = '$maskin' 
-cv_lsm_in = '$mask' 
-ldrown    = T 
-ewper     = 0 
-vmax      =  1.E10 
-vmin      = -1.E10 
-/ 
-!! 
-!! 
-!! 
-!! 
-!! *********************************** 
-!!  IF 3D INTERPOLATION ( jplev = 0 ) 
-!! *********************************** 
-!! 
-!! Only mind if you do want to perform a 3D (spatial) interpolation 
-!!  
-!! Mind only if you do want to perform a 3D interpolation ! 
-!! First, make sure that jplev is set to 0 ! 
-!! 
-!! cf_z_in  : file containing the input depth vector (associates a depth to a  
-!!            given level). In most cases should be the same file than cf_x_in. 
-!! cv_z_in  : name of the variable for the input depth vector 
-!! 
-!! cf_z_out : file containing the output depth vector (associates a depth to a  
-!!            given level). In most cases should be the same file than cf_x_in. 
-!! cv_z_out : name of the variable for the output depth vector in file 'cf_z_out' 
-!! cv_z_out_name: name you wish to give to depth variable in file to be created... 
-!! 
-!! 
-&n3d 
-cf_z_in  = '$file_in' 
-cv_z_in  = 'nav_lev' 
-cf_z_out = '$maskout' 
-cv_z_out = 'nav_lev' 
-cv_z_out_name = 'lev' 
-/ 
-!!  
-!! 
-!! 
-!! 
-!! 
-!! *****************************  
-!! Output Grid characteristics :  
-!! *****************************  
-!!  
-!! lregout : is the target grid regular ? [logical]  
-!!           (ie : are output longitude and latitude 1D?)  
-!! 
-!! cf_x_out   : file containing the target grid [char]  
-!! cv_lon_out : name of longitude variable [char]  
-!! cv_lat_out : name of latitude variable [char]  
-!! 
-!! TRICK:  for interpolating onto a global regular spherical grid 
-!! ------  with a resolution of dx deg. of longitude and dy deg. of latitude 
-!!         * cf_x_out   = 'spheric' ! tells SOSIE to build a spherical output grid 
-!!         * cv_lon_out = '1.0'  ! your dx, here 1.0 deg.  
-!!         * cv_lat_out = '1.0'  ! your dy, here 1.0 deg. 
-!! 
-!! 
-!! cf_lsm_out : file containing output land-sea mask [char]  
-!!              MUST BE 3D for 3D interpolation! 
-!!              or specify 'missing_value' if a 'missing_value' netcdf 
-!!              attribute defines the mask on a field 'X' in file 'cf_x_out' 
-!!              (not needed if "lmout = .FALSE." --> '' 
-!! 
-!! cv_lsm_out : name of land-sea mask variable in 'cf_lsm_out'     [char] 
-!!              or name of field 'X' in 'cf_x_out' if you specified  
-!!              cf_lsm_out = 'missing_value' 
-!!              (not needed if "lmout = .FALSE." --> '' 
-!! 
-!! lmout : whether to mask the interpolated field on the output file [logical]  
-!! 
-!! rmaskvalue : missing value given to output field (for continents) [logical]  
-!! 
-!! lct   : whether to control or not time variable [logical]  
-!!         TRUE -> specify time array with starting time 't0' and step 't_stp'  
-!!         FALSE -> same time array as in input file is used  
-!! t0    : time to start (if lct is set to .TRUE.) [real]  
-!! t_stp : time step (if lct is set to .TRUE.) [real]  
-!! 
-!! 
-&noutput 
-lregout    = F   ! the output grid is not regular 
-cf_x_out   = '$maskout' 
-cv_lon_out = 'nav_lon' 
-cv_lat_out = 'nav_lat' 
-cf_lsm_out = '$maskout' 
-cv_lsm_out = '$mask' 
-lmout      = T 
-rmaskvalue = 1.e+20 ! -9999. 
-lct        = F 
-t0         = 0. 
-t_stp      = 0.25 
-/ 
-!!  
-!!  
-!!  
-!!  
-!! *******************************  
-!! Netcdf output characteristics :  
-!! *******************************  
-!!  
-!! This mostly deals with how the output file to be created is going to look like! 
-!! 
-!! cmethod  : the 2D interpolation method to be used 
-!!            use 'akima' if your input domain is regular (non-distorted grid) 
-!!            use 'bilin' otherwise, which is bilinear 2D interpolation 
-!! 
-!! *** Into the netcdf file to be created : ***  
-!! cv_l_out : name for longitude on the output file [char]  
-!! cv_p_out : name for latitude on the output file [char]  
-!! cv_t_out : name for time on the output file [char]  
-!! cv_out   : name for treated variable on the output file [char]  
-!! cu_out   : treated variable units [char]  
-!! cu_t     : time unit [char] 
-!! cln_out  : treated variable long name [char]  
-!! cd_out   : directory to create output file to [char] 
-!!  
-!! *** Name of the output file : ***  
-!! csource  : short string to describe origin of the file [char]  
-!! ctarget  : short string to describe the target grid [char]  
-!! cextra   : short extra indication about the file [char]  
-!!  
-&nnetcdf 
-cmethod  = 'bilin' 
-cv_l_out = 'x'  ! 'var_lon' 
-cv_p_out = 'y'  ! 'var_lat' 
-cv_t_out = 'time_counter' 
-cv_out   = '${var}' 
-cu_out   = ' ' 
-cu_t     = 'unknown' 
-cln_out  = ' ' 
-cd_out   = '.' 
-csource  = 'ORCA025' 
-ctarget  = 'ORCA1' 
-cextra   = 'restart_${year}${date}' 
- 
-!! 
- 
- 
-EOF 
- 
-./sosie.x  -f namelist_$var  
- 
- 
-cdo setmisstoc, ${var}_ORCA025-ORCA1_restart_${year}${date}.nc  ${var}_ORCA025-ORCA1_restart_${year}${date}_miss.nc 
- 
-ncks -A ${var}_ORCA025-ORCA1_restart_${year}${date}_miss.nc  ${restart_out}.nc  
- 
-rm -rf  ${var}_ORCA025-ORCA1_restart_${year}${date}_*.nc    
-fi 
-done  
- 
- 
-# Some variables have negative values in some points,  
-# whereas they should be always positive. We fix it by 
-# making these values equal to 0. These vars are  
-# avt,avm,avmu,avmv,dissl  
- 
-file1=ORAP5_fc0_${year}${date}_restart_int.nc    
-file2=ORAP5_fc0_${year}${date}_restart_int_needtofix.nc                               
-file3=ORAP5_fc0_${year}${date}_restart_int_fixed.nc                    
-file4=ORAP5_fc0_${year}${date}_restart_int_valuesfixed.nc     
-file5=ORAP5_fc0_${year}${date}_restart_int_valuesfixed_percision.nc     
- 
-cdo selvar,avt,avm,avmu,avmv,dissl  $file1  $file2 
-cdo setrtoc,-1000000000,0,        $file2  $file3 
- 
-cdo replace  $file1     $file3  $file4 
-cdo  -b 64 copy         $file4  $file5  
- 
-gzip -c  $file5  >  /esnas/releases/ic/ocean/ORCA1L46/ORAP5/${file_final}.nc.gz  
-rm  -rf  ${curdir}/ORAP5_fc0_${year}${date}_restart.nc 
- 
-fi  
-fi  
-done  
-done  
- 
-rm -rf $TMPDIR 
- 
-    
-</code> 
-  
- 
 == GLOSEA5, ORCA025L75 ==  == GLOSEA5, ORCA025L75 == 
  
-We need to extrapolate the files to the mask we use in the in-house model version of NEMO. We run the script.sh (**sbatch script.sh ** in moore/amdahl+We need to extrapolate the files to the mask we use locally. We do the following separately per year (here as example for 19940501, in the fat nodes)
  
-<code> +   cd cpg_tools/prep_restarts/generate_restarts_gs5_HR/19940501 
- +   sbatch 19940501.sh 
-#!/bin/bash +
-  #SBATCH -n 1 +
-  #SBATCH -t 10-12:00:00 +
-  #SBATCH -J gs5-HR  +
-  #SBATCH --mem=60000 +
-  #SBATCH -o gs5-HR-%j.log +
- +
-#!/bin/bash +
- +
-set -evx +
-TMPDIR=/scratch/$(whoami)/$$ +
-mkdir $TMPDIR +
-cd $TMPDIR +
- +
-year=1994 +
-mon=05 +
- +
-((mon1=$mon -1 )) +
- +
- +
-cp /home/Earth/$(whoami)/git-stuff/cfutools/prep_restarts/generate_restarts_gs5_HR/19940501/script_interp_vert_ocean_restart_GS5_ORCA025L75.bash  +
-ln -sf /cfunas/exp/MetOffice/GS5/restarts/${year}/${year}${mon}01__restart00.tar  ${year}${mon}01__restart00.tar   +
-ln -sf /cfu/autosubmit/con_files/mesh_mask_nemo.Ec3.0_O25L75_ClosedSeas.nc mesh_mask_nemo.Ec3.0_O25L75_ClosedSeas.nc  +
-ln -sf /cfu/autosubmit/con_files/new_mask.GloSea5_O25L75.nc mask_GS5.nc +
-ln -sf /cfu/pub/scripts/prep_restarts/auxfiles/masks/Tofill_ecearth.v3.0.ORCA025L75.extrap.glosea5.nc Tofill_extrap.nc  +
-ln -sf /cfu/pub/scripts/prep_restarts/auxfiles/masks/Tofill_ecearth.v3.0.ORCA025L75.clim.glosea5.nc   Tofill_clim.nc   +
- +
-tar xvf  ${year}${mon}01__restart00.tar   +
-gunzip restart.nc.gz +
- +
-./script_interp_vert_ocean_restart_GS5_ORCA025L75.bash  restart  restart_out  11  +
- +
-ncecat -O -h restart_out.nc    tmp1.nc +
-ncrename -d record, tmp1.nc  tmp2.nc +
-cdo setmisstoc, tmp2.nc      GLOSEA5_fc0_${year}0${mon1}30_restart.nc +
- +
-gzip -c GLOSEA5_fc0_${year}0${mon1}30_restart.nc > GLOSEA5_fc0_${year}0${mon1}30_restart.nc.gz   +
-mv  GLOSEA5_fc0_${year}0${mon1}30_restart.nc.gz  /cfu/releases/ic/ocean/ORCA025L75/GLOSEA5/ +
- +
-</code> +
- +
-Where the script script_interp_vert_ocean_restart_GS5_ORCA025L75.bash is  +
- +
-<code> +
- +
-#!/bin/bash +
-set -evx  +
-#  +
-# This script extrapolates horizontally, +
-# fills up empty seas with climatologies, extrapolate vertically, for GloSea5 restarts.  +
-+
-# History : Virginie Guemas - Initial version                           2012  +
-#           Virginie Guemas - ORAS4 + vertical extrapolation +  +
-#                             commenting and clarifying         - March 2014 +
-#           Eleftheria Exarchou - GloSea5                       - January 2015 +
-#  +
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +
-#                                Arguments +
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +
-type='glosea5' # 'glorys' / 'metoffice' : if you add another type, you'll have +
-             # to adapt the list of variables this restart contains below. +
-             # Look for the variable $type in the script. +
-fillinrot='TRUE' # Extrapolate or not the rotational rotn / rotb +
-                  # TRUE increases subtantially the interpolation time  +
-                  # FALSE has negligible effects ( u, v, t, s are initialized ) +
-restart_in=$1 # Input restart file name without the .nc extension +
-#meshmaskin='/cfu/autosubmit/con_files/mesh_mask_nemo.nemovar_O1L42_new.nc' +
-meshmaskin='mask_GS5.nc' +
-    # Meshmask of the input reanalysis. Example: +
-    #'/cfu/autosubmit/con_files/mesh_mask_nemo.glorys2v1_O25L75.nc' +
-confout='ORCA025L75' # output configuration +
-#vertgridout='/cfu/autosubmit/con_files/mesh_mask_nemo.Ec3.0_O25L75.nc' +
-vertgridout='mesh_mask_nemo.Ec3.0_O25L75_ClosedSeas.nc' +
-    # Meshmask of the output restart, i.e. model and grid to be used in +
-    # climate prediction  +
-#Ptoextrap='/cfu/pub/scripts/prep_restarts/auxfiles/masks/Tofill_ecearth.v3.0.ORCA1L46.extrap.oras4.nc' +
-Ptoextrap='Tofill_extrap.nc' +
-    # Locations of the points where to extrapolate horizontally the restarts after +
-    # interpolation = 1 in the netcdf file, 0 everywhere else. Locations available +
-    # for the tmask, umask, vmask and fmask grid. If you don't know about those +
-    # four variables read about the NEMO documentation about the grid. +
-    # To obtain the Ptoextrap netcdf file, it is necessary to run once this script +
-    # without extrapolation and filling of the empty seas and compare the output +
-    # restart with the output meshmask. To do so, set 0 everywhere in Ptoextrap +
-    # and use build_Tofill.bash afterwards. +
-#Ptofillclim='/cfu/pub/scripts/prep_restarts/auxfiles/masks/Tofill_ecearth.v3.0.ORCA1L46.clim.nc' +
-Ptofillclim='Tofill_clim.nc' +
-    # Locations of the empty seas that need to be filled up with a climatology after +
-    # interpolation = 1 in the netcdf file, 0 everywhere else. Locations available +
-    # for the tmask, umask, vmask and fmask grid. If you don't know about those +
-    # four variables read about the NEMO documentation about the grid. +
-    # To obtain the Ptofillclim netcdf file, it is necessary to run once this script +
-    # without extrapolation and filling of the empty seas and compare the output +
-    # restart with the output meshmask. To do so, set 0 everywhere in Ptofillclim +
-    # and use build_Tofill.bash afterwards. +
-mon=$3 # Month of the restart on 2 digits MM +
-restart_out=$2 # Output restart file name without the .nc extension +
-cfutools='/home/eexarchou/git-stuff/cfutools' +
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +
- +
-case $type in +
-  'glorys')  +
-# List of 3d variables = that need to be vertically interpolated  +
-   listvarsinterp=( 'en' 'avt' 'avmt' 'avmu' 'avmv' 'dissl' 'ub' 'vb' 'tb' 'sb' 'rotb' 'hdivb' 'un' 'vn' 'tn' 'sn' 'rotn' 'hdivn' 'rhop'+
-# List of 2d variables = that only need extrapolation   +
-   listvarsextrap=( 'gcx' 'gcxb' 'gcxbfs' 'gru' 'grv' 'gsu' 'gsv' 'gtu' 'gtv' 'ssh_m' 'sshb' 'sshn' 'sss_m' 'sst_m' 'ssu_m' 'ssv_m'+
-# List of 0d variables = that need to be copied to the output restart +
-   varscopy='nn_fsbc,rdt,rdttra1' +
-  ;; +
-  'oras4'+
-   listvarsinterp=( 'en' 'ub' 'vb' 'tb' 'sb' 'rotb' 'hdivb' 'un' 'vn' 'tn' 'sn' 'rotn' 'hdivn'+
-   listvarsextrap=('alb_ice' 'gcx' 'gcxb' 'sshb' 'sshn' 'u_io' 'v_io' 'sst_io' 'sss_io' )  +
-   varscopy='nfice,rdt,rdttra1,ndastp,adatrj' +
-  ;; +
-  'glosea5'+
-   listvarsinterp=( 'tb'+
-   listvarsextrap=('gcx' 'gcxb' 'sshb' 'sshn' )  +
-   varscopy='rdt,rdttra1,kt,ndastp,adatrj' +
-  ;; +
-esac +
- +
-source ${cfutools}/prep_restarts/library/library.bash +
- +
-if [[ $fillinrot == 'FALSE' ]] ; then +
- cp ${Ptoextrap} Ptoextrap.nc  +
- ncks -v fmask Ptoextrap.nc tmp1.nc +
- cdo mulc,0 tmp1.nc tmp2.nc +
- ncks -A tmp2.nc Ptoextrap.nc +
- rm -f tmp1.nc tmp2.nc +
- Ptoextrap='Ptoextrap.nc' +
-fi +
- +
-# Copy the 0d variables from the input restart to the output restart +
- +
- +
-if [[ ! -e ${restart_out}.nc ]] ; then +
-ncks -O -v $varscopy ${restart_in}.nc ${restart_out}.nc +
-ncks -A -v nav_lon,nav_lat $meshmaskin ${restart_out}.nc +
-ncks -A -v nav_lev $vertgridout ${restart_out}.nc +
-fi  +
- +
-# Fist loop is: Vertical interpolation + horizontal extrapolation at each level + filling empty seas + vertical extrapolation +
-cdo vertsum -selvar,tmask,vmask,umask,fmask $meshmaskin mask2din.nc +
-for var in ${listvarsinterp[@]} ; do +
-  case $var in +
-   'avmu'|'un'|'ub') mask='umask' ; varlon='glamu' ; varlat='gphiu' ; fill='umask' ;; +
-   'avmv'|'vn'|'vb') mask='vmask' ; varlon='glamv' ; varlat='gphiv' ; fill='vmask' ;; +
-   'rotb'|'rotn') mask='fmask' ; varlon='glamf' ; varlat='gphif' ; fill='fmask' ;; +
-   'avt'|'avmt'|'en'|'dissl'|'hdivb'|'hdivn'|'rhop'|'sn'|'tn'|'sb'|'tb') mask='tmask' ; varlon='glamt' ; varlat='gphit' ;  fill='tmask' ;; +
-  esac +
-#  # The vertical interpolation is performed below +
-#  python ${cfutools}/interpolation/interp_vert.py ${restart_in}.nc $var $meshmaskin e3t_0 mask2din.nc $mask $vertgridout e3t_0 gdept_0 ${var}_${restart_out}_int.nc +
- +
- +
-  # The function extrap extrapolates horizontally and fill in the empty seas with a climatology +
-  #extrap ${var}_${restart_out}_int.nc ${var} ${meshmaskin} ${varlon} ${varlat} ${Ptoextrap} ${Ptofillclim} ${fill} ${var}_${restart_out}_int2.nc 3d $cfutools $confout $mon  +
- +
-  if [ ! -e ${fill}.nc ] ; then +
-  cdo -setctomiss,0 -selvar,${fill}  $meshmaskin  ${fill}.nc  +
-  fi  +
-  cdo  -ifthen ${fill}.nc  -selvar,${var} ${restart_in}.nc  ${var}_${restart_in}.nc +
-# Modify the missing value to 1e20  +
-  ncatted -O -a _FillValue,${var},m,f,1e20      ${var}_${restart_in}.nc +
-  ncatted -O -a  missing_value,${var},m,f,1e20  ${var}_${restart_in}.nc +
-  extrap ${var}_${restart_in}.nc ${var} ${meshmaskin} ${varlon} ${varlat} ${Ptoextrap} ${Ptofillclim} ${fill} ${var}_${restart_out}_int.nc 3d $cfutools $confout $mon  +
- +
-  # The vertical extrapolation to empty levels is performed below +
-# python ${cfutools}/interpolation/vertextrap.py  ${var}_${restart_out}_int2.nc ${var} $vertgridout nav_lev ${var}_${restart_out}_int3.nc +
-# python ${cfutools}/interpolation/vertextrap.py  ${restart_in}.nc ${var} $vertgridout nav_lev ${var}_${restart_out}_int3.nc +
- +
-  # Apply the mask +
-  applymask $vertgridout $mask ${var}_${restart_out}_int.nc $var ${var}_${restart_out}.nc +
- +
-  # Pasting the output to ${restart_out}.nc +
-  gathervar ${restart_out}.nc ${var}_${restart_out}.nc +
-  # for some un known reason (nco bug?) after ncks -A of gathervar, the zaxis gets corrupted, so I reset it.  +
-  cdo -O  setzaxis,L75   ${restart_out}.nc    ${restart_out}_2.nc   +
-  mv   ${restart_out}_2.nc  ${restart_out}.nc  +
-#  rm -f ${var}_${restart_out}.nc ${var}_${restart_out}_int?.nc   +
-done +
- +
-##--------------------------------------------------------------------------------- +
-##--------------------------------------------------------------------------------- +
-## Second loop is: horizontal extrapolation at each level + filling empty seas for 2D variables.  +
-# Horizontal extrapolation and filling empty seas of 2d variables +
-ncks -O -d lev,0 ${Ptoextrap} Ptoextrap_lev0.nc +
-ncks -O -d lev,0 ${Ptofillclim} Ptofillclim_lev0.nc +
-ncks -O -d z,0 $vertgridout mask_lev0.nc +
-ncks -O -d z,0 $meshmaskin maskin_lev0.nc +
- +
-for var in ${listvarsextrap[@]} ; do +
-  case $var in +
-   'gru'|'gsu'|'gtu'|'ssu_m'|'u_io') varlon='glamu' ; varlat='gphiu' ; fill='umask' ;; +
-   'grv'|'gsv'|'gtv'|'ssv_m'|'v_io') varlon='glamv' ; varlat='gphiv' ; fill='vmask' ;; +
-   'gcx'|'gcxb'|'gcxbfs'|'ssh_m'|'sshb'|'sshn'|'sss_m'|'sst_m'|'alb_ice'|'sst_io'|'sss_io') varlon='glamt' ; varlat='gphit' ; fill='tmask' ;; +
-  esac +
- +
-  # Apply the input mask +
-  cdo selvar,${var} ${restart_in}.nc  ${var}_${restart_in}_withoutmask.nc  +
-  applymask maskin_lev0.nc $fill ${var}_${restart_in}_withoutmask.nc $var ${var}_${restart_in}.nc +
- +
-  # Horizontal extrapolation and fillup the empty seas with a climatology +
-  extrap ${var}_${restart_in}.nc ${var} ${meshmaskin} ${varlon} ${varlat} Ptoextrap_lev0.nc Ptofillclim_lev0.nc ${fill} ${var}_${restart_out}_int.nc 2d $cfutools $confout $mon +
-  +
-  # Apply the output mask +
-  applymask mask_lev0.nc $fill ${var}_${restart_out}_int.nc $var ${var}_${restart_out}.nc +
- +
-  # Pasting the output to ${restart_out}.nc +
-  gathervar ${restart_out}.nc ${var}_${restart_out}.nc +
-#  rm -f ${var}_${restart_out}.nc ${var}_${restart_out}_int.nc ${var}_${restart_in}.nc +
-done +
- +
-#  rm -f Ptoextrap_lev0.nc Ptofillclim_lev0.nc mask2din.nc mask_lev0.nc tmpmask.nc maskin_lev0.nc +
-if [[ -e Ptoextrap.nc ]] ; then rm -f Ptoextrap.nc ; fi +
- +
-</code>+
  
 == GLOSEA5, ORCA1L46 ==  == GLOSEA5, ORCA1L46 == 
  
-Similarly, as in ORAP5 ORCA1L46, we need to interpolate by using a software called **SOSIE** [[http://sosie.sourceforge.net/]] to interpolate the data. We run the script.sh below (on moore or amdahl by **sbatch script.sh**). We need two files:  +Similarly, as in ORAP5 ORCA1L46, we need to interpolate by using a software called **SOSIE** [[http://sosie.sourceforge.net/]] to interpolate the data. We do the following steps on the fat nodes
- +
-- The executable sosie.x       +
- +
-- The weights for the interpolation ORCA025-ORCA1.map  +
- +
-Both files are available on **cfutools** in branch **develop-eleftheria**, in the directory   +
-  prep_restarts/sources_for_ORCA025-ORCA1   +
- +
-We run the script.sh (in amdahl/moore we type **sbatch script.sh**)  +
- +
- +
-<code> +
-   #!/bin/bash +
-#SBATCH -n 1 +
-#SBATCH -t 10-12:00:00 +
-#SBATCH -J GS5-LR  +
-#SBATCH --mem=60000 +
-#SBATCH -o GS5-LR-%j.log +
-  +
- +
-set -evx +
-TMPDIR=/scratch/$(whoami)/$$ +
-mkdir -p $TMPDIR +
-cd $TMPDIR +
- +
-# The masks of the input file, which here is in GLOSEA5 ORCA05L75  +
-# and the output file, which is the ORCA01L46 +
-maskin='mesh_mask_nemo.Ec3.0_O25L75_ClosedSeas.nc'  +
-maskout='mesh_mask_nemo.Ec3.0_O1L46.nc' +
-ln -sf  /esnas/autosubmit/con_files/$maskin  +
-ln -sf  /esnas/autosubmit/con_files/$maskout  +
- +
-cp  /home/Earth/$(whoami)WORK/stargate/generate_restarts_gs5_LR/remap_ocean_ORCA025L75_ORCA15L46_final.sh    .  +
-cp  /home/Earth/$(whoami)WORK/stargate/generate_restarts_gs5_LR/sosie.x             .  +
-cp  /home/Earth/$(whoami)WORK/stargate/generate_restarts_gs5_LR/ORCA025-ORCA1.map   .  +
- +
-./remap_ocean_ORCA025L75_ORCA15L46_final.sh  +
-</code> +
- +
-Where ./remap_ocean_ORCA025L75_ORCA15L46_final.sh  is  +
- +
-<code> +
-#!/bin/bash +
- +
-set -evx  +
-#  +
-# This script extrapolates horizontally, interpolates horizontally and interpolates vertically  +
-# the scalar fields  +
-+
-# History : Eleftheria Exarchou  - Initial version           June 2015  +
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +
-#                                Arguments +
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +
- +
-dirhigh=/esnas/releases/ic/ocean/ORCA025L75/GLOSEA5/ +
-dirlow=/esnas/releases/ic/ocean/ORCA1L46/GLOSEA5/ +
-curdir=`pwd` +
-cd  $curdir  +
- +
-# The masks of the input file, which here is in GLOSEA5 ORCA05L75  +
-# and the output file, which is the ORCA01L46 +
-maskin='mesh_mask_nemo.Ec3.0_O25L75_ClosedSeas.nc'  +
-maskout='mesh_mask_nemo.Ec3.0_O1L46.nc' +
- +
-listdates=( '0430' '1031' +
- +
-for year in {1997..2013} ; do  +
- echo $year  +
- +
-for date in ${listdates[@]} ; do +
-file_final=GLOSEA5_fc0_${year}${date}_restart +
- +
-        # check if interpolated file exists already in esnas +
- if [ ! -e  /esnas/releases/ic/ocean/ORCA1L46/GLOSEA5/${file_final}.nc.gz ] ; then    +
- # check if the HR file exists  +
- if  [  -e ${dirhigh}/GLOSEA5_fc0_${year}${date}_restart.nc.gz ] ; then   +
-         +
- # check if file is locally here already (or: use gunzip -f to force overwrite, but this is slower ) +
- if [ ! -e  ${curdir}/GLOSEA5_fc0_${year}${date}_restart.nc ] ; then    +
- gunzip -c  ${dirhigh}/GLOSEA5_fc0_${year}${date}_restart.nc.gz   > ${curdir}/GLOSEA5_fc0_${year}${date}_restart.nc +
-        fi  +
- # Input/output restart file names  +
- restart_in=GLOSEA5_fc0_${year}${date}_restart   +
- restart_out=GLOSEA5_fc0_${year}${date}_restart_int +
- +
- +
-listvars=( 'en' 'ub' 'vb' 'tb' 'sb' 'rotb' 'hdivb' 'un' 'vn' 'tn' 'sn' 'rotn' 'hdivn' 'dissl' 'avt' 'avm' 'avmu' 'avmv' 'rhop' 'gcx' 'gcxb' 'sshb' 'sshn'+
-varscopy='rdt,rdttra1,kt,ndastp,adatrj' +
- +
- +
-# Create the initial restart file with the basic set of 0 dimensional variables  +
-if [[ ! -e ${restart_out}.nc ]] ; then +
-ncks -O -v $varscopy ${restart_in}.nc ${restart_out}.nc +
-ncks -A -v nav_lon,nav_lat,nav_lev    $maskout ${restart_out}.nc +
-fi  +
- +
- +
-# Specify the masks etc that correspond to each variable +
-for var in ${listvars[@]} ; do +
-  case $var in +
-   'avmu'|'un'|'ub') mask='umask' ; interp3d='0'  ;; +
-   'avmv'|'vn'|'vb') mask='vmask' ; interp3d='0'  ;; +
-   'rotb'|'rotn'   mask='fmask' ; interp3d='0'  ;; +
-   'avt'|'avmt'|'en'|'dissl'|'hdivb'|'hdivn'|'rhop'|'sn'|'tn'|'sb'|'tb') mask='tmask'  ;; +
-   'gcx'|'gcxb'|'sshb'|'sshn' mask='tmask' ;  interp3d=1  ;; +
-  esac +
- +
- +
-# Check if interpolation for this particular variable is already done  +
-if [ ! -e ${var}_ORCA025-ORCA1_restart_${year}${date}_miss.nc ] ;  then  +
- +
-file_in=${var}_in.nc  +
-ncks -O  -v ${var},nav_lon,nav_lat,nav_lev ${restart_in}.nc $file_in +
- +
-cat <<EOF > namelist_$var  +
- +
-!! -------------------  +
-!! Namelist for SOSIE  +
-!! -------------------  +
-!!  +
-!!  +
-!! ***********************  +
-!! Input characteristics :  +
-!! ***********************  +
-!!  +
-!! ivect : vector correction control on treated field [integer]  +
-!!         ivect = 0 : input field is not a component of a vector  +
-!!         or the target grid is regular (lregout = T)  +
-!!         * if non-regular distorted target grids (like ORCAX):  +
-!!         ivect = 1 : input field is a zonal (X) component of a vector  +
-!!         ivect = 2 : input field is a meridional (Y) component of a vector  +
-!!  +
-!! lregin : is the source grid regular? [logical]  +
-!!          (ie : are input longitude and latitude 1D?)  +
-!!  +
-!! cf_in   : file containing the input field to be interpolated [char] +
-!! cv_in   : name of treated variable (in input field file) [char] +
-!! +
-!! cv_t_in : name of time record variable in the input file [char] +
-!!           or 'missing_rec' if no time record is present in the input file +
-!! +
-!! jt1     : first time record to be interpolated +
-!! jt2     : last  time record to be interpolated +
-!!           => set jt1 and jt2 to 0 if you want to skip this option  +
-!!              and interpolate the nt time steps of the current field +
-!!  +
-!! jplev : level to treat if your file is 3D (spatial), has no influence if  +
-!!         your file is 2D ! +
-!!         jplev > 0 = level to treat (ex : jplev = 1 will interpolate only  +
-!!                     surface field corresponding to the 1st level ) +
-!!       ------------------------------------------------------------------ +
-!!       | jplev = 0 : perform 3D interpolation (if input file is 3D) !!! | +
-!!       ------------------------------------------------------------------ +
-!! +
-!! cf_x_in   : file containing the input grid (usually = cf_in) [char]  +
-!! cv_lon_in : name of longitude in the input grid file [char]  +
-!! cv_lat_in : name of latitude in the input grid file [char]  +
-!!  +
-!! cf_lsm_in : file containing the input land-sea mask [char] +
-!!             or specify 'missing_value' if a 'missing_value' netcdf +
-!!             attribute defines the mask on the input data field +
-!!             (not needed if "ldrown = .FALSE." --> ''+
- +
-!! cv_lsm_in name of land-sea mask variable [char] +
-!!             (not needed if "ldrown = .FALSE."  +
-!!              or if cf_lsm_in = 'missing_value'--> ''+
-!!             by default ocean is flagged with value 1 +
-!!             and continents are flagged with value 0 +
-!! +
-!! ldrown : whether we call DROWN land filling procedure [logical]  +
-!! +
-!! ewper : east-west periodicity on the input file/grid [integer]  +
-!!         = -1 --> no periodicity  +
-!!         >= 0 --> periodicity with overlap of ewper points  +
-!!  +
-!! vmax : upper bound not to exceed for treated variable [real]  +
-!! vmin : lower bound not to exceed for treated variable [real]  +
-!!--------------------------------------------------------------------------  +
-!!  +
-&ninput +
-ivect     = 0 +
-lregin    = F  ! F becuase the input grid is not regular  +
-cf_in     = '$file_in' +
-cv_in     = '${var}' +
-cv_t_in   = 'time'  +
-jt1       = 0   ! sdfgdfhgdfgh +
-jt2       = 0 +
-jplev     = $interp3d  ! use 0 for 3D interpolation  +
-cf_x_in   = '$file_in'  +
-cv_lon_in = 'nav_lon' +
-cv_lat_in = 'nav_lat' +
-cf_lsm_in = '$maskin' +
-cv_lsm_in = '$mask' +
-ldrown    = T +
-ewper     = 0 +
-vmax      =  1.E10 +
-vmin      = -1.E10 +
-+
-!! +
-!! +
-!! +
-!! +
-!! *********************************** +
-!!  IF 3D INTERPOLATION ( jplev = 0 ) +
-!! *********************************** +
-!! +
-!! Only mind if you do want to perform a 3D (spatial) interpolation +
-!!  +
-!! Mind only if you do want to perform a 3D interpolation ! +
-!! First, make sure that jplev is set to 0 ! +
-!! +
-!! cf_z_in  : file containing the input depth vector (associates a depth to a  +
-!!            given level). In most cases should be the same file than cf_x_in. +
-!! cv_z_in  : name of the variable for the input depth vector +
-!! +
-!! cf_z_out : file containing the output depth vector (associates a depth to a  +
-!!            given level). In most cases should be the same file than cf_x_in. +
-!! cv_z_out : name of the variable for the output depth vector in file 'cf_z_out' +
-!! cv_z_out_name: name you wish to give to depth variable in file to be created... +
-!! +
-!! +
-&n3d +
-cf_z_in  = '$file_in' +
-cv_z_in  = 'nav_lev' +
-cf_z_out = '$maskout' +
-cv_z_out = 'nav_lev' +
-cv_z_out_name = 'lev' +
-+
-!!  +
-!! +
-!! +
-!! +
-!! +
-!! *****************************  +
-!! Output Grid characteristics :  +
-!! *****************************  +
-!!  +
-!! lregout : is the target grid regular ? [logical]  +
-!!           (ie : are output longitude and latitude 1D?)  +
-!! +
-!! cf_x_out   : file containing the target grid [char]  +
-!! cv_lon_out : name of longitude variable [char]  +
-!! cv_lat_out : name of latitude variable [char]  +
-!! +
-!! TRICK:  for interpolating onto a global regular spherical grid +
-!! ------  with a resolution of dx deg. of longitude and dy deg. of latitude +
-!!         * cf_x_out   = 'spheric' ! tells SOSIE to build a spherical output grid +
-!!         * cv_lon_out = '1.0'  ! your dx, here 1.0 deg.  +
-!!         * cv_lat_out = '1.0'  ! your dy, here 1.0 deg. +
-!! +
-!! +
-!! cf_lsm_out : file containing output land-sea mask [char]  +
-!!              MUST BE 3D for 3D interpolation! +
-!!              or specify 'missing_value' if a 'missing_value' netcdf +
-!!              attribute defines the mask on a field 'X' in file 'cf_x_out' +
-!!              (not needed if "lmout = .FALSE." --> '')  +
-!! +
-!! cv_lsm_out : name of land-sea mask variable in 'cf_lsm_out'     [char] +
-!!              or name of field 'X' in 'cf_x_out' if you specified  +
-!!              cf_lsm_out = 'missing_value' +
-!!              (not needed if "lmout = .FALSE." --> '')  +
-!! +
-!! lmout : whether to mask the interpolated field on the output file [logical]  +
-!! +
-!! rmaskvalue : missing value given to output field (for continents) [logical]  +
-!! +
-!! lct   : whether to control or not time variable [logical]  +
-!!         TRUE -> specify time array with starting time 't0' and step 't_stp'  +
-!!         FALSE -> same time array as in input file is used  +
-!! t0    : time to start (if lct is set to .TRUE.) [real]  +
-!! t_stp : time step (if lct is set to .TRUE.) [real]  +
-!! +
-!! +
-&noutput +
-lregout    = F   ! the output grid is not regular +
-cf_x_out   = '$maskout' +
-cv_lon_out = 'nav_lon' +
-cv_lat_out = 'nav_lat' +
-cf_lsm_out = '$maskout' +
-cv_lsm_out = '$mask' +
-lmout      = T +
-rmaskvalue = 1.e+20 ! -9999. +
-lct        = F +
-t0         = 0. +
-t_stp      = 0.25 +
-+
-!!  +
-!!  +
-!!  +
-!!  +
-!! *******************************  +
-!! Netcdf output characteristics :  +
-!! *******************************  +
-!!  +
-!! This mostly deals with how the output file to be created is going to look like! +
-!! +
-!! cmethod  : the 2D interpolation method to be used +
-!!            use 'akima' if your input domain is regular (non-distorted grid) +
-!!            use 'bilin' otherwise, which is bilinear 2D interpolation +
-!! +
-!! *** Into the netcdf file to be created : ***  +
-!! cv_l_out : name for longitude on the output file [char]  +
-!! cv_p_out : name for latitude on the output file [char]  +
-!! cv_t_out : name for time on the output file [char]  +
-!! cv_out   : name for treated variable on the output file [char]  +
-!! cu_out   : treated variable units [char]  +
-!! cu_t     : time unit [char] +
-!! cln_out  : treated variable long name [char]  +
-!! cd_out   : directory to create output file to [char] +
-!!  +
-!! *** Name of the output file : ***  +
-!! csource  : short string to describe origin of the file [char]  +
-!! ctarget  : short string to describe the target grid [char]  +
-!! cextra   : short extra indication about the file [char]  +
-!!  +
-&nnetcdf +
-cmethod  = 'bilin' +
-cv_l_out = 'x'  ! 'var_lon' +
-cv_p_out = 'y'  ! 'var_lat' +
-cv_t_out = 'time' +
-cv_out   = '${var}' +
-cu_out   = ' ' +
-cu_t     = 'unknown' +
-cln_out  = ' ' +
-cd_out   = '.' +
-csource  = 'ORCA025' +
-ctarget  = 'ORCA1' +
-cextra   = 'restart_${year}${date}' +
-/  +
-!! +
- +
- +
-EOF +
- +
-./sosie.x  -f namelist_$var  +
- +
-cdo setmisstoc, ${var}_ORCA025-ORCA1_restart_${year}${date}.nc  ${var}_ORCA025-ORCA1_restart_${year}${date}_miss.nc +
- +
-ncks -A ${var}_ORCA025-ORCA1_restart_${year}${date}_miss.nc  ${restart_out}.nc  +
-rm -rf  ${var}_ORCA025-ORCA1_restart_${year}${date}*.nc    +
-fi  +
-done  +
- +
-# Some variables have negative values in some points,  +
-# whereas they should be always positive. We fix it by +
-# making these values equal to 0. These vars are  +
-# avt,avm,avmu,avmv,dissl  +
- +
-file1=GLOSEA5_fc0_${year}${date}_restart_int.nc    +
-file2=GLOSEA5_fc0_${year}${date}_restart_int_needtofix.nc                               +
-file3=GLOSEA5_fc0_${year}${date}_restart_int_fixed.nc                    +
-file4=GLOSEA5_fc0_${year}${date}_restart_int_valuesfixed.nc     +
-file5=GLOSEA5_fc0_${year}${date}_restart_int_valuesfixed_precision.nc     +
-#file_final=GLOSEA5_fc0_${year}${date}_restart +
- +
-cdo selvar,avt,avm,avmu,avmv,dissl  $file1  $file2 +
-cdo setrtoc,-1000000000,0,        $file2  $file3 +
- +
-cdo replace  $file1     $file3  $file4 +
-cdo  -b 64 copy         $file4  $file5  +
- +
-gzip -c  $file5  >  /esnas/releases/ic/ocean/ORCA1L46/GLOSEA5/${file_final}.nc.gz  +
-rm  -rf ${curdir}/GLOSEA5_fc0_${year}${date}_restart.nc +
- +
-fi  +
-fi  +
-done  +
-done  +
- +
- +
- +
  
-</code>+   sbatch launchscript.sh
initial_conditions/oceanic.1452268595.txt.gz · Last modified: 2016/01/08 15:56 by eexarcho