Browse Source

Last lemaitre3 changes

Pierre-Yves Barriat 2 years ago
parent
commit
50058ef90d

+ 1 - 0
.gitignore

@@ -4,3 +4,4 @@
 *.log
 *.err
 cdftools_light/bin/
+slurm-*.out

+ 15 - 22
README.md

@@ -29,7 +29,7 @@ https://brodeau.github.io/barakuda/example/
   => https://www.enthought.com/products/canopy/
 
   In any case, specify the appropriate "PYTHON_HOME" environment variable in
-  your ${BARAKUDA_ROOT}/configs/config_${MYCONF}.sh or ./config_${MYCONF}.sh file
+  your ${BARAKUDA_ROOT}/configs/config_<MYCONF>.sh or ./config_<MYCONF>.sh file
 
 * NEMO output data! => A directory containing the MONTHLY-AVERAGED, global
                        (rebuilt), NEMO output to analyze
@@ -39,7 +39,7 @@ https://brodeau.github.io/barakuda/example/
   XIOS2 can be found in: src/xios2_xml/
 
 * a NEMO mesh_mask file and the the corresponding basin_mask (ocean basins).
-  (variables MM_FILE and BM_FILE into the config_${MYCONF}.sh file you use).
+  (variables MM_FILE and BM_FILE into the config_<MYCONF>.sh file you use).
   
   To create the NEMO mesh_mask.nc just launch the relevant NEMO experiment with the
   namelist parameter nn_msh set to 1 !
@@ -63,7 +63,7 @@ https://brodeau.github.io/barakuda/example/
 
 
 
-### I/ Compile CDFTOOLS executables 
+### I / Compile CDFTOOLS executables 
 
  * CDFTOOLS is a set of FORTRAN executables intended to perform a multitude of
    ocean diagnostics based on NEMO output
@@ -95,21 +95,21 @@ https://brodeau.github.io/barakuda/example/
 
            
 
-### II/ Create and configure your own "config_${MYCONF}.sh"
+### II / Create and configure your own "config_<MY_CONF>.sh"
 
 All setup related to your host, simulation, location of third party files is
-defined in the "config_${MYCONF}.sh" file.
+defined in the "config_<MY_CONF>.sh" file.
 
 You can either used to chose a config file located in the
 "${BARAKUDA_ROOT}/configs" directory of Barakuda:
-('${BARAKUDA_ROOT}/configs/config_${MYCONF}.sh')
+('${BARAKUDA_ROOT}/configs/config_<MY_CONF>.sh')
 
 Or, in case you have no write access into ${BARAKUDA_ROOT}/ and call the Barakuda
 suite of scripts from another location, hereafter "work directory", you can use
-a "config_${MYCONF}.sh" present in the "work directory".
+a "config_<MY_CONF>.sh" present in the "work directory".
 
-Note: if a given "config_${MYCONF}.sh" exists both in "${BARAKUDA_ROOT}/configs"
-and the "work directory", Barakuda will always refer to "config_${MYCONF}.sh"
+Note: if a given "config_<MY_CONF>.sh" exists both in "${BARAKUDA_ROOT}/configs"
+and the "work directory", Barakuda will always refer to "config_<MY_CONF>.sh"
 present in the "work directory".
 
 IMPORTANT: Always refer to the most relevant
@@ -118,17 +118,14 @@ yours! These are symbolic links pointing to the last officially supported and
 most up-to-date config files.  It should be sufficiently well commented for you
 to be able to adjust your own config file.
 
-```
 MY_CONF should always be of the form: "(e)ORCA<RES>_L<NLEV>_<blabla>.sh"
         ( with NLEV being the number of z levels )
-```
 
 NEMO output files must be monthly averages and of the following form:
-```
+
         <EXP NAME>_1m_<YEAR>0101_<YEAR>1231_<GRID_TYPE>.nc(.gz)
 
         (GRID_TYPE=grid_T/grid_U/grid_V/icemod) 
-```        
 
 Gzipped or not!
 
@@ -157,7 +154,8 @@ The "CONF_INI_DIR" variable in your config file should point to the location of
 the directory you created by untaring one of these tar archives.
 
 
-### III/ Create diagnostics
+
+### III) Create diagnostics
 
 
 Launch "barakuda.sh"
@@ -175,26 +173,22 @@ Use the -h switch to see available options.
 * Once the previous job has finished to run, launch
 
 To only generate time-series plots use the "-e" switch:
-```
+
         ./barakuda.sh -C <MY_CONF> -R <EXP> -e
 
         (ex: ./barakuda.sh -C ORCA1_L75_v36_triolith -R SL36C00 -e)
-```        
 
 To generate time-series + 2D climatology plots use the "-E" switch, provided you
 have built the monthly/annual climatology (based on N years of your simulation)
 out of your experiment with the "build_clim.sh" script (see next bullet point):
-```     
+     
         ./barakuda.sh -C <MY_CONF> -R <EXP> -E
-```        
 
 * To be able to create the "climatology" plots (maps, sections, etc, based on a monthly climatology of a few years) you will have to
 
   1. create the climatology with the "build_clim.sh" script:
 
-```
         ./build_clim.sh -C <MY_CONF> -R <EXP> -i <first_year> -e <last_year>
-```        
 
     Use the -h switch to see available options.
       
@@ -203,9 +197,8 @@ out of your experiment with the "build_clim.sh" script (see next bullet point):
 
 
 * To compare time-series between at least 2 (already diagnosed) experiments:
-```   
+   
          ./compare_time-series.sh -C <MY_CONF> -R <EXP1>,<EXP2>,...,<EXPn>
-```         
 
          (ex: ./compare_time-series.sh -C ORCA1_L75_v36_triolith -R SL36C00,SL36EIE )
 

+ 3 - 3
barakuda.sh

@@ -133,12 +133,12 @@ while ${lcontinue}; do
 
     export cyear=`printf "%04d" ${jyear}`
     cpf=""
-    #if [ ${ISTAGE} -eq 1 ] && [ ${ece_exp} -gt 0 ]; then
-        iy=$((${jyear}-${YEAR_INI}+1+${YEAR_INI}-${YEAR_INI_F}))
+    if [ ${ISTAGE} -eq 1 ]; then
+        iy=$(((${jyear}-${YEAR_INI})/${IFREQ_SAV_YEARS}+1+${YEAR_INI}-${YEAR_INI_F}))
         dir_ece=`printf "%03d" ${iy}`
         echo " *** ${cyear} => dir_ece = ${dir_ece}"
         cpf="${dir_ece}/"
-    #fi
+    fi
 
     i_get_file=0
     if [ $((${jyear}%${IFREQ_SAV_YEARS})) -eq 0 ]; then

+ 46 - 0
batch.sh

