This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
initial_conditions:oceanic [2016/05/31 15:33] cprodhom |
initial_conditions:oceanic [2018/10/09 13:23] macosta [Brief description] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== Brief description | + | ==== Shared in EC-Earth consortium |
+ | Details are here https:// | ||
+ | |||
+ | ==== 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| 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) | | | 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) | | ||
Line 17: | Line 21: | ||
| m01w| NEMO3.3| ORCA025L46| 19921101| 20091101| 02, | | m01w| NEMO3.3| ORCA025L46| 19921101| 20091101| 02, | ||
| m01u| NEMO3.3| ORCA025L75| 19921101| 20091101| 02, | | m01u| NEMO3.3| ORCA025L75| 19921101| 20091101| 02, | ||
+ | | official_repro| NEMO3.6| ORCA01L75| 19500101 19500101 --- | fc00-fc04| Initial conditions for the official EC-Earth reproducibility test| https:// | ||
| | | | ||
Line 51: | Line 56: | ||
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. clone the branch fetch_ORAS4 of cfutools and run the script tranfert/fetch_ORAS4.sh | + | 2. clone the project https:// |
+ | |||
+ | 3. run | ||
+ | |||
+ | 4. go into the path_to_the_Oce_IC and run fetch_ORAS4.sh | ||
== ORAP5, ORCA025L75 == | == ORAP5, ORCA025L75 == | ||
Line 57: | Line 66: | ||
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:// |
- | # | + | 2. Fetch the data locally |
- | #SBATCH -n 1 | + | |
- | #SBATCH -t 10-12: | + | |
- | #SBATCH -J fetchORAP5 | + | |
- | #SBATCH --mem=60000 | + | |
- | #SBATCH -o fetch-orap5-%j.log | + | |
- | + | ||
- | set -evx | + | |
- | TMPDIR=/ | + | |
- | mkdir -p $TMPDIR | + | |
- | cd $TMPDIR | + | |
- | + | ||
- | module load ECAC | + | |
- | + | ||
- | DATASOURCE=" | + | |
- | YEARI=2000 # First eyar to download | + | |
- | YEARF=2013 # Last year to download | + | |
- | MEMBER_LST=" | + | |
- | YEAR=$YEARI | + | |
- | + | ||
- | workdir=`pwd` | + | |
- | + | ||
- | echo $YEAR | + | |
- | | + | |
- | mkdir -p / | + | |
- | for mem in $MEMBER_LST ; do | + | |
- | for file in $( ecaccess-file-dir ${DATASOURCE}/ | + | |
- | do | + | |
- | if [[ " | + | |
- | echo $file | + | |
- | if [[ ! -f / | + | |
- | while [[ ! -f / | + | |
- | do | + | |
- | ecaccess-file-get -progress ${DATASOURCE}/ | + | |
- | mv $file / | + | |
- | done | + | |
- | fi | + | |
- | fi | + | |
- | done | + | |
- | done | + | |
- | YEAR=$((YEAR+1)) | + | |
- | done | + | |
- | + | ||
- | rm -rf $TMPDIR | + | |
+ | cd cpg_tools/ | ||
+ | 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 120: | Line 89: | ||
-rw-r--r-- 1 pbretonn Earth 4927336766 Oct 7 06:50 / | -rw-r--r-- 1 pbretonn Earth 4927336766 Oct 7 06:50 / | ||
- | 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 | |
- | # | + | |
- | #SBATCH -n 1 | + | |
- | #SBATCH -t 10-12: | + | |
- | #SBATCH -J fetchORAP5 | + | |
- | #SBATCH --mem=60000 | + | |
- | #SBATCH -o fetch-orap5-%j.log | + | |
- | + | ||
- | set -evx | + | |
- | TMPDIR=/ | + | |
- | mkdir $TMPDIR | + | |
- | cd $TMPDIR | + | |
- | + | ||
- | dir=/esnas/ | + | |
- | | + | |
- | curdir=`pwd` | + | |
- | + | ||
- | for year in {2005..2007} ; do | + | |
- | ##May start dates | + | |
- | echo $year | + | |
- | dirin=${dir}/ | + | |
- | if [ -e $dirin | + | |
- | cd $dirin | + | |
- | for file in $( ls | + | |
- | inname=$(echo $file | cut -f1 -d" | + | |
- | ofile=ORAP5_fc0_${year}0430_restart.nc.gz | + | |
- | if [ ! -e ${outdir}/ | + | |
- | cd $curdir | + | |
- | gunzip -c | + | |
- | tar xfv ${inname}.tar | + | |
- | gzip -c ${inname}.nc > ${outdir}/ | + | |
- | rm -rf ${curdir}/ | + | |
- | fi | + | |
- | done | + | |
- | fi | + | |
- | + | ||
- | # November start dates | + | |
- | echo $year | + | |
- | dirin=${dir}/ | + | |
- | if [ -e $dirin | + | |
- | cd $dirin | + | |
- | for file in $( ls | + | |
- | inname=$(echo $file | cut -f1 -d" | + | |
- | ofile=ORAP5_fc0_${year}1031_restart.nc.gz | + | |
- | if [ ! -e ${outdir}/ | + | |
- | cd $curdir | + | |
- | gunzip -c | + | |
- | tar xfv ${inname}.tar | + | |
- | gzip -c ${inname}.nc > ${outdir}/ | + | |
- | rm -rf ${curdir}/ | + | |
- | fi | + | |
- | done | + | |
- | fi | + | |
- | done | + | |
- | + | ||
- | + | ||
- | rm -rf $TMPDIR | + | |
| | ||
| | ||
+ | |||
== ORAP5, ORCA1L46 == | == ORAP5, ORCA1L46 == | ||
- | We use a software called **SOSIE** [[http:// | + | We use a software called **SOSIE** [[http:// |
- | - The executable sosie.x | + | cd cpg_tools/ |
+ | sbatch launchscript.sh | ||
- | - The weights for the interpolation ORCA025-ORCA1.map | ||
- | |||
- | Both files are available on **cfutools** in branch **develop-eleftheria**, | ||
- | prep_restarts/ | ||
- | |||
- | The script.sh is: | ||
- | |||
- | < | ||
- | #!/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=/ | ||
- | mkdir -p $TMPDIR | ||
- | cd $TMPDIR | ||
- | |||
- | | ||
- | # Copy the masks of the input file and the output file: | ||
- | maskin=' | ||
- | maskout=' | ||
- | ln -sf / | ||
- | ln -sf / | ||
- | |||
- | | ||
- | cp / | ||
- | cp / | ||
- | |||
- | #!/bin/bash | ||
- | |||
- | set -evx | ||
- | # This script extrapolates horizontally, | ||
- | # the scalar fields | ||
- | # | ||
- | # History : Eleftheria Exarchou | ||
- | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
- | # Arguments | ||
- | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
- | |||
- | # The masks of the input file, which here is in ORAP5 ORCA05L75 | ||
- | # and the output file, which is the ORCA01L46 | ||
- | maskin=' | ||
- | maskout=' | ||
- | |||
- | dirhigh=/ | ||
- | dirlow=/ | ||
- | curdir=`pwd` | ||
- | |||
- | |||
- | listdates=( ' | ||
- | |||
- | 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 / | ||
- | # check if the HR file exists | ||
- | if [ -e ${dirhigh}/ | ||
- | # check if file is locally here already (or: use gunzip -f to force overwrite, but this is slower ) | ||
- | if [ ! -e ${curdir}/ | ||
- | gunzip -c ${dirhigh}/ | ||
- | fi | ||
- | # Input/ | ||
- | restart_in=ORAP5_fc0_${year}${date}_restart | ||
- | restart_out=ORAP5_fc0_${year}${date}_restart_int | ||
- | |||
- | |||
- | |||
- | listvars3d=( ' | ||
- | | ||
- | |||
- | |||
- | # 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, | ||
- | fi | ||
- | |||
- | # Specify the masks etc that correspond to each variable | ||
- | for var in ${listvars3d[@]} ; do | ||
- | case $var in | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | ' | ||
- | 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}, | ||
- | ncrename -d t, | ||
- | |||
- | 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 ' | ||
- | !! | ||
- | !! 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 | ||
- | !! | ||
- | !! | ||
- | !! | jplev = 0 : perform 3D interpolation (if input file is 3D) !!! | | ||
- | !! | ||
- | !! | ||
- | !! cf_x_in | ||
- | !! 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 ' | ||
- | !! | ||
- | !! (not needed if " | ||
- | |||
- | !! cv_lsm_in : name of land-sea mask variable [char] | ||
- | !! (not needed if " | ||
- | !! or if cf_lsm_in = ' | ||
- | !! 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 | ||
- | cf_in = ' | ||
- | cv_in = ' | ||
- | cv_t_in | ||
- | jt1 = 0 ! sdfgdfhgdfgh | ||
- | jt2 = 0 | ||
- | jplev = $interp3d | ||
- | cf_x_in | ||
- | cv_lon_in = ' | ||
- | cv_lat_in = ' | ||
- | cf_lsm_in = ' | ||
- | cv_lsm_in = ' | ||
- | ldrown | ||
- | 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 | ||
- | !! given level). In most cases should be the same file than cf_x_in. | ||
- | !! cv_z_in | ||
- | !! | ||
- | !! 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 ' | ||
- | !! cv_z_out_name: | ||
- | !! | ||
- | !! | ||
- | &n3d | ||
- | cf_z_in | ||
- | cv_z_in | ||
- | cf_z_out = ' | ||
- | cv_z_out = ' | ||
- | cv_z_out_name = ' | ||
- | / | ||
- | !! | ||
- | !! | ||
- | !! | ||
- | !! | ||
- | !! | ||
- | !! ***************************** | ||
- | !! Output Grid characteristics : | ||
- | !! ***************************** | ||
- | !! | ||
- | !! lregout : is the target grid regular ? [logical] | ||
- | !! (ie : are output longitude and latitude 1D?) | ||
- | !! | ||
- | !! cf_x_out | ||
- | !! cv_lon_out : name of longitude variable [char] | ||
- | !! cv_lat_out : name of latitude variable [char] | ||
- | !! | ||
- | !! TRICK: | ||
- | !! ------ | ||
- | !! * cf_x_out | ||
- | !! * cv_lon_out = ' | ||
- | !! * cv_lat_out = ' | ||
- | !! | ||
- | !! | ||
- | !! cf_lsm_out : file containing output land-sea mask [char] | ||
- | !! MUST BE 3D for 3D interpolation! | ||
- | !! or specify ' | ||
- | !! attribute defines the mask on a field ' | ||
- | !! (not needed if "lmout = .FALSE." | ||
- | !! | ||
- | !! cv_lsm_out : name of land-sea mask variable in ' | ||
- | !! or name of field ' | ||
- | !! cf_lsm_out = ' | ||
- | !! (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 ' | ||
- | !! 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] | ||
- | !! | ||
- | !! | ||
- | & | ||
- | lregout | ||
- | cf_x_out | ||
- | cv_lon_out = ' | ||
- | cv_lat_out = ' | ||
- | cf_lsm_out = ' | ||
- | cv_lsm_out = ' | ||
- | 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 | ||
- | !! use ' | ||
- | !! use ' | ||
- | !! | ||
- | !! *** 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 | ||
- | !! cu_out | ||
- | !! cu_t : time unit [char] | ||
- | !! cln_out | ||
- | !! cd_out | ||
- | !! | ||
- | !! *** Name of the output file : *** | ||
- | !! csource | ||
- | !! ctarget | ||
- | !! cextra | ||
- | !! | ||
- | & | ||
- | cmethod | ||
- | cv_l_out = ' | ||
- | cv_p_out = ' | ||
- | cv_t_out = ' | ||
- | cv_out | ||
- | cu_out | ||
- | cu_t = ' | ||
- | cln_out | ||
- | cd_out | ||
- | csource | ||
- | ctarget | ||
- | cextra | ||
- | / | ||
- | !! | ||
- | |||
- | |||
- | EOF | ||
- | |||
- | ./ | ||
- | |||
- | |||
- | cdo setmisstoc, | ||
- | |||
- | ncks -A ${var}_ORCA025-ORCA1_restart_${year}${date}_miss.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, | ||
- | |||
- | 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, | ||
- | cdo setrtoc, | ||
- | |||
- | cdo replace | ||
- | cdo -b 64 copy | ||
- | |||
- | gzip -c $file5 | ||
- | rm -rf ${curdir}/ | ||
- | |||
- | fi | ||
- | fi | ||
- | done | ||
- | done | ||
- | |||
- | rm -rf $TMPDIR | ||
- | |||
- | |||
- | </ | ||
- | |||
- | |||
== 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 | + | We need to extrapolate the files to the mask we use locally. We do the following separately per year (here as example for 19940501, |
- | < | + | cd cpg_tools/ |
- | + | sbatch 19940501.sh | |
- | # | + | |
- | #SBATCH -n 1 | + | |
- | #SBATCH -t 10-12: | + | |
- | #SBATCH -J gs5-HR | + | |
- | #SBATCH --mem=60000 | + | |
- | #SBATCH -o gs5-HR-%j.log | + | |
- | + | ||
- | # | + | |
- | + | ||
- | set -evx | + | |
- | TMPDIR=/ | + | |
- | mkdir $TMPDIR | + | |
- | cd $TMPDIR | + | |
- | + | ||
- | year=1994 | + | |
- | mon=05 | + | |
- | + | ||
- | ((mon1=$mon -1 )) | + | |
- | + | ||
- | + | ||
- | cp / | + | |
- | ln -sf / | + | |
- | ln -sf / | + | |
- | ln -sf / | + | |
- | ln -sf / | + | |
- | ln -sf / | + | |
- | + | ||
- | tar xvf ${year}${mon}01__restart00.tar | + | |
- | gunzip restart.nc.gz | + | |
- | + | ||
- | ./ | + | |
- | + | ||
- | ncecat -O -h restart_out.nc | + | |
- | ncrename -d record, | + | |
- | cdo setmisstoc, | + | |
- | + | ||
- | 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 | + | |
- | + | ||
- | </ | + | |
- | + | ||
- | Where the script script_interp_vert_ocean_restart_GS5_ORCA025L75.bash is | + | |
- | + | ||
- | < | + | |
- | + | ||
- | # | + | |
- | set -evx | + | |
- | # | + | |
- | # This script extrapolates horizontally, | + | |
- | # fills up empty seas with climatologies, | + | |
- | # | + | |
- | # History : Virginie Guemas - Initial version | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # | + | |
- | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | + | |
- | # Arguments | + | |
- | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | + | |
- | type=' | + | |
- | # to adapt the list of variables this restart contains below. | + | |
- | # Look for the variable $type in the script. | + | |
- | fillinrot=' | + | |
- | # 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=' | + | |
- | # Meshmask of the input reanalysis. Example: | + | |
- | #'/ | + | |
- | confout=' | + | |
- | # | + | |
- | vertgridout=' | + | |
- | # Meshmask of the output restart, i.e. model and grid to be used in | + | |
- | # climate prediction | + | |
- | # | + | |
- | Ptoextrap=' | + | |
- | # 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=' | + | |
- | # 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='/ | + | |
- | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | + | |
- | + | ||
- | case $type in | + | |
- | ' | + | |
- | # List of 3d variables = that need to be vertically interpolated | + | |
- | | + | |
- | # List of 2d variables = that only need extrapolation | + | |
- | | + | |
- | # List of 0d variables = that need to be copied to the output restart | + | |
- | | + | |
- | ;; | + | |
- | ' | + | |
- | | + | |
- | | + | |
- | | + | |
- | ;; | + | |
- | ' | + | |
- | | + | |
- | | + | |
- | | + | |
- | ;; | + | |
- | esac | + | |
- | + | ||
- | source ${cfutools}/ | + | |
- | + | ||
- | if [[ $fillinrot == ' | + | |
- | 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 | + | |
- | | + | |
- | 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, | + | |
- | 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, | + | |
- | for var in ${listvarsinterp[@]} ; do | + | |
- | case $var in | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | esac | + | |
- | # # The vertical interpolation is performed below | + | |
- | # python ${cfutools}/ | + | |
- | + | ||
- | + | ||
- | # 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, | + | |
- | fi | + | |
- | cdo -ifthen ${fill}.nc | + | |
- | # Modify the missing value to 1e20 | + | |
- | ncatted -O -a _FillValue, | + | |
- | ncatted -O -a missing_value, | + | |
- | 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}/ | + | |
- | # python ${cfutools}/ | + | |
- | + | ||
- | # 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, | + | |
- | mv | + | |
- | # rm -f ${var}_${restart_out}.nc ${var}_${restart_out}_int? | + | |
- | 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 | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | esac | + | |
- | + | ||
- | # Apply the input mask | + | |
- | cdo selvar, | + | |
- | 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 | + | |
- | + | ||
- | </ | + | |
== GLOSEA5, ORCA1L46 == | == GLOSEA5, ORCA1L46 == | ||
- | Similarly, as in ORAP5 ORCA1L46, we need to interpolate by using a software called **SOSIE** [[http:// | + | Similarly, as in ORAP5 ORCA1L46, we need to interpolate by using a software called **SOSIE** [[http:// |
- | + | ||
- | - The executable sosie.x | + | |
- | + | ||
- | - The weights for the interpolation ORCA025-ORCA1.map | + | |
- | + | ||
- | Both files are available on **cfutools** in branch **develop-eleftheria**, | + | |
- | prep_restarts/ | + | |
- | + | ||
- | We run the script.sh (in amdahl/ | + | |
- | + | ||
- | + | ||
- | < | + | |
- | # | + | |
- | #SBATCH -n 1 | + | |
- | #SBATCH -t 10-12: | + | |
- | #SBATCH -J GS5-LR | + | |
- | #SBATCH --mem=60000 | + | |
- | #SBATCH -o GS5-LR-%j.log | + | |
- | + | ||
- | + | ||
- | set -evx | + | |
- | TMPDIR=/ | + | |
- | 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=' | + | |
- | maskout=' | + | |
- | ln -sf / | + | |
- | ln -sf / | + | |
- | + | ||
- | cp / | + | |
- | cp / | + | |
- | cp / | + | |
- | + | ||
- | ./ | + | |
- | </ | + | |
- | + | ||
- | Where ./ | + | |
- | + | ||
- | < | + | |
- | # | + | |
- | + | ||
- | set -evx | + | |
- | # | + | |
- | # This script extrapolates horizontally, | + | |
- | # the scalar fields | + | |
- | # | + | |
- | # History : Eleftheria Exarchou | + | |
- | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | + | |
- | # Arguments | + | |
- | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | + | |
- | + | ||
- | dirhigh=/ | + | |
- | dirlow=/ | + | |
- | 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=' | + | |
- | maskout=' | + | |
- | + | ||
- | listdates=( ' | + | |
- | + | ||
- | 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 / | + | |
- | # check if the HR file exists | + | |
- | if [ -e ${dirhigh}/ | + | |
- | + | ||
- | # check if file is locally here already (or: use gunzip -f to force overwrite, but this is slower ) | + | |
- | if [ ! -e ${curdir}/ | + | |
- | gunzip -c ${dirhigh}/ | + | |
- | fi | + | |
- | # Input/ | + | |
- | restart_in=GLOSEA5_fc0_${year}${date}_restart | + | |
- | restart_out=GLOSEA5_fc0_${year}${date}_restart_int | + | |
- | + | ||
- | + | ||
- | listvars=( ' | + | |
- | varscopy=' | + | |
- | + | ||
- | + | ||
- | # 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, | + | |
- | fi | + | |
- | + | ||
- | + | ||
- | # Specify the masks etc that correspond to each variable | + | |
- | for var in ${listvars[@]} ; do | + | |
- | case $var in | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | 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}, | + | |
- | + | ||
- | 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 ' | + | |
- | !! | + | |
- | !! 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 | + | |
- | !! | + | |
- | !! | + | |
- | !! | jplev = 0 : perform 3D interpolation (if input file is 3D) !!! | | + | |
- | !! | + | |
- | !! | + | |
- | !! cf_x_in | + | |
- | !! 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 ' | + | |
- | !! | + | |
- | !! (not needed if " | + | |
- | + | ||
- | !! cv_lsm_in | + | |
- | !! (not needed if " | + | |
- | !! or if cf_lsm_in = ' | + | |
- | !! 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] | + | |
- | !!-------------------------------------------------------------------------- | + | |
- | !! | + | |
- | & | + | |
- | ivect = 0 | + | |
- | lregin | + | |
- | cf_in = ' | + | |
- | cv_in = ' | + | |
- | cv_t_in | + | |
- | jt1 = 0 ! sdfgdfhgdfgh | + | |
- | jt2 = 0 | + | |
- | jplev = $interp3d | + | |
- | cf_x_in | + | |
- | cv_lon_in = ' | + | |
- | cv_lat_in = ' | + | |
- | cf_lsm_in = ' | + | |
- | cv_lsm_in = ' | + | |
- | ldrown | + | |
- | 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 | + | |
- | !! given level). In most cases should be the same file than cf_x_in. | + | |
- | !! cv_z_in | + | |
- | !! | + | |
- | !! 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 ' | + | |
- | !! cv_z_out_name: | + | |
- | !! | + | |
- | !! | + | |
- | &n3d | + | |
- | cf_z_in | + | |
- | cv_z_in | + | |
- | cf_z_out = ' | + | |
- | cv_z_out = ' | + | |
- | cv_z_out_name = ' | + | |
- | / | + | |
- | !! | + | |
- | !! | + | |
- | !! | + | |
- | !! | + | |
- | !! | + | |
- | !! ***************************** | + | |
- | !! Output Grid characteristics : | + | |
- | !! ***************************** | + | |
- | !! | + | |
- | !! lregout : is the target grid regular ? [logical] | + | |
- | !! (ie : are output longitude and latitude 1D?) | + | |
- | !! | + | |
- | !! cf_x_out | + | |
- | !! cv_lon_out : name of longitude variable [char] | + | |
- | !! cv_lat_out : name of latitude variable [char] | + | |
- | !! | + | |
- | !! TRICK: | + | |
- | !! ------ | + | |
- | !! * cf_x_out | + | |
- | !! * cv_lon_out = ' | + | |
- | !! * cv_lat_out = ' | + | |
- | !! | + | |
- | !! | + | |
- | !! cf_lsm_out : file containing output land-sea mask [char] | + | |
- | !! MUST BE 3D for 3D interpolation! | + | |
- | !! or specify ' | + | |
- | !! attribute defines the mask on a field ' | + | |
- | !! (not needed if "lmout = .FALSE." | + | |
- | !! | + | |
- | !! cv_lsm_out : name of land-sea mask variable in ' | + | |
- | !! or name of field ' | + | |
- | !! cf_lsm_out = ' | + | |
- | !! (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 ' | + | |
- | !! 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] | + | |
- | !! | + | |
- | !! | + | |
- | & | + | |
- | lregout | + | |
- | cf_x_out | + | |
- | cv_lon_out = ' | + | |
- | cv_lat_out = ' | + | |
- | cf_lsm_out = ' | + | |
- | cv_lsm_out = ' | + | |
- | 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 | + | |
- | !! use ' | + | |
- | !! use ' | + | |
- | !! | + | |
- | !! *** 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 | + | |
- | !! cu_out | + | |
- | !! cu_t : time unit [char] | + | |
- | !! cln_out | + | |
- | !! cd_out | + | |
- | !! | + | |
- | !! *** Name of the output file : *** | + | |
- | !! csource | + | |
- | !! ctarget | + | |
- | !! cextra | + | |
- | !! | + | |
- | & | + | |
- | cmethod | + | |
- | cv_l_out = ' | + | |
- | cv_p_out = ' | + | |
- | cv_t_out = ' | + | |
- | cv_out | + | |
- | cu_out | + | |
- | cu_t = ' | + | |
- | cln_out | + | |
- | cd_out | + | |
- | csource | + | |
- | ctarget | + | |
- | cextra | + | |
- | / | + | |
- | !! | + | |
- | + | ||
- | + | ||
- | EOF | + | |
- | + | ||
- | ./ | + | |
- | + | ||
- | cdo setmisstoc, | + | |
- | + | ||
- | ncks -A ${var}_ORCA025-ORCA1_restart_${year}${date}_miss.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, | + | |
- | + | ||
- | 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 | + | |
- | # | + | |
- | + | ||
- | cdo selvar, | + | |
- | cdo setrtoc, | + | |
- | + | ||
- | cdo replace | + | |
- | cdo -b 64 copy | + | |
- | + | ||
- | gzip -c $file5 | + | |
- | rm -rf ${curdir}/ | + | |
- | + | ||
- | fi | + | |
- | fi | + | |
- | done | + | |
- | done | + | |
- | + | ||
- | + | ||
- | + | ||
- | </ | + | |