@@ -0,0 +1,46 @@
+#!/usr/bin/env bash
+
+#SBATCH --job-name=barakuda
+#SBATCH --time=47:55:00
+##SBATCH --time=05:55:00
+#SBATCH --ntasks=1
+#SBATCH --mem-per-cpu=2048
+##SBATCH --partition=debug
+#
+##SBATCH --mail-user=noname@uclouvain.be
+##SBATCH --mail-type=ALL
+##SBATCH --open-mode=append
+set -ueo pipefail
+
+stdout_file=${SLURM_SUBMIT_DIR-$PWD}/${SLURM_JOB_NAME-"local"}_${SLURM_JOB_ID-"id"}.log
+exec > ${stdout_file}
+echo "------------------ Job Info --------------------"
+echo "jobid : ${SLURM_JOB_ID-"id"}"
+echo "jobname : ${SLURM_JOB_NAME-"local"}"
+echo "submit dir : ${SLURM_SUBMIT_DIR-$PWD}"
+
+set -ue 
+
+exp="NE4_70"
+starting_year=1800
+slice=5
+path_out="/scratch/ucl/elic/pbarriat/nemo/archive/${exp}"
+path_exe="/home/ucl/elic/pbarriat/modeles/barakuda"
+
+###
+
+# Configure and load modules
+module purge
+module load releases/2018b use.own
+module load netCDF-Fortran/4.4.4-foss-2018b ELIC_Python/1-foss-2018b-Python-2.7.15
+module load ImageMagick/7.0.8-11-GCCcore-7.3.0 FFmpeg/4.1-foss-2018b
+
+cd ${path_exe}
+
+./barakuda.sh -C ORCA1_L75_NEMO4_lm3 -R ${exp} -f ${slice} -y ${starting_year}
+
+# IF grep "Diagnostics built and saved" *
+
+./barakuda.sh -C ORCA1_L75_NEMO4_lm3 -R ${exp} -f ${slice} -y ${starting_year} -e
+
+echo ----- BARAKUDA post finished

+ 0 - 14
cdftools_light/make.macro

@@ -1,14 +0,0 @@
-# Makefile for CDFTOOLS
-# --------------------------------------------------------------
-
-NCDF_DIR=$(EBROOTNETCDF)
-NCDFF_DIR=$(EBROOTNETCDFMINFORTRAN)
-
-NCDF= -I$(NCDF_DIR)/include -I$(NCDFF_DIR)/include -L$(NCDF_DIR)/lib64 -lnetcdf -L$(NCDFF_DIR)/lib -lnetcdff
-
-# -lnetcdff
-
-F90=gfortran
-
-FFLAGS= -O2 -I./mod -J./mod $(NCDF)
-

+ 1 - 0
cdftools_light/make.macro

@@ -0,0 +1 @@
+macro/macro.easybuild

+ 1 - 1
configs/config_ORCA1_L75_NEMO4_lm3.sh

@@ -21,7 +21,7 @@ export NBL=75         ; # number of levels
 export HOST=lemaitre3.cism.ucl.ac.be ; # this has no importance at all, it will just become an "info" on the web-page!
 export MASTERMIND="UCL-ELIC / PY Barriat" ; # same here, who's the person who designed/ran this simulation?
 
-export EXTRA_CONF="NEMO 4.0.6";   #  // same here ...
+export EXTRA_CONF="NEMO 4.0.7";   #  // same here ...
 
 # Path / directory structure in which to find NEMO output file (you can use
 # <ORCA> and <EXP> as substitute to your ORCA grid and experiment (EXP) name):

+ 1 - 0
mesh_mask.nc

@@ -0,0 +1 @@
+data/mesh_mask_nemo.N3.6_ORCA1L75.nc

+ 7 - 7
rebuild_pbs.sh → post_rebuild.sh

@@ -20,17 +20,17 @@ echo "threads : $OMP_NUM_THREADS"
 
 set -ue
 
-exp="NE4_00"
+# Configure and load modules
+module purge
+module load netCDF-Fortran/4.5.3-gompi-2020b
+
+exp="NE4_SP"
 cores="24"
-path_out="/SCRATCH/acad/cclm/pbarriat/nemo/archive/${exp}"
-path_exe="/home/acad/ucl-elic/pbarriat/modeles/nemo/nemo_dev_4/tools/REBUILD_NEMO"
+path_out="/scratch/ucl/elic/pbarriat/nemo/archive/${exp}"
+path_exe="/home/ucl/elic/pbarriat/modeles/nemo/nemo_dev_4/tools/REBUILD_NEMO"
 
 ###
 
-# Configure and load modules
-module purge
-module load netCDF-Fortran/4.4.4-foss-2016c
-
 files=${path_out}/output/*
 dir=`echo $files | cut -d' ' -f1`
 cd ${dir}

+ 0 - 154
python/exec/build_q2_from_d2_slp.py

@@ -1,154 +0,0 @@
-#!/usr/bin/env python
-#
-# L. Brodeau, Feb.2001
-
-import sys
-import numpy as nmp
-from netCDF4 import Dataset
-import string
-
-from os.path import basename
-
-import barakuda_tool as bt
-import barakuda_thermo as bthermo
-
-cv_d2='D2M'
-cv_p0='MSL'
-cv_q2='Q2M' ; # OUTPUT !
-
-
-if len(sys.argv) != 2:
-    print 'Usage: '+sys.argv[0]+' <IN_FILE_D2.nc>'
-    sys.exit(0)
-
-cf_d2   = sys.argv[1]
-cf_p0 = string.replace(cf_d2, cv_d2, cv_p0)
-cf_q2 = basename(string.replace(cf_d2, cv_d2, cv_q2))
-
-
-
-# First need time length:
-
-bt.chck4f(cf_d2) ; f_d2_in = Dataset(cf_d2)
-vlon     = f_d2_in.variables['lon'][:]
-cunt_lon = f_d2_in.variables['lon'].units
-print 'LONGITUDE: ', cunt_lon
-# Extracting the longitude 1D array:
-vlat     = f_d2_in.variables['lat'][:]
-cunt_lat = f_d2_in.variables['lat'].units
-print 'LATITUDE: ', cunt_lat
-
-# Extracting time 1D array:
-vtime     = f_d2_in.variables['time'][:] ; cunt_time = f_d2_in.variables['time'].units
-print 'TIME: ', cunt_time, '\n'
-f_d2_in.close()
-
-
-
-
-
-Nt = len(vtime)
-
-
-print 'Nt = ', Nt
-
-for jt in range(Nt):
-
-    print ' *** jt = ', jt
-    
-        
-    # D2M
-    # ~~~
-    if jt == 0:
-        bt.chck4f(cf_d2)
-        f_d2_in = Dataset(cf_d2)
-        cunt_d2 = f_d2_in.variables[cv_d2].units
-    xd2     = f_d2_in.variables[cv_d2][jt,:,:]
-    if jt == Nt-1: f_d2_in.close()
-    
-    
-    # MSL
-    # ~~~
-    if jt == 0:
-        bt.chck4f(cf_p0)
-        f_p0_in = Dataset(cf_p0)
-        cunt_p0 = f_p0_in.variables[cv_p0].units
-    xp0     = f_p0_in.variables[cv_p0][jt,:,:]
-    if jt == Nt-1: f_p0_in.close()
-    
-    
-    
-    
-    
-    # Checking dimensions
-    # ~~~~~~~~~~~~~~~~~~~
-    if jt == 0:
-        dim_d2 = xd2.shape ; dim_p0 = xp0.shape
-        if dim_d2 != dim_p0:
-            print 'Shape problem!!!'; print dim_d2 , dim_p0
-        print '\n'
-        [ nj, ni ] = dim_d2
-        print 'ni, nj, nt = ', ni, nj, Nt
-        xq2 = nmp.zeros(nj*ni) ; xq2.shape = dim_d2
-    
-    
-    # Building q2
-    # ~~~~~~~~~~~
-    xq2 = bthermo.qa_e_p(bthermo.e_sat(xd2), xp0)
-    
-    
-    
-    
-    
-    # Creating output file
-    # ~~~~~~~~~~~~~~~~~~~~
-    if jt == 0:
-        f_out = Dataset(cf_q2, 'w', format='NETCDF3_CLASSIC')
-    
-        # Dimensions:
-        f_out.createDimension('lon', ni)
-        f_out.createDimension('lat', nj)
-        f_out.createDimension('time', None)
-    
-        # Variables
-        id_lon = f_out.createVariable('lon','f4',('lon',))
-        id_lat = f_out.createVariable('lat','f4',('lat',))
-        id_tim = f_out.createVariable('time','f4',('time',))
-        id_q2  = f_out.createVariable(cv_q2,'f4',('time','lat','lon',))
-    
-        # Attributes
-        id_tim.units = cunt_time
-    
-        #id_lat.long_name     = clnm_lat
-        id_lat.units         = cunt_lat
-        #id_lat.standard_name = csnm_lat
-    
-        #id_lon.long_name     = clnm_lon
-        id_lon.units         = cunt_lon
-        #id_lon.standard_name = csnm_lon
-    
-        id_tim.units         = cunt_time
-    
-        id_q2.long_name = 'Surface specific humidity at 2m, built from D2M and MSL'
-        id_q2.units = 'kg/kg'
-        id_q2.code  = '133'
-        id_q2.table = '128'
-    
-        f_out.About = 'Created by L. Brodeau using MSL and D2M corresponding fields'
-    
-        # Filling variables:
-        id_lat[:] = vlat[:]
-        id_lon[:] = vlon[:]
-        
-    id_tim[jt]     = vtime[jt]
-    id_q2[jt,:,:]  = xq2[:,:] 
-    
-    if jt == Nt-1: f_out.close()
-    
-    
-    
-    
-    
-    
-        
-print 'Bye!'

+ 0 - 367
python/exec/movie_nemo_zoom_box.py

@@ -1,367 +0,0 @@
-#!/usr/bin/env python
-
-#       B a r a K u d a
-#
-#  Prepare 2D maps (monthly) that will later become a GIF animation!
-#  NEMO output and observations needed
-#
-#    L. Brodeau, May 2018
-
-import sys
-import os
-from string import replace
-import numpy as nmp
-
-from netCDF4 import Dataset
-
-import matplotlib as mpl
-mpl.use('Agg')
-import matplotlib.pyplot as plt
-import matplotlib.colors as colors
-
-import warnings
-warnings.filterwarnings("ignore")
-
-import datetime
-
-import barakuda_colmap as bcm
-
-import barakuda_tool as bt
-
-
-vmn = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ]
-
-CNEMO = 'eNATL60'
-#CNEMO = 'NATL60'
-#CNEMO = 'NANUK025'
-
-color_top = 'white'
-#color_top = 'k'
-
-
-
-
-
-#jt0 = 248
-jt0 = 0
-
-
-i2=0
-j2=0
-l_show_lsm = True
-l_do_ice  = True
-l_show_cb = True
-l_show_dt = True
-l_log_field = False
-l_pow_field = False
-l_annotate_name = False
-
-l_apply_lap = False
-
-
-if CNEMO == 'eNATL60':
-    Ni0 = 8354-1
-    Nj0 = 4729-1
-    l_do_ice  = False
-    l_show_cb = False
-    l_show_dt = False
-    #cdt = '1h'; cbox = 'zoom1' ; i1=Ni0-2560 ; j1=Nj0/2-1440 ; i2=Ni0 ; j2=Nj0/2 ; rfact_zoom = 1. ; vcb = [0.5, 0.875, 0.485, 0.02] ; font_rat = 0.5*rfact_zoom
-    cdt = '1h'; cbox = 'ALL' ; i1=0 ; j1=0 ; i2=Ni0 ; j2=Nj0 ; rfact_zoom = 0.3047 ; vcb = [0.5, 0.875, 0.485, 0.02] ; font_rat = 0.5*rfact_zoom
-    x_date = 350 ; y_date = 7 ; # where to put the date
-
-if CNEMO == 'NATL60':
-    #l_pow_field = True ; pow_field = 1.5
-    l_do_ice  = False
-    l_show_cb = False
-    l_show_dt = False
-    #cdt = '1h'; cbox = 'zoom1' ; i1 = 1800 ; j1 = 950 ; i2 = i1+1920 ; j2 = j1+1080 ; rfact_zoom = 1. ; vcb = [0.5, 0.875, 0.485, 0.02] ; font_rat = 0.5*rfact_zoom ; l_show_lsm = False
-    cdt = '1h'; cbox = 'zoom1' ; i1 = 1800 ; j1 = 950 ; i2 = i1+2560 ; j2 = j1+1440 ; rfact_zoom = 1. ; vcb = [0.5, 0.875, 0.485, 0.02] ; font_rat = 0.5*rfact_zoom
-    x_date = 350 ; y_date = 7 ; # where to put the date
-
-
-if CNEMO == 'NANUK025':
-    l_do_ice = True
-    cdt = '3h'; cbox = 'ALL' ; i1 = 0 ; j1 = 0 ; i2 = 492 ; j2 = 614 ; rfact_zoom = 2. ; vcb = [0.5, 0.875, 0.485, 0.02] ; font_rat = 0.5*rfact_zoom
-    x_date = 350 ; y_date = 7 ; # where to put the date
-
-
-
-nx_res = i2-i1
-ny_res = j2-j1
-
-
-
-
-print ' i1,i2,j1,j2 =>', i1,i2,j1,j2
-
-yx_ratio = float(ny_res)/float(nx_res)
-
-nxr = int(rfact_zoom*nx_res) ; # widt image (in pixels)
-nyr = int(rfact_zoom*ny_res) ; # height image (in pixels)
-
-
-
-
-dpi = 110
-
-rh = round(float(nxr)/float(dpi),3) ; # width of figure as for figure...
-
-fig_type='png'
-
-narg = len(sys.argv)
-if narg < 5: print 'Usage: '+sys.argv[0]+' <file> <variable> <LSM_file> <YYYYMMDD (start)>'; sys.exit(0)
-cf_in = sys.argv[1] ; cv_in=sys.argv[2] ; cf_lsm=sys.argv[3] ; cf_date0=sys.argv[4]
-
-
-cyr0=cf_date0[0:4]
-cmn0=cf_date0[4:6]
-cdd0=cf_date0[6:8]
-
-
-
-# Ice:
-if l_do_ice:
-    cv_ice  = 'siconc'
-    cf_ice = replace(cf_in, 'grid_T', 'icemod')
-    rmin_ice = 0.5
-    cpal_ice = 'ncview_bw'
-    vcont_ice = nmp.arange(rmin_ice, 1.05, 0.05)
-
-if cv_in in ['sosstsst','tos']:
-    cfield = 'SST'
-    #tmin=0. ;  tmax=25.   ;  df = 1. ; cpal_fld = 'ncview_nrl'
-    tmin=4. ;  tmax=20.   ;  df = 1. ; cpal_fld = 'PuBu'
-    cunit = r'SST ($^{\circ}$C)'
-    cb_jump = 2
-
-if cv_in == 'sossheig':
-    cfield = 'SSH'
-    #tmin=-0.5 ;  tmax=0.5   ;  df = 0.05
-    tmin=-1.2 ;  tmax=2.3   ;  df = 0.05 ; l_apply_lap = True
-    #cpal_fld = 'ncview_jaisnc'
-    #cpal_fld = 'PuBu'
-    #cpal_fld = 'RdBu'
-    #cpal_fld = 'BrBG'
-    #
-    #cpal_fld = 'on3' ; tmin=-1.2 ;  tmax=2.3   ;  df = 0.05 ; l_apply_lap = True
-    cpal_fld = 'on2' ; tmin=-1.2 ;  tmax=1.2   ;  df = 0.05 ; l_apply_lap = True
-    cunit = r'SSH (m)'
-    cb_jump = 1
-
-elif cv_in == 'somxl010':
-    cfield == 'MLD'
-    tmin=50. ;  tmax=1500. ;  df = 50.
-    cpal_fld = 'viridis_r'
-
-
-if l_do_ice: bt.chck4f(cf_ice)
-
-bt.chck4f(cf_in)
-id_fld = Dataset(cf_in)
-vtime = id_fld.variables['time_counter'][:]
-id_fld.close()
-Nt = len(vtime)
-
-if l_show_lsm or l_apply_lap:
-    bt.chck4f(cf_lsm)
-    id_lsm = Dataset(cf_lsm)
-    nb_dim = len(id_lsm.variables['tmask'].dimensions)
-    if l_show_lsm:
-        if nb_dim==4: XMSK  = id_lsm.variables['tmask'][0,0,j1:j2,i1:i2]
-        if nb_dim==3: XMSK  = id_lsm.variables['tmask'][0,j1:j2,i1:i2]
-        if nb_dim==2: XMSK  = id_lsm.variables['tmask'][j1:j2,i1:i2]
-        (nj,ni) = nmp.shape(XMSK)
-    if l_apply_lap:
-        XE1T2 = id_lsm.variables['e1t'][0,j1:j2,i1:i2]
-        XE2T2 = id_lsm.variables['e2t'][0,j1:j2,i1:i2]
-        (nj,ni) = nmp.shape(XE1T2)
-        XE1T2 = XE1T2*XE1T2
-        XE2T2 = XE2T2*XE2T2
-        id_lsm.close()
-
-if l_show_lsm: pmsk = nmp.ma.masked_where(XMSK[:,:] > 0.2, XMSK[:,:]*0.+40.)
-
-
-
-#font_rat
-#params = { 'font.family':'Ubuntu',
-params = { 'font.family':'Helvetica Neue',
-           'font.weight':    'normal',
-           'font.size':       int(12.*font_rat),
-           'legend.fontsize': int(12.*font_rat),
-           'xtick.labelsize': int(12.*font_rat),
-           'ytick.labelsize': int(12.*font_rat),
-           'axes.labelsize':  int(12.*font_rat) }
-mpl.rcParams.update(params)
-cfont_clb  = { 'fontname':'Helvetica Neue', 'fontweight':'medium', 'fontsize':int(12.*font_rat), 'color':color_top }
-cfont_date = { 'fontname':'Ubuntu Mono', 'fontweight':'normal', 'fontsize':int(14.*font_rat), 'color':'w' }
-cfont_mail = { 'fontname':'Times New Roman', 'fontweight':'normal', 'fontstyle':'italic', 'fontsize':int(14.*font_rat), 'color':'0.8'}
-cfont_titl = { 'fontname':'Helvetica Neue', 'fontweight':'light', 'fontsize':int(30.*font_rat), 'color':'w' }
-
-
-# Colormaps for fields:
-pal_fld = bcm.chose_colmap(cpal_fld)
-if l_log_field:
-    norm_fld = colors.LogNorm(  vmin = tmin, vmax = tmax, clip = False)
-if l_pow_field:
-    norm_fld = colors.PowerNorm(gamma=pow_field, vmin = tmin, vmax = tmax, clip = False)
-else:
-    norm_fld = colors.Normalize(vmin = tmin, vmax = tmax, clip = False)
-
-
-if l_show_lsm:
-    pal_lsm = bcm.chose_colmap('land_dark')
-    norm_lsm = colors.Normalize(vmin = 0., vmax = 1., clip = False)
-
-if l_do_ice:
-    pal_ice = bcm.chose_colmap(cpal_ice)
-    norm_ice = colors.Normalize(vmin = rmin_ice, vmax = 1, clip = False)
-
-
-
-if cdt == '3h':
-    dt = 3
-elif cdt == '1h':
-    dt = 1
-else:
-    print 'ERROR: unknown dt!'
-
-
-
-
-print ' *** Dimension image:', rh*float(dpi), rh*yx_ratio*float(dpi),'\n'
-
-
-ntpd = 24/dt
-
-jd = int(cdd0) - 1
-jm = int(cmn0)
-
-for jt in range(jt0,Nt):
-
-    jh = (jt*dt)%24
-    jdc = (jt*dt)/24 + 1
-
-    if jt%ntpd == 0: jd = jd + 1
-
-    if jd == vmn[jm-1]+1 and (jt)%ntpd == 0 :
-        jd = 1
-        jm = jm + 1
-
-    ch = '%2.2i'%(jh)
-    #cdc= '%3.3i'%(jdc)
-    cd = '%3.3i'%(jd)
-    cm = '%2.2i'%(jm)
-
-    #print '\n\n *** jt, ch, cd, cm =>', jt, ch, cd, cm
-
-
-    ct = str(datetime.datetime.strptime(cyr0+'-'+cm+'-'+cd+' '+ch, '%Y-%m-%j %H'))
-    ct=ct[:5]+cm+ct[7:] #lolo bug !!! need to do that to get the month and not "01"
-    print ' ct = ', ct
-    cday  = ct[:10]   ; print ' *** cday  :', cday
-    chour = ct[11:13] ; print ' *** chour :', chour
-
-
-
-    cfig = 'figs/zoom_'+cv_in+'_NEMO'+'_'+cday+'_'+chour+'_'+cpal_fld+'.'+fig_type
-
-    fig = plt.figure(num = 1, figsize=(rh,rh*yx_ratio), dpi=None, facecolor='w', edgecolor='0.5')
-
-    #ax  = plt.axes([0.065, 0.05, 0.9, 1.], axisbg = '0.5')
-    ax  = plt.axes([0., 0., 1., 1.], axisbg = '0.5')
-
-    vc_fld = nmp.arange(tmin, tmax + df, df)
-
-
-    print "Reading record #"+str(jt)+" of "+cv_in+" in "+cf_in
-    id_fld = Dataset(cf_in)
-    XFLD  = id_fld.variables[cv_in][jt,j1:j2,i1:i2] ; # t, y, x
-    id_fld.close()
-    print "Done!"
-
-    if l_apply_lap:
-        lx = nmp.zeros((nj,ni))
-        ly = nmp.zeros((nj,ni))
-        lx[:,1:ni-1] = 1.E9*(XFLD[:,2:ni] -2.*XFLD[:,1:ni-1] + XFLD[:,0:ni-2])/XE1T2[:,1:ni-1]
-        ly[1:nj-1,:] = 1.E9*(XFLD[2:nj,:] -2.*XFLD[1:nj-1,:] + XFLD[0:nj-2,:])/XE2T2[1:nj-1,:]
-        XFLD[:,:] = lx[:,:] + ly[:,:]
-        del lx, ly
-
-    if not l_show_lsm and jt == jt0: ( nj , ni ) = nmp.shape(XFLD)
-    print '  *** dimension of array => ', ni, nj
-
-    print "Ploting"
-    cf = plt.imshow(XFLD[:,:], cmap = pal_fld, norm = norm_fld, interpolation='none')
-    del XFLD
-    print "Done!"
-
-    # Ice
-    if not cfield == 'MLD' and l_do_ice:
-        print "Reading record #"+str(jt)+" of "+cv_ice+" in "+cf_ice
-        id_ice = Dataset(cf_ice)
-        XICE  = id_ice.variables[cv_ice][jt,:,:] ; # t, y, x
-        id_ice.close()
-        print "Done!"
-
-        #XM[:,:] = XMSK[:,:]
-        #bt.drown(XICE, XM, k_ew=2, nb_max_inc=10, nb_smooth=10)
-        #ci = plt.contourf(XICE[:,:], vcont_ice, cmap = pal_ice, norm = norm_ice) #
-
-        pice = nmp.ma.masked_where(XICE < rmin_ice, XICE)
-        ci = plt.imshow(pice, cmap = pal_ice, norm = norm_ice, interpolation='none') ; del pice, ci
-        del XICE
-
-
-    if l_show_lsm: cm = plt.imshow(pmsk, cmap = pal_lsm, norm = norm_lsm, interpolation='none')
-
-    plt.axis([ 0, ni, 0, nj])
-
-    #plt.title('NEMO: '+cfield+', coupled '+CNEMO+', '+cday+' '+chour+':00', **cfont_title)
-
-
-
-    if l_show_cb:
-        ax2 = plt.axes(vcb)
-        clb = mpl.colorbar.ColorbarBase(ax2, ticks=vc_fld, cmap=pal_fld, norm=norm_fld, orientation='horizontal', extend='both')
-        if cb_jump > 1:
-            cb_labs = [] ; cpt = 0
-            for rr in vc_fld:
-                if cpt % cb_jump == 0:
-                    if df >= 1.: cb_labs.append(str(int(rr)))
-                    if df <  1.: cb_labs.append(str(rr))
-                else:
-                    cb_labs.append(' ')
-                    cpt = cpt + 1
-                    clb.ax.set_xticklabels(cb_labs)
-                    clb.set_label(cunit, **cfont_clb)
-                    clb.ax.yaxis.set_tick_params(color=color_top) ; # set colorbar tick color
-                    clb.outline.set_edgecolor(color_top) ; # set colorbar edgecolor
-                    plt.setp(plt.getp(clb.ax.axes, 'xticklabels'), color=color_top) ; # set colorbar ticklabels
-
-    del cf
-
-
-
-
-
-    if l_show_dt: ax.annotate('Date: '+cday+' '+chour+':00',   xy=(1, 4), xytext=(x_date,    y_date), **cfont_date)
-
-    #ax.annotate('laurent.brodeau@ocean-next.fr', xy=(1, 4), xytext=(x_date+150, 20), **cfont_mail)
-
-
-    xl = float(nxr)/20./rfact_zoom
-    yl = float(nyr)/1.2/rfact_zoom
-
-    if l_annotate_name:
-        ax.annotate(CNEMO, xy=(1, 4), xytext=(xl, yl), **cfont_titl)
-
-
-
-    plt.savefig(cfig, dpi=dpi, orientation='portrait', facecolor='k')
-    print cfig+' created!\n'
-    plt.close(1)
-
-
-    del cm, fig, ax
-    if l_show_cb: del clb

+ 0 - 337
python/exec/nemo_imshow_2d_field.py

@@ -1,337 +0,0 @@
-#!/usr/bin/env python
-
-#       B a r a K u d a
-#
-#  Prepare 2D maps (monthly) that will later become a GIF animation!
-#  NEMO output and observations needed
-#
-#    L. Brodeau, May 2018
-
-import sys
-import os
-from string import replace
-import numpy as nmp
-
-from netCDF4 import Dataset
-
-import matplotlib as mpl
-mpl.use('Agg')
-import matplotlib.pyplot as plt
-import matplotlib.colors as colors
-
-import warnings
-warnings.filterwarnings("ignore")
-
-import barakuda_colmap as bcm
-
-import barakuda_tool as bt
-
-
-#CNEMO = 'NATL60'
-#CNEMO = 'NANUK025'
-
-color_top = 'white'
-#color_top = 'k'
-
-
-
-
-
-
-    
-
-
-
-
-
-
-
-
-
-
-fig_type='png'
-
-narg = len(sys.argv)
-if narg < 6: print 'Usage: '+sys.argv[0]+' <CONF> <file> <variable> <snapshot> <LSM_file>'; sys.exit(0)
-CNEMO = sys.argv[1] ; cf_fld = sys.argv[2] ; cv_in=sys.argv[3] ; jt=int(sys.argv[4]) ; cf_lsm=sys.argv[5]
-
-
-i2=0
-j2=0
-
-if CNEMO == 'NATL60':
-    i1 = 0 ; j1 = 0 ; i2 = 0 ; j2 = 0 ; rfact_zoom = 1. ; vcb = [0.6, 0.1, 0.39, 0.025] ; font_rat = 7.
-    x_cnf = 160. ; y_cnf = 2300. ; # where to put label of conf on Figure...
-    
-elif CNEMO == 'NANUK1':
-    i1 = 0 ; j1 = 0 ; i2 = 0 ; j2 = 0 ; rfact_zoom = 4. ; vcb = [0.5, 0.875, 0.49, 0.02] ; font_rat = 0.16*rfact_zoom
-
-elif CNEMO == 'NANUK025':
-    i1 = 0 ; j1 = 0 ; i2 = 0 ; j2 = 0 ; rfact_zoom = 2. ; vcb = [0.5, 0.875, 0.49, 0.02] ; font_rat = 0.5*rfact_zoom
-    x_cnf = 30. ; y_cnf = 540. ; # where to put label of conf on Figure...
-
-elif CNEMO == 'CREG025':
-    i1 = 0 ; j1 = 0 ; i2 = 0 ; j2 = 0 ; rfact_zoom = 2.
-    vcb = [0.6, 0.975, 0.38, 0.02] ; font_rat = 0.5*rfact_zoom
-    x_cnf = 20. ; y_cnf = 560. ; # where to put label of conf on Figure...
-
-elif CNEMO == 'eNATL4':
-    i1 = 0 ; j1 = 0 ; i2 = 0 ; j2 = 0 ; rfact_zoom = 2. ; vcb = [0.6, 0.11, 0.39, 0.025] ; font_rat = 0.5*rfact_zoom
-
-elif CNEMO == 'eNATL60':
-    i1 = 0 ; j1 = 0 ; i2 = 0 ; j2 = 0 ; rfact_zoom = 1. ; vcb = [0.6, 0.1, 0.39, 0.025] ; font_rat = 5.
-    x_cnf = 160. ; y_cnf = 4000. ; # where to put label of conf on Figure...
-
-elif CNEMO == 'eNATL1':
-    i1 = 0 ; j1 = 0 ; i2 = 0 ; j2 = 0 ; rfact_zoom = 6.
-    vcb = [0.62, 0.11, 0.35, 0.025] ; font_rat = 0.12*rfact_zoom
-    x_cnf = 4. ; y_cnf = 120. ; # where to put label of conf on Figure...
-
-    
-else:
-    print '\n PROBLEM: "'+CNEMO+'" is an unknown config!!!'
-    sys.exit(0)
-
-
-
-
-
-
-
-
-laplacian = False
-l_log_field = False
-l_pow_field = False
-cextend='both'
-l_hide_cb_ticks = False
-
-if cv_in in ['sosstsst','tos']:
-    cfield = 'SST'
-    tmin=0. ;  tmax=28.   ;  df = 1.
-    cpal_fld = 'ncview_nrl'    
-    cunit = r'SST ($^{\circ}$C)'
-    cb_jump = 1
-
-
-if cv_in in ['Bathymetry']:
-    cfield = 'Bathymetry'
-    #tmin=100. ;  tmax=4500.   ;  df = 100.
-    tmin=0. ;  tmax=5000.   ;  df = 100.
-    #cpal_fld = 'ocean'
-    #cpal_fld = 'Blues'
-    cpal_fld = 'PuBu'
-    #cpal_fld = 'ncview_ssec'
-    #cpal_fld = 'ncview_hotres'
-    #cpal_fld = 'ncview_helix'
-    cunit = r'Bathymetry (m)'
-    cb_jump = 10
-    l_pow_field = True
-    pow_field = 1.5
-    #l_log_field = False
-    cextend='max'
-    l_hide_cb_ticks=True
-
-    
-if cv_in == 'sossheig':
-    cfield = 'SSH'
-    tmin=-0.3 ;  tmax=0.3   ;  df = 0.1
-    cpal_fld = 'ncview_jaisnc'    
-    cunit = r'SSH (m)'
-    cb_jump = 1
-
-elif cv_in == 'somxl010':
-    cfield == 'MLD'
-    tmin=50. ;  tmax=1500. ;  df = 50.
-    cpal_fld = 'viridis_r'
-    
-
-# Time record stuff...
-bt.chck4f(cf_fld)
-id_fld = Dataset(cf_fld)
-list_var = id_fld.variables.keys()
-if 'time_counter' in list_var:    
-    vtime = id_fld.variables['time_counter'][:]
-    Nt = len(vtime)
-    print '\n There is a "time_counter" in file '+cf_fld+' !'
-    print '   => '+str(Nt)+' snapshots!'
-    if jt <= 0 or jt > Nt: print ' PROBLEM: your time record does not exist!', jt ; sys.exit(0)
-else:
-    print '\n There is NO "time_counter" in file '+cf_fld+' !'
-    Nt = 0    
-id_fld.close()
-
-
-
-
-
-
-bt.chck4f(cf_lsm)
-print '\n *** Reading "tmask" in meshmask file...'
-id_lsm = Dataset(cf_lsm)
-nb_dim = len(id_lsm.variables['tmask'].dimensions)
-Ni = id_lsm.dimensions['x'].size
-Nj = id_lsm.dimensions['y'].size
-if i2 == 0: i2 = Ni
-if j2 == 0: j2 = Nj
-if nb_dim == 4: XMSK  = id_lsm.variables['tmask'][0,0,j1:j2,i1:i2] ; # t, y, x
-if nb_dim == 3: XMSK  = id_lsm.variables['tmask'][0,  j1:j2,i1:i2] ; # t, y, x
-id_lsm.close()
-print '      done.'
-
-
-print '\n According to "tmask" the shape of the domain is Ni, Nj =', Ni, Nj
-
-
-# Stuff for size of figure respecting pixels...
-print '  *** we are going to show: i1,i2,j1,j2 =>', i1,i2,j1,j2, '\n'
-nx_res = i2-i1
-ny_res = j2-j1
-yx_ratio = float(ny_res)/float(nx_res)
-nxr = int(rfact_zoom*nx_res) ; # widt image (in pixels)
-nyr = int(rfact_zoom*ny_res) ; # height image (in pixels)
-dpi = 110
-rh  = float(nxr)/float(dpi) ; # width of figure as for figure...
-###font_rat = nxr/1080.
-
-
-
-
-
-pmsk = nmp.ma.masked_where(XMSK[:,:] > 0.2, XMSK[:,:]*0.+40.)
-
-
-
-
-
-idx_oce = nmp.where(XMSK[:,:] > 0.5)
-
-#font_rat
-#params = { 'font.family':'Ubuntu',
-params = { 'font.family':'Helvetica Neue',
-           'font.weight':    'normal',
-           'font.size':       int(12.*font_rat),
-           'legend.fontsize': int(12.*font_rat),
-           'xtick.labelsize': int(12.*font_rat),
-           'ytick.labelsize': int(12.*font_rat),
-           'axes.labelsize':  int(12.*font_rat) }
-mpl.rcParams.update(params)
-cfont_clb  = { 'fontname':'Helvetica Neue', 'fontweight':'medium', 'fontsize':int(12.*font_rat), 'color':color_top }
-cfont_date = { 'fontname':'Ubuntu Mono', 'fontweight':'normal', 'fontsize':int(12.*font_rat), 'color':'w' }
-cfont_mail = { 'fontname':'Times New Roman', 'fontweight':'normal', 'fontstyle':'italic', 'fontsize':int(14.*font_rat), 'color':'0.8'}
-cfont_titl = { 'fontname':'Helvetica Neue', 'fontweight':'light', 'fontsize':int(30.*font_rat), 'color':'w' }
-
-
-# Colormaps for fields:
-pal_fld = bcm.chose_colmap(cpal_fld)
-if l_log_field:
-    norm_fld = colors.LogNorm(  vmin = tmin, vmax = tmax, clip = False)
-if l_pow_field:
-    norm_fld = colors.PowerNorm(gamma=pow_field, vmin = tmin, vmax = tmax, clip = False)
-else:
-    norm_fld = colors.Normalize(vmin = tmin, vmax = tmax, clip = False)
-
-pal_lsm = bcm.chose_colmap('land_dark')
-norm_lsm = colors.Normalize(vmin = 0., vmax = 1., clip = False)
-
-
-if Nt == 0:
-    cfig = cv_in+'_'+CNEMO+'_'+cpal_fld+'.'+fig_type    
-else:
-    cfig = 'snapshot_'+str(jt)+'_'+cv_in+'_'+CNEMO+'_'+cpal_fld+'.'+fig_type    
-
-fig = plt.figure(num = 1, figsize=(rh,rh*yx_ratio), dpi=None, facecolor='w', edgecolor='0.5')
-
-#ax  = plt.axes([0.065, 0.05, 0.9, 1.], axisbg = '0.5')
-ax  = plt.axes([0., 0., 1., 1.], axisbg = '0.5')
-
-vc_fld = nmp.arange(tmin, tmax + df, df)
-
-
-print '\n *** Opening file '+cf_fld
-id_fld = Dataset(cf_fld)
-if Nt > 0:
-    print '    => Reading record #'+str(jt)+' of '+cv_in+' in '+cf_fld
-    XFLD  = id_fld.variables[cv_in][jt-1,j1:j2,i1:i2] ; # t, y, x
-else:
-    print '    => Reading 2D field '+cv_in+' in '+cf_fld+' (no time records...)'
-    XFLD  = id_fld.variables[cv_in][j1:j2,i1:i2] ; # t, y, x
-
-id_fld.close()
-print '          Done!\n'
-
-
-if XMSK.shape != XFLD.shape:
-    print '\n PROBLEM: field and mask do not agree in shape!'
-    print XMSK.shape , XFLD.shape
-    sys.exit(0)
-
-print '  *** Shape of field and mask => ', nmp.shape(XFLD)
-
-
-del XMSK
-
-
-print 'Ploting'
-cf = plt.imshow(XFLD[:,:], cmap = pal_fld, norm = norm_fld, interpolation='none')
-print 'LOLO: XFLD[4,4] = ', XFLD[4,4], nmp.isnan(XFLD[4,4])
-del XFLD
-print 'Done!'
-
-
-
-
-cm = plt.imshow(pmsk, cmap = pal_lsm, norm = norm_lsm, interpolation='none')
-
-del pmsk
-
-
-plt.axis([ 0, Ni, 0, Nj])
-
-#plt.title('NEMO: '+cfield+', coupled '+CNEMO+', '+cday+' '+chour+':00', **cfont_title)
-
-
-#ax2 = plt.axes([0.3, 0.08, 0.4, 0.025])
-
-ax2 = plt.axes(vcb)
-    
-clb = mpl.colorbar.ColorbarBase(ax2, ticks=vc_fld, cmap=pal_fld, norm=norm_fld, orientation='horizontal', extend=cextend)
-if cb_jump > 1:
-    cb_labs = [] ; cpt = 0
-    for rr in vc_fld:
-        if cpt % cb_jump == 0:
-            if df >= 1.: cb_labs.append(str(int(rr)))
-            if df <  1.: cb_labs.append(str(rr))
-        else:
-            cb_labs.append(' ')
-        cpt = cpt + 1
-    clb.ax.set_xticklabels(cb_labs)    
-clb.set_label(cunit, **cfont_clb)
-clb.ax.yaxis.set_tick_params(color=color_top) ; # set colorbar tick color    
-#clb.outline.set_edgecolor(color_top) ; # set colorbar edgecolor
-if l_hide_cb_ticks: clb.ax.tick_params(axis=u'both', which=u'both',length=0) ; # remove ticks!
-plt.setp(plt.getp(clb.ax.axes, 'xticklabels'), color=color_top) ; # set colorbar ticklabels
-    
-del cf
-
-
-#x_annot = nxr-nxr*0.22.*font_rat ; y_annot = 150
-x_annot = 650 ; y_annot = 1035
-
-#ax.annotate('Date: '+cday+' '+chour+':00',   xy=(1, 4), xytext=(x_annot,    y_annot), **cfont_date)
-
-#ax.annotate('laurent.brodeau@ocean-next.fr', xy=(1, 4), xytext=(x_annot+150, 20), **cfont_mail)
-
-
-
-ax.annotate(CNEMO, xy=(1, 4), xytext=(x_cnf, y_cnf), **cfont_titl)
-
-
-
-plt.savefig(cfig, dpi=dpi, orientation='portrait', facecolor='k')
-print cfig+' created!\n'
-plt.close(1)
-
-
-del cm, fig, ax, clb
-
-

+ 0 - 108
rebuild.sh

@@ -1,108 +0,0 @@
-#!/usr/bin/env bash
-
-#SBATCH --job-name=nemreb
-#SBATCH --time=47:55:00
-#SBATCH --ntasks=24
-#SBATCH --mem-per-cpu=2048
-##SBATCH --partition=debug
-#
-##SBATCH --mail-user=noname@uclouvain.be
-##SBATCH --mail-type=ALL
-##SBATCH --open-mode=append
-set -ueo pipefail
-
-stdout_file=${SLURM_SUBMIT_DIR-$PWD}/${SLURM_JOB_NAME-"local"}_${SLURM_JOB_ID-"id"}.log
-exec > ${stdout_file}
-echo "------------------ Job Info --------------------"
-echo "jobid : ${SLURM_JOB_ID-"id"}"
-echo "jobname : ${SLURM_JOB_NAME-"local"}"
-echo "submit dir : ${SLURM_SUBMIT_DIR-$PWD}"
-
-set -ue 
-
-exp="NE4_SP"
-cores="24"
-path_out="/scratch/ucl/elic/pbarriat/nemo/archive/${exp}"
-path_exe="/home/ucl/elic/pbarriat/modeles/nemo/nemo_dev_4/tools/REBUILD_NEMO"
-
-###
-
-# Configure and load modules
-module purge
-module load netCDF-Fortran/4.5.3-gompi-2020b
-
-files=${path_out}/output/*
-dir=`echo $files | cut -d' ' -f1`
-cd ${dir}
-#
-file=`ls ${exp}_1m_*_grid_T_*.nc | tail -n 1`
-xios_split=`echo ${file%.nc} | rev | cut -d'_' -f1 | rev`
-xios_split=`expr $xios_split + 1`
-#
-for dir in ${files}
-do
-  cd ${dir}
-  #
-  file=`ls ${exp}_1m_*_grid_T_0000.nc`
-  to_year=`echo ${file%_grid_T_0000.nc} | rev | cut -d'_' -f1 | rev`
-  from_year=`echo ${file%_grid_T_0000.nc} | rev | cut -d'_' -f2 | rev`
-  #
-  echo "In ${dir} :"
-  echo "Processing ${exp}_1m_${from_year}_${to_year} ..."
-
-  rm -f nam_rebuild_*
-  rm -f ${exp}_1m_${from_year}_${to_year}_grid_T.nc 
-  rm -f ${exp}_1m_${from_year}_${to_year}_grid_U.nc 
-  rm -f ${exp}_1m_${from_year}_${to_year}_grid_V.nc 
-  rm -f ${exp}_1m_${from_year}_${to_year}_SBC.nc 
-  rm -f ${exp}_1m_${from_year}_${to_year}_icemod.nc  
-
-  if [ -s ${exp}_1m_${from_year}_${to_year}_grid_T_0000.nc ]
-  then
-    [[ ! -s ${exp}_1m_${from_year}_${to_year}_grid_T.nc ]] && ${path_exe}/rebuild_nemo -t ${cores} ${exp}_1m_${from_year}_${to_year}_grid_T ${xios_split}
-  fi
-  if [ -s ${exp}_1m_${from_year}_${to_year}_grid_U_0000.nc ]
-  then
-    [[ ! -s ${exp}_1m_${from_year}_${to_year}_grid_U.nc ]] && ${path_exe}/rebuild_nemo -t ${cores} ${exp}_1m_${from_year}_${to_year}_grid_U ${xios_split}
-  fi  
-  if [ -s ${exp}_1m_${from_year}_${to_year}_grid_V_0000.nc ]
-  then
-    [[ ! -s ${exp}_1m_${from_year}_${to_year}_grid_V.nc ]] && ${path_exe}/rebuild_nemo -t ${cores} ${exp}_1m_${from_year}_${to_year}_grid_V ${xios_split}
-  fi  
-  if [ -s ${exp}_1m_${from_year}_${to_year}_SBC_0000.nc ]
-  then
-    [[ ! -s ${exp}_1m_${from_year}_${to_year}_SBC.nc ]] && ${path_exe}/rebuild_nemo -t ${cores} ${exp}_1m_${from_year}_${to_year}_SBC ${xios_split}
-  fi  
-  if [ -s ${exp}_1m_${from_year}_${to_year}_icemod_0000.nc ]
-  then
-    [[ ! -s ${exp}_1m_${from_year}_${to_year}_icemod.nc ]] && ${path_exe}/rebuild_nemo -t ${cores} ${exp}_1m_${from_year}_${to_year}_icemod ${xios_split}
-  fi 
-
-done
-
-###
-
-files=`ls ${path_out}/restart/ | tail -n 1`
-dir=${path_out}/restart/${files}
-cd ${dir}
-
-file=`ls ${exp}_*_restart_ice* | tail -n 1`
-nemo_split=`echo ${file%.nc} | rev | cut -d'_' -f1 | rev`
-nemo_split=`expr $nemo_split + 1`
-restart_step=`echo ${file%.nc} | rev | cut -d'_' -f4 | rev`
-
-echo "In ${dir} processing ${exp}_${restart_step}_restart_ice ..."
-
-rm -f ${exp}_${restart_step}_restart_ice.nc
-rm -f ${exp}_${restart_step}_restart_oce.nc
-
-if [ -s ${exp}_${restart_step}_restart_ice_0000.nc ]
-then
-  [[ ! -s ${exp}_${restart_step}_restart_ice.nc ]] && ${path_exe}/rebuild_nemo -t ${cores} ${exp}_${restart_step}_restart_ice ${nemo_split}
-fi
-if [ -s ${exp}_${restart_step}_restart_oce_0000.nc ]
-then
-  [[ ! -s ${exp}_${restart_step}_restart_oce.nc ]] && ${path_exe}/rebuild_nemo -t ${cores} ${exp}_${restart_step}_restart_oce ${nemo_split}
-fi
-
-echo ----- REBUILD post finished

+ 9 - 8
src/bash/bash_functions.bash

@@ -270,15 +270,16 @@ function barakuda_first_last_years()
     #if [ ${ece_exp} -gt 0 ]; then
         dir_end=`printf "%03d" ${nby_ece}`
         if [ ! -d ${dir_end} ]; then echo "ERROR: since ece_exp=${ece_exp}, there should be a directory ${dir_end} in:"; echo " ${NEMO_OUT_D}"; exit ; fi
-        export YEAR_END=$((${YEAR_INI}+${nby_ece}))
+        #export YEAR_END=$((${YEAR_INI}+${nby_ece}))
     #else
-    #    export YEAR_END=`\ls ${CPREF}*${ctest}* | sed -e s/"${CPREF}"/''/g | tail -1 | cut -c1-4`
-    #    echo ${YEAR_END} |  grep "[^0-9]" >/dev/null; # Checking if it's an integer
-    #    if [ ! "$?" -eq 1 ]; then
-    #        echo "ERROR: it was imposible to guess the year coresponding to the last saved year!"
-    #        echo "       => check your NEMO output directory and file naming..."; exit
-    #    fi
-    #    export YEAR_END=$((${YEAR_END}+${IFREQ_SAV_YEARS}-1))
+        #export YEAR_END=`\ls ${CPREF}*${ctest}* | sed -e s/"${CPREF}"/''/g | tail -1 | cut -c1-4`
+        #echo ${YEAR_END} |  grep "[^0-9]" >/dev/null; # Checking if it's an integer
+        #if [ ! "$?" -eq 1 ]; then
+        #    echo "ERROR: it was imposible to guess the year coresponding to the last saved year!"
+        #    echo "       => check your NEMO output directory and file naming..."; exit
+        #fi
+        export YEAR_END=$((${nby_ece}*${IFREQ_SAV_YEARS}))
+        export YEAR_END=$((${YEAR_INI}+${YEAR_END}-1))
     #fi
     echo
     echo " *** Initial year set to ${YEAR_INI}"