From 251292b1df66aba76516d533f8e28c5f9f4a5172 Mon Sep 17 00:00:00 2001
From: Gildas Cambon <gildas.cambon@ird.fr>
Date: Thu, 27 Oct 2022 21:12:58 +0200
Subject: [PATCH] BIOLOGY

Again ... Still cleaning to put routines for preprocessing bgc (npzd,
bioebus, pisces) input files into a subdirectory Bio of Preprocessing_tools/
---
 Preprocessing_tools/Bio/add_chla.m          | 303 ++++++++-------
 Preprocessing_tools/Bio/add_dic.m           |  19 +
 Preprocessing_tools/Bio/add_doc.m           |  19 +
 Preprocessing_tools/Bio/add_no3.m           | 344 +++++++++--------
 Preprocessing_tools/Bio/add_o2.m            | 255 ++++++-------
 Preprocessing_tools/{ => Bio}/make_biol.m   |   0
 Preprocessing_tools/{ => Bio}/nevis_2003.m  |   0
 Preprocessing_tools/add_Sphyto_Lphyto.m     | 112 ------
 Preprocessing_tools/add_Szoo_Lzoo.m         | 112 ------
 Preprocessing_tools/add_bry_bioebus.m       | 372 ------------------
 Preprocessing_tools/add_bry_bioebus_Z.m     | 341 -----------------
 Preprocessing_tools/add_bry_npzd.m          | 298 ---------------
 Preprocessing_tools/add_bry_npzd_Z.m        | 267 -------------
 Preprocessing_tools/add_bry_pisces.m        | 399 --------------------
 Preprocessing_tools/add_bry_pisces_Z.m      | 319 ----------------
 Preprocessing_tools/add_chla.m              | 151 --------
 Preprocessing_tools/add_dic.m               | 144 -------
 Preprocessing_tools/add_doc.m               | 144 -------
 Preprocessing_tools/add_fer.m               | 144 -------
 Preprocessing_tools/add_ini_Sphyto_Lphyto.m |  82 ----
 Preprocessing_tools/add_ini_Szoo_Lzoo.m     |  84 -----
 Preprocessing_tools/add_ini_bioebus.m       |  52 ---
 Preprocessing_tools/add_ini_chla.m          | 202 ----------
 Preprocessing_tools/add_ini_no3.m           | 204 ----------
 Preprocessing_tools/add_ini_npzd.m          |  63 ----
 Preprocessing_tools/add_ini_o2.m            | 205 ----------
 Preprocessing_tools/add_ini_phyto.m         |  68 ----
 Preprocessing_tools/add_ini_pisces.m        | 117 ------
 Preprocessing_tools/add_ini_zoo.m           |  70 ----
 Preprocessing_tools/add_no3.m               | 185 ---------
 Preprocessing_tools/add_o2.m                | 126 -------
 Preprocessing_tools/add_phyto.m             |  85 -----
 Preprocessing_tools/add_po4.m               | 144 -------
 Preprocessing_tools/add_sio3.m              | 144 -------
 Preprocessing_tools/add_talk.m              | 144 -------
 Preprocessing_tools/add_zoo.m               |  87 -----
 Preprocessing_tools/make_clim_bioebus.m     | 159 --------
 Preprocessing_tools/make_clim_npzd.m        | 152 --------
 Preprocessing_tools/make_clim_pisces.m      | 221 -----------
 Preprocessing_tools/vinterp_bry_bgc.m       | 109 ------
 40 files changed, 496 insertions(+), 5950 deletions(-)
 rename Preprocessing_tools/{ => Bio}/make_biol.m (100%)
 rename Preprocessing_tools/{ => Bio}/nevis_2003.m (100%)
 delete mode 100644 Preprocessing_tools/add_Sphyto_Lphyto.m
 delete mode 100644 Preprocessing_tools/add_Szoo_Lzoo.m
 delete mode 100644 Preprocessing_tools/add_bry_bioebus.m
 delete mode 100644 Preprocessing_tools/add_bry_bioebus_Z.m
 delete mode 100644 Preprocessing_tools/add_bry_npzd.m
 delete mode 100644 Preprocessing_tools/add_bry_npzd_Z.m
 delete mode 100644 Preprocessing_tools/add_bry_pisces.m
 delete mode 100644 Preprocessing_tools/add_bry_pisces_Z.m
 delete mode 100644 Preprocessing_tools/add_chla.m
 delete mode 100644 Preprocessing_tools/add_dic.m
 delete mode 100644 Preprocessing_tools/add_doc.m
 delete mode 100644 Preprocessing_tools/add_fer.m
 delete mode 100644 Preprocessing_tools/add_ini_Sphyto_Lphyto.m
 delete mode 100644 Preprocessing_tools/add_ini_Szoo_Lzoo.m
 delete mode 100644 Preprocessing_tools/add_ini_bioebus.m
 delete mode 100644 Preprocessing_tools/add_ini_chla.m
 delete mode 100644 Preprocessing_tools/add_ini_no3.m
 delete mode 100644 Preprocessing_tools/add_ini_npzd.m
 delete mode 100644 Preprocessing_tools/add_ini_o2.m
 delete mode 100644 Preprocessing_tools/add_ini_phyto.m
 delete mode 100644 Preprocessing_tools/add_ini_pisces.m
 delete mode 100644 Preprocessing_tools/add_ini_zoo.m
 delete mode 100644 Preprocessing_tools/add_no3.m
 delete mode 100644 Preprocessing_tools/add_o2.m
 delete mode 100644 Preprocessing_tools/add_phyto.m
 delete mode 100644 Preprocessing_tools/add_po4.m
 delete mode 100644 Preprocessing_tools/add_sio3.m
 delete mode 100644 Preprocessing_tools/add_talk.m
 delete mode 100644 Preprocessing_tools/add_zoo.m
 delete mode 100644 Preprocessing_tools/make_clim_bioebus.m
 delete mode 100644 Preprocessing_tools/make_clim_npzd.m
 delete mode 100644 Preprocessing_tools/make_clim_pisces.m
 delete mode 100644 Preprocessing_tools/vinterp_bry_bgc.m

diff --git a/Preprocessing_tools/Bio/add_chla.m b/Preprocessing_tools/Bio/add_chla.m
index abc0a6f1..a5ecdd22 100644
--- a/Preprocessing_tools/Bio/add_chla.m
+++ b/Preprocessing_tools/Bio/add_chla.m
@@ -1,156 +1,151 @@
-function add_chla(climfile, gridfile, seas_datafile, cycle, Roa);
+function add_chla(climfile,gridfile,seas_datafile,cycle,Roa);
 
-    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-    %
-    %  function add_chla(climfile,gridfile,seas_datafile,cycle);
-    %
-    %  Add chlorophyll (mg C) in a CROCO climatology file.
-    %  take seasonal data for the surface levels and extrapole
-    %  using Morel and Berthon (1989) parameterization for the
-    %  lower levels. warning ! the unit is (micro mole/l) in the
-    %  dataset.
-    %  ref:  Morel and Berthon, Surface pigments, algal biomass
-    %        profiles, and potential production of the euphotic layer:
-    %        Relationships reinvestigated in view of remote-sensing
-    %        applications. Limnol. Oceanogr., 34, 1989, 1545-1562.
-    %
-    %  input:
-    %
-    %    climfile      : croco climatology file to process (netcdf)
-    %    gridfile      : croco grid file (netcdf)
-    %    seas_datafile : regular longitude - latitude - z seasonal data
-    %                    file used for the upper levels  (netcdf)
-    %    ann_datafile  : regular longitude - latitude - z annual data
-    %                    file used for the lower levels  (netcdf)
-    %    cycle         : time length (days) of climatology cycle (ex:360 for
-    %                    annual cycle) - 0 if no cycle.
-    %
-    %  Further Information:
-    %  http://www.croco-ocean.org
-    %
-    %  This file is part of CROCOTOOLS
-    %
-    %  CROCOTOOLS is free software; you can redistribute it and/or modify
-    %  it under the terms of the GNU General Public License as published
-    %  by the Free Software Foundation; either version 2 of the License,
-    %  or (at your option) any later version.
-    %
-    %  CROCOTOOLS is distributed in the hope that it will be useful, but
-    %  WITHOUT ANY WARRANTY; without even the implied warranty of
-    %  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    %  GNU General Public License for more details.
-    %
-    %  You should have received a copy of the GNU General Public License
-    %  along with this program; if not, write to the Free Software
-    %  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-    %  MA  02111-1307  USA
-    %
-    %  Copyright (c) 2001-2006 by Pierrick Penven
-    %  e-mail:Pierrick.Penven@ird.fr
-    %
-    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-    %
-    disp('Add_chla: creating variable and attribute')
-    default = NaN;
-    %
-    % read in the datafile
-    %
-    ncseas = netcdf(seas_datafile, 'r');
-    x = ncseas{'X'}(:);
-    y = ncseas{'Y'}(:);
-    t = ncseas{'T'}(:);
-    tlen = length(t);
-    %
-    % open the grid file
-    %
-    ng = netcdf(gridfile, 'r');
-    lon = ng{'lon_rho'}(:);
-    %lon(lon<0)=lon(lon<0)+360;
-    lat = ng{'lat_rho'}(:);
-    h = ng{'h'}(:);
-    close(ng);
-    [M, L] = size(lon);
-    dl = 2.;
-    minlon = min(min(lon)) - dl;
-    maxlon = max(max(lon)) + dl;
-    minlat = min(min(lat)) - dl;
-    maxlat = max(max(lat)) + dl;
-    imin = max(find(x <= minlon));
-    imax = min(find(x >= maxlon));
-    jmin = max(find(y <= minlat));
-    jmax = min(find(y >= maxlat));
-    x = x(imin:imax);
-    y = y(jmin:jmax);
-    %
-    % open the clim file
-    %
-    nc = netcdf(climfile, 'write');
-    theta_s = nc{'theta_s'}(:);
-    theta_b = nc{'theta_b'}(:);
-    Tcline = nc{'Tcline'}(:);
-    vtransform = nc{'Vtransform'}(:);
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%  function add_chla(climfile,gridfile,seas_datafile,cycle);
+%
+%  Add chlorophyll (mg C) in a CROCO climatology file.
+%  take seasonal data for the surface levels and extrapole 
+%  using Morel and Berthon (1989) parameterization for the
+%  lower levels. warning ! the unit is (micro mole/l) in the
+%  dataset.
+%  ref:  Morel and Berthon, Surface pigments, algal biomass
+%        profiles, and potential production of the euphotic layer:
+%        Relationships reinvestigated in view of remote-sensing 
+%        applications. Limnol. Oceanogr., 34, 1989, 1545-1562.
+%
+%  input:
+%    
+%    climfile      : croco climatology file to process (netcdf)
+%    gridfile      : croco grid file (netcdf)
+%    seas_datafile : regular longitude - latitude - z seasonal data 
+%                    file used for the upper levels  (netcdf)
+%    ann_datafile  : regular longitude - latitude - z annual data 
+%                    file used for the lower levels  (netcdf)
+%    cycle         : time length (days) of climatology cycle (ex:360 for
+%                    annual cycle) - 0 if no cycle.
+% 
+%  Further Information:  
+%  http://www.croco-ocean.org
+%  
+%  This file is part of CROCOTOOLS
+%
+%  CROCOTOOLS is free software; you can redistribute it and/or modify
+%  it under the terms of the GNU General Public License as published
+%  by the Free Software Foundation; either version 2 of the License,
+%  or (at your option) any later version.
+%
+%  CROCOTOOLS is distributed in the hope that it will be useful, but
+%  WITHOUT ANY WARRANTY; without even the implied warranty of
+%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+%  GNU General Public License for more details.
+%
+%  You should have received a copy of the GNU General Public License
+%  along with this program; if not, write to the Free Software
+%  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+%  MA  02111-1307  USA
+%
+%  Copyright (c) 2001-2006 by Pierrick Penven 
+%  e-mail:Pierrick.Penven@ird.fr  
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+disp('Add_chla: creating variable and attribute')
+default=NaN;
+%
+% read in the datafile 
+%
+ncseas=netcdf(seas_datafile,'r');
+x=ncseas{'X'}(:);
+y=ncseas{'Y'}(:);
+t=ncseas{'T'}(:);
+tlen=length(t);
+%
+% open the grid file  
+% 
+ng=netcdf(gridfile,'r');
+lon=ng{'lon_rho'}(:);
+%lon(lon<0)=lon(lon<0)+360;
+lat=ng{'lat_rho'}(:);
+h=ng{'h'}(:);
+close(ng);
+[M,L]=size(lon);
+dl=2.;
+minlon=min(min(lon))-dl;
+maxlon=max(max(lon))+dl;
+minlat=min(min(lat))-dl;
+maxlat=max(max(lat))+dl;
+imin=max(find(x<=minlon));
+imax=min(find(x>=maxlon));
+jmin=max(find(y<=minlat));
+jmax=min(find(y>=maxlat));
+x=x(imin:imax);
+y=y(jmin:jmax);
+%
+% open the clim file  
+% 
+nc=netcdf(climfile,'write');
+theta_s = nc{'theta_s'}(:);
+theta_b =  nc{'theta_b'}(:);
+Tcline  =  nc{'Tcline'}(:);
+vtransform=nc{'Vtransform'}(:);
+if  ~exist('vtransform')
+    vtransform=1; %Old Vtransform
+    disp([' NO VTRANSFORM parameter found'])
+end
+N =  length(nc('s_rho'));
 
-    if ~exist('vtransform')
-        vtransform = 1; %Old Vtransform
-        disp([' NO VTRANSFORM parameter found'])
-    end
-
-    N = length(nc('s_rho'));
-
-    %redef(nc);
-    nc('chla_time') = tlen;
-    nc{'chla_time'} = ncdouble('chla_time');
-    nc{'CHLA'} = ncdouble('chla_time', 's_rho', 'eta_rho', 'xi_rho');
-    %
-    nc{'chla_time'}.long_name = ncchar('time for chlorophyll');
-    nc{'chla_time'}.long_name = 'time for chlorophyll';
-    nc{'chla_time'}.units = ncchar('day');
-    nc{'chla_time'}.units = 'day';
-
-    if cycle ~= 0
-        nc{'chla_time'}.cycle_length = cycle;
-    end
-
-    %
-    nc{'CHLA'}.long_name = ncchar('Chlorophyll');
-    nc{'CHLA'}.long_name = 'Chlorophyll';
-    nc{'CHLA'}.units = ncchar('mg C');
-    nc{'CHLA'}.units = 'mg C';
-    nc{'CHLA'}.fields = ncchar('CHLA, scalar, series');
-    nc{'CHLA'}.fields = 'CHLA, scalar, series';
-    %
-    %endef(nc);
-    %
-    % Record the time
-    %
-    nc{'chla_time'}(:) = t * 30; % if time in month in the dataset !!!
-    %
-    % Get the missing values
-    %
-    missval = ncseas{'chlorophyll'}.missing_value(:);
-    %
-    % loop on time
-    %
-    for l = 1:tlen
-        disp(['time index: ', num2str(l), ' of total: ', num2str(tlen)])
-        %
-        % extrapole the annual dataset on the horizontal croco grid
-        %
-        disp('Add_chla: horizontal interpolation of surface data')
-        surfchla = squeeze(ncseas{'chlorophyll'}(l, jmin:jmax, imin:imax));
-        surfchla = get_missing_val(x, y, surfchla, missval, Roa, default);
-        surfchlacroco = interp2(x, y, surfchla, lon, lat);
-        %
-        % extrapole the chlorophyll on the vertical
-        %
-        zcroco = zlevs(h, 0 .* h, theta_s, theta_b, Tcline, N, 'r', vtransform);
-        disp(['Add_chla: vertical ', ...
-            'extrapolation of chlorophyll'])
-        chlacroco = extr_chlo(surfchlacroco, zcroco);
-        nc{'CHLA'}(l, :, :, :) = chlacroco;
-    end
-
-    close(nc);
-    close(ncseas);
-    chla = squeeze(chlacroco(N, :, :));
-    return
+%redef(nc);
+nc('chla_time') = tlen;
+nc{'chla_time'} = ncdouble('chla_time') ;
+nc{'CHLA'} = ncdouble('chla_time','s_rho','eta_rho','xi_rho') ;
+%
+nc{'chla_time'}.long_name = ncchar('time for chlorophyll');
+nc{'chla_time'}.long_name = 'time for chlorophyll';
+nc{'chla_time'}.units = ncchar('day');
+nc{'chla_time'}.units = 'day';
+if cycle~=0
+  nc{'chla_time'}.cycle_length = cycle;
+end
+%
+nc{'CHLA'}.long_name = ncchar('Chlorophyll');
+nc{'CHLA'}.long_name = 'Chlorophyll';
+nc{'CHLA'}.units = ncchar('mg C');
+nc{'CHLA'}.units = 'mg C';
+nc{'CHLA'}.fields = ncchar('CHLA, scalar, series');
+nc{'CHLA'}.fields = 'CHLA, scalar, series';
+%
+%endef(nc);
+%
+% Record the time
+%
+nc{'chla_time'}(:)=t*30; % if time in month in the dataset !!!
+%
+% Get the missing values
+%
+missval=ncseas{'chlorophyll'}.missing_value(:);
+%
+% loop on time
+%
+for l=1:tlen
+disp(['time index: ',num2str(l),' of total: ',num2str(tlen)])
+%
+% extrapole the annual dataset on the horizontal croco grid
+%
+  disp('Add_chla: horizontal interpolation of surface data')
+  surfchla=squeeze(ncseas{'chlorophyll'}(l,jmin:jmax,imin:imax));
+  surfchla=get_missing_val(x,y,surfchla,missval,Roa,default);
+  surfchlacroco=interp2(x,y,surfchla,lon,lat);
+%
+% extrapole the chlorophyll on the vertical
+%
+  zcroco=zlevs(h,0.*h,theta_s,theta_b,Tcline,N,'r',vtransform);
+  disp(['Add_chla: vertical ',...
+  'extrapolation of chlorophyll'])
+  chlacroco=extr_chlo(surfchlacroco,zcroco);
+  nc{'CHLA'}(l,:,:,:)=chlacroco;
+end
+close(nc);
+close(ncseas);
+chla=squeeze(chlacroco(N,:,:));
+return
diff --git a/Preprocessing_tools/Bio/add_dic.m b/Preprocessing_tools/Bio/add_dic.m
index 9864ee62..88cace3b 100644
--- a/Preprocessing_tools/Bio/add_dic.m
+++ b/Preprocessing_tools/Bio/add_dic.m
@@ -122,4 +122,23 @@ if (makeclim)
   nc{'dic_time'}(:)=t*30; % if time in month in the dataset !!!
   close(nc)
 end
+%
+% Same thing for the Initial file
+%
+%disp('Add_no3: creating variables and attributes for the Initial file')
+%
+% open the clim file  
+% 
+%nc=netcdf(inifile,'write');
+%redef(nc);
+%nc{'NO3'} = ncdouble('time','s_rho','eta_rho','xi_rho') ;
+%
+%nc{'NO3'}.long_name = ncchar('Nitrate');
+%nc{'NO3'}.long_name = 'Nitrate';
+%nc{'NO3'}.units = ncchar('mMol N m-3');
+%nc{'NO3'}.units = 'mMol N m-3';
+%
+%endef(nc);
+%close(nc)
+
 return
diff --git a/Preprocessing_tools/Bio/add_doc.m b/Preprocessing_tools/Bio/add_doc.m
index e6374601..d8c3e30f 100644
--- a/Preprocessing_tools/Bio/add_doc.m
+++ b/Preprocessing_tools/Bio/add_doc.m
@@ -122,4 +122,23 @@ if (makeclim)
   nc{'doc_time'}(:)=t*30; % if time in month in the dataset !!!
   close(nc)
 end
+%
+% Same thing for the Initial file
+%
+%disp('Add_doc: creating variables and attributes for the Initial file')
+%
+% open the clim file  
+% 
+%nc=netcdf(inifile,'write');
+%redef(nc);
+%nc{'DOC'} = ncdouble('time','s_rho','eta_rho','xi_rho') ;
+%
+%nc{'DOC'}.long_name = ncchar('Nitrate');
+%nc{'DOC'}.long_name = 'Nitrate';
+%nc{'DOC'}.units = ncchar('mMol N m-3');
+%nc{'DOC'}.units = 'mMol N m-3';
+%
+%endef(nc);
+%close(nc)
+
 return
diff --git a/Preprocessing_tools/Bio/add_no3.m b/Preprocessing_tools/Bio/add_no3.m
index d8b53361..1670583b 100644
--- a/Preprocessing_tools/Bio/add_no3.m
+++ b/Preprocessing_tools/Bio/add_no3.m
@@ -1,161 +1,185 @@
-function add_no3(oafile, climfile, inifile, gridfile, seas_datafile, ...
-        ann_datafile, cycle, makeoa, makeclim);
-    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-    %
-    %  function [longrd,latgrd,no3]=add_no3(climfile,gridfile,...
-    %                                       seas_datafile,ann_datafile,...
-    %                                       cycle);
-    %
-    %  Add nitrate (mMol N m-3) in a CROCO climatology file
-    %  take seasonal data for the upper levels and annual data for the
-    %  lower levels
-    %
-    %  input:
-    %
-    %    climfile      : croco climatology file to process (netcdf)
-    %    gridfile      : croco grid file (netcdf)
-    %    seas_datafile : regular longitude - latitude - z seasonal data
-    %                    file used for the upper levels  (netcdf)
-    %    ann_datafile  : regular longitude - latitude - z annual data
-    %                    file used for the lower levels  (netcdf)
-    %    cycle         : time length (days) of climatology cycle (ex:360 for
-    %                    annual cycle) - 0 if no cycle.
-    %
-    %   output:
-    %
-    %    [longrd,latgrd,no3] : surface field to plot (as an illustration)
-    %
-    %  Further Information:
-    %  http://www.croco-ocean.org
-    %
-    %  This file is part of CROCOTOOLS
-    %
-    %  CROCOTOOLS is free software; you can redistribute it and/or modify
-    %  it under the terms of the GNU General Public License as published
-    %  by the Free Software Foundation; either version 2 of the License,
-    %  or (at your option) any later version.
-    %
-    %  CROCOTOOLS is distributed in the hope that it will be useful, but
-    %  WITHOUT ANY WARRANTY; without even the implied warranty of
-    %  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    %  GNU General Public License for more details.
-    %
-    %  You should have received a copy of the GNU General Public License
-    %  along with this program; if not, write to the Free Software
-    %  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-    %  MA  02111-1307  USA
-    %
-    %  Copyright (c) 2001-2006 by Pierrick Penven
-    %  e-mail:Pierrick.Penven@ird.fr
-    %
-    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-    %
-    % Read in the grid
-    %
-    nc = netcdf(gridfile, 'r');
-    hmax = max(max(nc{'h'}(:)));
-    close(nc);
-    %
-    % read in the datafiles
-    %
-    nc = netcdf(seas_datafile, 'r');
-    t = nc{'T'}(:);
-    t;
-    close(nc)
-    nc = netcdf(ann_datafile, 'r');
-    zno3 = nc{'Z'}(:);
-    kmax = max(find(zno3 < hmax)) - 1;
-    zno3 = zno3(1:kmax);
-    size(zno3);
-    close(nc)
-    %
-    % open the OA file
-    %
-    if (makeoa)
-        disp('Add_no3: creating variables and attributes for the OA file')
-        nc = netcdf(oafile, 'write');
-        % redef(nc);
+function add_no3(oafile,climfile,inifile,gridfile,seas_datafile,...
+                 ann_datafile,cycle,makeoa,makeclim);
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%  function [longrd,latgrd,no3]=add_no3(climfile,gridfile,...
+%                                       seas_datafile,ann_datafile,...
+%                                       cycle);
+%
+%  Add nitrate (mMol N m-3) in a CROCO climatology file
+%  take seasonal data for the upper levels and annual data for the
+%  lower levels
+%
+%  input:
+%    
+%    climfile      : croco climatology file to process (netcdf)
+%    gridfile      : croco grid file (netcdf)
+%    seas_datafile : regular longitude - latitude - z seasonal data 
+%                    file used for the upper levels  (netcdf)
+%    ann_datafile  : regular longitude - latitude - z annual data 
+%                    file used for the lower levels  (netcdf)
+%    cycle         : time length (days) of climatology cycle (ex:360 for
+%                    annual cycle) - 0 if no cycle.
+%
+%   output:
+%
+%    [longrd,latgrd,no3] : surface field to plot (as an illustration)
+% 
+%  Further Information:  
+%  http://www.croco-ocean.org
+%  
+%  This file is part of CROCOTOOLS
+%
+%  CROCOTOOLS is free software; you can redistribute it and/or modify
+%  it under the terms of the GNU General Public License as published
+%  by the Free Software Foundation; either version 2 of the License,
+%  or (at your option) any later version.
+%
+%  CROCOTOOLS is distributed in the hope that it will be useful, but
+%  WITHOUT ANY WARRANTY; without even the implied warranty of
+%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+%  GNU General Public License for more details.
+%
+%  You should have received a copy of the GNU General Public License
+%  along with this program; if not, write to the Free Software
+%  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+%  MA  02111-1307  USA
+%
+%  Copyright (c) 2001-2006 by Pierrick Penven 
+%  e-mail:Pierrick.Penven@ird.fr  
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Read in the grid
+%
+nc=netcdf(gridfile,'r');
+hmax=max(max(nc{'h'}(:)));
+close(nc);
+%
+% read in the datafiles 
+%
+nc=netcdf(seas_datafile,'r');
+t=nc{'T'}(:);
+t;
+close(nc)
+nc=netcdf(ann_datafile,'r');
+zno3=nc{'Z'}(:);
+kmax=max(find(zno3<hmax))-1;
+zno3=zno3(1:kmax);
+%disp('Size zno3=')
+size(zno3);
+close(nc)
+%
+% open the OA file  
+% 
+if (makeoa)
+  disp('Add_no3: creating variables and attributes for the OA file')
+  nc=netcdf(oafile,'write');
+ % redef(nc);
+  
+  %Create Dimensions
+  nc('no3_time') = length(t);
+  %Create Variable
+  nc{'no3_time'} = ncdouble('no3_time') ;
+%
+%%
+%
+  %Create Dimensions
+  nc('Zno3') = length(zno3);  
+  %Create Variable
+  nc{'Zno3'} = ncdouble('Zno3') ;
+%
+%%
+%    
+  %Create Variable
+  nc{'NO3'} = ncdouble('no3_time','Zno3','eta_rho','xi_rho') ;
+%
+%%
+%    
+  %Create Attribute
+  
+  nc{'no3_time'}.long_name = ncchar('time for nitrate');
+  nc{'no3_time'}.long_name = 'time for nitrate';
+  nc{'no3_time'}.units = ncchar('day');
+  nc{'no3_time'}.units = 'day';
+  if cycle~=0
+    nc{'no3_time'}.cycle_length = cycle;
+  end
+%%%
+  nc{'Zno3'}.long_name = ncchar('Depth for NO3');
+  nc{'Zno3'}.long_name = 'Depth for NO3';
+  nc{'Zno3'}.units = ncchar('m');
+  nc{'Zno3'}.units = 'm';
+%%%
+  nc{'NO3'}.long_name = ncchar('Nitrate');
+  nc{'NO3'}.long_name = 'Nitrate';
+  nc{'NO3'}.units = ncchar('mMol N m-3');
+  nc{'NO3'}.units = 'mMol N m-3';
+  nc{'NO3'}.fields = ncchar('NO3, scalar, series');
+  nc{'NO3'}.fields = 'NO3, scalar, series';
+%%%
+%%  endef(nc);
+%
+%% Write variables
+%% record depth and time and close
+%
+  nc{'no3_time'}(:)=t*30; % if time in month in the dataset !!!
+  nc{'Zno3'}(:)=zno3;
+  close(nc)
+end
+%
+% Same thing for the Clim file
+%
+if (makeclim)
+  disp('Add_no3: creating variables and attributes for the Climatology file')
+%
+% open the clim file  
+% 
+  nc=netcdf(climfile,'write');
+ % redef(nc);
+  nc('no3_time') = length(t);;
+  nc{'no3_time'} = ncdouble('no3_time') ;
+  nc{'NO3'} = ncdouble('no3_time','s_rho','eta_rho','xi_rho') ;
+%
+  nc{'no3_time'}.long_name = ncchar('time for nitrate');
+  nc{'no3_time'}.long_name = 'time for nitrate';
+  nc{'no3_time'}.units = ncchar('day');
+  nc{'no3_time'}.units = 'day';
+  if cycle~=0
+    nc{'no3_time'}.cycle_length = cycle;
+  end
+%
+  nc{'NO3'}.long_name = ncchar('Nitrate');
+  nc{'NO3'}.long_name = 'Nitrate';
+  nc{'NO3'}.units = ncchar('mMol N m-3');
+  nc{'NO3'}.units = 'mMol N m-3';
+  nc{'NO3'}.fields = ncchar('NO3, scalar, series');
+  nc{'NO3'}.fields = 'NO3, scalar, series';
+%
+%%  endef(nc);
+%
+% record the time and close
+%
+  nc{'no3_time'}(:)=t*30; % if time in month in the dataset !!!
+  close(nc)
+end
+%
+% Same thing for the Initial file
+%
+%disp('Add_no3: creating variables and attributes for the Initial file')
+%
+% open the clim file  
+% 
+%nc=netcdf(inifile,'write');
+%redef(nc);
+%nc{'NO3'} = ncdouble('time','s_rho','eta_rho','xi_rho') ;
+%
+%nc{'NO3'}.long_name = ncchar('Nitrate');
+%nc{'NO3'}.long_name = 'Nitrate';
+%nc{'NO3'}.units = ncchar('mMol N m-3');
+%nc{'NO3'}.units = 'mMol N m-3';
+%
+%endef(nc);
+%close(nc)
 
-        %Create Dimensions
-        nc('no3_time') = length(t);
-        %Create Variable
-        nc{'no3_time'} = ncdouble('no3_time');
-        %
-        %Create Dimensions
-        nc('Zno3') = length(zno3);
-        %Create Variable
-        nc{'Zno3'} = ncdouble('Zno3');
-        %
-        %Create Variable
-        nc{'NO3'} = ncdouble('no3_time', 'Zno3', 'eta_rho', 'xi_rho');
-        %
-        %Create Attribute
-        nc{'no3_time'}.long_name = ncchar('time for nitrate');
-        nc{'no3_time'}.long_name = 'time for nitrate';
-        nc{'no3_time'}.units = ncchar('day');
-        nc{'no3_time'}.units = 'day';
-
-        if cycle ~= 0
-            nc{'no3_time'}.cycle_length = cycle;
-        end
-
-        %%%
-        nc{'Zno3'}.long_name = ncchar('Depth for NO3');
-        nc{'Zno3'}.long_name = 'Depth for NO3';
-        nc{'Zno3'}.units = ncchar('m');
-        nc{'Zno3'}.units = 'm';
-        %%%
-        nc{'NO3'}.long_name = ncchar('Nitrate');
-        nc{'NO3'}.long_name = 'Nitrate';
-        nc{'NO3'}.units = ncchar('mMol N m-3');
-        nc{'NO3'}.units = 'mMol N m-3';
-        nc{'NO3'}.fields = ncchar('NO3, scalar, series');
-        nc{'NO3'}.fields = 'NO3, scalar, series';
-        %%%
-        %%  endef(nc);
-        %
-        %% Write variables record depth and time and close
-        %
-        nc{'no3_time'}(:) = t * 30; % if time in month in the dataset !!!
-        nc{'Zno3'}(:) = zno3;
-        close(nc)
-    end
-
-    %
-    % Same thing for the Clim file
-    %
-    if (makeclim)
-        disp('Add_no3: creating variables and attributes for the Climatology file')
-        %
-        % open the clim file
-        %
-        nc = netcdf(climfile, 'write');
-        % redef(nc);
-        nc('no3_time') = length(t);;
-        nc{'no3_time'} = ncdouble('no3_time');
-        nc{'NO3'} = ncdouble('no3_time', 's_rho', 'eta_rho', 'xi_rho');
-        %
-        nc{'no3_time'}.long_name = ncchar('time for nitrate');
-        nc{'no3_time'}.long_name = 'time for nitrate';
-        nc{'no3_time'}.units = ncchar('day');
-        nc{'no3_time'}.units = 'day';
-
-        if cycle ~= 0
-            nc{'no3_time'}.cycle_length = cycle;
-        end
-        %
-        nc{'NO3'}.long_name = ncchar('Nitrate');
-        nc{'NO3'}.long_name = 'Nitrate';
-        nc{'NO3'}.units = ncchar('mMol N m-3');
-        nc{'NO3'}.units = 'mMol N m-3';
-        nc{'NO3'}.fields = ncchar('NO3, scalar, series');
-        nc{'NO3'}.fields = 'NO3, scalar, series';
-        %
-        %%  endef(nc);
-        %
-        % record the time and close
-        %
-        nc{'no3_time'}(:) = t * 30; % if time in month in the dataset !!!
-        close(nc)
-      end
-    return
+return
diff --git a/Preprocessing_tools/Bio/add_o2.m b/Preprocessing_tools/Bio/add_o2.m
index 0ac3e045..86321ce1 100644
--- a/Preprocessing_tools/Bio/add_o2.m
+++ b/Preprocessing_tools/Bio/add_o2.m
@@ -1,131 +1,126 @@
-function add_o2(oafile, climfile, inifile, gridfile, month_datafile, ...
-        ann_datafile, cycle, makeoa, makeclim);
-    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-    %
-    %  function [longrd,latgrd,o2]=add_o2(climfile,gridfile,...
-    %                                       month_datafile,ann_datafile,...
-    %                                       cycle);
-    %
-    %  pierrick 2001
-    %
-    %  Add oxygen (mMol 0 m-3) in a CROCO climatology file
-    %  take monthly data for the upper levels and annual data for the
-    %  lower levels
-    %
-    %  input:
-    %
-    %    climfile      : croco climatology file to process (netcdf)
-    %    gridfile      : croco grid file (netcdf)
-    %    month_datafile : regular longitude - latitude - z monthly data
-    %                    file used for the upper levels  (netcdf)
-    %    ann_datafile  : regular longitude - latitude - z annual data
-    %                    file used for the lower levels  (netcdf)
-    %    cycle         : time length (days) of climatology cycle (ex:360 for
-    %                    annual cycle) - 0 if no cycle.
-    %
-    %   output:
-    %
-    %    [longrd,latgrd,o2] : surface field to plot (as an illustration)
-    %
-    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-    %
-    % Read in the grid
-    %
-    nc = netcdf(gridfile, 'r');
-    hmax = max(max(nc{'h'}(:)));
-    close(nc);
-    %
-    % read in the datafiles
-    %
-    nc = netcdf(month_datafile, 'r');
-    t = nc{'T'}(:);
-    close(nc)
-    nc = netcdf(ann_datafile, 'r');
-    zo2 = nc{'Z'}(:);
-    kmax = max(find(zo2 < hmax)) - 1;
-    zo2 = zo2(1:kmax);
-    close(nc)
-    %
-    % open the OA file
-    %
-    if (makeoa)
-        disp('Add_o2: creating variables and attributes for the OA file')
-        nc = netcdf(oafile, 'write');
-        %%  redef(nc);
-        nc('o2_time') = length(t);
-        nc{'o2_time'} = ncdouble('o2_time');
-        nc('Zo2') = length(zo2);
-        nc{'Zo2'} = ncdouble('Zo2');
-        nc{'O2'} = ncdouble('o2_time', 'Zo2', 'eta_rho', 'xi_rho');
-        %
-        nc{'o2_time'}.long_name = ncchar('time for oxygen');
-        nc{'o2_time'}.long_name = 'time for oxygen';
-        nc{'o2_time'}.units = ncchar('day');
-        nc{'o2_time'}.units = 'day';
+function add_o2(oafile,climfile,inifile,gridfile,month_datafile,...
+                 ann_datafile,cycle,makeoa,makeclim);
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%  function [longrd,latgrd,o2]=add_o2(climfile,gridfile,...
+%                                       month_datafile,ann_datafile,...
+%                                       cycle);
+%
+%  pierrick 2001
+%
+%  Add oxygen (mMol 0 m-3) in a CROCO climatology file
+%  take monthly data for the upper levels and annual data for the
+%  lower levels
+%
+%  input:
+%    
+%    climfile      : croco climatology file to process (netcdf)
+%    gridfile      : croco grid file (netcdf)
+%    month_datafile : regular longitude - latitude - z monthly data 
+%                    file used for the upper levels  (netcdf)
+%    ann_datafile  : regular longitude - latitude - z annual data 
+%                    file used for the lower levels  (netcdf)
+%    cycle         : time length (days) of climatology cycle (ex:360 for
+%                    annual cycle) - 0 if no cycle.
+%
+%   output:
+%
+%    [longrd,latgrd,o2] : surface field to plot (as an illustration)
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Read in the grid
+%
+nc=netcdf(gridfile,'r');
+hmax=max(max(nc{'h'}(:)));
+close(nc);
+%
+% read in the datafiles 
+%
+nc=netcdf(month_datafile,'r');
+t=nc{'T'}(:);
+close(nc)
+nc=netcdf(ann_datafile,'r');
+zo2=nc{'Z'}(:);
+kmax=max(find(zo2<hmax))-1;
+zo2=zo2(1:kmax);
+close(nc)
+%
+% open the OA file  
+% 
+if (makeoa)
+  disp('Add_o2: creating variables and attributes for the OA file')
+  nc=netcdf(oafile,'write');
+%%  redef(nc);
+  nc('o2_time') = length(t);
+  nc{'o2_time'} = ncdouble('o2_time') ;
+  nc('Zo2') = length(zo2);
+  nc{'Zo2'} = ncdouble('Zo2') ;
+  nc{'O2'} = ncdouble('o2_time','Zo2','eta_rho','xi_rho') ;
+%
+  nc{'o2_time'}.long_name = ncchar('time for oxygen');
+  nc{'o2_time'}.long_name = 'time for oxygen';
+  nc{'o2_time'}.units = ncchar('day');
+  nc{'o2_time'}.units = 'day';
+  if cycle~=0
+    nc{'o2_time'}.cycle_length = cycle;
+  end
+%
+  nc{'Zo2'}.long_name = ncchar('Depth for O2');
+  nc{'Zo2'}.long_name = 'Depth for O2';
+  nc{'Zo2'}.units = ncchar('m');
+  nc{'Zo2'}.units = 'm';
+%
+  nc{'O2'}.long_name = ncchar('Oxygen');
+  nc{'O2'}.long_name = 'Oxygen';
+  nc{'O2'}.units = ncchar('mMol O m-3');
+  nc{'O2'}.units = 'mMol O m-3';
+  nc{'O2'}.fields = ncchar('O2, scalar, series');
+  nc{'O2'}.fields = 'O2, scalar, series';
+%
+%%  endef(nc);
+%
+% record depth and time and close
+%
+  nc{'o2_time'}(:)=t*30;  % ojo aqui quite *30 % if time in month in the dataset !!!
+  nc{'Zo2'}(:)=squeeze(zo2);
+  close(nc)
+end
+%
+% Same thing for the Clim file
+%
+if (makeclim)
+  disp('Add_o2: creating variables and attributes for the Climatology file')
+%
+% open the clim file  
+% 
+  nc=netcdf(climfile,'write');
+ %% redef(nc);
+  nc('o2_time') = length(t);
+  nc{'o2_time'} = ncdouble('o2_time') ;
+  nc{'O2'} = ncdouble('o2_time','s_rho','eta_rho','xi_rho') ;
+%
+  nc{'o2_time'}.long_name = ncchar('time for oxygen');
+  nc{'o2_time'}.long_name = 'time for oxygen';
+  nc{'o2_time'}.units = ncchar('day');
+  nc{'o2_time'}.units = 'day';
+  if cycle~=0
+    nc{'o2_time'}.cycle_length = cycle;
+  end
+%
+  nc{'O2'}.long_name = ncchar('Oxygen');
+  nc{'O2'}.long_name = 'Oxygen';
+  nc{'O2'}.units = ncchar('mMol O m-3');
+  nc{'O2'}.units = 'mMol O m-3';
+  nc{'O2'}.fields = ncchar('O2, scalar, series');
+  nc{'O2'}.fields = 'O2, scalar, series';
+%
+%%  endef(nc);
+%
+% record the time and close
+%
+  nc{'o2_time'}(:,:)=t*30; % if time in month in the dataset !!!
+  close(nc)
+end
 
-        if cycle ~= 0
-            nc{'o2_time'}.cycle_length = cycle;
-        end
-
-        %
-        nc{'Zo2'}.long_name = ncchar('Depth for O2');
-        nc{'Zo2'}.long_name = 'Depth for O2';
-        nc{'Zo2'}.units = ncchar('m');
-        nc{'Zo2'}.units = 'm';
-        %
-        nc{'O2'}.long_name = ncchar('Oxygen');
-        nc{'O2'}.long_name = 'Oxygen';
-        nc{'O2'}.units = ncchar('mMol O m-3');
-        nc{'O2'}.units = 'mMol O m-3';
-        nc{'O2'}.fields = ncchar('O2, scalar, series');
-        nc{'O2'}.fields = 'O2, scalar, series';
-        %
-        %%  endef(nc);
-        %
-        % record depth and time and close
-        %
-        nc{'o2_time'}(:) = t * 30; % ojo aqui quite *30 % if time in month in the dataset !!!
-        nc{'Zo2'}(:) = squeeze(zo2);
-        close(nc)
-    end
-
-    %
-    % Same thing for the Clim file
-    %
-    if (makeclim)
-        disp('Add_o2: creating variables and attributes for the Climatology file')
-        %
-        % open the clim file
-        %
-        nc = netcdf(climfile, 'write');
-        %% redef(nc);
-        nc('o2_time') = length(t);
-        nc{'o2_time'} = ncdouble('o2_time');
-        nc{'O2'} = ncdouble('o2_time', 's_rho', 'eta_rho', 'xi_rho');
-        %
-        nc{'o2_time'}.long_name = ncchar('time for oxygen');
-        nc{'o2_time'}.long_name = 'time for oxygen';
-        nc{'o2_time'}.units = ncchar('day');
-        nc{'o2_time'}.units = 'day';
-
-        if cycle ~= 0
-            nc{'o2_time'}.cycle_length = cycle;
-        end
-
-        %
-        nc{'O2'}.long_name = ncchar('Oxygen');
-        nc{'O2'}.long_name = 'Oxygen';
-        nc{'O2'}.units = ncchar('mMol O m-3');
-        nc{'O2'}.units = 'mMol O m-3';
-        nc{'O2'}.fields = ncchar('O2, scalar, series');
-        nc{'O2'}.fields = 'O2, scalar, series';
-        %
-        %%  endef(nc);
-        %
-        % record the time and close
-        %
-        nc{'o2_time'}(:, :) = t * 30; % if time in month in the dataset !!!
-        close(nc)
-    end
-
-    return
+return
diff --git a/Preprocessing_tools/make_biol.m b/Preprocessing_tools/Bio/make_biol.m
similarity index 100%
rename from Preprocessing_tools/make_biol.m
rename to Preprocessing_tools/Bio/make_biol.m
diff --git a/Preprocessing_tools/nevis_2003.m b/Preprocessing_tools/Bio/nevis_2003.m
similarity index 100%
rename from Preprocessing_tools/nevis_2003.m
rename to Preprocessing_tools/Bio/nevis_2003.m
diff --git a/Preprocessing_tools/add_Sphyto_Lphyto.m b/Preprocessing_tools/add_Sphyto_Lphyto.m
deleted file mode 100644
index 95a2eade..00000000
--- a/Preprocessing_tools/add_Sphyto_Lphyto.m
+++ /dev/null
@@ -1,112 +0,0 @@
-function add_Sphyto_Lphyto(climfile);
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  function add_phyto(climfile);
-%
-%  Add phytoplancton (mMol N m-3)  in a CROCO climatology file.
-%  take the chlorophyll (mg C) from the climatology file and
-%  multiply by the ratio chlorophyll / phytoplancton derived
-%  from previous simulations.
-%
-%  phyto = 0.5 * chla
-%
-%  input:
-%    
-%    climfile      : croco climatology file to process (netcdf)
-% 
-%  Further Information:  
-%  http://www.croco-ocean.org
-%  
-%  This file is part of CROCOTOOLS
-%
-%  CROCOTOOLS is free software; you can redistribute it and/or modify
-%  it under the terms of the GNU General Public License as published
-%  by the Free Software Foundation; either version 2 of the License,
-%  or (at your option) any later version.
-%
-%  CROCOTOOLS is distributed in the hope that it will be useful, but
-%  WITHOUT ANY WARRANTY; without even the implied warranty of
-%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-%  GNU General Public License for more details.
-%
-%  You should have received a copy of the GNU General Public License
-%  along with this program; if not, write to the Free Software
-%  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-%  MA  02111-1307  USA
-%
-%  Copyright (c) 2001-2006 by Pierrick Penven 
-%  e-mail:Pierrick.Penven@ird.fr  
-%
-%  Updated 14/10/14 Andres Sepulveda (DGEO) Octave compatibility
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-theta1=0.1;
-theta2=0.4;
-%
-disp('Add_Sphyto_Lphyto: creating variable and attribute')
-%
-% open the clim file  
-% 
-nc=netcdf(climfile,'write');
-time= nc{'chla_time'}(:);
-cycle= nc{'chla_time'}.cycle_length(:);
-tlen=length(time);
-%
-%%redef(nc);
-%
-nc('sphyto_time') = tlen;
-nc{'sphyto_time'} = ncdouble('sphyto_time') ;
-nc{'SPHYTO'} = ncdouble('sphyto_time','s_rho','eta_rho','xi_rho') ;
-%
-nc{'sphyto_time'}.long_name = ncchar('time for Small Phytoplankton');
-nc{'sphyto_time'}.long_name = 'time for Small Phytoplankton';
-nc{'sphyto_time'}.units = ncchar('day');
-nc{'sphyto_time'}.units = 'day';
-if cycle~=0
-  nc{'sphyto_time'}.cycle_length = cycle;
-end
-%
-nc('lphyto_time') = tlen;
-nc{'lphyto_time'} = ncdouble('lphyto_time') ;
-nc{'LPHYTO'} = ncdouble('lphyto_time','s_rho','eta_rho','xi_rho') ;
-%
-nc{'lphyto_time'}.long_name = ncchar('time for Large Phytoplankton');
-nc{'lphyto_time'}.long_name = 'time for Large Phytoplankton';
-nc{'lphyto_time'}.units = ncchar('day');
-nc{'lphyto_time'}.units = 'day';
-if cycle~=0
-  nc{'lphyto_time'}.cycle_length = cycle;
-end
-%
-nc{'SPHYTO'}.long_name = ncchar('Small Phytoplankton');
-nc{'SPHYTO'}.long_name = 'Small Phytoplankton';
-nc{'SPHYTO'}.units = ncchar('mMol N m-3');
-nc{'SPHYTO'}.units = 'mMol N m-3';
-nc{'SPHYTO'}.fields = ncchar('SPHYTO, scalar, series');
-nc{'SPHYTO'}.fields = 'SPHYTO, scalar, series';
-%
-nc{'LPHYTO'}.long_name = ncchar('Large Phytoplankton');
-nc{'LPHYTO'}.long_name = 'Large Phytoplankton';
-nc{'LPHYTO'}.units = ncchar('mMol N m-3');
-nc{'LPHYTO'}.units = 'mMol N m-3';
-nc{'LPHYTO'}.fields = ncchar('LPHYTO, scalar, series');
-nc{'LPHYTO'}.fields = 'LPHYTO, scalar, series';
-%
-%%endef(nc);
-%
-% record the time
-%
-nc{'sphyto_time'}(:)=time;
-nc{'lphyto_time'}(:)=time;
-%
-% loop on time
-%
-for l=1:tlen
-  disp(['time index: ',num2str(l),' of total: ',num2str(tlen)])
-  nc{'SPHYTO'}(l,:,:,:)=theta1*squeeze(nc{'CHLA'}(l,:,:,:));
-  nc{'LPHYTO'}(l,:,:,:)=theta2*squeeze(nc{'CHLA'}(l,:,:,:));  
-end
-close(nc);
-return
-
diff --git a/Preprocessing_tools/add_Szoo_Lzoo.m b/Preprocessing_tools/add_Szoo_Lzoo.m
deleted file mode 100644
index 96bc091c..00000000
--- a/Preprocessing_tools/add_Szoo_Lzoo.m
+++ /dev/null
@@ -1,112 +0,0 @@
-function add_Szoo_Lzoo(climfile);
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  function add_zoo(climfile);
-%
-%  Add zooplancton (mMol N m-3) in a CROCO climatology file.
-%  take the chlorophyll (mg C) from the climatology file and
-%  multiply by the ratio chlorophyll / phytoplancton derived
-%  from previous simulations (Gruber et al., 2005)
-%
-%  zoo = 0.2 * chla
-%
-%  input:
-%    
-%    climfile      : croco climatology file to process (netcdf)
-% 
-%  Further Information:  
-%  http://www.croco-ocean.org
-%  
-%  This file is part of CROCOTOOLS
-%
-%  CROCOTOOLS is free software; you can redistribute it and/or modify
-%  it under the terms of the GNU General Public License as published
-%  by the Free Software Foundation; either version 2 of the License,
-%  or (at your option) any later version.
-%
-%  CROCOTOOLS is distributed in the hope that it will be useful, but
-%  WITHOUT ANY WARRANTY; without even the implied warranty of
-%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-%  GNU General Public License for more details.
-%
-%  You should have received a copy of the GNU General Public License
-%  along with this program; if not, write to the Free Software
-%  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-%  MA  02111-1307  USA
-%
-%  Copyright (c) 2001-2006 by Pierrick Penven 
-%  e-mail:Pierrick.Penven@ird.fr  
-%
-%  Updated    2005 by Patrick Marchesiello (IRD)
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-theta1=0.2;
-theta2=0.3;
-%
-disp('Add_Szoo_Lzoo: creating variable and attribute')
-%
-% open the clim file  
-% 
-nc=netcdf(climfile,'write');
-time= nc{'chla_time'}(:);
-cycle= nc{'chla_time'}.cycle_length(:);
-tlen=length(time);
-%
-%%redef(nc);
-%
-nc('szoo_time') = tlen;
-nc{'szoo_time'} = ncdouble('szoo_time') ;
-nc{'SZOO'} = ncdouble('szoo_time','s_rho','eta_rho','xi_rho') ;
-%
-nc{'szoo_time'}.long_name = ncchar('time for Small Zooplankton');
-nc{'szoo_time'}.long_name = 'time for Small Zooplankton';
-nc{'szoo_time'}.units = ncchar('day');
-nc{'szoo_time'}.units = 'day';
-if cycle~=0
-  nc{'szoo_time'}.cycle_length = cycle;
-end
-%
-nc('lzoo_time') = tlen;
-nc{'lzoo_time'} = ncdouble('lzoo_time') ;
-nc{'LZOO'} = ncdouble('lzoo_time','s_rho','eta_rho','xi_rho') ;
-%
-nc{'lzoo_time'}.long_name = ncchar('time for Large Zooplankton');
-nc{'lzoo_time'}.long_name = 'time for Large Zooplankton';
-nc{'lzoo_time'}.units = ncchar('day');
-nc{'lzoo_time'}.units = 'day';
-if cycle~=0
-  nc{'lzoo_time'}.cycle_length = cycle;
-end
-%
-nc{'SZOO'}.long_name = ncchar('Small Zooplankton');
-nc{'SZOO'}.long_name = 'Small Zooplankton';
-nc{'SZOO'}.units = ncchar('mMol N m-3');
-nc{'SZOO'}.units = 'mMol N m-3';
-nc{'SZOO'}.fields = ncchar('SZOO, scalar, series');
-nc{'SZOO'}.fields = 'SZOO, scalar, series';
-%
-nc{'LZOO'}.long_name = ncchar('Large Zooplankton');
-nc{'LZOO'}.long_name = 'Large Zooplankton';
-nc{'LZOO'}.units = ncchar('mMol N m-3');
-nc{'LZOO'}.units = 'mMol N m-3';
-nc{'LZOO'}.fields = ncchar('LZOO, scalar, series');
-nc{'LZOO'}.fields = 'LZOO, scalar, series';
-%
-%%endef(nc);
-%
-% record the time
-%
-nc{'szoo_time'}(:)=time;
-nc{'lzoo_time'}(:)=time;
-%
-% loop on time
-%
-for l=1:tlen
-  disp(['time index: ',num2str(l),' of total: ',num2str(tlen)])
-  nc{'SZOO'}(l,:,:,:)=theta1*squeeze(nc{'CHLA'}(l,:,:,:));
-  nc{'LZOO'}(l,:,:,:)=theta2*squeeze(nc{'CHLA'}(l,:,:,:));
-end
-close(nc);
-return
-
diff --git a/Preprocessing_tools/add_bry_bioebus.m b/Preprocessing_tools/add_bry_bioebus.m
deleted file mode 100644
index 6938dafe..00000000
--- a/Preprocessing_tools/add_bry_bioebus.m
+++ /dev/null
@@ -1,372 +0,0 @@
-function add_bry_bioebus(bryname,obc,time_no3,time_o2,time_zoo,time_phyto,time_chla,cycle,clobber);
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%                                                                 
-% function add_bry_bioebus(bryname,grdname,title,obc...            
-%                         theta_s,theta_b,hc,N,...                
-%                         time,cycle,clobber);                    
-%                                                                 
-%   This function create the header of a Netcdf climatology       
-%   file.                                                         
-%                                                                 
-%   Input:                                                        
-%                                                                 
-%   bryname      Netcdf climatology file name (character string). 
-%   obc          open boundaries flag (1=open , [S E N W]).       
-%   time         time.(vector)                                    
-%   cycle        Length (days) for cycling the climatology.(Real) 
-%   clobber      Switch to allow or not writing over an existing  
-%                file.(character string)                          
-%
-%  Further Information:  
-%  http://www.croco-ocean.org
-%  
-%  This file is part of CROCOTOOLS
-%
-%  CROCOTOOLS is free software; you can redistribute it and/or modify
-%  it under the terms of the GNU General Public License as published
-%  by the Free Software Foundation; either version 2 of the License,
-%  or (at your option) any later version.
-%
-%  CROCOTOOLS is distributed in the hope that it will be useful, but
-%  WITHOUT ANY WARRANTY; without even the implied warranty of
-%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-%  GNU General Public License for more details.
-%
-%  You should have received a copy of the GNU General Public License
-%  along with this program; if not, write to the Free Software
-%  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-%  MA  02111-1307  USA
-%
-%  Copyright (c) 2001-2006 by Pierrick Penven 
-%  e-mail:Pierrick.Penven@ird.fr  
-%  Pierrick Penven, IRD, 2005.                                    %
-%  Olivier Aumont the master, IRD, 2006.                          %
-%  Patricio Marchesiello, chief, IRD, 2007.                       %
-%  Christophe Eugene Raoul Menkes, the slave, IRD, 2007.          %
-%  Gildas Cambon, IRD, 2011                                       %
-%  Gildas Cambon, IRD, 2013 : Add oxygen processing               %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-disp(' ')
-disp([' Adding BIOEBUS BGC data into file : ',bryname])
-disp(' ')
-%
-%  Redefine the boundary file
-%
-nc = netcdf(bryname,clobber);
-%%result = redef(nc);
-%
-%  Create dimenPHYTOons
-%
-nc('no3_time')  = length(time_no3);
-nc('o2_time')  = length(time_o2);
-nc('chla_time')  = length(time_chla);
-nc('sphyto_time') = length(time_phyto);
-nc('lphyto_time') = length(time_phyto);
-nc('szoo_time')   = length(time_zoo);
-nc('lzoo_time')   = length(time_zoo);
-nc('one') = 1;
-%
-%  Create variables and attributes
-%
-nc{'no3_time'} = ncdouble('no3_time') ;
-nc{'no3_time'}.long_name = ncchar('time for NO3 climatology')
-nc{'no3_time'}.long_name = 'time for NO3 climatology';
-nc{'no3_time'}.units = ncchar('day');
-nc{'no3_time'}.units = 'day';
-nc{'no3_time'}.cycle_length = cycle;%
-%
-nc{'o2_time'} = ncdouble('o2_time') ;
-nc{'o2_time'}.long_name = ncchar('time for O2 climatology')
-nc{'o2_time'}.long_name = 'time for O2 climatology';
-nc{'o2_time'}.units = ncchar('day');
-nc{'o2_time'}.units = 'day';
-nc{'o2_time'}.cycle_length = cycle;
-%
-nc{'chla_time'} = ncdouble('chla_time') ;
-nc{'chla_time'}.long_name = ncchar('time for CHLA climatology');
-nc{'chla_time'}.long_name = 'time for CHLA climatology';
-nc{'chla_time'}.units = ncchar('day');
-nc{'chla_time'}.units = 'day';
-nc{'chla_time'}.cycle_length = cycle;%
-%
-nc{'sphyto_time'} = ncdouble('sphyto_time') ;
-nc{'sphyto_time'}.long_name = ncchar('time for SPHYTO climatology');
-nc{'sphyto_time'}.long_name = 'time for SPHYTO climatology';
-nc{'sphyto_time'}.units = ncchar('day');
-nc{'sphyto_time'}.units = 'day';
-nc{'sphyto_time'}.cycle_length = cycle;%
-%
-nc{'lphyto_time'} = ncdouble('lphyto_time') ;
-nc{'lphyto_time'}.long_name = ncchar('time for LPHYTO climatology');
-nc{'lphyto_time'}.long_name = 'time for LPHYTO climatology';
-nc{'lphyto_time'}.units = ncchar('day');
-nc{'lphyto_time'}.units = 'day';
-nc{'lphyto_time'}.cycle_length = cycle;%
-%
-nc{'szoo_time'} = ncdouble('szoo_time') ;
-nc{'szoo_time'}.long_name = ncchar('time for SZOO climatology');
-nc{'szoo_time'}.long_name = 'time for SZOO climatology';
-nc{'szoo_time'}.units = ncchar('day');
-nc{'szoo_time'}.units = 'day';
-nc{'szoo_time'}.cycle_length = cycle;%
-%
-nc{'lzoo_time'} = ncdouble('lzoo_time') ;
-nc{'lzoo_time'}.long_name = ncchar('time for LZOO climatology');
-nc{'lzoo_time'}.long_name = 'time for LZOO climatology';
-nc{'lzoo_time'}.units = ncchar('day');
-nc{'lzoo_time'}.units = 'day';
-nc{'lzoo_time'}.cycle_length = cycle;%
-%
-%
-if obc(1)==1
-%
-%   Southern boundary
-%
-  disp('Process Southern boundary')
-  
-  nc{'NO3_south'} = ncdouble('no3_time','s_rho','xi_rho') ;
-  nc{'NO3_south'}.long_name = ncchar('southern boundary NO3');
-  nc{'NO3_south'}.long_name = 'southern boundary NO3';
-  nc{'NO3_south'}.units = ncchar('mMol N m-3');
-  nc{'NO3_south'}.units = 'mMol N m-3';
-%
-  nc{'O2_south'} = ncdouble('o2_time','s_rho','xi_rho') ;
-  nc{'O2_south'}.long_name = ncchar('southern boundary O2');
-  nc{'O2_south'}.long_name = 'southern boundary O2';
-  nc{'O2_south'}.units = ncchar('mMol O m-3');
-  nc{'O2_south'}.units = 'mMol N m-3';
-  %
-  nc{'CHLA_south'} = ncdouble('chla_time','s_rho','xi_rho') ;
-  nc{'CHLA_south'}.long_name = ncchar('southern boundary CHLA');
-  nc{'CHLA_south'}.long_name = 'southern boundary CHLA';
-  nc{'CHLA_south'}.units = ncchar('mMol N m-3');
-  nc{'CHLA_south'}.units = 'mMol N m-3';
-%
-  nc{'SPHYTO_south'} = ncdouble('sphyto_time','s_rho','xi_rho') ;
-  nc{'SPHYTO_south'}.long_name = ncchar('southern boundary SPHYTO');
-  nc{'SPHYTO_south'}.long_name = 'southern boundary SPHYTO';
-  nc{'SPHYTO_south'}.units = ncchar('mMol N m-3');
-  nc{'SPHYTO_south'}.units = 'mMol N m-3';
-%
-  nc{'LPHYTO_south'} = ncdouble('lphyto_time','s_rho','xi_rho') ;
-  nc{'LPHYTO_south'}.long_name = ncchar('southern boundary LPHYTO');
-  nc{'LPHYTO_south'}.long_name = 'southern boundary LPHYTO';
-  nc{'LPHYTO_south'}.units = ncchar('mMol N m-3');
-  nc{'LPHYTO_south'}.units = 'mMol N m-3';
-%
-  nc{'SZOO_south'} = ncdouble('szoo_time','s_rho','xi_rho') ;
-  nc{'SZOO_south'}.long_name = ncchar('southern boundary SZOO');
-  nc{'SZOO_south'}.long_name = 'southern boundary SZOO';
-  nc{'SZOO_south'}.units = ncchar('mMol N m-3');
-  nc{'SZOO_south'}.units = 'mMol N m-3';
-%
-  nc{'LZOO_south'} = ncdouble('lzoo_time','s_rho','xi_rho') ;
-  nc{'LZOO_south'}.long_name = ncchar('southern boundary LZOO');
-  nc{'LZOO_south'}.long_name = 'southern boundary LZOO';
-  nc{'LZOO_south'}.units = ncchar('mMol N m-3');
-  nc{'LZOO_south'}.units = 'mMol N m-3';
-%
-end
-%
-if obc(2)==1
-%
-%   Eastern boundary
-%
-  disp('Process Eastern boundary')
-  
-  nc{'NO3_east'} = ncdouble('no3_time','s_rho','eta_rho') ;
-  nc{'NO3_east'}.long_name = ncchar('eastern boundary NO3');
-  nc{'NO3_east'}.long_name = 'eastern boundary NO3';
-  nc{'NO3_east'}.units = ncchar('mMol N m-3');
-  nc{'NO3_east'}.units = 'mMol N m-3';
-%
-  nc{'O2_east'} = ncdouble('o2_time','s_rho','eta_rho') ;
-  nc{'O2_east'}.long_name = ncchar('eastern boundary O2');
-  nc{'O2_east'}.long_name = 'eastern boundary O2';
-  nc{'O2_east'}.units = ncchar('mMol O m-3');
-  nc{'O2_east'}.units = 'mMol N m-3';
-  %
-  nc{'CHLA_east'} = ncdouble('chla_time','s_rho','eta_rho') ;
-  nc{'CHLA_east'}.long_name = ncchar('eastern boundary CHLA');
-  nc{'CHLA_east'}.long_name = 'eastern boundary CHLA';
-  nc{'CHLA_east'}.units = ncchar('mMol N m-3');
-  nc{'CHLA_east'}.units = 'mMol N m-3';
-%
-  nc{'SZOO_east'} = ncdouble('szoo_time','s_rho','eta_rho') ;
-  nc{'SZOO_east'}.long_name = ncchar('eastern boundary SZOO');
-  nc{'SZOO_east'}.long_name = 'eastern boundary SZOO';
-  nc{'SZOO_east'}.units = ncchar('mMol N m-3');
-  nc{'SZOO_east'}.units = 'mMol N m-3';
-%
-  nc{'LZOO_east'} = ncdouble('lzoo_time','s_rho','eta_rho') ;
-  nc{'LZOO_east'}.long_name = ncchar('eastern boundary LZOO');
-  nc{'LZOO_east'}.long_name = 'eastern boundary LZOO';
-  nc{'LZOO_east'}.units = ncchar('mMol N m-3');
-  nc{'LZOO_east'}.units = 'mMol N m-3';
-%
-  nc{'SPHYTO_east'} = ncdouble('sphyto_time','s_rho','eta_rho') ;
-  nc{'SPHYTO_east'}.long_name = ncchar('eastern boundary SPHYTO');
-  nc{'SPHYTO_east'}.long_name = 'eastern boundary SPHYTO';
-  nc{'SPHYTO_east'}.units = ncchar('mMol N m-3');
-  nc{'SPHYTO_east'}.units = 'mMol N m-3';
-%
-  nc{'LPHYTO_east'} = ncdouble('lphyto_time','s_rho','eta_rho') ;
-  nc{'LPHYTO_east'}.long_name = ncchar('eastern boundary LPHYTO');
-  nc{'LPHYTO_east'}.long_name = 'eastern boundary LPHYTO';
-  nc{'LPHYTO_east'}.units = ncchar('mMol N m-3');
-  nc{'LPHYTO_east'}.units = 'mMol N m-3';
-%
-end
-%
-if obc(3)==1
-%
-%   Northern boundary
-%
-  disp('Process Northern boundary')
-  
-  nc{'NO3_north'} = ncdouble('no3_time','s_rho','xi_rho') ;
-  nc{'NO3_north'}.long_name = ncchar('northern boundary NO3');
-  nc{'NO3_north'}.long_name = 'northern boundary NO3';
-  nc{'NO3_north'}.units = ncchar('mMol N m-3');
-  nc{'NO3_north'}.units = 'mMol N m-3';
-%
-  nc{'O2_north'} = ncdouble('o2_time','s_rho','xi_rho') ;
-  nc{'O2_north'}.long_name = ncchar('northern boundary O2');
-  nc{'O2_north'}.long_name = 'northern boundary O2';
-  nc{'O2_north'}.units = ncchar('mMol O m-3');
-  nc{'O2_north'}.units = 'mMol N m-3';
-%
-  nc{'CHLA_north'} = ncdouble('chla_time','s_rho','xi_rho') ;
-  nc{'CHLA_north'}.long_name = ncchar('northern boundary CHLA');
-  nc{'CHLA_north'}.long_name = 'northern boundary CHLA';
-  nc{'CHLA_north'}.units = ncchar('mMol N m-3');
-  nc{'CHLA_north'}.units = 'mMol N m-3';
-%
-  nc{'SZOO_north'} = ncdouble('szoo_time','s_rho','xi_rho') ;
-  nc{'SZOO_north'}.long_name = ncchar('northern boundary SZOO');
-  nc{'SZOO_north'}.long_name = 'northern boundary SZOO';
-  nc{'SZOO_north'}.units = ncchar('mMol N m-3');
-  nc{'SZOO_north'}.units = 'mMol N m-3';
-%
-  nc{'LZOO_north'} = ncdouble('lzoo_time','s_rho','xi_rho') ;
-  nc{'LZOO_north'}.long_name = ncchar('northern boundary LZOO');
-  nc{'LZOO_north'}.long_name = 'northern boundary LZOO';
-  nc{'LZOO_north'}.units = ncchar('mMol N m-3');
-  nc{'LZOO_north'}.units = 'mMol N m-3';
-%
-  nc{'SPHYTO_north'} = ncdouble('sphyto_time','s_rho','xi_rho') ;
-  nc{'SPHYTO_north'}.long_name = ncchar('northern boundary SPHYTO');
-  nc{'SPHYTO_north'}.long_name = 'northern boundary SPHYTO';
-  nc{'SPHYTO_north'}.units = ncchar('mMol N m-3');
-  nc{'SPHYTO_north'}.units = 'mMol N m-3';
-%
-  nc{'LPHYTO_north'} = ncdouble('lphyto_time','s_rho','xi_rho') ;
-  nc{'LPHYTO_north'}.long_name = ncchar('northern boundary LPHYTO');
-  nc{'LPHYTO_north'}.long_name = 'northern boundary LPHYTO';
-  nc{'LPHYTO_north'}.units = ncchar('mMol N m-3');
-  nc{'LPHYTO_north'}.units = 'mMol N m-3';
-%
-end
-%
-if obc(4)==1
-%
-%   Western boundary
-%
-   disp('Process Western boundary')
- 
-  nc{'NO3_west'} = ncdouble('no3_time','s_rho','eta_rho') ;
-  nc{'NO3_west'}.long_name = ncchar('western boundary NO3');
-  nc{'NO3_west'}.long_name = 'western boundary NO3';
-  nc{'NO3_west'}.units = ncchar('mMol N m-3');
-  nc{'NO3_west'}.units = 'mMol N m-3';
-%
-  nc{'O2_west'} = ncdouble('o2_time','s_rho','eta_rho') ;
-  nc{'O2_west'}.long_name = ncchar('western boundary O2');
-  nc{'O2_west'}.long_name = 'western boundary O2';
-  nc{'O2_west'}.units = ncchar('mMol O m-3');
-  nc{'O2_west'}.units = 'mMol N m-3';
-%
-  nc{'CHLA_west'} = ncdouble('chla_time','s_rho','eta_rho') ;
-  nc{'CHLA_west'}.long_name = ncchar('western boundary CHLA');
-  nc{'CHLA_west'}.long_name = 'western boundary CHLA';
-  nc{'CHLA_west'}.units = ncchar('mMol N m-3');
-  nc{'CHLA_west'}.units = 'mMol N m-3';
-%
-  nc{'SPHYTO_west'} = ncdouble('sphyto_time','s_rho','eta_rho') ;
-  nc{'SPHYTO_west'}.long_name = ncchar('western boundary SPHYTO');
-  nc{'SPHYTO_west'}.long_name = 'western boundary SPHYTO';
-  nc{'SPHYTO_west'}.units = ncchar('mMol N m-3');
-  nc{'SPHYTO_west'}.units = 'mMol N m-3';
-%
-  nc{'LPHYTO_west'} = ncdouble('lphyto_time','s_rho','eta_rho') ;
-  nc{'LPHYTO_west'}.long_name = ncchar('western boundary LPHYTO');
-  nc{'LPHYTO_west'}.long_name = 'western boundary LPHYTO';
-  nc{'LPHYTO_west'}.units = ncchar('mMol N m-3');
-  nc{'LPHYTO_west'}.units = 'mMol N m-3';
-%
-  nc{'SZOO_west'} = ncdouble('szoo_time','s_rho','eta_rho') ;
-  nc{'SZOO_west'}.long_name = ncchar('western boundary SZOO');
-  nc{'SZOO_west'}.long_name = 'western boundary SZOO';
-  nc{'SZOO_west'}.units = ncchar('mMol N m-3');
-  nc{'SZOO_west'}.units = 'mMol N m-3';
-%
-  nc{'LZOO_west'} = ncdouble('lzoo_time','s_rho','eta_rho') ;
-  nc{'LZOO_west'}.long_name = ncchar('western boundary LZOO');
-  nc{'LZOO_west'}.long_name = 'western boundary LZOO';
-  nc{'LZOO_west'}.units = ncchar('mMol N m-3');
-  nc{'LZOO_west'}.units = 'mMol N m-3';
-%
-end
-%
-% Leave define mode
-%
-%%result = endef(nc);
-%
-% Write variables
-%
-nc{'szoo_time'}(:) = time_zoo;
-nc{'lzoo_time'}(:) = time_zoo;
-nc{'sphyto_time'}(:) = time_phyto;
-nc{'lphyto_time'}(:) = time_phyto;
-nc{'no3_time'}(:) = time_no3;
-nc{'o2_time'}(:) = time_o2;
-nc{'chla_time'}(:) = time_chla;
-if obc(1)==1
-  nc{'NO3_south'}(:)  =  0;
-  nc{'O2_south'}(:)  =  0;
-  nc{'CHLA_south'}(:)  =  0;
-  nc{'SPHYTO_south'}(:) =  0;
-  nc{'LPHYTO_south'}(:) =  0;
-  nc{'SZOO_south'}(:)   =  0;
-  nc{'LZOO_south'}(:)   =  0;
-end 
-if obc(2)==1
-  nc{'NO3_east'}(:)  =  0;
-  nc{'O2_east'}(:)  =  0;
-  nc{'CHLA_east'}(:)  =  0;
-  nc{'SPHYTO_east'}(:) =  0;
-  nc{'LPHYTO_east'}(:) =  0;
-  nc{'SZOO_east'}(:)   =  0;
-  nc{'LZOO_east'}(:)   =  0;
-end 
-if obc(3)==1
-  nc{'NO3_north'}(:)  =  0;
-  nc{'O2_north'}(:)  =  0;
-  nc{'CHLA_north'}(:)  =  0;
-  nc{'SPHYTO_north'}(:) =  0;
-  nc{'LPHYTO_north'}(:) =  0;
-  nc{'SZOO_north'}(:)   =  0;
-  nc{'LZOO_north'}(:)   =  0;
-end 
-if obc(4)==1
-  nc{'NO3_west'}(:)  =  0;
-  nc{'O2_west'}(:)  =  0;
-  nc{'CHLA_west'}(:)  =  0;
-  nc{'SPHYTO_west'}(:) =  0;
-  nc{'LPHYTO_west'}(:) =  0;
-  nc{'SZOO_west'}(:)   =  0;
-  nc{'LZOO_west'}(:)   =  0;
-end 
-close(nc)
-return
-
diff --git a/Preprocessing_tools/add_bry_bioebus_Z.m b/Preprocessing_tools/add_bry_bioebus_Z.m
deleted file mode 100644
index 4a953a06..00000000
--- a/Preprocessing_tools/add_bry_bioebus_Z.m
+++ /dev/null
@@ -1,341 +0,0 @@
-function add_bry_bioebus_Z(zbryname,obc,Z,time_no3,time_o2,time_zoo,time_phyto,time_chla,cycle,clobber);
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%                                                                 %
-%   function add_bry_bioebus_Z(zbryname,obc,...                    %
-%                             Z,time,cycle,clobber);              %
-%                                                                 %
-%   This function create the header of a Netcdf climatology       %
-%   file.                                                         %
-%                                                                 %
-%   Input:                                                        %
-%                                                                 %
-%   zbryname     Netcdf climatology file name (character string). %
-%   obc          open boundaries flag (1=open , [S E N W]).       %
-%   Z            Depth of vertical levels.(Vector)                %
-%   time         time.(vector)                                    %
-%   cycle        Length (days) for cycling the climatology.(Real) %
-%   clobber      Switch to allow or not writing over an existing  %
-%                file.(character string)                          %
-%                                                                 %
-%  Pierrick Penven, IRD, 2005.                                    %
-%  Olivier Aumont the master, IRD, 2006.                          %
-%  Patricio Marchesiello, chief, IRD, 2007.                       %
-%  Christophe Eugene Raoul Menkes, the slave, IRD, 2007.          %
-%  Gildas Cambon, IRD/LEGOS, 2013 : Add O2 processing             %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-disp(' ')
-disp([' Adding BioEBUS data into file : ',zbryname])
-disp(' ')
-%
-%  Create the boundary file
-%
-nc = netcdf(zbryname,clobber);
-%%result = redef(nc);
-%
-%  Create dimensions
-%
-nc('no3_time') = length(time_no3);
-nc('o2_time') = length(time_o2);
-nc('chla_time') = length(time_chla);
-nc('szoo_time') = length(time_zoo);
-nc('lzoo_time') = length(time_zoo);
-nc('sphyto_time') = length(time_phyto);
-nc('lphyto_time') = length(time_phyto);
-nc('one') = 1;
-%
-%  Create variables and attributes
-%
-nc{'no3_time'} = ncdouble('no3_time') ;
-nc{'no3_time'}.long_name = ncchar('time for NO3 climatology')
-nc{'no3_time'}.long_name = 'time for NO3 climatology';
-nc{'no3_time'}.units = ncchar('day');
-nc{'no3_time'}.units = 'day';
-nc{'no3_time'}.cycle_length = cycle;
-%
-nc{'o2_time'} = ncdouble('o2_time') ;
-nc{'o2_time'}.long_name = ncchar('time for O2 climatology')
-nc{'o2_time'}.long_name = 'time for O2 climatology';
-nc{'o2_time'}.units = ncchar('day');
-nc{'o2_time'}.units = 'day';
-nc{'o2_time'}.cycle_length = cycle;
-%
-nc{'chla_time'} = ncdouble('chla_time') ;
-nc{'chla_time'}.long_name = ncchar('time for CHLA climatology');
-nc{'chla_time'}.long_name = 'time for CHLA climatology';
-nc{'chla_time'}.units = ncchar('day');
-nc{'chla_time'}.units = 'day';
-nc{'chla_time'}.cycle_length = cycle;%
-%
-nc{'sphyto_time'} = ncdouble('sphyto_time') ;
-nc{'sphyto_time'}.long_name = ncchar('time for SPHYTO climatology');
-nc{'sphyto_time'}.long_name = 'time for SPHYTO climatology';
-nc{'sphyto_time'}.units = ncchar('day');
-nc{'sphyto_time'}.units = 'day';
-nc{'sphyto_time'}.cycle_length = cycle;%
-%
-nc{'lphyto_time'} = ncdouble('lphyto_time') ;
-nc{'lphyto_time'}.long_name = ncchar('time for LPHYTO climatology');
-nc{'lphyto_time'}.long_name = 'time for LPHYTO climatology';
-nc{'lphyto_time'}.units = ncchar('day');
-nc{'lphyto_time'}.units = 'day';
-nc{'lphyto_time'}.cycle_length = cycle;%
-%
-nc{'szoo_time'} = ncdouble('szoo_time') ;
-nc{'szoo_time'}.long_name = ncchar('time for SZOO climatology');
-nc{'szoo_time'}.long_name = 'time for SZOO climatology';
-nc{'szoo_time'}.units = ncchar('day');
-nc{'szoo_time'}.units = 'day';
-nc{'szoo_time'}.cycle_length = cycle;
-%
-nc{'lzoo_time'} = ncdouble('lzoo_time') ;
-nc{'lzoo_time'}.long_name = ncchar('time for LZOO climatology');
-nc{'lzoo_time'}.long_name = 'time for LZOO climatology';
-nc{'lzoo_time'}.units = ncchar('day');
-nc{'lzoo_time'}.units = 'day';
-nc{'lzoo_time'}.cycle_length = cycle;
-%
-
-if obc(1)==1
-%
-%   Southern boundary
-%
-  nc{'NO3_south'} = ncdouble('no3_time','Z','xi_rho') ;
-  nc{'NO3_south'}.long_name = ncchar('southern boundary NO3');
-  nc{'NO3_south'}.long_name = 'southern boundary NO3';
-  nc{'NO3_south'}.units = ncchar('mMol N m-3');
-  nc{'NO3_south'}.units = 'mMol N m-3';
-%
-  nc{'O2_south'} = ncdouble('o2_time','Z','xi_rho') ;
-  nc{'O2_south'}.long_name = ncchar('southern boundary O2');
-  nc{'O2_south'}.long_name = 'southern boundary O2';
-  nc{'O2_south'}.units = ncchar('mMol O m-3');
-  nc{'O2_south'}.units = 'mMol O m-3';
-%
-  nc{'CHLA_south'} = ncdouble('chla_time','Z','xi_rho') ;
-  nc{'CHLA_south'}.long_name = ncchar('southern boundary CHLA');
-  nc{'CHLA_south'}.long_name = 'southern boundary CHLA';
-  nc{'CHLA_south'}.units = ncchar('mMol N m-3');
-  nc{'CHLA_south'}.units = 'mMol N m-3';
-%
-  nc{'SZOO_south'} = ncdouble('szoo_time','Z','xi_rho') ;
-  nc{'SZOO_south'}.long_name = ncchar('southern boundary SZOO');
-  nc{'SZOO_south'}.long_name = 'southern boundary SZOO';
-  nc{'SZOO_south'}.units = ncchar('mMol N m-3');
-  nc{'SZOO_south'}.units = 'mMol N m-3';
-%
-  nc{'LZOO_south'} = ncdouble('lzoo_time','Z','xi_rho') ;
-  nc{'LZOO_south'}.long_name = ncchar('southern boundary LZOO');
-  nc{'LZOO_south'}.long_name = 'southern boundary LZOO';
-  nc{'LZOO_south'}.units = ncchar('mMol N m-3');
-  nc{'LZOO_south'}.units = 'mMol N m-3';
-%
-  nc{'SPHYTO_south'} = ncdouble('sphyto_time','Z','xi_rho') ;
-  nc{'SPHYTO_south'}.long_name = ncchar('southern boundary SPHYTO');
-  nc{'SPHYTO_south'}.long_name = 'southern boundary SPHYTO';
-  nc{'SPHYTO_south'}.units = ncchar('mMol N m-3');
-  nc{'SPHYTO_south'}.units = 'mMol N m-3';
-%
-  nc{'LPHYTO_south'} = ncdouble('lphyto_time','Z','xi_rho') ;
-  nc{'LPHYTO_south'}.long_name = ncchar('southern boundary LPHYTO');
-  nc{'LPHYTO_south'}.long_name = 'southern boundary LPHYTO';
-  nc{'LPHYTO_south'}.units = ncchar('mMol N m-3');
-  nc{'LPHYTO_south'}.units = 'mMol N m-3';
-end
-%
-if obc(2)==1
-%
-%   Eastern boundary
-%
-  nc{'NO3_east'} = ncdouble('no3_time','Z','eta_rho') ;
-  nc{'NO3_east'}.long_name = ncchar('eastern boundary NO3');
-  nc{'NO3_east'}.long_name = 'eastern boundary NO3';
-  nc{'NO3_east'}.units = ncchar('mMol N m-3');
-  nc{'NO3_east'}.units = 'mMol N m-3';
-%
-  nc{'O2_east'} = ncdouble('o2_time','Z','eta_rho') ;
-  nc{'O2_east'}.long_name = ncchar('eastern boundary O2');
-  nc{'O2_east'}.long_name = 'eastern boundary O2';
-  nc{'O2_east'}.units = ncchar('mMol O m-3');
-  nc{'O2_east'}.units = 'mMol O m-3';
-%
-  nc{'CHLA_east'} = ncdouble('chla_time','Z','eta_rho') ;
-  nc{'CHLA_east'}.long_name = ncchar('eastern boundary CHLA');
-  nc{'CHLA_east'}.long_name = 'eastern boundary CHLA';
-  nc{'CHLA_east'}.units = ncchar('mMol N m-3');
-  nc{'CHLA_east'}.units = 'mMol N m-3';
-%
-  nc{'SZOO_east'} = ncdouble('szoo_time','Z','eta_rho') ;
-  nc{'SZOO_east'}.long_name = ncchar('eastern boundary SZOO');
-  nc{'SZOO_east'}.long_name = 'eastern boundary SZOO';
-  nc{'SZOO_east'}.units = ncchar('mMol N m-3');
-  nc{'SZOO_east'}.units = 'mMol N m-3';
-%
-  nc{'LZOO_east'} = ncdouble('lzoo_time','Z','eta_rho') ;
-  nc{'LZOO_east'}.long_name = ncchar('eastern boundary LZOO');
-  nc{'LZOO_east'}.long_name = 'eastern boundary LZOO';
-  nc{'LZOO_east'}.units = ncchar('mMol N m-3');
-  nc{'LZOO_east'}.units = 'mMol N m-3';
-%
-  nc{'SPHYTO_east'} = ncdouble('sphyto_time','Z','eta_rho') ;
-  nc{'SPHYTO_east'}.long_name = ncchar('eastern boundary SPHYTO');
-  nc{'SPHYTO_east'}.long_name = 'eastern boundary SPHYTO';
-  nc{'SPHYTO_east'}.units = ncchar('mMol N m-3');
-  nc{'SPHYTO_east'}.units = 'mMol N m-3';
-%
-  nc{'LPHYTO_east'} = ncdouble('lphyto_time','Z','eta_rho') ;
-  nc{'LPHYTO_east'}.long_name = ncchar('eastern boundary LPHYTO');
-  nc{'LPHYTO_east'}.long_name = 'eastern boundary LPHYTO';
-  nc{'LPHYTO_east'}.units = ncchar('mMol N m-3');
-  nc{'LPHYTO_east'}.units = 'mMol N m-3';
-%
-end
-%
-if obc(3)==1
-%
-%   Northern boundary
-%
-  nc{'NO3_north'} = ncdouble('no3_time','Z','xi_rho') ;
-  nc{'NO3_north'}.long_name = ncchar('northern boundary NO3');
-  nc{'NO3_north'}.long_name = 'northern boundary NO3';
-  nc{'NO3_north'}.units = ncchar('mMol N m-3');
-  nc{'NO3_north'}.units = 'mMol N m-3';
-%
-  nc{'O2_north'} = ncdouble('o2_time','Z','xi_rho') ;
-  nc{'O2_north'}.long_name = ncchar('northern boundary O2');
-  nc{'O2_north'}.long_name = 'northern boundary O2';
-  nc{'O2_north'}.units = ncchar('mMol O m-3');
-  nc{'O2_north'}.units = 'mMol O m-3';
-%
-  nc{'CHLA_north'} = ncdouble('chla_time','Z','xi_rho') ;
-  nc{'CHLA_north'}.long_name = ncchar('northern boundary CHLA');
-  nc{'CHLA_north'}.long_name = 'northern boundary CHLA';
-  nc{'CHLA_north'}.units = ncchar('mMol N m-3');
-  nc{'CHLA_north'}.units = 'mMol N m-3';
-%
-  nc{'SZOO_north'} = ncdouble('szoo_time','Z','xi_rho') ;
-  nc{'SZOO_north'}.long_name = ncchar('northern boundary SZOO');
-  nc{'SZOO_north'}.long_name = 'northern boundary SZOO';
-  nc{'SZOO_north'}.units = ncchar('mMol N m-3');
-  nc{'SZOO_north'}.units = 'mMol N m-3';
-%
-  nc{'LZOO_north'} = ncdouble('lzoo_time','Z','xi_rho') ;
-  nc{'LZOO_north'}.long_name = ncchar('northern boundary LZOO');
-  nc{'LZOO_north'}.long_name = 'northern boundary LZOO';
-  nc{'LZOO_north'}.units = ncchar('mMol N m-3');
-  nc{'LZOO_north'}.units = 'mMol N m-3';
-%
-  nc{'SPHYTO_north'} = ncdouble('sphyto_time','Z','xi_rho') ;
-  nc{'SPHYTO_north'}.long_name = ncchar('northern boundary SPHYTO');
-  nc{'SPHYTO_north'}.long_name = 'northern boundary SPHYTO';
-  nc{'SPHYTO_north'}.units = ncchar('mMol N m-3');
-  nc{'SPHYTO_north'}.units = 'mMol N m-3';
-%
-  nc{'LPHYTO_north'} = ncdouble('lphyto_time','Z','xi_rho') ;
-  nc{'LPHYTO_north'}.long_name = ncchar('northern boundary LPHYTO');
-  nc{'LPHYTO_north'}.long_name = 'northern boundary LPHYTO';
-  nc{'LPHYTO_north'}.units = ncchar('mMol N m-3');
-  nc{'LPHYTO_north'}.units = 'mMol N m-3';
-%
-end
-%
-if obc(4)==1
-%
-%   Western boundary
-%
-  nc{'NO3_west'} = ncdouble('no3_time','Z','eta_rho') ;
-  nc{'NO3_west'}.long_name = ncchar('western boundary NO3');
-  nc{'NO3_west'}.long_name = 'western boundary NO3';
-  nc{'NO3_west'}.units = ncchar('mMol N m-3');
-  nc{'NO3_west'}.units = 'mMol N m-3';
-%
-  nc{'O2_west'} = ncdouble('no3_time','Z','eta_rho') ;
-  nc{'O2_west'}.long_name = ncchar('western boundary O2');
-  nc{'O2_west'}.long_name = 'western boundary O2';
-  nc{'O2_west'}.units = ncchar('mMol O m-3');
-  nc{'O2_west'}.units = 'mMol O m-3';
-%
-  nc{'CHLA_west'} = ncdouble('chla_time','Z','eta_rho') ;
-  nc{'CHLA_west'}.long_name = ncchar('western boundary CHLA');
-  nc{'CHLA_west'}.long_name = 'western boundary CHLA';
-  nc{'CHLA_west'}.units = ncchar('mMol N m-3');
-  nc{'CHLA_west'}.units = 'mMol N m-3';
-%
-  nc{'SZOO_west'} = ncdouble('szoo_time','Z','eta_rho') ;
-  nc{'SZOO_west'}.long_name = ncchar('western boundary SZOO');
-  nc{'SZOO_west'}.long_name = 'western boundary SZOO';
-  nc{'SZOO_west'}.units = ncchar('mMol N m-3');
-  nc{'SZOO_west'}.units = 'mMol N m-3';
-%
-  nc{'LZOO_west'} = ncdouble('lzoo_time','Z','eta_rho') ;
-  nc{'LZOO_west'}.long_name = ncchar('western boundary LZOO');
-  nc{'LZOO_west'}.long_name = 'western boundary LZOO';
-  nc{'LZOO_west'}.units = ncchar('mMol N m-3');
-  nc{'LZOO_west'}.units = 'mMol N m-3';
-%
-  nc{'SPHYTO_west'} = ncdouble('sphyto_time','Z','eta_rho') ;
-  nc{'SPHYTO_west'}.long_name = ncchar('western boundary SPHYTO');
-  nc{'SPHYTO_west'}.long_name = 'western boundary SPHYTO';
-  nc{'SPHYTO_west'}.units = ncchar('mMol N m-3');
-  nc{'SPHYTO_west'}.units = 'mMol N m-3';
-%
-  nc{'LPHYTO_west'} = ncdouble('lphyto_time','Z','eta_rho') ;
-  nc{'LPHYTO_west'}.long_name = ncchar('western boundary LPHYTO');
-  nc{'LPHYTO_west'}.long_name = 'western boundary LPHYTO';
-  nc{'LPHYTO_west'}.units = ncchar('mMol N m-3');
-  nc{'LPHYTO_west'}.units = 'mMol N m-3';
-%
-end
-%
-% Leave define mode
-%
-%%result = endef(nc);
-%
-% Write variables
-%
-nc{'no3_time'}(:) = time_no3;
-nc{'o2_time'}(:) = time_no3;
-nc{'chla_time'}(:) = time_chla;
-nc{'szoo_time'}(:) = time_zoo;
-nc{'lzoo_time'}(:) = time_zoo;
-nc{'sphyto_time'}(:) = time_phyto;
-nc{'lphyto_time'}(:) = time_phyto;
-if obc(1)==1
-  nc{'NO3_south'}(:)  =  0;
-  nc{'O2_south'}(:)  =  0;
-  nc{'CHLA_south'}(:)  =  0;
-  nc{'SZOO_south'}(:) =  0;
-  nc{'LZOO_south'}(:) =  0;
-  nc{'SPHYTO_south'}(:)   =  0;
-  nc{'LPHYTO_south'}(:)   =  0;
-end
-if obc(2)==1 
-  nc{'NO3_east'}(:)  =  0;
-  nc{'O2_east'}(:)  =  0;
-  nc{'CHLA_east'}(:)  =  0;
-  nc{'SZOO_east'}(:) =  0;
-  nc{'LZOO_east'}(:) =  0;
-  nc{'SPHYTO_east'}(:)   =  0;
-  nc{'LPHYTO_east'}(:)   =  0;
-end 
-if obc(3)==1 
-  nc{'NO3_north'}(:)  =  0;
-  nc{'O2_north'}(:)  =  0;
-  nc{'CHLA_north'}(:)  =  0;
-  nc{'SZOO_north'}(:) =  0;
-  nc{'LZOO_north'}(:) =  0;
-  nc{'SPHYTO_north'}(:)   =  0;
-  nc{'LPHYTO_north'}(:)   =  0;
-end 
-if obc(4)==1 
-  nc{'NO3_west'}(:)  =  0;
-  nc{'O2_west'}(:)  =  0;
-  nc{'CHLA_west'}(:)  =  0;
-  nc{'SZOO_west'}(:) =  0;
-  nc{'LZOO_west'}(:) =  0;
-  nc{'SPHYTO_west'}(:)   =  0;
-  nc{'LPHYTO_west'}(:)   =  0;
-end 
-close(nc)
-return
-
-
diff --git a/Preprocessing_tools/add_bry_npzd.m b/Preprocessing_tools/add_bry_npzd.m
deleted file mode 100644
index 9cd49e6b..00000000
--- a/Preprocessing_tools/add_bry_npzd.m
+++ /dev/null
@@ -1,298 +0,0 @@
-function add_bry_npzd(bryname,obc,time_no3,time_o2,time_zoo,time_phyto,time_chla,cycle,clobber);
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%                                                                 
-% function add_bry_bgc(bryname,grdname,title,obc...            
-%                         theta_s,theta_b,hc,N,...                
-%                         time,cycle,clobber);                    
-%                                                                 
-%   This function create the header of a Netcdf climatology       
-%   file.                                                         
-%                                                                 
-%   Input:                                                        
-%                                                                 
-%   bryname      Netcdf climatology file name (character string). 
-%   obc          open boundaries flag (1=open , [S E N W]).       
-%   time         time.(vector)                                    
-%   cycle        Length (days) for cycling the climatology.(Real) 
-%   clobber      Switch to allow or not writing over an existing  
-%                file.(character string)                          
-%
-%  Further Information:  
-%  http://www.croco-ocean.org
-%  
-%  This file is part of CROCOTOOLS
-%
-%  CROCOTOOLS is free software; you can redistribute it and/or modify
-%  it under the terms of the GNU General Public License as published
-%  by the Free Software Foundation; either version 2 of the License,
-%  or (at your option) any later version.
-%
-%  CROCOTOOLS is distributed in the hope that it will be useful, but
-%  WITHOUT ANY WARRANTY; without even the implied warranty of
-%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-%  GNU General Public License for more details.
-%
-%  You should have received a copy of the GNU General Public License
-%  along with this program; if not, write to the Free Software
-%  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-%  MA  02111-1307  USA
-%
-%  Copyright (c) 2001-2006 by Pierrick Penven 
-%  e-mail:Pierrick.Penven@ird.fr  
-%  Pierrick Penven, IRD, 2005.                                    %
-%  Olivier Aumont the master, IRD, 2006.                          %
-%  Patricio Marchesiello, chief, IRD, 2007.                       %
-%  Christophe Eugene Raoul Menkes, the slave, IRD, 2007.          %
-%  Gildas Cambon, IRD, 2011                                       %
-%  Gildas Cambon, IRD, 2013 : Add oxygen processing               %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-disp(' ')
-disp([' Adding NPZD BGC data into file : ',bryname])
-disp(' ')
-%
-%  Redefine the boundary file
-%
-nc = netcdf(bryname,clobber);
-%%result = redef(nc);
-%
-%  Create dimensions
-%
-nc('no3_time')  = length(time_no3);
-nc('o2_time')  = length(time_o2);
-nc('chla_time')  = length(time_chla);
-nc('phyto_time') = length(time_phyto);
-nc('zoo_time')   = length(time_zoo);
-nc('one') = 1;
-%
-%  Create variables and attributes
-%
-nc{'no3_time'} = ncdouble('no3_time') ;
-nc{'no3_time'}.long_name = ncchar('time for NO3 climatology')
-nc{'no3_time'}.long_name = 'time for NO3 climatology';
-nc{'no3_time'}.units = ncchar('day');
-nc{'no3_time'}.units = 'day';
-nc{'no3_time'}.cycle_length = cycle;%
-%
-nc{'o2_time'} = ncdouble('o2_time') ;
-nc{'o2_time'}.long_name = ncchar('time for O2 climatology')
-nc{'o2_time'}.long_name = 'time for O2 climatology';
-nc{'o2_time'}.units = ncchar('day');
-nc{'o2_time'}.units = 'day';
-nc{'o2_time'}.cycle_length = cycle;
-%
-nc{'chla_time'} = ncdouble('chla_time') ;
-nc{'chla_time'}.long_name = ncchar('time for CHLA climatology');
-nc{'chla_time'}.long_name = 'time for CHLA climatology';
-nc{'chla_time'}.units = ncchar('day');
-nc{'chla_time'}.units = 'day';
-nc{'chla_time'}.cycle_length = cycle;%
-%
-nc{'phyto_time'} = ncdouble('phyto_time') ;
-nc{'phyto_time'}.long_name = ncchar('time for PHYTO climatology');
-nc{'phyto_time'}.long_name = 'time for PHYTO climatology';
-nc{'phyto_time'}.units = ncchar('day');
-nc{'phyto_time'}.units = 'day';
-nc{'phyto_time'}.cycle_length = cycle;%
-%
-nc{'zoo_time'} = ncdouble('zoo_time') ;
-nc{'zoo_time'}.long_name = ncchar('time for ZOO climatology');
-nc{'zoo_time'}.long_name = 'time for ZOO climatology';
-nc{'zoo_time'}.units = ncchar('day');
-nc{'zoo_time'}.units = 'day';
-nc{'zoo_time'}.cycle_length = cycle;%
-%
-%
-if obc(1)==1
-%
-%   Southern boundary
-%
-  disp('Process Southern boundary')
-  
-  nc{'NO3_south'} = ncdouble('no3_time','s_rho','xi_rho') ;
-  nc{'NO3_south'}.long_name = ncchar('southern boundary NO3');
-  nc{'NO3_south'}.long_name = 'southern boundary NO3';
-  nc{'NO3_south'}.units = ncchar('mMol N m-3');
-  nc{'NO3_south'}.units = 'mMol N m-3';
-%
-  nc{'O2_south'} = ncdouble('o2_time','s_rho','xi_rho') ;
-  nc{'O2_south'}.long_name = ncchar('southern boundary O2');
-  nc{'O2_south'}.long_name = 'southern boundary O2';
-  nc{'O2_south'}.units = ncchar('mMol O m-3');
-  nc{'O2_south'}.units = 'mMol N m-3';
-  %
-  nc{'CHLA_south'} = ncdouble('chla_time','s_rho','xi_rho') ;
-  nc{'CHLA_south'}.long_name = ncchar('southern boundary CHLA');
-  nc{'CHLA_south'}.long_name = 'southern boundary CHLA';
-  nc{'CHLA_south'}.units = ncchar('mMol N m-3');
-  nc{'CHLA_south'}.units = 'mMol N m-3';
-%
-  nc{'PHYTO_south'} = ncdouble('phyto_time','s_rho','xi_rho') ;
-  nc{'PHYTO_south'}.long_name = ncchar('southern boundary PHYTO');
-  nc{'PHYTO_south'}.long_name = 'southern boundary PHYTO';
-  nc{'PHYTO_south'}.units = ncchar('mMol N m-3');
-  nc{'PHYTO_south'}.units = 'mMol N m-3';
-%
-  nc{'ZOO_south'} = ncdouble('zoo_time','s_rho','xi_rho') ;
-  nc{'ZOO_south'}.long_name = ncchar('southern boundary ZOO');
-  nc{'ZOO_south'}.long_name = 'southern boundary ZOO';
-  nc{'ZOO_south'}.units = ncchar('mMol N m-3');
-  nc{'ZOO_south'}.units = 'mMol N m-3';
-%
-end
-%
-if obc(2)==1
-%
-%   Eastern boundary
-%
-  disp('Process Esater boundary')
-  
-  nc{'NO3_east'} = ncdouble('no3_time','s_rho','eta_rho') ;
-  nc{'NO3_east'}.long_name = ncchar('eastern boundary NO3');
-  nc{'NO3_east'}.long_name = 'eastern boundary NO3';
-  nc{'NO3_east'}.units = ncchar('mMol N m-3');
-  nc{'NO3_east'}.units = 'mMol N m-3';
-%
-  nc{'O2_east'} = ncdouble('o2_time','s_rho','eta_rho') ;
-  nc{'O2_east'}.long_name = ncchar('eastern boundary O2');
-  nc{'O2_east'}.long_name = 'eastern boundary O2';
-  nc{'O2_east'}.units = ncchar('mMol O m-3');
-  nc{'O2_east'}.units = 'mMol N m-3';
-  %
-  nc{'CHLA_east'} = ncdouble('chla_time','s_rho','eta_rho') ;
-  nc{'CHLA_east'}.long_name = ncchar('eastern boundary CHLA');
-  nc{'CHLA_east'}.long_name = 'eastern boundary CHLA';
-  nc{'CHLA_east'}.units = ncchar('mMol N m-3');
-  nc{'CHLA_east'}.units = 'mMol N m-3';
-%
-  nc{'ZOO_east'} = ncdouble('zoo_time','s_rho','eta_rho') ;
-  nc{'ZOO_east'}.long_name = ncchar('eastern boundary ZOO');
-  nc{'ZOO_east'}.long_name = 'eastern boundary ZOO';
-  nc{'ZOO_east'}.units = ncchar('mMol N m-3');
-  nc{'ZOO_east'}.units = 'mMol N m-3';
-%
-  nc{'PHYTO_east'} = ncdouble('phyto_time','s_rho','eta_rho') ;
-  nc{'PHYTO_east'}.long_name = ncchar('eastern boundary PHYTO');
-  nc{'PHYTO_east'}.long_name = 'eastern boundary PHYTO';
-  nc{'PHYTO_east'}.units = ncchar('mMol N m-3');
-  nc{'PHYTO_east'}.units = 'mMol N m-3';
-%
-end
-%
-if obc(3)==1
-%
-%   Northern boundary
-%
-  disp('Process Northern boundary')
-  
-  nc{'NO3_north'} = ncdouble('no3_time','s_rho','xi_rho') ;
-  nc{'NO3_north'}.long_name = ncchar('northern boundary NO3');
-  nc{'NO3_north'}.long_name = 'northern boundary NO3';
-  nc{'NO3_north'}.units = ncchar('mMol N m-3');
-  nc{'NO3_north'}.units = 'mMol N m-3';
-%
-  nc{'O2_north'} = ncdouble('o2_time','s_rho','xi_rho') ;
-  nc{'O2_north'}.long_name = ncchar('northern boundary O2');
-  nc{'O2_north'}.long_name = 'northern boundary O2';
-  nc{'O2_north'}.units = ncchar('mMol O m-3');
-  nc{'O2_north'}.units = 'mMol N m-3';
-%
-  nc{'CHLA_north'} = ncdouble('chla_time','s_rho','xi_rho') ;
-  nc{'CHLA_north'}.long_name = ncchar('northern boundary CHLA');
-  nc{'CHLA_north'}.long_name = 'northern boundary CHLA';
-  nc{'CHLA_north'}.units = ncchar('mMol N m-3');
-  nc{'CHLA_north'}.units = 'mMol N m-3';
-%
-  nc{'ZOO_north'} = ncdouble('zoo_time','s_rho','xi_rho') ;
-  nc{'ZOO_north'}.long_name = ncchar('northern boundary ZOO');
-  nc{'ZOO_north'}.long_name = 'northern boundary ZOO';
-  nc{'ZOO_north'}.units = ncchar('mMol N m-3');
-  nc{'ZOO_north'}.units = 'mMol N m-3';
-%
-  nc{'PHYTO_north'} = ncdouble('phyto_time','s_rho','xi_rho') ;
-  nc{'PHYTO_north'}.long_name = ncchar('northern boundary PHYTO');
-  nc{'PHYTO_north'}.long_name = 'northern boundary PHYTO';
-  nc{'PHYTO_north'}.units = ncchar('mMol N m-3');
-  nc{'PHYTO_north'}.units = 'mMol N m-3';
-%
-end
-%
-if obc(4)==1
-%
-%   Western boundary
-%
-   disp('Process Western boundary')
- 
-  nc{'NO3_west'} = ncdouble('no3_time','s_rho','eta_rho') ;
-  nc{'NO3_west'}.long_name = ncchar('western boundary NO3');
-  nc{'NO3_west'}.long_name = 'western boundary NO3';
-  nc{'NO3_west'}.units = ncchar('mMol N m-3');
-  nc{'NO3_west'}.units = 'mMol N m-3';
-%
-  nc{'O2_west'} = ncdouble('o2_time','s_rho','eta_rho') ;
-  nc{'O2_west'}.long_name = ncchar('western boundary O2');
-  nc{'O2_west'}.long_name = 'western boundary O2';
-  nc{'O2_west'}.units = ncchar('mMol O m-3');
-  nc{'O2_west'}.units = 'mMol N m-3';
-%
-  nc{'CHLA_west'} = ncdouble('chla_time','s_rho','eta_rho') ;
-  nc{'CHLA_west'}.long_name = ncchar('western boundary CHLA');
-  nc{'CHLA_west'}.long_name = 'western boundary CHLA';
-  nc{'CHLA_west'}.units = ncchar('mMol N m-3');
-  nc{'CHLA_west'}.units = 'mMol N m-3';
-%
-  nc{'PHYTO_west'} = ncdouble('phyto_time','s_rho','eta_rho') ;
-  nc{'PHYTO_west'}.long_name = ncchar('western boundary PHYTO');
-  nc{'PHYTO_west'}.long_name = 'western boundary PHYTO';
-  nc{'PHYTO_west'}.units = ncchar('mMol N m-3');
-  nc{'PHYTO_west'}.units = 'mMol N m-3';
-%
-  nc{'ZOO_west'} = ncdouble('zoo_time','s_rho','eta_rho') ;
-  nc{'ZOO_west'}.long_name = ncchar('western boundary ZOO');
-  nc{'ZOO_west'}.long_name = 'western boundary ZOO';
-  nc{'ZOO_west'}.units = ncchar('mMol N m-3');
-  nc{'ZOO_west'}.units = 'mMol N m-3';
-%
-end
-%
-% Leave define mode
-%
-%%result = endef(nc);
-%
-% Write variables
-%
-nc{'zoo_time'}(:) = time_zoo;
-nc{'phyto_time'}(:) = time_phyto;
-nc{'no3_time'}(:) = time_no3;
-nc{'o2_time'}(:) = time_o2;
-nc{'chla_time'}(:) = time_chla;
-if obc(1)==1
-  nc{'NO3_south'}(:)  =  0;
-  nc{'O2_south'}(:)  =  0;
-  nc{'CHLA_south'}(:)  =  0;
-  nc{'PHYTO_south'}(:) =  0;
-  nc{'ZOO_south'}(:)   =  0;
-end 
-if obc(2)==1
-  nc{'NO3_east'}(:)  =  0;
-  nc{'O2_east'}(:)  =  0;
-  nc{'CHLA_east'}(:)  =  0;
-  nc{'PHYTO_east'}(:) =  0;
-  nc{'ZOO_east'}(:)   =  0;
-end 
-if obc(3)==1
-  nc{'NO3_north'}(:)  =  0;
-  nc{'O2_north'}(:)  =  0;
-  nc{'CHLA_north'}(:)  =  0;
-  nc{'PHYTO_north'}(:) =  0;
-  nc{'ZOO_north'}(:)   =  0;
-end 
-if obc(4)==1
-  nc{'NO3_west'}(:)  =  0;
-  nc{'O2_west'}(:)  =  0;
-  nc{'CHLA_west'}(:)  =  0;
-  nc{'PHYTO_west'}(:) =  0;
-  nc{'ZOO_west'}(:)   =  0;
-end 
-close(nc)
-return
-
diff --git a/Preprocessing_tools/add_bry_npzd_Z.m b/Preprocessing_tools/add_bry_npzd_Z.m
deleted file mode 100644
index c1755f6a..00000000
--- a/Preprocessing_tools/add_bry_npzd_Z.m
+++ /dev/null
@@ -1,267 +0,0 @@
-function add_bry_npzd_Z(zbryname,obc,Z,time_no3,time_o2,time_zoo,time_phyto,time_chla,cycle,clobber);
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%                                                                 %
-%   function add_bry_npzd_Z(zbryname,obc,...                    %
-%                             Z,time,cycle,clobber);              %
-%                                                                 %
-%   This function create the header of a Netcdf climatology       %
-%   file.                                                         %
-%                                                                 %
-%   Input:                                                        %
-%                                                                 %
-%   zbryname     Netcdf climatology file name (character string). %
-%   obc          open boundaries flag (1=open , [S E N W]).       %
-%   Z            Depth of vertical levels.(Vector)                %
-%   time         time.(vector)                                    %
-%   cycle        Length (days) for cycling the climatology.(Real) %
-%   clobber      Switch to allow or not writing over an existing  %
-%                file.(character string)                          %
-%                                                                 %
-%  Pierrick Penven, IRD, 2005.                                    %
-%  Olivier Aumont the master, IRD, 2006.                          %
-%  Patricio Marchesiello, chief, IRD, 2007.                       %
-%  Christophe Eugene Raoul Menkes, the slave, IRD, 2007.          %
-%  Gildas Cambon, IRD/LEGOS, 2013 : Add O2 processing             %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-disp(' ')
-disp([' Adding NPZD data into file : ',zbryname])
-disp(' ')
-%
-%  Create the boundary file
-%
-nc = netcdf(zbryname,clobber);
-%%result = redef(nc);
-%
-%  Create dimensions
-%
-nc('no3_time') = length(time_no3);
-nc('o2_time') = length(time_o2);
-nc('chla_time') = length(time_chla);
-nc('zoo_time') = length(time_zoo);
-nc('phyto_time') = length(time_phyto);
-nc('one') = 1;
-%
-%  Create variables and attributes
-%
-nc{'no3_time'} = ncdouble('no3_time') ;
-nc{'no3_time'}.long_name = ncchar('time for NO3 climatology')
-nc{'no3_time'}.long_name = 'time for NO3 climatology';
-nc{'no3_time'}.units = ncchar('day');
-nc{'no3_time'}.units = 'day';
-nc{'no3_time'}.cycle_length = cycle;
-%
-nc{'o2_time'} = ncdouble('o2_time') ;
-nc{'o2_time'}.long_name = ncchar('time for O2 climatology')
-nc{'o2_time'}.long_name = 'time for O2 climatology';
-nc{'o2_time'}.units = ncchar('day');
-nc{'o2_time'}.units = 'day';
-nc{'o2_time'}.cycle_length = cycle;
-%
-nc{'chla_time'} = ncdouble('chla_time') ;
-nc{'chla_time'}.long_name = ncchar('time for CHLA climatology');
-nc{'chla_time'}.long_name = 'time for CHLA climatology';
-nc{'chla_time'}.units = ncchar('day');
-nc{'chla_time'}.units = 'day';
-nc{'chla_time'}.cycle_length = cycle;%
-%
-nc{'phyto_time'} = ncdouble('phyto_time') ;
-nc{'phyto_time'}.long_name = ncchar('time for PHYTO climatology');
-nc{'phyto_time'}.long_name = 'time for PHYTO climatology';
-nc{'phyto_time'}.units = ncchar('day');
-nc{'phyto_time'}.units = 'day';
-nc{'phyto_time'}.cycle_length = cycle;%
-%
-nc{'zoo_time'} = ncdouble('zoo_time') ;
-nc{'zoo_time'}.long_name = ncchar('time for ZOO climatology');
-nc{'zoo_time'}.long_name = 'time for ZOO climatology';
-nc{'zoo_time'}.units = ncchar('day');
-nc{'zoo_time'}.units = 'day';
-nc{'zoo_time'}.cycle_length = cycle;
-%
-
-if obc(1)==1
-%
-%   Southern boundary
-%
-  nc{'NO3_south'} = ncdouble('no3_time','Z','xi_rho') ;
-  nc{'NO3_south'}.long_name = ncchar('southern boundary NO3');
-  nc{'NO3_south'}.long_name = 'southern boundary NO3';
-  nc{'NO3_south'}.units = ncchar('mMol N m-3');
-  nc{'NO3_south'}.units = 'mMol N m-3';
-%
-  nc{'O2_south'} = ncdouble('no3_time','Z','xi_rho') ;
-  nc{'O2_south'}.long_name = ncchar('southern boundary O2');
-  nc{'O2_south'}.long_name = 'southern boundary O2';
-  nc{'O2_south'}.units = ncchar('mMol O m-3');
-  nc{'O2_south'}.units = 'mMol O m-3';
-%
-  nc{'CHLA_south'} = ncdouble('chla_time','Z','xi_rho') ;
-  nc{'CHLA_south'}.long_name = ncchar('southern boundary CHLA');
-  nc{'CHLA_south'}.long_name = 'southern boundary CHLA';
-  nc{'CHLA_south'}.units = ncchar('mMol N m-3');
-  nc{'CHLA_south'}.units = 'mMol N m-3';
-%
-  nc{'ZOO_south'} = ncdouble('zoo_time','Z','xi_rho') ;
-  nc{'ZOO_south'}.long_name = ncchar('southern boundary ZOO');
-  nc{'ZOO_south'}.long_name = 'southern boundary ZOO';
-  nc{'ZOO_south'}.units = ncchar('mMol N m-3');
-  nc{'ZOO_south'}.units = 'mMol N m-3';
-%
-  nc{'PHYTO_south'} = ncdouble('phyto_time','Z','xi_rho') ;
-  nc{'PHYTO_south'}.long_name = ncchar('southern boundary PHYTO');
-  nc{'PHYTO_south'}.long_name = 'southern boundary PHYTO';
-  nc{'PHYTO_south'}.units = ncchar('mMol N m-3');
-  nc{'PHYTO_south'}.units = 'mMol N m-3';
-end
-%
-if obc(2)==1
-%
-%   Eastern boundary
-%
-  nc{'NO3_east'} = ncdouble('no3_time','Z','eta_rho') ;
-  nc{'NO3_east'}.long_name = ncchar('eastern boundary NO3');
-  nc{'NO3_east'}.long_name = 'eastern boundary NO3';
-  nc{'NO3_east'}.units = ncchar('mMol N m-3');
-  nc{'NO3_east'}.units = 'mMol N m-3';
-%
-  nc{'O2_east'} = ncdouble('o2_time','Z','eta_rho') ;
-  nc{'O2_east'}.long_name = ncchar('eastern boundary O2');
-  nc{'O2_east'}.long_name = 'eastern boundary O2';
-  nc{'O2_east'}.units = ncchar('mMol O m-3');
-  nc{'O2_east'}.units = 'mMol O m-3';
-%
-  nc{'CHLA_east'} = ncdouble('chla_time','Z','eta_rho') ;
-  nc{'CHLA_east'}.long_name = ncchar('eastern boundary CHLA');
-  nc{'CHLA_east'}.long_name = 'eastern boundary CHLA';
-  nc{'CHLA_east'}.units = ncchar('mMol N m-3');
-  nc{'CHLA_east'}.units = 'mMol N m-3';
-%
-  nc{'ZOO_east'} = ncdouble('zoo_time','Z','eta_rho') ;
-  nc{'ZOO_east'}.long_name = ncchar('eastern boundary ZOO');
-  nc{'ZOO_east'}.long_name = 'eastern boundary ZOO';
-  nc{'ZOO_east'}.units = ncchar('mMol N m-3');
-  nc{'ZOO_east'}.units = 'mMol N m-3';
-%
-  nc{'PHYTO_east'} = ncdouble('phyto_time','Z','eta_rho') ;
-  nc{'PHYTO_east'}.long_name = ncchar('eastern boundary PHYTO');
-  nc{'PHYTO_east'}.long_name = 'eastern boundary PHYTO';
-  nc{'PHYTO_east'}.units = ncchar('mMol N m-3');
-  nc{'PHYTO_east'}.units = 'mMol N m-3';
-%
-end
-%
-if obc(3)==1
-%
-%   Northern boundary
-%
-  nc{'NO3_north'} = ncdouble('no3_time','Z','xi_rho') ;
-  nc{'NO3_north'}.long_name = ncchar('northern boundary NO3');
-  nc{'NO3_north'}.long_name = 'northern boundary NO3';
-  nc{'NO3_north'}.units = ncchar('mMol N m-3');
-  nc{'NO3_north'}.units = 'mMol N m-3';
-%
-  nc{'O2_north'} = ncdouble('o2_time','Z','xi_rho') ;
-  nc{'O2_north'}.long_name = ncchar('northern boundary O2');
-  nc{'O2_north'}.long_name = 'northern boundary O2';
-  nc{'O2_north'}.units = ncchar('mMol O m-3');
-  nc{'O2_north'}.units = 'mMol O m-3';
-%
-  nc{'CHLA_north'} = ncdouble('chla_time','Z','xi_rho') ;
-  nc{'CHLA_north'}.long_name = ncchar('northern boundary CHLA');
-  nc{'CHLA_north'}.long_name = 'northern boundary CHLA';
-  nc{'CHLA_north'}.units = ncchar('mMol N m-3');
-  nc{'CHLA_north'}.units = 'mMol N m-3';
-%
-  nc{'ZOO_north'} = ncdouble('zoo_time','Z','xi_rho') ;
-  nc{'ZOO_north'}.long_name = ncchar('northern boundary ZOO');
-  nc{'ZOO_north'}.long_name = 'northern boundary ZOO';
-  nc{'ZOO_north'}.units = ncchar('mMol N m-3');
-  nc{'ZOO_north'}.units = 'mMol N m-3';
-%
-  nc{'PHYTO_north'} = ncdouble('phyto_time','Z','xi_rho') ;
-  nc{'PHYTO_north'}.long_name = ncchar('northern boundary PHYTO');
-  nc{'PHYTO_north'}.long_name = 'northern boundary PHYTO';
-  nc{'PHYTO_north'}.units = ncchar('mMol N m-3');
-  nc{'PHYTO_north'}.units = 'mMol N m-3';
-%
-end
-%
-if obc(4)==1
-%
-%   Western boundary
-%
-  nc{'NO3_west'} = ncdouble('no3_time','Z','eta_rho') ;
-  nc{'NO3_west'}.long_name = ncchar('western boundary NO3');
-  nc{'NO3_west'}.long_name = 'western boundary NO3';
-  nc{'NO3_west'}.units = ncchar('mMol N m-3');
-  nc{'NO3_west'}.units = 'mMol N m-3';
-%
-  nc{'O2_west'} = ncdouble('no3_time','Z','eta_rho') ;
-  nc{'O2_west'}.long_name = ncchar('western boundary O2');
-  nc{'O2_west'}.long_name = 'western boundary O2';
-  nc{'O2_west'}.units = ncchar('mMol O m-3');
-  nc{'O2_west'}.units = 'mMol O m-3';
-%
-  nc{'CHLA_west'} = ncdouble('chla_time','Z','eta_rho') ;
-  nc{'CHLA_west'}.long_name = ncchar('western boundary CHLA');
-  nc{'CHLA_west'}.long_name = 'western boundary CHLA';
-  nc{'CHLA_west'}.units = ncchar('mMol N m-3');
-  nc{'CHLA_west'}.units = 'mMol N m-3';
-%
-  nc{'ZOO_west'} = ncdouble('zoo_time','Z','eta_rho') ;
-  nc{'ZOO_west'}.long_name = ncchar('western boundary ZOO');
-  nc{'ZOO_west'}.long_name = 'western boundary ZOO';
-  nc{'ZOO_west'}.units = ncchar('mMol N m-3');
-  nc{'ZOO_west'}.units = 'mMol N m-3';
-%
-  nc{'PHYTO_west'} = ncdouble('phyto_time','Z','eta_rho') ;
-  nc{'PHYTO_west'}.long_name = ncchar('western boundary PHYTO');
-  nc{'PHYTO_west'}.long_name = 'western boundary PHYTO';
-  nc{'PHYTO_west'}.units = ncchar('mMol N m-3');
-  nc{'PHYTO_west'}.units = 'mMol N m-3';
-%
-end
-%
-% Leave define mode
-%
-%%result = endef(nc);
-%
-% Write variables
-%
-nc{'no3_time'}(:) = time_no3;
-nc{'o2_time'}(:) = time_no3;
-nc{'chla_time'}(:) = time_chla;
-nc{'zoo_time'}(:) = time_zoo;
-nc{'phyto_time'}(:) = time_phyto;
-if obc(1)==1
-  nc{'NO3_south'}(:)  =  0;
-  nc{'O2_south'}(:)  =  0;
-  nc{'CHLA_south'}(:)  =  0;
-  nc{'ZOO_south'}(:) =  0;
-  nc{'PHYTO_south'}(:)   =  0;
-end
-if obc(2)==1 
-  nc{'NO3_east'}(:)  =  0;
-  nc{'O2_east'}(:)  =  0;
-  nc{'CHLA_east'}(:)  =  0;
-  nc{'ZOO_east'}(:) =  0;
-  nc{'PHYTO_east'}(:)   =  0;
-end 
-if obc(3)==1 
-  nc{'NO3_north'}(:)  =  0;
-  nc{'O2_north'}(:)  =  0;
-  nc{'CHLA_north'}(:)  =  0;
-  nc{'ZOO_north'}(:) =  0;
-  nc{'PHYTO_north'}(:)   =  0;
-end 
-if obc(4)==1 
-  nc{'NO3_west'}(:)  =  0;
-  nc{'O2_west'}(:)  =  0;
-  nc{'CHLA_west'}(:)  =  0;
-  nc{'ZOO_west'}(:) =  0;
-  nc{'PHYTO_west'}(:)   =  0;
-end 
-close(nc)
-return
-
-
diff --git a/Preprocessing_tools/add_bry_pisces.m b/Preprocessing_tools/add_bry_pisces.m
deleted file mode 100644
index c170f967..00000000
--- a/Preprocessing_tools/add_bry_pisces.m
+++ /dev/null
@@ -1,399 +0,0 @@
-function add_bry_pisces(bryname,obc,time,cycle,clobber);
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%                                                                 
-% function add_bry_pisces(bryname,grdname,title,obc...            
-%                         theta_s,theta_b,hc,N,...                
-%                         time,cycle,clobber);                    
-%                                                                 
-%   This function create the header of a Netcdf climatology       
-%   file.                                                         
-%                                                                 
-%   Input:                                                        
-%                                                                 
-%   bryname      Netcdf climatology file name (character string). 
-%   obc          open boundaries flag (1=open , [S E N W]).       
-%   time         time.(vector)                                    
-%   cycle        Length (days) for cycling the climatology.(Real) 
-%   clobber      Switch to allow or not writing over an existing  
-%                file.(character string)                          
-%
-%  Further Information:  
-%  http://www.croco-ocean.org
-%  
-%  This file is part of CROCOTOOLS
-%
-%  CROCOTOOLS is free software; you can redistribute it and/or modify
-%  it under the terms of the GNU General Public License as published
-%  by the Free Software Foundation; either version 2 of the License,
-%  or (at your option) any later version.
-%
-%  CROCOTOOLS is distributed in the hope that it will be useful, but
-%  WITHOUT ANY WARRANTY; without even the implied warranty of
-%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-%  GNU General Public License for more details.
-%
-%  You should have received a copy of the GNU General Public License
-%  along with this program; if not, write to the Free Software
-%  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-%  MA  02111-1307  USA
-%
-%  Copyright (c) 2001-2006 by Pierrick Penven 
-%  e-mail:Pierrick.Penven@ird.fr  
-%  Pierrick Penven, IRD, 2005.                                    %
-%  Olivier Aumont the master, IRD, 2006.                          %
-%  Patricio Marchesiello, chief, IRD, 2007.                       %
-%  Christophe Eugene Raoul Menkes, the slave, IRD, 2007.          %
-%                                                                 %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-disp(' ')
-disp([' Adding PISCES data into file : ',bryname])
-disp(' ')
-%
-%  Redefine the boundary file
-%
-nc = netcdf(bryname,clobber);
-%%result = redef(nc);
-%
-%  Create dimensions
-%
-nc('dic_time')  = length(time);
-nc('doc_time')  = length(time);
-nc('no3_time')  = length(time);
-nc('po4_time')  = length(time);
-nc('talk_time') = length(time);
-nc('si_time')   = length(time);
-nc('fer_time')  = length(time);
-nc('o2_time')   = length(time);
-nc('one') = 1;
-%
-%  Create variables and attributes
-%
-nc{'dic_time'} = ncdouble('dic_time') ;
-nc{'dic_time'}.long_name = ncchar('time for DIC climatology');
-nc{'dic_time'}.long_name = 'time for DIC climatology';
-nc{'dic_time'}.units = ncchar('day');
-nc{'dic_time'}.units = 'day';
-nc{'dic_time'}.cycle_length = cycle;%
-%
-nc{'talk_time'} = ncdouble('talk_time') ;
-nc{'talk_time'}.long_name = ncchar('time for TALK climatology');
-nc{'talk_time'}.long_name = 'time for TALK climatology';
-nc{'talk_time'}.units = ncchar('day');
-nc{'talk_time'}.units = 'day';
-nc{'talk_time'}.cycle_length = cycle;%
-%
-nc{'no3_time'} = ncdouble('no3_time') ;
-nc{'no3_time'}.long_name = ncchar('time for NO3 climatology');
-nc{'no3_time'}.long_name = 'time for NO3 climatology';
-nc{'no3_time'}.units = ncchar('day');
-nc{'no3_time'}.units = 'day';
-nc{'no3_time'}.cycle_length = cycle;%
-%
-nc{'po4_time'} = ncdouble('po4_time') ;
-nc{'po4_time'}.long_name = ncchar('time for PO4 climatology');
-nc{'po4_time'}.long_name = 'time for PO4 climatology';
-nc{'po4_time'}.units = ncchar('day');
-nc{'po4_time'}.units = 'day';
-nc{'po4_time'}.cycle_length = cycle;%
-%
-nc{'si_time'} = ncdouble('si_time') ;
-nc{'si_time'}.long_name = ncchar('time for Si climatology');
-nc{'si_time'}.long_name = 'time for Si climatology';
-nc{'si_time'}.units = ncchar('day');
-nc{'si_time'}.units = 'day';
-nc{'si_time'}.cycle_length = cycle;%
-%
-nc{'o2_time'} = ncdouble('o2_time') ;
-nc{'o2_time'}.long_name = ncchar('time for O2 climatology');
-nc{'o2_time'}.long_name = 'time for O2 climatology';
-nc{'o2_time'}.units = ncchar('day');
-nc{'o2_time'}.units = 'day';
-nc{'o2_time'}.cycle_length = cycle;%
-%
-nc{'doc_time'} = ncdouble('doc_time') ;
-nc{'doc_time'}.long_name = ncchar('time for DOC climatology');
-nc{'doc_time'}.long_name = 'time for DOC climatology';
-nc{'doc_time'}.units = ncchar('day');
-nc{'doc_time'}.units = 'day';
-nc{'doc_time'}.cycle_length = cycle;%
-%
-nc{'fer_time'} = ncdouble('fer_time') ;
-nc{'fer_time'}.long_name = ncchar('time for FER climatology');
-nc{'fer_time'}.long_name = 'time for FER climatology';
-nc{'fer_time'}.units = ncchar('day');
-nc{'fer_time'}.units = 'day';
-nc{'fer_time'}.cycle_length = cycle;%
-%
-if obc(1)==1
-%
-%   Southern boundary
-%
-  nc{'NO3_south'} = ncdouble('no3_time','s_rho','xi_rho') ;
-  nc{'NO3_south'}.long_name = ncchar('southern boundary NO3');
-  nc{'NO3_south'}.long_name = 'southern boundary NO3';
-  nc{'NO3_south'}.units = ncchar('mMol N m-3');
-  nc{'NO3_south'}.units = 'mMol N m-3';
-%
-  nc{'PO4_south'} = ncdouble('po4_time','s_rho','xi_rho') ;
-  nc{'PO4_south'}.long_name = ncchar('southern boundary PO4');
-  nc{'PO4_south'}.long_name = 'southern boundary PO4';
-  nc{'PO4_south'}.units = ncchar('mMol N m-3');
-  nc{'PO4_south'}.units = 'mMol N m-3';
-%
-  nc{'Si_south'} = ncdouble('si_time','s_rho','xi_rho') ;
-  nc{'Si_south'}.long_name = ncchar('southern boundary Si');
-  nc{'Si_south'}.long_name = 'southern boundary Si';
-  nc{'Si_south'}.units = ncchar('mMol N m-3');
-  nc{'Si_south'}.units = 'mMol N m-3';
-%
-  nc{'O2_south'} = ncdouble('o2_time','s_rho','xi_rho') ;
-  nc{'O2_south'}.long_name = ncchar('southern boundary O2');
-  nc{'O2_south'}.long_name = 'southern boundary O2';
-  nc{'O2_south'}.units = ncchar('mMol N m-3');
-  nc{'O2_south'}.units = 'mMol N m-3';
-%
-  nc{'DIC_south'} = ncdouble('dic_time','s_rho','xi_rho') ;
-  nc{'DIC_south'}.long_name = ncchar('southern boundary DIC');
-  nc{'DIC_south'}.long_name = 'southern boundary DIC';
-  nc{'DIC_south'}.units = ncchar('mMol N m-3');
-  nc{'DIC_south'}.units = 'mMol N m-3';
-%
-  nc{'TALK_south'} = ncdouble('talk_time','s_rho','xi_rho') ;
-  nc{'TALK_south'}.long_name = ncchar('southern boundary TALK');
-  nc{'TALK_south'}.long_name = 'southern boundary TALK';
-  nc{'TALK_south'}.units = ncchar('mMol N m-3');
-  nc{'TALK_south'}.units = 'mMol N m-3';
-%
-  nc{'DOC_south'} = ncdouble('doc_time','s_rho','xi_rho') ;
-  nc{'DOC_south'}.long_name = ncchar('southern boundary DOC');
-  nc{'DOC_south'}.long_name = 'southern boundary DOC';
-  nc{'DOC_south'}.units = ncchar('mMol N m-3');
-  nc{'DOC_south'}.units = 'mMol N m-3';
-%
-  nc{'FER_south'} = ncdouble('fer_time','s_rho','xi_rho') ;
-  nc{'FER_south'}.long_name = ncchar('southern boundary Iron');
-  nc{'FER_south'}.long_name = 'southern boundary Iron';
-  nc{'FER_south'}.units = ncchar('mMol N m-3');
-  nc{'FER_south'}.units = 'mMol N m-3';
-%
-end
-%
-if obc(2)==1
-%
-%   Eastern boundary
-%
-  nc{'NO3_east'} = ncdouble('no3_time','s_rho','eta_rho') ;
-  nc{'NO3_east'}.long_name = ncchar('eastern boundary NO3');
-  nc{'NO3_east'}.long_name = 'eastern boundary NO3';
-  nc{'NO3_east'}.units = ncchar('mMol N m-3');
-  nc{'NO3_east'}.units = 'mMol N m-3';
-%
-  nc{'PO4_east'} = ncdouble('po4_time','s_rho','eta_rho') ;
-  nc{'PO4_east'}.long_name = ncchar('eastern boundary PO4');
-  nc{'PO4_east'}.long_name = 'eastern boundary PO4';
-  nc{'PO4_east'}.units = ncchar('mMol N m-3');
-  nc{'PO4_east'}.units = 'mMol N m-3';
-%
-  nc{'Si_east'} = ncdouble('si_time','s_rho','eta_rho') ;
-  nc{'Si_east'}.long_name = ncchar('eastern boundary Si');
-  nc{'Si_east'}.long_name = 'eastern boundary Si';
-  nc{'Si_east'}.units = ncchar('mMol N m-3');
-  nc{'Si_east'}.units = 'mMol N m-3';
-%
-  nc{'O2_east'} = ncdouble('o2_time','s_rho','eta_rho') ;
-  nc{'O2_east'}.long_name = ncchar('eastern boundary O2');
-  nc{'O2_east'}.long_name = 'eastern boundary O2';
-  nc{'O2_east'}.units = ncchar('mMol N m-3');
-  nc{'O2_east'}.units = 'mMol N m-3';
-%
-  nc{'DIC_east'} = ncdouble('dic_time','s_rho','eta_rho') ;
-  nc{'DIC_east'}.long_name = ncchar('eastern boundary DIC');
-  nc{'DIC_east'}.long_name = 'eastern boundary DIC';
-  nc{'DIC_east'}.units = ncchar('mMol N m-3');
-  nc{'DIC_east'}.units = 'mMol N m-3';
-%
-  nc{'TALK_east'} = ncdouble('talk_time','s_rho','eta_rho') ;
-  nc{'TALK_east'}.long_name = ncchar('eastern boundary TALK');
-  nc{'TALK_east'}.long_name = 'eastern boundary TALK';
-  nc{'TALK_east'}.units = ncchar('mMol N m-3');
-  nc{'TALK_east'}.units = 'mMol N m-3';
-%
-  nc{'DOC_east'} = ncdouble('doc_time','s_rho','eta_rho') ;
-  nc{'DOC_east'}.long_name = ncchar('eastern boundary DOC');
-  nc{'DOC_east'}.long_name = 'eastern boundary DOC';
-  nc{'DOC_east'}.units = ncchar('mMol N m-3');
-  nc{'DOC_east'}.units = 'mMol N m-3';
-%
-  nc{'FER_east'} = ncdouble('fer_time','s_rho','eta_rho') ;
-  nc{'FER_east'}.long_name = ncchar('eastern boundary Iron');
-  nc{'FER_east'}.long_name = 'eastern boundary Iron';
-  nc{'FER_east'}.units = ncchar('mMol N m-3');
-  nc{'FER_east'}.units = 'mMol N m-3';
-%
-end
-%
-if obc(3)==1
-%
-%   Northern boundary
-%
-  nc{'NO3_north'} = ncdouble('no3_time','s_rho','xi_rho') ;
-  nc{'NO3_north'}.long_name = ncchar('northern boundary NO3');
-  nc{'NO3_north'}.long_name = 'northern boundary NO3';
-  nc{'NO3_north'}.units = ncchar('mMol N m-3');
-  nc{'NO3_north'}.units = 'mMol N m-3';
-%
-  nc{'PO4_north'} = ncdouble('po4_time','s_rho','xi_rho') ;
-  nc{'PO4_north'}.long_name = ncchar('northern boundary PO4');
-  nc{'PO4_north'}.long_name = 'northern boundary PO4';
-  nc{'PO4_north'}.units = ncchar('mMol N m-3');
-  nc{'PO4_north'}.units = 'mMol N m-3';
-%
-  nc{'Si_north'} = ncdouble('si_time','s_rho','xi_rho') ;
-  nc{'Si_north'}.long_name = ncchar('northern boundary Si');
-  nc{'Si_north'}.long_name = 'northern boundary Si';
-  nc{'Si_north'}.units = ncchar('mMol N m-3');
-  nc{'Si_north'}.units = 'mMol N m-3';
-%
-  nc{'O2_north'} = ncdouble('o2_time','s_rho','xi_rho') ;
-  nc{'O2_north'}.long_name = ncchar('northern boundary O2');
-  nc{'O2_north'}.long_name = 'northern boundary O2';
-  nc{'O2_north'}.units = ncchar('mMol N m-3');
-  nc{'O2_north'}.units = 'mMol N m-3';
-%
-  nc{'DIC_north'} = ncdouble('dic_time','s_rho','xi_rho') ;
-  nc{'DIC_north'}.long_name = ncchar('northern boundary DIC');
-  nc{'DIC_north'}.long_name = 'northern boundary DIC';
-  nc{'DIC_north'}.units = ncchar('mMol N m-3');
-  nc{'DIC_north'}.units = 'mMol N m-3';
-%
-  nc{'TALK_north'} = ncdouble('talk_time','s_rho','xi_rho') ;
-  nc{'TALK_north'}.long_name = ncchar('northern boundary TALK');
-  nc{'TALK_north'}.long_name = 'northern boundary TALK';
-  nc{'TALK_north'}.units = ncchar('mMol N m-3');
-  nc{'TALK_north'}.units = 'mMol N m-3';
-%
-  nc{'DOC_north'} = ncdouble('doc_time','s_rho','xi_rho') ;
-  nc{'DOC_north'}.long_name = ncchar('northern boundary DOC');
-  nc{'DOC_north'}.long_name = 'northern boundary DOC';
-  nc{'DOC_north'}.units = ncchar('mMol N m-3');
-  nc{'DOC_north'}.units = 'mMol N m-3';
-%
-  nc{'FER_north'} = ncdouble('fer_time','s_rho','xi_rho') ;
-  nc{'FER_north'}.long_name = ncchar('northern boundary Iron');
-  nc{'FER_north'}.long_name = 'northern boundary Iron';
-  nc{'FER_north'}.units = ncchar('mMol N m-3');
-  nc{'FER_north'}.units = 'mMol N m-3';
-%
-end
-%
-if obc(4)==1
-%
-%   Western boundary
-%
-  nc{'NO3_west'} = ncdouble('no3_time','s_rho','eta_rho') ;
-  nc{'NO3_west'}.long_name = ncchar('western boundary NO3');
-  nc{'NO3_west'}.long_name = 'western boundary NO3';
-  nc{'NO3_west'}.units = ncchar('mMol N m-3');
-  nc{'NO3_west'}.units = 'mMol N m-3';
-%
-  nc{'PO4_west'} = ncdouble('po4_time','s_rho','eta_rho') ;
-  nc{'PO4_west'}.long_name = ncchar('western boundary PO4');
-  nc{'PO4_west'}.long_name = 'western boundary PO4';
-  nc{'PO4_west'}.units = ncchar('mMol N m-3');
-  nc{'PO4_west'}.units = 'mMol N m-3';
-%
-  nc{'Si_west'} = ncdouble('si_time','s_rho','eta_rho') ;
-  nc{'Si_west'}.long_name = ncchar('western boundary Si');
-  nc{'Si_west'}.long_name = 'western boundary Si';
-  nc{'Si_west'}.units = ncchar('mMol N m-3');
-  nc{'Si_west'}.units = 'mMol N m-3';
-%
-  nc{'O2_west'} = ncdouble('o2_time','s_rho','eta_rho') ;
-  nc{'O2_west'}.long_name = ncchar('western boundary O2');
-  nc{'O2_west'}.long_name = 'western boundary O2';
-  nc{'O2_west'}.units = ncchar('mMol N m-3');
-  nc{'O2_west'}.units = 'mMol N m-3';
-%
-  nc{'DIC_west'} = ncdouble('dic_time','s_rho','eta_rho') ;
-  nc{'DIC_west'}.long_name = ncchar('western boundary DIC');
-  nc{'DIC_west'}.long_name = 'western boundary DIC';
-  nc{'DIC_west'}.units = ncchar('mMol N m-3');
-  nc{'DIC_west'}.units = 'mMol N m-3';
-%
-  nc{'TALK_west'} = ncdouble('talk_time','s_rho','eta_rho') ;
-  nc{'TALK_west'}.long_name = ncchar('western boundary TALK');
-  nc{'TALK_west'}.long_name = 'western boundary TALK';
-  nc{'TALK_west'}.units = ncchar('mMol N m-3');
-  nc{'TALK_west'}.units = 'mMol N m-3';
-%
-  nc{'DOC_west'} = ncdouble('doc_time','s_rho','eta_rho') ;
-  nc{'DOC_west'}.long_name = ncchar('western boundary DOC');
-  nc{'DOC_west'}.long_name = 'western boundary DOC';
-  nc{'DOC_west'}.units = ncchar('mMol N m-3');
-  nc{'DOC_west'}.units = 'mMol N m-3';
-%
-  nc{'FER_west'} = ncdouble('fer_time','s_rho','eta_rho') ;
-  nc{'FER_west'}.long_name = ncchar('western boundary Iron');
-  nc{'FER_west'}.long_name = 'western boundary Iron';
-  nc{'FER_west'}.units = ncchar('mMol N m-3');
-  nc{'FER_west'}.units = 'mMol N m-3';
-%
-end
-%
-% Leave define mode
-%
-%%result = endef(nc);
-%
-% Write variables
-%
-nc{'dic_time'}(:) = time;
-nc{'doc_time'}(:) = time;
-nc{'no3_time'}(:) = time;
-nc{'po4_time'}(:) = time;
-nc{'talk_time'}(:) = time;
-nc{'si_time'}(:) = time;
-nc{'fer_time'}(:) = time;
-nc{'o2_time'}(:) = time;
-if obc(1)==1
-  nc{'NO3_south'}(:)  =  0;
-  nc{'PO4_south'}(:)  =  0;
-  nc{'Si_south'}(:) =  0;
-  nc{'O2_south'}(:)   =  0;
-  nc{'DIC_south'}(:)  =  0;
-  nc{'TALK_south'}(:) =  0;
-  nc{'DOC_south'}(:)  =  0;
-  nc{'FER_south'}(:)  =  0;
-end 
-if obc(2)==1
-  nc{'NO3_east'}(:)  =  0;
-  nc{'PO4_east'}(:)  =  0;
-  nc{'Si_east'}(:) =  0;
-  nc{'O2_east'}(:)   =  0;
-  nc{'DIC_east'}(:)  =  0;
-  nc{'TALK_east'}(:) =  0;
-  nc{'DOC_east'}(:)  =  0;
-  nc{'FER_east'}(:)  =  0;
-end 
-if obc(3)==1
-  nc{'NO3_north'}(:)  =  0;
-  nc{'PO4_north'}(:)  =  0;
-  nc{'Si_north'}(:) =  0;
-  nc{'O2_north'}(:)   =  0;
-  nc{'DIC_north'}(:)  =  0;
-  nc{'TALK_north'}(:) =  0;
-  nc{'DOC_north'}(:)  =  0;
-  nc{'FER_north'}(:)  =  0;
-end 
-if obc(4)==1
-  nc{'NO3_west'}(:)  =  0;
-  nc{'PO4_west'}(:)  =  0;
-  nc{'Si_west'}(:) =  0;
-  nc{'O2_west'}(:)   =  0;
-  nc{'DIC_west'}(:)  =  0;
-  nc{'TALK_west'}(:) =  0;
-  nc{'DOC_west'}(:)  =  0;
-  nc{'FER_west'}(:)  =  0;
-end 
-close(nc)
-return
-
diff --git a/Preprocessing_tools/add_bry_pisces_Z.m b/Preprocessing_tools/add_bry_pisces_Z.m
deleted file mode 100644
index 7aa1b507..00000000
--- a/Preprocessing_tools/add_bry_pisces_Z.m
+++ /dev/null
@@ -1,319 +0,0 @@
-function add_bry_pisces_Z(zbryname,obc,Z,time,cycle,clobber);
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%                                                                 %
-%   function add_bry_pisces_Z(zbryname,obc,...                    %
-%                             Z,time,cycle,clobber);              %
-%                                                                 %
-%   This function create the header of a Netcdf climatology       %
-%   file.                                                         %
-%                                                                 %
-%   Input:                                                        %
-%                                                                 %
-%   zbryname     Netcdf climatology file name (character string). %
-%   obc          open boundaries flag (1=open , [S E N W]).       %
-%   Z            Depth of vertical levels.(Vector)                %
-%   time         time.(vector)                                    %
-%   cycle        Length (days) for cycling the climatology.(Real) %
-%   clobber      Switch to allow or not writing over an existing  %
-%                file.(character string)                          %
-%                                                                 %
-%  Pierrick Penven, IRD, 2005.                                    %
-%  Olivier Aumont the master, IRD, 2006.                          %
-%  Patricio Marchesiello, chief, IRD, 2007.                       %
-%  Christophe Eugene Raoul Menkes, the slave, IRD, 2007.          %
-%                                                                 %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-disp(' ')
-disp([' Adding PISCES data into file : ',zbryname])
-disp(' ')
-%
-%  Create the boundary file
-%
-nc = netcdf(zbryname,clobber);
-%%result = redef(nc);
-%
-%  Create dimensions
-%
-nc('dic_time') = length(time);
-nc('doc_time') = length(time);
-nc('no3_time') = length(time);
-nc('po4_time') = length(time);
-nc('talk_time') = length(time);
-nc('si_time') = length(time);
-nc('fer_time') = length(time);
-nc('o2_time') = length(time);
-nc('one') = 1;
-%
-if obc(1)==1
-%
-%   Southern boundary
-%
-  nc{'NO3_south'} = ncdouble('no3_time','Z','xi_rho') ;
-  nc{'NO3_south'}.long_name = ncchar('southern boundary NO3');
-  nc{'NO3_south'}.long_name = 'southern boundary NO3';
-  nc{'NO3_south'}.units = ncchar('mMol N m-3');
-  nc{'NO3_south'}.units = 'mMol N m-3';
-%
-  nc{'PO4_south'} = ncdouble('po4_time','Z','xi_rho') ;
-  nc{'PO4_south'}.long_name = ncchar('southern boundary PO4');
-  nc{'PO4_south'}.long_name = 'southern boundary PO4';
-  nc{'PO4_south'}.units = ncchar('mMol N m-3');
-  nc{'PO4_south'}.units = 'mMol N m-3';
-%
-  nc{'Si_south'} = ncdouble('si_time','Z','xi_rho') ;
-  nc{'Si_south'}.long_name = ncchar('southern boundary Si');
-  nc{'Si_south'}.long_name = 'southern boundary Si';
-  nc{'Si_south'}.units = ncchar('mMol N m-3');
-  nc{'Si_south'}.units = 'mMol N m-3';
-%
-  nc{'O2_south'} = ncdouble('o2_time','Z','xi_rho') ;
-  nc{'O2_south'}.long_name = ncchar('southern boundary O2');
-  nc{'O2_south'}.long_name = 'southern boundary O2';
-  nc{'O2_south'}.units = ncchar('mMol N m-3');
-  nc{'O2_south'}.units = 'mMol N m-3';
-%
-  nc{'DIC_south'} = ncdouble('dic_time','Z','xi_rho') ;
-  nc{'DIC_south'}.long_name = ncchar('southern boundary DIC');
-  nc{'DIC_south'}.long_name = 'southern boundary DIC';
-  nc{'DIC_south'}.units = ncchar('mMol N m-3');
-  nc{'DIC_south'}.units = 'mMol N m-3';
-%
-  nc{'TALK_south'} = ncdouble('talk_time','Z','xi_rho') ;
-  nc{'TALK_south'}.long_name = ncchar('southern boundary TALK');
-  nc{'TALK_south'}.long_name = 'southern boundary TALK';
-  nc{'TALK_south'}.units = ncchar('mMol N m-3');
-  nc{'TALK_south'}.units = 'mMol N m-3';
-%
-  nc{'DOC_south'} = ncdouble('doc_time','Z','xi_rho') ;
-  nc{'DOC_south'}.long_name = ncchar('southern boundary DOC');
-  nc{'DOC_south'}.long_name = 'southern boundary DOC';
-  nc{'DOC_south'}.units = ncchar('mMol N m-3');
-  nc{'DOC_south'}.units = 'mMol N m-3';
-%
-  nc{'FER_south'} = ncdouble('fer_time','Z','xi_rho') ;
-  nc{'FER_south'}.long_name = ncchar('southern boundary Iron');
-  nc{'FER_south'}.long_name = 'southern boundary Iron';
-  nc{'FER_south'}.units = ncchar('mMol N m-3');
-  nc{'FER_south'}.units = 'mMol N m-3';
-end
-%
-if obc(2)==1
-%
-%   Eastern boundary
-%
-  nc{'NO3_east'} = ncdouble('no3_time','Z','eta_rho') ;
-  nc{'NO3_east'}.long_name = ncchar('eastern boundary NO3');
-  nc{'NO3_east'}.long_name = 'eastern boundary NO3';
-  nc{'NO3_east'}.units = ncchar('mMol N m-3');
-  nc{'NO3_east'}.units = 'mMol N m-3';
-%
-  nc{'PO4_east'} = ncdouble('po4_time','Z','eta_rho') ;
-  nc{'PO4_east'}.long_name = ncchar('eastern boundary PO4');
-  nc{'PO4_east'}.long_name = 'eastern boundary PO4';
-  nc{'PO4_east'}.units = ncchar('mMol N m-3');
-  nc{'PO4_east'}.units = 'mMol N m-3';
-%
-  nc{'Si_east'} = ncdouble('si_time','Z','eta_rho') ;
-  nc{'Si_east'}.long_name = ncchar('eastern boundary Si');
-  nc{'Si_east'}.long_name = 'eastern boundary Si';
-  nc{'Si_east'}.units = ncchar('mMol N m-3');
-  nc{'Si_east'}.units = 'mMol N m-3';
-%
-  nc{'O2_east'} = ncdouble('o2_time','Z','eta_rho') ;
-  nc{'O2_east'}.long_name = ncchar('eastern boundary O2');
-  nc{'O2_east'}.long_name = 'eastern boundary O2';
-  nc{'O2_east'}.units = ncchar('mMol N m-3');
-  nc{'O2_east'}.units = 'mMol N m-3';
-%
-  nc{'DIC_east'} = ncdouble('dic_time','Z','eta_rho') ;
-  nc{'DIC_east'}.long_name = ncchar('eastern boundary DIC');
-  nc{'DIC_east'}.long_name = 'eastern boundary DIC';
-  nc{'DIC_east'}.units = ncchar('mMol N m-3');
-  nc{'DIC_east'}.units = 'mMol N m-3';
-%
-  nc{'TALK_east'} = ncdouble('talk_time','Z','eta_rho') ;
-  nc{'TALK_east'}.long_name = ncchar('eastern boundary TALK');
-  nc{'TALK_east'}.long_name = 'eastern boundary TALK';
-  nc{'TALK_east'}.units = ncchar('mMol N m-3');
-  nc{'TALK_east'}.units = 'mMol N m-3';
-%
-  nc{'DOC_east'} = ncdouble('doc_time','Z','eta_rho') ;
-  nc{'DOC_east'}.long_name = ncchar('eastern boundary DOC');
-  nc{'DOC_east'}.long_name = 'eastern boundary DOC';
-  nc{'DOC_east'}.units = ncchar('mMol N m-3');
-  nc{'DOC_east'}.units = 'mMol N m-3';
-%
-  nc{'FER_east'} = ncdouble('fer_time','Z','eta_rho') ;
-  nc{'FER_east'}.long_name = ncchar('eastern boundary Iron');
-  nc{'FER_east'}.long_name = 'eastern boundary Iron';
-  nc{'FER_east'}.units = ncchar('mMol N m-3');
-  nc{'FER_east'}.units = 'mMol N m-3';
-%
-end
-%
-if obc(3)==1
-%
-%   Northern boundary
-%
-  nc{'NO3_north'} = ncdouble('no3_time','Z','xi_rho') ;
-  nc{'NO3_north'}.long_name = ncchar('northern boundary NO3');
-  nc{'NO3_north'}.long_name = 'northern boundary NO3';
-  nc{'NO3_north'}.units = ncchar('mMol N m-3');
-  nc{'NO3_north'}.units = 'mMol N m-3';
-%
-  nc{'PO4_north'} = ncdouble('po4_time','Z','xi_rho') ;
-  nc{'PO4_north'}.long_name = ncchar('northern boundary PO4');
-  nc{'PO4_north'}.long_name = 'northern boundary PO4';
-  nc{'PO4_north'}.units = ncchar('mMol N m-3');
-  nc{'PO4_north'}.units = 'mMol N m-3';
-%
-  nc{'Si_north'} = ncdouble('si_time','Z','xi_rho') ;
-  nc{'Si_north'}.long_name = ncchar('northern boundary Si');
-  nc{'Si_north'}.long_name = 'northern boundary Si';
-  nc{'Si_north'}.units = ncchar('mMol N m-3');
-  nc{'Si_north'}.units = 'mMol N m-3';
-%
-  nc{'O2_north'} = ncdouble('o2_time','Z','xi_rho') ;
-  nc{'O2_north'}.long_name = ncchar('northern boundary O2');
-  nc{'O2_north'}.long_name = 'northern boundary O2';
-  nc{'O2_north'}.units = ncchar('mMol N m-3');
-  nc{'O2_north'}.units = 'mMol N m-3';
-%
-  nc{'DIC_north'} = ncdouble('dic_time','Z','xi_rho') ;
-  nc{'DIC_north'}.long_name = ncchar('northern boundary DIC');
-  nc{'DIC_north'}.long_name = 'northern boundary DIC';
-  nc{'DIC_north'}.units = ncchar('mMol N m-3');
-  nc{'DIC_north'}.units = 'mMol N m-3';
-%
-  nc{'TALK_north'} = ncdouble('talk_time','Z','xi_rho') ;
-  nc{'TALK_north'}.long_name = ncchar('northern boundary TALK');
-  nc{'TALK_north'}.long_name = 'northern boundary TALK';
-  nc{'TALK_north'}.units = ncchar('mMol N m-3');
-  nc{'TALK_north'}.units = 'mMol N m-3';
-%
-  nc{'DOC_north'} = ncdouble('doc_time','Z','xi_rho') ;
-  nc{'DOC_north'}.long_name = ncchar('northern boundary DOC');
-  nc{'DOC_north'}.long_name = 'northern boundary DOC';
-  nc{'DOC_north'}.units = ncchar('mMol N m-3');
-  nc{'DOC_north'}.units = 'mMol N m-3';
-%
-  nc{'FER_north'} = ncdouble('fer_time','Z','xi_rho') ;
-  nc{'FER_north'}.long_name = ncchar('northern boundary Iron');
-  nc{'FER_north'}.long_name = 'northern boundary Iron';
-  nc{'FER_north'}.units = ncchar('mMol N m-3');
-  nc{'FER_north'}.units = 'mMol N m-3';
-%
-end
-%
-if obc(4)==1
-%
-%   Western boundary
-%
-  nc{'NO3_west'} = ncdouble('no3_time','Z','eta_rho') ;
-  nc{'NO3_west'}.long_name = ncchar('western boundary NO3');
-  nc{'NO3_west'}.long_name = 'western boundary NO3';
-  nc{'NO3_west'}.units = ncchar('mMol N m-3');
-  nc{'NO3_west'}.units = 'mMol N m-3';
-%
-  nc{'PO4_west'} = ncdouble('po4_time','Z','eta_rho') ;
-  nc{'PO4_west'}.long_name = ncchar('western boundary PO4');
-  nc{'PO4_west'}.long_name = 'western boundary PO4';
-  nc{'PO4_west'}.units = ncchar('mMol N m-3');
-  nc{'PO4_west'}.units = 'mMol N m-3';
-%
-  nc{'Si_west'} = ncdouble('si_time','Z','eta_rho') ;
-  nc{'Si_west'}.long_name = ncchar('western boundary Si');
-  nc{'Si_west'}.long_name = 'western boundary Si';
-  nc{'Si_west'}.units = ncchar('mMol N m-3');
-  nc{'Si_west'}.units = 'mMol N m-3';
-%
-  nc{'O2_west'} = ncdouble('o2_time','Z','eta_rho') ;
-  nc{'O2_west'}.long_name = ncchar('western boundary O2');
-  nc{'O2_west'}.long_name = 'western boundary O2';
-  nc{'O2_west'}.units = ncchar('mMol N m-3');
-  nc{'O2_west'}.units = 'mMol N m-3';
-%
-  nc{'DIC_west'} = ncdouble('dic_time','Z','eta_rho') ;
-  nc{'DIC_west'}.long_name = ncchar('western boundary DIC');
-  nc{'DIC_west'}.long_name = 'western boundary DIC';
-  nc{'DIC_west'}.units = ncchar('mMol N m-3');
-  nc{'DIC_west'}.units = 'mMol N m-3';
-%
-  nc{'TALK_west'} = ncdouble('talk_time','Z','eta_rho') ;
-  nc{'TALK_west'}.long_name = ncchar('western boundary TALK');
-  nc{'TALK_west'}.long_name = 'western boundary TALK';
-  nc{'TALK_west'}.units = ncchar('mMol N m-3');
-  nc{'TALK_west'}.units = 'mMol N m-3';
-%
-  nc{'DOC_west'} = ncdouble('doc_time','Z','eta_rho') ;
-  nc{'DOC_west'}.long_name = ncchar('western boundary DOC');
-  nc{'DOC_west'}.long_name = 'western boundary DOC';
-  nc{'DOC_west'}.units = ncchar('mMol N m-3');
-  nc{'DOC_west'}.units = 'mMol N m-3';
-%
-  nc{'FER_west'} = ncdouble('fer_time','Z','eta_rho') ;
-  nc{'FER_west'}.long_name = ncchar('western boundary Iron');
-  nc{'FER_west'}.long_name = 'western boundary Iron';
-  nc{'FER_west'}.units = ncchar('mMol N m-3');
-  nc{'FER_west'}.units = 'mMol N m-3';
-%
-end
-%
-% Leave define mode
-%
-%%result = endef(nc);
-%
-% Write variables
-%
-nc('dic_time') = time;
-nc('doc_time') = time;
-nc('no3_time') = time;
-nc('po4_time') = time;
-nc('talk_time') = time;
-nc('si_time') = time;
-nc('fer_time') = time;
-nc('o2_time') = time;
-if obc(1)==1
-  nc{'NO3_south'}(:)  =  0;
-  nc{'PO4_south'}(:)  =  0;
-  nc{'Si_south'}(:) =  0;
-  nc{'O2_south'}(:)   =  0;
-  nc{'DIC_south'}(:)  =  0;
-  nc{'TALK_south'}(:) =  0;
-  nc{'DOC_south'}(:)  =  0;
-  nc{'FER_south'}(:)  =  0;
-end 
-if obc(2)==1 
-  nc{'NO3_east'}(:)  =  0;
-  nc{'PO4_east'}(:)  =  0;
-  nc{'Si_east'}(:) =  0;
-  nc{'O2_east'}(:)   =  0;
-  nc{'DIC_east'}(:)  =  0;
-  nc{'TALK_east'}(:) =  0;
-  nc{'DOC_east'}(:)  =  0;
-  nc{'FER_east'}(:)  =  0;
-end 
-if obc(3)==1 
-  nc{'NO3_north'}(:)  =  0;
-  nc{'PO4_north'}(:)  =  0;
-  nc{'Si_north'}(:) =  0;
-  nc{'O2_north'}(:)   =  0;
-  nc{'DIC_north'}(:)  =  0;
-  nc{'TALK_north'}(:) =  0;
-  nc{'DOC_north'}(:)  =  0;
-  nc{'FER_north'}(:)  =  0;
-end 
-if obc(4)==1 
-  nc{'NO3_west'}(:)  =  0;
-  nc{'PO4_west'}(:)  =  0;
-  nc{'Si_west'}(:) =  0;
-  nc{'O2_west'}(:)   =  0;
-  nc{'DIC_west'}(:)  =  0;
-  nc{'TALK_west'}(:) =  0;
-  nc{'DOC_west'}(:)  =  0;
-  nc{'FER_west'}(:)  =  0;
-end 
-close(nc)
-return
-
-
diff --git a/Preprocessing_tools/add_chla.m b/Preprocessing_tools/add_chla.m
deleted file mode 100644
index a5ecdd22..00000000
--- a/Preprocessing_tools/add_chla.m
+++ /dev/null
@@ -1,151 +0,0 @@
-function add_chla(climfile,gridfile,seas_datafile,cycle,Roa);
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  function add_chla(climfile,gridfile,seas_datafile,cycle);
-%
-%  Add chlorophyll (mg C) in a CROCO climatology file.
-%  take seasonal data for the surface levels and extrapole 
-%  using Morel and Berthon (1989) parameterization for the
-%  lower levels. warning ! the unit is (micro mole/l) in the
-%  dataset.
-%  ref:  Morel and Berthon, Surface pigments, algal biomass
-%        profiles, and potential production of the euphotic layer:
-%        Relationships reinvestigated in view of remote-sensing 
-%        applications. Limnol. Oceanogr., 34, 1989, 1545-1562.
-%
-%  input:
-%    
-%    climfile      : croco climatology file to process (netcdf)
-%    gridfile      : croco grid file (netcdf)
-%    seas_datafile : regular longitude - latitude - z seasonal data 
-%                    file used for the upper levels  (netcdf)
-%    ann_datafile  : regular longitude - latitude - z annual data 
-%                    file used for the lower levels  (netcdf)
-%    cycle         : time length (days) of climatology cycle (ex:360 for
-%                    annual cycle) - 0 if no cycle.
-% 
-%  Further Information:  
-%  http://www.croco-ocean.org
-%  
-%  This file is part of CROCOTOOLS
-%
-%  CROCOTOOLS is free software; you can redistribute it and/or modify
-%  it under the terms of the GNU General Public License as published
-%  by the Free Software Foundation; either version 2 of the License,
-%  or (at your option) any later version.
-%
-%  CROCOTOOLS is distributed in the hope that it will be useful, but
-%  WITHOUT ANY WARRANTY; without even the implied warranty of
-%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-%  GNU General Public License for more details.
-%
-%  You should have received a copy of the GNU General Public License
-%  along with this program; if not, write to the Free Software
-%  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-%  MA  02111-1307  USA
-%
-%  Copyright (c) 2001-2006 by Pierrick Penven 
-%  e-mail:Pierrick.Penven@ird.fr  
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-disp('Add_chla: creating variable and attribute')
-default=NaN;
-%
-% read in the datafile 
-%
-ncseas=netcdf(seas_datafile,'r');
-x=ncseas{'X'}(:);
-y=ncseas{'Y'}(:);
-t=ncseas{'T'}(:);
-tlen=length(t);
-%
-% open the grid file  
-% 
-ng=netcdf(gridfile,'r');
-lon=ng{'lon_rho'}(:);
-%lon(lon<0)=lon(lon<0)+360;
-lat=ng{'lat_rho'}(:);
-h=ng{'h'}(:);
-close(ng);
-[M,L]=size(lon);
-dl=2.;
-minlon=min(min(lon))-dl;
-maxlon=max(max(lon))+dl;
-minlat=min(min(lat))-dl;
-maxlat=max(max(lat))+dl;
-imin=max(find(x<=minlon));
-imax=min(find(x>=maxlon));
-jmin=max(find(y<=minlat));
-jmax=min(find(y>=maxlat));
-x=x(imin:imax);
-y=y(jmin:jmax);
-%
-% open the clim file  
-% 
-nc=netcdf(climfile,'write');
-theta_s = nc{'theta_s'}(:);
-theta_b =  nc{'theta_b'}(:);
-Tcline  =  nc{'Tcline'}(:);
-vtransform=nc{'Vtransform'}(:);
-if  ~exist('vtransform')
-    vtransform=1; %Old Vtransform
-    disp([' NO VTRANSFORM parameter found'])
-end
-N =  length(nc('s_rho'));
-
-%redef(nc);
-nc('chla_time') = tlen;
-nc{'chla_time'} = ncdouble('chla_time') ;
-nc{'CHLA'} = ncdouble('chla_time','s_rho','eta_rho','xi_rho') ;
-%
-nc{'chla_time'}.long_name = ncchar('time for chlorophyll');
-nc{'chla_time'}.long_name = 'time for chlorophyll';
-nc{'chla_time'}.units = ncchar('day');
-nc{'chla_time'}.units = 'day';
-if cycle~=0
-  nc{'chla_time'}.cycle_length = cycle;
-end
-%
-nc{'CHLA'}.long_name = ncchar('Chlorophyll');
-nc{'CHLA'}.long_name = 'Chlorophyll';
-nc{'CHLA'}.units = ncchar('mg C');
-nc{'CHLA'}.units = 'mg C';
-nc{'CHLA'}.fields = ncchar('CHLA, scalar, series');
-nc{'CHLA'}.fields = 'CHLA, scalar, series';
-%
-%endef(nc);
-%
-% Record the time
-%
-nc{'chla_time'}(:)=t*30; % if time in month in the dataset !!!
-%
-% Get the missing values
-%
-missval=ncseas{'chlorophyll'}.missing_value(:);
-%
-% loop on time
-%
-for l=1:tlen
-disp(['time index: ',num2str(l),' of total: ',num2str(tlen)])
-%
-% extrapole the annual dataset on the horizontal croco grid
-%
-  disp('Add_chla: horizontal interpolation of surface data')
-  surfchla=squeeze(ncseas{'chlorophyll'}(l,jmin:jmax,imin:imax));
-  surfchla=get_missing_val(x,y,surfchla,missval,Roa,default);
-  surfchlacroco=interp2(x,y,surfchla,lon,lat);
-%
-% extrapole the chlorophyll on the vertical
-%
-  zcroco=zlevs(h,0.*h,theta_s,theta_b,Tcline,N,'r',vtransform);
-  disp(['Add_chla: vertical ',...
-  'extrapolation of chlorophyll'])
-  chlacroco=extr_chlo(surfchlacroco,zcroco);
-  nc{'CHLA'}(l,:,:,:)=chlacroco;
-end
-close(nc);
-close(ncseas);
-chla=squeeze(chlacroco(N,:,:));
-return
diff --git a/Preprocessing_tools/add_dic.m b/Preprocessing_tools/add_dic.m
deleted file mode 100644
index 88cace3b..00000000
--- a/Preprocessing_tools/add_dic.m
+++ /dev/null
@@ -1,144 +0,0 @@
-function add_dic(oafile,climfile,inifile,gridfile,seas_datafile,...
-                 ann_datafile,cycle,makeoa,makeclim);
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  function [longrd,latgrd,dic]=add_dic(climfile,gridfile,...
-%                                       seas_datafile,ann_datafile,...
-%                                       cycle);
-%
-%  pierrick 2001
-%
-%  Add DIC (mMol C m-3) in a CROCO climatology file
-%  take seasonal data for the upper levels and annual data for the
-%  lower levels
-%
-%  input:
-%    
-%    climfile      : croco climatology file to process (netcdf)
-%    gridfile      : croco grid file (netcdf)
-%    seas_datafile : regular longitude - latitude - z seasonal data 
-%                    file used for the upper levels  (netcdf)
-%    ann_datafile  : regular longitude - latitude - z annual data 
-%                    file used for the lower levels  (netcdf)
-%    cycle         : time length (days) of climatology cycle (ex:360 for
-%                    annual cycle) - 0 if no cycle.
-%
-%   output:
-%
-%    [longrd,latgrd,dic] : surface field to plot (as an illustration)
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% Read in the grid
-%
-nc=netcdf(gridfile,'r');
-hmax=max(max(nc{'h'}(:)));
-close(nc);
-%
-% read in the datafiles 
-%
-nc=netcdf(seas_datafile,'r');
-t=nc{'T'}(:);
-close(nc)
-nc=netcdf(ann_datafile,'r');
-zdic=nc{'Z'}(:);
-kmax=max(find(zdic<hmax))-1;
-zdic=zdic(1:kmax);
-close(nc)
-%
-% open the OA file  
-% 
-if (makeoa)
-  disp('Add_dic: creating variables and attributes for the OA file')
-  nc=netcdf(oafile,'write');
-%%  redef(nc);
-  nc('dic_time') = length(t);
-  nc{'dic_time'} = ncdouble('dic_time') ;
-  nc('Zdic') = length(zdic);
-  nc{'Zdic'} = ncdouble('Zdic') ;
-  nc{'DIC'} = ncdouble('dic_time','Zdic','eta_rho','xi_rho') ;
-%
-  nc{'dic_time'}.long_name = ncchar('time for DIC');
-  nc{'dic_time'}.long_name = 'time for DIC';
-  nc{'dic_time'}.units = ncchar('day');
-  nc{'dic_time'}.units = 'day';
-  if cycle~=0
-    nc{'dic_time'}.cycle_length = cycle;
-  end
-%
-  nc{'Zdic'}.long_name = ncchar('Depth for DIC');
-  nc{'Zdic'}.long_name = 'Depth for DIC';
-  nc{'Zdic'}.units = ncchar('m');
-  nc{'Zdic'}.units = 'm';
-%
-  nc{'DIC'}.long_name = ncchar('DIC');
-  nc{'DIC'}.long_name = 'DIC';
-  nc{'DIC'}.units = ncchar('mMol C m-3');
-  nc{'DIC'}.units = 'mMol C m-3';
-  nc{'DIC'}.fields = ncchar('DIC, scalar, series');
-  nc{'DIC'}.fields = 'DIC, scalar, series';
-%
-%%  endef(nc);
-%
-% record deth and time and close
-%
-  nc{'dic_time'}(:)=t*30; % if time in month in the dataset !!!
-  nc{'Zdic'}(:)=zdic;
-  close(nc)
-end
-%
-% Same thing for the Clim file
-%
-if (makeclim)
-  disp('Add_dic: creating variables and attributes for the Climatology file')
-%
-% open the clim file  
-% 
-  nc=netcdf(climfile,'write');
-%%  redef(nc);
-  nc('dic_time') = length(t);;
-  nc{'dic_time'} = ncdouble('dic_time') ;
-  nc{'DIC'} = ncdouble('dic_time','s_rho','eta_rho','xi_rho') ;
-%
-  nc{'dic_time'}.long_name = ncchar('time for DIC');
-  nc{'dic_time'}.long_name = 'time for DIC';
-  nc{'dic_time'}.units = ncchar('day');
-  nc{'dic_time'}.units = 'day';
-  if cycle~=0
-    nc{'dic_time'}.cycle_length = cycle;
-  end
-%
-  nc{'DIC'}.long_name = ncchar('DIC');
-  nc{'DIC'}.long_name = 'DIC';
-  nc{'DIC'}.units = ncchar('mMol C m-3');
-  nc{'DIC'}.units = 'mMol C m-3';
-  nc{'DIC'}.fields = ncchar('DIC, scalar, series');
-  nc{'DIC'}.fields = 'DIC, scalar, series';
-%
-%%  endef(nc);
-%
-% record the time and close
-%
-  nc{'dic_time'}(:)=t*30; % if time in month in the dataset !!!
-  close(nc)
-end
-%
-% Same thing for the Initial file
-%
-%disp('Add_no3: creating variables and attributes for the Initial file')
-%
-% open the clim file  
-% 
-%nc=netcdf(inifile,'write');
-%redef(nc);
-%nc{'NO3'} = ncdouble('time','s_rho','eta_rho','xi_rho') ;
-%
-%nc{'NO3'}.long_name = ncchar('Nitrate');
-%nc{'NO3'}.long_name = 'Nitrate';
-%nc{'NO3'}.units = ncchar('mMol N m-3');
-%nc{'NO3'}.units = 'mMol N m-3';
-%
-%endef(nc);
-%close(nc)
-
-return
diff --git a/Preprocessing_tools/add_doc.m b/Preprocessing_tools/add_doc.m
deleted file mode 100644
index d8c3e30f..00000000
--- a/Preprocessing_tools/add_doc.m
+++ /dev/null
@@ -1,144 +0,0 @@
-function add_doc(oafile,climfile,inifile,gridfile,seas_datafile,...
-                 ann_datafile,cycle,makeoa,makeclim);
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  function [longrd,latgrd,doc]=add_doc(climfile,gridfile,...
-%                                       seas_datafile,ann_datafile,...
-%                                       cycle);
-%
-%  pierrick 2001
-%
-%  Add DOC (mMol C m-3) in a CROCO climatology file
-%  take seasonal data for the upper levels and annual data for the
-%  lower levels
-%
-%  input:
-%    
-%    climfile      : croco climatology file to process (netcdf)
-%    gridfile      : croco grid file (netcdf)
-%    seas_datafile : regular longitude - latitude - z seasonal data 
-%                    file used for the upper levels  (netcdf)
-%    ann_datafile  : regular longitude - latitude - z annual data 
-%                    file used for the lower levels  (netcdf)
-%    cycle         : time length (days) of climatology cycle (ex:360 for
-%                    annual cycle) - 0 if no cycle.
-%
-%   output:
-%
-%    [longrd,latgrd,doc] : surface field to plot (as an illustration)
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% Read in the grid
-%
-nc=netcdf(gridfile,'r');
-hmax=max(max(nc{'h'}(:)));
-close(nc);
-%
-% read in the datafiles 
-%
-nc=netcdf(seas_datafile,'r');
-t=nc{'T'}(:);
-close(nc)
-nc=netcdf(ann_datafile,'r');
-zdoc=nc{'Z'}(:);
-kmax=max(find(zdoc<hmax))-1;
-zdoc=zdoc(1:kmax);
-close(nc)
-%
-% open the OA file  
-% 
-if (makeoa)
-  disp('Add_doc: creating variables and attributes for the OA file')
-  nc=netcdf(oafile,'write');
-%%  redef(nc);
-  nc('doc_time') = length(t);
-  nc{'doc_time'} = ncdouble('doc_time') ;
-  nc('Zdoc') = length(zdoc);
-  nc{'Zdoc'} = ncdouble('Zdoc') ;
-  nc{'DOC'} = ncdouble('doc_time','Zdoc','eta_rho','xi_rho') ;
-%
-  nc{'doc_time'}.long_name = ncchar('time for doc');
-  nc{'doc_time'}.long_name = 'time for doc';
-  nc{'doc_time'}.units = ncchar('day');
-  nc{'doc_time'}.units = 'day';
-  if cycle~=0
-    nc{'doc_time'}.cycle_length = cycle;
-  end
-%
-  nc{'Zdoc'}.long_name = ncchar('Depth for DOC');
-  nc{'Zdoc'}.long_name = 'Depth for DOC';
-  nc{'Zdoc'}.units = ncchar('m');
-  nc{'Zdoc'}.units = 'm';
-%
-  nc{'DOC'}.long_name = ncchar('DOC');
-  nc{'DOC'}.long_name = 'DOC';
-  nc{'DOC'}.units = ncchar('mMol C m-3');
-  nc{'DOC'}.units = 'mMol C m-3';
-  nc{'DOC'}.fields = ncchar('DOC, scalar, series');
-  nc{'DOC'}.fields = 'DOC, scalar, series';
-%
-%%  endef(nc);
-%
-% record deth and time and close
-%
-  nc{'doc_time'}(:)=t*30; % if time in month in the dataset !!!
-  nc{'Zdoc'}(:)=zdoc;
-  close(nc)
-end
-%
-% Same thing for the Clim file
-%
-if (makeclim)
-  disp('Add_doc: creating variables and attributes for the Climatology file')
-%
-% open the clim file  
-% 
-  nc=netcdf(climfile,'write');
-%%  redef(nc);
-  nc('doc_time') = length(t);;
-  nc{'doc_time'} = ncdouble('doc_time') ;
-  nc{'DOC'} = ncdouble('doc_time','s_rho','eta_rho','xi_rho') ;
-%
-  nc{'doc_time'}.long_name = ncchar('time for doc');
-  nc{'doc_time'}.long_name = 'time for doc';
-  nc{'doc_time'}.units = ncchar('day');
-  nc{'doc_time'}.units = 'day';
-  if cycle~=0
-    nc{'doc_time'}.cycle_length = cycle;
-  end
-%
-  nc{'DOC'}.long_name = ncchar('DOC');
-  nc{'DOC'}.long_name = 'DOC';
-  nc{'DOC'}.units = ncchar('mMol C m-3');
-  nc{'DOC'}.units = 'mMol C m-3';
-  nc{'DOC'}.fields = ncchar('DOC, scalar, series');
-  nc{'DOC'}.fields = 'DOC, scalar, series';
-%
-%%  endef(nc);
-%
-% record the time and close
-%
-  nc{'doc_time'}(:)=t*30; % if time in month in the dataset !!!
-  close(nc)
-end
-%
-% Same thing for the Initial file
-%
-%disp('Add_doc: creating variables and attributes for the Initial file')
-%
-% open the clim file  
-% 
-%nc=netcdf(inifile,'write');
-%redef(nc);
-%nc{'DOC'} = ncdouble('time','s_rho','eta_rho','xi_rho') ;
-%
-%nc{'DOC'}.long_name = ncchar('Nitrate');
-%nc{'DOC'}.long_name = 'Nitrate';
-%nc{'DOC'}.units = ncchar('mMol N m-3');
-%nc{'DOC'}.units = 'mMol N m-3';
-%
-%endef(nc);
-%close(nc)
-
-return
diff --git a/Preprocessing_tools/add_fer.m b/Preprocessing_tools/add_fer.m
deleted file mode 100644
index f8d7cf89..00000000
--- a/Preprocessing_tools/add_fer.m
+++ /dev/null
@@ -1,144 +0,0 @@
-function add_fer(oafile,climfile,inifile,gridfile,seas_datafile,...
-                 ann_datafile,cycle,makeoa,makeclim);
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  function [longrd,latgrd,fer]=add_fer(climfile,gridfile,...
-%                                       seas_datafile,ann_datafile,...
-%                                       cycle);
-%
-%  pierrick 2001
-%
-%  Add iron (mMol Fe m-3) in a CROCO climatology file
-%  take seasonal data for the upper levels and annual data for the
-%  lower levels
-%
-%  input:
-%    
-%    climfile      : croco climatology file to process (netcdf)
-%    gridfile      : croco grid file (netcdf)
-%    seas_datafile : regular longitude - latitude - z seasonal data 
-%                    file used for the upper levels  (netcdf)
-%    ann_datafile  : regular longitude - latitude - z annual data 
-%                    file used for the lower levels  (netcdf)
-%    cycle         : time length (days) of climatology cycle (ex:360 for
-%                    annual cycle) - 0 if no cycle.
-%
-%   output:
-%
-%    [longrd,latgrd,fer] : surface field to plot (as an illustration)
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% Read in the grid
-%
-nc=netcdf(gridfile,'r');
-hmax=max(max(nc{'h'}(:)));
-close(nc);
-%
-% read in the datafiles 
-%
-nc=netcdf(seas_datafile,'r');
-t=nc{'T'}(:);
-close(nc)
-nc=netcdf(ann_datafile,'r');
-zfer=nc{'Z'}(:);
-kmax=max(find(zfer<hmax))-1;
-zfer=zfer(1:kmax);
-close(nc)
-%
-% open the OA file  
-% 
-if (makeoa)
-  disp('Add_fer: creating variables and attributes for the OA file')
-  nc=netcdf(oafile,'write');
-%%  redef(nc);
-  nc('fer_time') = length(t);
-  nc{'fer_time'} = ncdouble('fer_time') ;
-  nc('Zfer') = length(zfer);
-  nc{'Zfer'} = ncdouble('Zfer') ;
-  nc{'FER'} = ncdouble('fer_time','Zfer','eta_rho','xi_rho') ;
-%
-  nc{'fer_time'}.long_name = ncchar('time for iron');
-  nc{'fer_time'}.long_name = 'time for iron';
-  nc{'fer_time'}.units = ncchar('day');
-  nc{'fer_time'}.units = 'day';
-  if cycle~=0
-    nc{'fer_time'}.cycle_length = cycle;
-  end
-%
-  nc{'Zfer'}.long_name = ncchar('Depth for FER');
-  nc{'Zfer'}.long_name = 'Depth for FER';
-  nc{'Zfer'}.units = ncchar('m');
-  nc{'Zfer'}.units = 'm';
-%
-  nc{'FER'}.long_name = ncchar('Iron');
-  nc{'FER'}.long_name = 'Iron';
-  nc{'FER'}.units = ncchar('uMol Fe m-3');
-  nc{'FER'}.units = 'uMol Fe m-3';
-  nc{'FER'}.fields = ncchar('FER, scalar, series');
-  nc{'FER'}.fields = 'FER, scalar, series';
-%
-%%  endef(nc);
-%
-% record deth and time and close
-%
-  nc{'fer_time'}(:)=t*30; % if time in month in the dataset !!!
-  nc{'Zfer'}(:)=zfer;
-  close(nc)
-end
-%
-% Same thing for the Clim file
-%
-if (makeclim)
-  disp('Add_fer: creating variables and attributes for the Climatology file')
-%
-% open the clim file  
-% 
-  nc=netcdf(climfile,'write');
-%%  redef(nc);
-  nc('fer_time') = length(t);;
-  nc{'fer_time'} = ncdouble('fer_time') ;
-  nc{'FER'} = ncdouble('fer_time','s_rho','eta_rho','xi_rho') ;
-%
-  nc{'fer_time'}.long_name = ncchar('time for iron');
-  nc{'fer_time'}.long_name = 'time for iron';
-  nc{'fer_time'}.units = ncchar('day');
-  nc{'fer_time'}.units = 'day';
-  if cycle~=0
-    nc{'fer_time'}.cycle_length = cycle;
-  end
-%
-  nc{'FER'}.long_name = ncchar('Iron');
-  nc{'FER'}.long_name = 'Iron';
-  nc{'FER'}.units = ncchar('uMol Fe m-3');
-  nc{'FER'}.units = 'uMol Fe m-3';
-  nc{'FER'}.fields = ncchar('FER, scalar, series');
-  nc{'FER'}.fields = 'FER, scalar, series';
-%
-%%  endef(nc);
-%
-% record the time and close
-%
-  nc{'fer_time'}(:)=t*30; % if time in month in the dataset !!!
-  close(nc)
-end
-%
-% Same thing for the Initial file
-%
-%disp('Add_fer: creating variables and attributes for the Initial file')
-%
-% open the clim file  
-% 
-%nc=netcdf(inifile,'write');
-%redef(nc);
-%nc{'FER'} = ncdouble('time','s_rho','eta_rho','xi_rho') ;
-%
-%nc{'FER'}.long_name = ncchar('Nitrate');
-%nc{'FER'}.long_name = 'Nitrate';
-%nc{'FER'}.units = ncchar('mMol N m-3');
-%nc{'FER'}.units = 'mMol N m-3';
-%
-%endef(nc);
-%close(nc)
-
-return
diff --git a/Preprocessing_tools/add_ini_Sphyto_Lphyto.m b/Preprocessing_tools/add_ini_Sphyto_Lphyto.m
deleted file mode 100644
index e6354de5..00000000
--- a/Preprocessing_tools/add_ini_Sphyto_Lphyto.m
+++ /dev/null
@@ -1,82 +0,0 @@
-function add_ini_Sphyto_Lphyto(inifile);
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  function add_ini_phyto(inifile);
-%
-%  Add phytoplancton (mMol N m-3)  in a CROCO initial file.
-%  take the chlorophyll (mg C) from the initial file and
-%  multiply by the ratio chlorophyll / phytoplancton derived
-%  from previous simulations.
-%
-%  phyto = theta * chla
-%
-%  input:
-%    
-%    inifile      : croco initial file to process (netcdf)
-% 
-%  Further Information:  
-%  http://www.croco-ocean.org
-%  
-%  This file is part of CROCOTOOLS
-%
-%  CROCOTOOLS is free software; you can redistribute it and/or modify
-%  it under the terms of the GNU General Public License as published
-%  by the Free Software Foundation; either version 2 of the License,
-%  or (at your option) any later version.
-%
-%  CROCOTOOLS is distributed in the hope that it will be useful, but
-%  WITHOUT ANY WARRANTY; without even the implied warranty of
-%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-%  GNU General Public License for more details.
-%
-%  You should have received a copy of the GNU General Public License
-%  along with this program; if not, write to the Free Software
-%  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-%  MA  02111-1307  USA
-%
-%  Copyright (c) 2001-2006 by Pierrick Penven 
-%  e-mail:Pierrick.Penven@ird.fr  
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-theta1=0.1;
-theta2=0.4;
-%
-disp('Add_ini_Sphyto_Lphyto: creating variable and attribute')
-%
-% open the initial file  
-% 
-nc=netcdf(inifile,'write');
-time= nc{'scrum_time'}(:);
-tlen=length(time);
-%
-%redef(nc);
-%
-nc{'SPHYTO'} = ncdouble('time','s_rho','eta_rho','xi_rho') ;
-nc{'SPHYTO'}.long_name = ncchar('Small Phytoplankton');
-nc{'SPHYTO'}.long_name = 'Small Phytoplankton';
-nc{'SPHYTO'}.units = ncchar('mMol N m-3');
-nc{'SPHYTO'}.units = 'mMol N m-3';
-nc{'SPHYTO'}.fields = ncchar('SPHYTO, scalar, series');
-nc{'SPHYTO'}.fields = 'SPHYTO, scalar, series';
-%
-nc{'LPHYTO'} = ncdouble('time','s_rho','eta_rho','xi_rho') ;
-nc{'LPHYTO'}.long_name = ncchar('Large Phytoplankton');
-nc{'LPHYTO'}.long_name = 'Large Phytoplankton';
-nc{'LPHYTO'}.units = ncchar('mMol N m-3');
-nc{'LPHYTO'}.units = 'mMol N m-3';
-nc{'LPHYTO'}.fields = ncchar('LPHYTO, scalar, series');
-nc{'LPHYTO'}.fields = 'LPHYTO, scalar, series';
-%
-%endef(nc);
-%
-% loop on time
-%
-for l=1:tlen
-  disp(['time index: ',num2str(l),' of total: ',num2str(tlen)])
-  nc{'SPHYTO'}(l,:,:,:)=theta1*squeeze(nc{'CHLA'}(l,:,:,:));
-  nc{'LPHYTO'}(l,:,:,:)=theta2*squeeze(nc{'CHLA'}(l,:,:,:));  
-end
-close(nc);
-return
-
diff --git a/Preprocessing_tools/add_ini_Szoo_Lzoo.m b/Preprocessing_tools/add_ini_Szoo_Lzoo.m
deleted file mode 100644
index 8a65476c..00000000
--- a/Preprocessing_tools/add_ini_Szoo_Lzoo.m
+++ /dev/null
@@ -1,84 +0,0 @@
-function add_ini_Szoo_Lzoo(inifile);
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  function add_ini_zoo(inifile);
-%
-%  Add zooplancton (mMol N m-3) in a CROCO climatology file.
-%  take the chlorophyll (mg C) from the initial file and
-%  multiply by the ratio chlorophyll / phytoplancton derived
-%  from previous simulations (Gruber et al., 2005)
-%
-%  zoo = theta * chla
-
-%  input:
-%    
-%    inifile      : croco initial file to process (netcdf)
-% 
-%  Further Information:  
-%  http://www.croco-ocean.org
-%  
-%  This file is part of CROCOTOOLS
-%
-%  CROCOTOOLS is free software; you can redistribute it and/or modify
-%  it under the terms of the GNU General Public License as published
-%  by the Free Software Foundation; either version 2 of the License,
-%  or (at your option) any later version.
-%
-%  CROCOTOOLS is distributed in the hope that it will be useful, but
-%  WITHOUT ANY WARRANTY; without even the implied warranty of
-%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-%  GNU General Public License for more details.
-%
-%  You should have received a copy of the GNU General Public License
-%  along with this program; if not, write to the Free Software
-%  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-%  MA  02111-1307  USA
-%
-%  Copyright (c) 2001-2006 by Pierrick Penven 
-%  e-mail:Pierrick.Penven@ird.fr  
-%
-%  Updated in 2005 by Patrick Marchesiello
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-theta1=0.2;
-theta2=0.3;
-%
-disp('Add_ini_Szoo_Lzoo: creating variable and attribute')
-%
-% open the initial file  
-% 
-nc=netcdf(inifile,'write');
-time= nc{'scrum_time'}(:);
-tlen=length(time);
-%
-%redef(nc);
-%
-nc{'SZOO'} = ncdouble('time','s_rho','eta_rho','xi_rho') ;
-nc{'SZOO'}.long_name = ncchar('Small Zooplankton');
-nc{'SZOO'}.long_name = 'Small Zooplankton';
-nc{'SZOO'}.units = ncchar('mMol N m-3');
-nc{'SZOO'}.units = 'mMol N m-3';
-nc{'SZOO'}.fields = ncchar('SZOO, scalar, series');
-nc{'SZOO'}.fields = 'SZOO, scalar, series';
-%
-nc{'LZOO'} = ncdouble('time','s_rho','eta_rho','xi_rho') ;
-nc{'LZOO'}.long_name = ncchar('Large Zooplankton');
-nc{'LZOO'}.long_name = 'Large Zooplankton';
-nc{'LZOO'}.units = ncchar('mMol N m-3');
-nc{'LZOO'}.units = 'mMol N m-3';
-nc{'LZOO'}.fields = ncchar('LZOO, scalar, series');
-nc{'LZOO'}.fields = 'LZOO, scalar, series';
-%
-%endef(nc);
-%
-% loop on time
-%
-for l=1:tlen
-  disp(['time index: ',num2str(l),' of total: ',num2str(tlen)])
-  nc{'SZOO'}(l,:,:,:)=theta1*squeeze(nc{'CHLA'}(l,:,:,:));
-  nc{'LZOO'}(l,:,:,:)=theta2*squeeze(nc{'CHLA'}(l,:,:,:));
-end
-close(nc);
-return
-
diff --git a/Preprocessing_tools/add_ini_bioebus.m b/Preprocessing_tools/add_ini_bioebus.m
deleted file mode 100644
index a1c6ec60..00000000
--- a/Preprocessing_tools/add_ini_bioebus.m
+++ /dev/null
@@ -1,52 +0,0 @@
-function add_ini_bioebus(inifile,clobber)
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Copyright (c) 2014 IRD                                          %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%                                                                 %
-%                                                                 %
-%  function nc=add_ini_bioebus(inifile,clobber)                   %
-%                                                                 %
-%   This function create the header of a Netcdf climatology       %
-%   file.                                                         %
-%                                                                 %
-%   Input:                                                        %
-%                                                                 %
-%   inifile      Netcdf initial file name (character string).     %
-%   clobber      Switch to allow or not writing over an existing  %
-%                file.(character string)                          %
-%                                                                 %
-%   Output                                                        %
-%                                                                 %
-%   nc       Output netcdf object.                                %
-%                                                                 %
-%  Gildas Cambon, IRD 2014                                        %
-%                                                                 %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-disp(' ')
-disp([' Adding BIOEBUS data in file : ',inifile])
-%
-%  Create the initial file
-%
-nc = netcdf(inifile,clobber);
-%%result = redef(nc);
-%
-%  Create variables
-%
-nc{'NO3'} = ncdouble('time','s_rho','eta_rho','xi_rho') ;
-nc{'O2'} = ncdouble('time','s_rho','eta_rho','xi_rho') ;
-%
-%  Create attributes
-%
-nc{'NO3'}.long_name = ncchar('NO3');
-nc{'NO3'}.long_name = 'NO3';
-nc{'NO3'}.units = ncchar('mMol N m-3');
-nc{'NO3'}.units = 'mMol N m-3';
-%
-nc{'O2'}.long_name = ncchar('O2');
-nc{'O2'}.long_name = 'O2';
-nc{'O2'}.units = ncchar('mMol O m-3');
-nc{'O2'}.units = 'mMol O m-3';
-%
-% Leave define mode
-%
-%%result = endef(nc);
\ No newline at end of file
diff --git a/Preprocessing_tools/add_ini_chla.m b/Preprocessing_tools/add_ini_chla.m
deleted file mode 100644
index 9df8a5fc..00000000
--- a/Preprocessing_tools/add_ini_chla.m
+++ /dev/null
@@ -1,202 +0,0 @@
-function add_ini_chla(inifile,gridfile,seas_datafile,cycle,Roa);
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  function [longrd,latgrd,chla]=add_ini_chla(inifile,gridfile,...
-%                                             seas_datafile,...
-%                                             cycle);
-%
-%  pierrick 2001
-%
-%  Add chlorophyll in a CROCO initial file.
-%  take seasonal data for the surface levels and extrapole 
-%  using Morel and Berthon (1989) parameterization for the
-%  lower levels. warning ! the unit is (micro mole/l) in the
-%  dataset.
-%  do a temporal interpolation to have values at initial
-%  time.
-%
-%  ref:  Morel and Berthon, Surface pigments, algal biomass
-%        profiles, and potential production of the euphotic layer:
-%        Relationships reinvestigated in view of remote-sensing 
-%        applications. Limnol. Oceanogr., 34, 1989, 1545-1562.
-%
-%  input:
-%    
-%    inifile       : croco initial file to process (netcdf)
-%    gridfile      : croco grid file (netcdf)
-%    seas_datafile : regular longitude - latitude - z seasonal data 
-%                    file used for the upper levels  (netcdf)
-%    ann_datafile  : regular longitude - latitude - z annual data 
-%                    file used for the lower levels  (netcdf)
-%    cycle         : time length (days) of climatology cycle (ex:360 for
-%                    annual cycle) - 0 if no cycle.
-%
-%   output:
-%
-%    [longrd,latgrd,chla] : surface field to plot (as an illustration)
-% 
-%  Further Information:  
-%  http://www.croco-ocean.org
-%  
-%  This file is part of CROCOTOOLS
-%
-%  CROCOTOOLS is free software; you can redistribute it and/or modify
-%  it under the terms of the GNU General Public License as published
-%  by the Free Software Foundation; either version 2 of the License,
-%  or (at your option) any later version.
-%
-%  CROCOTOOLS is distributed in the hope that it will be useful, but
-%  WITHOUT ANY WARRANTY; without even the implied warranty of
-%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-%  GNU General Public License for more details.
-%
-%  You should have received a copy of the GNU General Public License
-%  along with this program; if not, write to the Free Software
-%  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-%  MA  02111-1307  USA
-%
-%  Copyright (c) 2001-2006 by Pierrick Penven 
-%  e-mail:Pierrick.Penven@ird.fr  
-%
-%  Updated    August-2006 by Pierrick Penven
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-disp('Add_ini_chla: creating variable and attribute')
-default=NaN;
-%
-% read in the datafile 
-%
-ncseas=netcdf(seas_datafile,'r');
-x=ncseas{'X'}(:);
-y=ncseas{'Y'}(:);
-datatime=ncseas{'T'}(:);
-datatime=datatime*30;  % !!! if the time in the dataset is in months !!!
-tlen=length(datatime);
-%
-% open the grid file  
-% 
-%
-% open the grid file  
-% 
-ng=netcdf(gridfile,'r');
-lon=ng{'lon_rho'}(:);
-%lon(lon<0)=lon(lon<0)+360;
-lat=ng{'lat_rho'}(:);
-h=ng{'h'}(:);
-close(ng);
-[M,L]=size(lon);
-dl=0.5;
-minlon=min(min(lon))-dl;
-maxlon=max(max(lon))+dl;
-minlat=min(min(lat))-dl;
-maxlat=max(max(lat))+dl;
-imin=max(find(x<=minlon));
-imax=min(find(x>=maxlon));
-jmin=max(find(y<=minlat));
-jmax=min(find(y>=maxlat));
-x=x(imin:imax);
-y=y(jmin:jmax);
-%
-% open the initial file  
-% 
-nc=netcdf(inifile,'write');
-theta_s = nc{'theta_s'}(:);
-if isempty(theta_s)
-  disp('Restart file')
-  theta_s=nc.theta_s(:);
-  theta_b=nc.theta_b(:);
-  hc=nc.hc(:);
-else
-  theta_b =  nc{'theta_b'}(:);
-  hc  =  nc{'hc'}(:);
-  vtransform = nc{'Vtransform'}(:);
-end
-N =  length(nc('s_rho'));
-scrum_time = nc{'scrum_time'}(:);
-scrum_time = scrum_time / (24*3600);
-tinilen = length(scrum_time);
-%redef(nc);
-nc{'CHLA'} = ncdouble('time','s_rho','eta_rho','xi_rho') ;
-nc{'CHLA'}.long_name = ncchar('Chlorophyll');
-nc{'CHLA'}.long_name = 'Chlorophyll';
-nc{'CHLA'}.units = ncchar('mg C');
-nc{'CHLA'}.units = 'mg C';
-nc{'CHLA'}.fields = ncchar('CHLA, scalar, series');
-nc{'CHLA'}.fields = 'CHLA, scalar, series';
-%
-%endef(nc);
-%
-% Get the missing values
-%
-missval=ncseas{'chlorophyll'}.missing_value(:);
-%
-% loop on time
-%
-for l=1:tinilen
-  disp(['time index: ',num2str(l),' of total: ',num2str(tinilen)])
-%
-%  get data time indices and weights for temporal interpolation
-%
-  if cycle~=0
-    modeltime=mod(scrum_time(l),cycle);
-  else
-    modeltime=scrum_time;
-  end
-  l1=find(modeltime==datatime);
-  if isempty(l1)
-    disp('temporal interpolation')
-    l1=max(find(datatime<modeltime));
-    time1=datatime(l1);
-    if isempty(l1)
-      if cycle~=0
-        l1=tlen;
-        time1=datatime(l1)-cycle;
-      else
-        error('No previous time in the dataset')
-      end
-    end
-    l2=min(find(datatime>modeltime));
-    time2=datatime(l2);
-    if isempty(l2)
-      if cycle~=0
-        l2=1;
-        time2=datatime(l2)+cycle;
-      else
-        error('No posterious time in the dataset')
-      end
-    end
-    disp(['Initialisation time: ',num2str(modeltime),...
-          ' - Time 1: ',num2str(time1),...
-          ' - Time 2: ',num2str(time2)])
-    cff1=(modeltime-time2)/(time1-time2);
-    cff2=(time1-modeltime)/(time1-time2);
-  else
-    cff1=1;
-    l2=l1;
-    cff2=0;
-  end
-%
-% interpole the annual dataset on the horizontal croco grid
-%
-  disp('Add_ini_chla: horizontal extrapolation of surface data')
-  surfchla=squeeze(ncseas{'chlorophyll'}(l1,jmin:jmax,imin:imax));
-  surfchla=get_missing_val(x,y,surfchla,missval,Roa,default);
-  surfchla2=squeeze(ncseas{'chlorophyll'}(l2,jmin:jmax,imin:imax));
-  surfchla2=get_missing_val(x,y,surfchla2,missval,Roa,default);
-  surfchla=cff1*surfchla + cff2*surfchla2;
-  surfchlacroco=interp2(x,y,surfchla,lon,lat);
-%
-% extrapole the chlorophyll on the vertical
-%
-  zeta = squeeze(nc{'zeta'}(l,:,:));
-  zcroco=zlevs(h,zeta,theta_s,theta_b,hc,N,'r',vtransform);
-  disp(['Add_ini_chla: vertical ',...
-  'extrapolation of chlorophyll'])
-  chlacroco=extr_chlo(surfchlacroco,zcroco);
-  nc{'CHLA'}(l,:,:,:)=chlacroco;
-end
-close(nc);
-close(ncseas);
-return
diff --git a/Preprocessing_tools/add_ini_no3.m b/Preprocessing_tools/add_ini_no3.m
deleted file mode 100644
index b3573181..00000000
--- a/Preprocessing_tools/add_ini_no3.m
+++ /dev/null
@@ -1,204 +0,0 @@
-function add_ini_no3(ininame,grdname,oaname,cycle,NO3min);
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  function [longrd,latgrd,no3]=add_ini_no3(ininame,grdname,...
-%                                           seas_datafile,ann_datafile,...
-%                                           cycle);
-%
-%  Add nitrate (mMol N m-3) in a CROCO initial file.
-%  take seasonal data for the upper levels and annual data for the
-%  lower levels.
-%  do a temporal interpolation to have values at initial
-%  time.
-%
-%  input:
-%    
-%    ininame       : croco initial file to process (netcdf)
-%    grdname      : croco grid file (netcdf)
-%    seas_datafile : regular longitude - latitude - z seasonal data 
-%                    file used for the upper levels  (netcdf)
-%    ann_datafile  : regular longitude - latitude - z annual data 
-%                    file used for the lower levels  (netcdf)
-%    cycle         : time length (days) of climatology cycle (ex:360 for
-%                    annual cycle) - 0 if no cycle.
-%
-%   output:
-%
-%    [longrd,latgrd,no3] : surface field to plot (as an illustration)
-% 
-%  Further Information:  
-%  http://www.croco-ocean.org
-%  
-%  This file is part of CROCOTOOLS
-%
-%  CROCOTOOLS is free software; you can redistribute it and/or modify
-%  it under the terms of the GNU General Public License as published
-%  by the Free Software Foundation; either version 2 of the License,
-%  or (at your option) any later version.
-%
-%  CROCOTOOLS is distributed in the hope that it will be useful, but
-%  WITHOUT ANY WARRANTY; without even the implied warranty of
-%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-%  GNU General Public License for more details.
-%
-%  You should have received a copy of the GNU General Public License
-%  along with this program; if not, write to the Free Software
-%  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-%  MA  02111-1307  USA
-%
-%  Copyright (c) 2001-2006 by Pierrick Penven 
-%  e-mail:Pierrick.Penven@ird.fr  
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-disp('Add_ini_no3: creating variable and attribute')
-%
-% open the grid file  
-% 
-nc=netcdf(grdname,'r');
-h=nc{'h'}(:);
-close(nc);
-%
-% open the initial file  
-% 
-nc=netcdf(ininame,'write');
-theta_s = nc{'theta_s'}(:);
-if isempty(theta_s)
-  disp('Restart file')
-  theta_s=nc.theta_s(:);
-  theta_b=nc.theta_b(:);
-  hc=nc.hc(:);
-else
-  theta_b =  nc{'theta_b'}(:);
-  hc  =  nc{'hc'}(:);
-  vtransform = nc{'Vtransform'}(:);
-  if  ~exist('vtransform')
-    vtransform=1; %Old Vtransform
-    disp([' NO VTRANSFORM parameter found'])
-    disp([' USE TRANSFORM default value vtransform = 1'])
-  end
-end
-N =  length(nc('s_rho'));
-%
-% open the oa file  
-% 
-noa=netcdf(oaname,'r');
-z=-noa{'Zno3'}(:);
-oatime=noa{'no3_time'}(:);
-tlen=length(oatime);
-%
-% Get the sigma depths
-%
-zcroco=zlevs(h,0.*h,theta_s,theta_b,hc,N,'r',vtransform);
-zmin=min(min(min(zcroco)));
-zmax=max(max(max(zcroco)));
-%
-% Check if the min z level is below the min sigma level 
-%    (if not add a deep layer)
-%
-%addsurf=max(z)<zmax;
-addsurf=1;
-addbot=min(z)>zmin;
-if addsurf
- z=[100;z];
-end
-if addbot
- z=[z;-100000];
-end
-Nz=min(find(z<zmin));
-z=z(1:Nz);
-%
-% read in the initial file  
-% 
-scrum_time = nc{'scrum_time'}(:);
-scrum_time = scrum_time / (24*3600);
-tinilen = length(scrum_time);
-%redef(nc);
-nc{'NO3'} = ncdouble('time','s_rho','eta_rho','xi_rho');
-nc{'NO3'}.long_name = ncchar('Nitrate');
-nc{'NO3'}.long_name = 'Nitrate';
-nc{'NO3'}.units = ncchar('mMol N m-3');
-nc{'NO3'}.units = 'mMol N m-3';
-nc{'NO3'}.fields = ncchar('NO3, scalar, series');
-nc{'NO3'}.fields = 'NO3, scalar, series';
-%endef(nc);
-%
-%  loop on initial time
-%
-for l=1:tinilen
-  disp(['time index: ',num2str(l),' of total: ',num2str(tinilen)])
-%
-%  get data time indices and weights for temporal interpolation
-%
-  if cycle~=0
-    modeltime=mod(scrum_time(l),cycle);
-  else
-    modeltime=scrum_time;
-  end
-  l1=find(modeltime==oatime);
-  if isempty(l1)
-    disp('temporal interpolation')
-    l1=max(find(oatime<modeltime));
-    time1=oatime(l1);
-    if isempty(l1)
-      if cycle~=0
-        l1=tlen;
-        time1=oatime(l1)-cycle;
-      else
-        error('No previous time in the dataset')
-      end
-    end
-    l2=min(find(oatime>modeltime));
-    time2=oatime(l2);
-    if isempty(l2)
-      if cycle~=0
-        l2=1;
-        time2=oatime(l2)+cycle;
-      else
-        error('No posterious time in the dataset')
-      end
-    end
-    disp(['Initialisation time: ',num2str(modeltime),...
-          ' - Time 1: ',num2str(time1),...
-          ' - Time 2: ',num2str(time2)])	 
-    cff1=(modeltime-time2)/(time1-time2);
-    cff2=(time1-modeltime)/(time1-time2);
-  else
-    cff1=1;
-    l2=l1;
-    cff2=0;
-  end
-%
-% interpole the seasonal dataset on the horizontal croco grid
-%
-  disp(['Add_ini_no3: vertical interpolation'])
-  var=squeeze(noa{'NO3'}(l1,:,:,:));
-  if addsurf
-    var=cat(1,var(1,:,:),var);
-  end
-  if addbot
-    var=cat(1,var,var(end,:,:));
-  end
-  var2=squeeze(noa{'NO3'}(l2,:,:,:));
-  if addsurf
-    var2=cat(1,var2(1,:,:),var2);
-  end
-  if addbot
-    var2=cat(1,var2,var2(end,:,:));
-  end
-  var=cff1*var + cff2*var2;
-  zeta = squeeze(nc{'zeta'}(l,:,:));
-  zcroco=zlevs(h,zeta,theta_s,theta_b,hc,N,'r',vtransform);
-  nc{'NO3'}(l,:,:,:)=ztosigma(flipdim(var,1),zcroco,flipud(z));
-end
-close(noa);
-%
-% Remove low values for oligotrophic areas
-%
-for l=1:tinilen
-  NO3=nc{'NO3'}(l,:,:,:);
-  NO3(NO3<NO3min)=0;
-  nc{'NO3'}(l,:,:,:)=NO3;
-end
-close(nc);
-return
diff --git a/Preprocessing_tools/add_ini_npzd.m b/Preprocessing_tools/add_ini_npzd.m
deleted file mode 100644
index d89cbc20..00000000
--- a/Preprocessing_tools/add_ini_npzd.m
+++ /dev/null
@@ -1,63 +0,0 @@
-function add_ini_npzd(inifile,clobber)
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Copyright (c) 2014 IRD                                          %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%                                                                 %
-%                                                                 %
-%  function nc=add_ini_npzd(inifile,clobber)                      %
-%                                                                 %
-%   This function create the header of a Netcdf climatology       %
-%   file.                                                         %
-%                                                                 %
-%   Input:                                                        %
-%                                                                 %
-%   inifile      Netcdf initial file name (character string).     %
-%   clobber      Switch to allow or not writing over an existing  %
-%                file.(character string)                          %
-%                                                                 %
-%   Output                                                        %
-%                                                                 %
-%   nc       Output netcdf object.                                %
-%                                                                 %
-%   Gildas Cambon, IRD, 20123                                     %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-disp(' ')
-disp([' Adding NPZD data in file : ',inifile])
-%
-%  Create the initial file
-%
-nc = netcdf(inifile,clobber);
-%%result = redef(nc);
-%
-%  Create variables
-%
-nc{'NO3'} = ncdouble('time','s_rho','eta_rho','xi_rho') ;
-nc{'O2'} = ncdouble('time','s_rho','eta_rho','xi_rho') ;
-%
-%  Create attributes
-%
-nc{'NO3'}.long_name = ncchar('NO3');
-nc{'NO3'}.long_name = 'NO3';
-nc{'NO3'}.units = ncchar('mMol N m-3');
-nc{'NO3'}.units = 'mMol N m-3';
-%
-nc{'O2'}.long_name = ncchar('O2');
-nc{'O2'}.long_name = 'O2';
-nc{'O2'}.units = ncchar('mMol O m-3');
-nc{'O2'}.units = 'mMol O m-3';
-%
-% Leave define mode
-%
-%%result = endef(nc);
-%
-% Write variables
-%
-nc{'NO3'}(:)  =  0;
-nc{'O2'}(:)   =  0;
-%
-% Synchronize on disk
-%
-close(nc);
-return
-
-
diff --git a/Preprocessing_tools/add_ini_o2.m b/Preprocessing_tools/add_ini_o2.m
deleted file mode 100644
index 8212a904..00000000
--- a/Preprocessing_tools/add_ini_o2.m
+++ /dev/null
@@ -1,205 +0,0 @@
-function add_ini_o2(ininame,grdname,oaname,cycle,O2min);
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  function [longrd,latgrd,o2]=add_ini_o2(ininame,grdname,...
-%                                           month_datafile,ann_datafile,...
-%                                           cycle);
-%
-%  Add oxygen (mMol O2 m-3) in a CROCO initial file.
-%  take monthly data for the upper levels and annual data for the
-%  lower levels.
-%  do a temporal interpolation to have values at initial
-%  time.
-%
-%  input:
-%    
-%    ininame       : croco initial file to process (netcdf)
-%    grdname      : croco grid file (netcdf)
-%    month_datafile : regular longitude - latitude - z monthly data 
-%                    file used for the upper levels  (netcdf)
-%    ann_datafile  : regular longitude - latitude - z annual data 
-%                    file used for the lower levels  (netcdf)
-%    cycle         : time length (days) of climatology cycle (ex:360 for
-%                    annual cycle) - 0 if no cycle.
-%
-%   output:
-%
-%    [longrd,latgrd,o2] : surface field to plot (as an illustration)
-% 
-%  Further Information:  
-%  http://www.croco-ocean.org
-%  
-%  This file is part of CROCOTOOLS
-%
-%  CROCOTOOLS is free software; you can redistribute it and/or modify
-%  it under the terms of the GNU General Public License as published
-%  by the Free Software Foundation; either version 2 of the License,
-%  or (at your option) any later version.
-%
-%  CROCOTOOLS is distributed in the hope that it will be useful, but
-%  WITHOUT ANY WARRANTY; without even the implied warranty of
-%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-%  GNU General Public License for more details.
-%
-%  You should have received a copy of the GNU General Public License
-%  along with this program; if not, write to the Free Software
-%  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-%  MA  02111-1307  USA
-%
-%  Copyright (c) 2001-2006 by Pierrick Penven 
-%  e-mail:Pierrick.Penven@ird.fr  
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-disp('Add_ini_o2: creating variable and attribute')
-%
-% open the grid file  
-% 
-nc=netcdf(grdname,'r');
-h=nc{'h'}(:);
-close(nc);
-%
-% open the initial file  
-%
-nc=netcdf(ininame,'write');
-theta_s = nc{'theta_s'}(:);
-if isempty(theta_s)
-    disp('Restart file')
-    theta_s=nc.theta_s(:);
-    theta_b=nc.theta_b(:);
-    hc=nc.hc(:);
-else
-    theta_b =  nc{'theta_b'}(:);
-    hc  =  nc{'hc'}(:);
-    vtransform = nc{'Vtransform'}(:);
-    if  ~exist('vtransform')
-        vtransform=1; %Old Vtransform
-        disp([' NO VTRANSFORM parameter found'])
-        disp([' USE TRANSFORM default value vtransform = 1'])
-    end
-end
-N =  length(nc('s_rho'));
-%
-% open the oa file  
-% 
-noa=netcdf(oaname,'r');
-z=-noa{'Zo2'}(:);
-oatime=noa{'o2_time'}(:);
-tlen=length(oatime);
-%
-% Get the sigma depths
-%
-zcroco=zlevs(h,0.*h,theta_s,theta_b,hc,N,'r',vtransform);
-zmin=min(min(min(zcroco)));
-zmax=max(max(max(zcroco)));
-%
-% Check if the min z level is below the min sigma level 
-%    (if not add a deep layer)
-%
-%addsurf=max(z)<zmax;
-addsurf=1;
-addbot=min(z)>zmin;
-if addsurf
- z=[100;z];
-end
-if addbot
- z=[z;-100000];
-end
-Nz=min(find(z<zmin));
-z=z(1:Nz);
-%
-% read in the initial file  
-% 
-scrum_time = nc{'scrum_time'}(:);
-scrum_time = scrum_time / (24*3600);
-tinilen = length(scrum_time);
-%redef(nc);
-nc{'O2'} = ncdouble('time','s_rho','eta_rho','xi_rho');
-nc{'O2'}.long_name = ncchar('Oxygen');
-nc{'O2'}.long_name = 'Oxygen';
-nc{'O2'}.units = ncchar('mMol O m-3');
-nc{'O2'}.units = 'mMol O m-3';
-nc{'O2'}.fields = ncchar('O2, scalar, series');
-nc{'O2'}.fields = 'O2, scalar, series';
-%endef(nc);
-%
-%  loop on initial time
-%
-for l=1:tinilen
-  disp(['time index: ',num2str(l),' of total: ',num2str(tinilen)])
-%
-%  get data time indices and weights for temporal interpolation
-%
-  if cycle~=0
-    modeltime=mod(scrum_time(l),cycle);
-  else
-    modeltime=scrum_time;
-  end
-  l1=find(modeltime==oatime);
-  if isempty(l1)
-    disp('temporal interpolation')
-    l1=max(find(oatime<modeltime));
-    time1=oatime(l1);
-    if isempty(l1)
-      if cycle~=0
-        l1=tlen;
-        time1=oatime(l1)-cycle;
-      else
-        error('No previous time in the dataset')
-      end
-    end
-    l2=min(find(oatime>modeltime));
-    time2=oatime(l2);
-    if isempty(l2)
-      if cycle~=0
-        l2=1;
-        time2=oatime(l2)+cycle;
-      else
-        error('No posterious time in the dataset')
-      end
-    end
-    disp(['Initialisation time: ',num2str(modeltime),...
-          ' - Time 1: ',num2str(time1),...
-          ' - Time 2: ',num2str(time2)])	 
-    cff1=(modeltime-time2)/(time1-time2);
-    cff2=(time1-modeltime)/(time1-time2);
-  else
-    cff1=1;
-    l2=l1;
-    cff2=0;
-  end
-%
-% interpole the monthly dataset on the horizontal croco grid
-%
-  disp(['Add_ini_o2: vertical interpolation'])
-  var=squeeze(noa{'O2'}(l1,:,:,:));
-  
-  if addsurf
-    var=cat(1,var(1,:,:),var);
-  end
-  if addbot
-    var=cat(1,var,var(end,:,:));
-  end
-  var2=squeeze(noa{'O2'}(l2,:,:,:));
-  if addsurf
-    var2=cat(1,var2(1,:,:),var2);
-  end
-  if addbot
-    var2=cat(1,var2,var2(end,:,:));
-  end
-  var=cff1*var + cff2*var2;
-  zeta = squeeze(nc{'zeta'}(l,:,:));
-  zcroco=zlevs(h,zeta,theta_s,theta_b,hc,N,'r',vtransform);
-  nc{'O2'}(l,:,:,:)=ztosigma(flipdim(var,1),zcroco,flipud(z));
-end
-close(noa);
-%
-% Remove low values for oligotrophic areas
-%
-for l=1:tinilen
-  O2=nc{'O2'}(l,:,:,:);
-  O2(O2<O2min)=O2min;
-  nc{'O2'}(l,:,:,:)=O2;
-end
-close(nc);
-return
diff --git a/Preprocessing_tools/add_ini_phyto.m b/Preprocessing_tools/add_ini_phyto.m
deleted file mode 100644
index 6c811b9b..00000000
--- a/Preprocessing_tools/add_ini_phyto.m
+++ /dev/null
@@ -1,68 +0,0 @@
-function add_ini_phyto(inifile);
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  function add_ini_phyto(inifile);
-%
-%  Add phytoplancton (mMol N m-3)  in a CROCO initial file.
-%  take the chlorophyll (mg C) from the initial file and
-%  multiply by the ratio chlorophyll / phytoplancton derived
-%  from previous simulations.
-%
-%  phyto = 0.5 * chla
-%
-%  input:
-%    
-%    inifile      : croco initial file to process (netcdf)
-% 
-%  Further Information:  
-%  http://www.croco-ocean.org
-%  
-%  This file is part of CROCOTOOLS
-%
-%  CROCOTOOLS is free software; you can redistribute it and/or modify
-%  it under the terms of the GNU General Public License as published
-%  by the Free Software Foundation; either version 2 of the License,
-%  or (at your option) any later version.
-%
-%  CROCOTOOLS is distributed in the hope that it will be useful, but
-%  WITHOUT ANY WARRANTY; without even the implied warranty of
-%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-%  GNU General Public License for more details.
-%
-%  You should have received a copy of the GNU General Public License
-%  along with this program; if not, write to the Free Software
-%  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-%  MA  02111-1307  USA
-%
-%  Copyright (c) 2001-2006 by Pierrick Penven 
-%  e-mail:Pierrick.Penven@ird.fr  
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-theta=0.5;
-%
-disp('Add_ini_phyto: creating variable and attribute')
-%
-% open the initial file  
-% 
-nc=netcdf(inifile,'write');
-time= nc{'scrum_time'}(:);
-tlen=length(time);
-%%redef(nc);
-nc{'PHYTO'} = ncdouble('time','s_rho','eta_rho','xi_rho') ;
-nc{'PHYTO'}.long_name = ncchar('Phytoplankton');
-nc{'PHYTO'}.long_name = 'Phytoplankton';
-nc{'PHYTO'}.units = ncchar('mMol N m-3');
-nc{'PHYTO'}.units = 'mMol N m-3';
-nc{'PHYTO'}.fields = ncchar('PHYTO, scalar, series');
-nc{'PHYTO'}.fields = 'PHYTO, scalar, series';
-%%endef(nc);
-%
-% loop on time
-%
-for l=1:tlen
-  disp(['time index: ',num2str(l),' of total: ',num2str(tlen)])
-  nc{'PHYTO'}(l,:,:,:)=theta*squeeze(nc{'CHLA'}(l,:,:,:));
-end
-close(nc);
-return
diff --git a/Preprocessing_tools/add_ini_pisces.m b/Preprocessing_tools/add_ini_pisces.m
deleted file mode 100644
index c25cbb61..00000000
--- a/Preprocessing_tools/add_ini_pisces.m
+++ /dev/null
@@ -1,117 +0,0 @@
-function add_ini_pisces(inifile,clobber)
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% Copyright (c) 2000 IRD                                          %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%                                                                 %
-%                                                                 %
-%  function nc=add_ini_pisces(inifile,clobber)                    %
-%                                                                 %
-%   This function create the header of a Netcdf climatology       %
-%   file.                                                         %
-%                                                                 %
-%   Input:                                                        %
-%                                                                 %
-%   inifile      Netcdf initial file name (character string).     %
-%   clobber      Switch to allow or not writing over an existing  %
-%                file.(character string)                          %
-%                                                                 %
-%   Output                                                        %
-%                                                                 %
-%   nc       Output netcdf object.                                %
-%                                                                 %
-%   Pierrick Penven, IRD, 2005.                                   %
-%   Olivier Aumont, IRD, 2006.                                    %
-%   Patricio Marchesiello, IRD 2007                               %
-%   Christophe Eugene Raoul Menkes, IRD 2007                      %
-%                                                                 %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-disp(' ')
-disp([' Adding PISCES data in file : ',inifile])
-%
-%  Create the initial file
-%
-nc = netcdf(inifile,clobber);
-%%result = redef(nc);
-%
-%  Create variables
-%
-nc{'NO3'} = ncdouble('time','s_rho','eta_rho','xi_rho') ;
-nc{'PO4'} = ncdouble('time','s_rho','eta_rho','xi_rho') ;
-nc{'Si'} = ncdouble('time','s_rho','eta_rho','xi_rho') ;
-nc{'O2'} = ncdouble('time','s_rho','eta_rho','xi_rho') ;
-nc{'DIC'} = ncdouble('time','s_rho','eta_rho','xi_rho') ;
-nc{'TALK'} = ncdouble('time','s_rho','eta_rho','xi_rho') ;
-nc{'DOC'} = ncdouble('time','s_rho','eta_rho','xi_rho') ;
-nc{'FER'} = ncdouble('time','s_rho','eta_rho','xi_rho') ;
-
-%
-%  Create attributes
-%
-nc{'NO3'}.long_name = ncchar('NO3');
-nc{'NO3'}.long_name = 'NO3';
-nc{'NO3'}.units = ncchar('mMol N m-3');
-nc{'NO3'}.units = 'mMol N m-3';
-%
-%
-nc{'PO4'}.long_name = ncchar('PO4');
-nc{'PO4'}.long_name = 'PO4';
-nc{'PO4'}.units = ncchar('mMol P m-3');
-nc{'PO4'}.units = 'mMol P m-3';
-%
-%
-nc{'Si'}.long_name = ncchar('Si');
-nc{'Si'}.long_name = 'Si';
-nc{'Si'}.units = ncchar('mMol Si m-3');
-nc{'Si'}.units = 'mMol Si m-3';
-%
-%
-nc{'O2'}.long_name = ncchar('O2');
-nc{'O2'}.long_name = 'O2';
-nc{'O2'}.units = ncchar('mMol O m-3');
-nc{'O2'}.units = 'mMol O m-3';
-%
-%
-nc{'DIC'}.long_name = ncchar('DIC');
-nc{'DIC'}.long_name = 'DIC';
-nc{'DIC'}.units = ncchar('mMol C m-3');
-nc{'DIC'}.units = 'mMol C m-3';
-%
-%
-nc{'TALK'}.long_name = ncchar('TALK');
-nc{'TALK'}.long_name = 'TALK';
-nc{'TALK'}.units = ncchar('mMol C m-3');
-nc{'TALK'}.units = 'mMol C m-3';
-%
-%
-nc{'DOC'}.long_name = ncchar('DOC');
-nc{'DOC'}.long_name = 'DOC';
-nc{'DOC'}.units = ncchar('mMol C m-3');
-nc{'DOC'}.units = 'mMol C m-3';
-%
-%
-nc{'FER'}.long_name = ncchar('FER');
-nc{'FER'}.long_name = 'FER';
-nc{'FER'}.units = ncchar('mMol Fe m-3');
-nc{'FER'}.units = 'mMol Fe m-3';
-%
-% Leave define mode
-%
-%%result = endef(nc);
-%
-% Write variables
-%
-nc{'NO3'}(:)  =  0;
-nc{'PO4'}(:)  =  0;
-nc{'Si'}(:) =  0;
-nc{'O2'}(:)   =  0;
-nc{'DIC'}(:)  =  0;
-nc{'TALK'}(:) =  0;
-nc{'DOC'}(:)  =  0;
-nc{'FER'}(:)  =  0;
-%
-% Synchronize on disk
-%
-close(nc);
-return
-
-
diff --git a/Preprocessing_tools/add_ini_zoo.m b/Preprocessing_tools/add_ini_zoo.m
deleted file mode 100644
index aed5c31e..00000000
--- a/Preprocessing_tools/add_ini_zoo.m
+++ /dev/null
@@ -1,70 +0,0 @@
-function add_ini_zoo(inifile);
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  function add_ini_zoo(inifile);
-%
-%  Add zooplancton (mMol N m-3) in a CROCO climatology file.
-%  take the chlorophyll (mg C) from the initial file and
-%  multiply by the ratio chlorophyll / phytoplancton derived
-%  from previous simulations (Gruber et al., 2005)
-%
-%  zoo = 0.2 * chla
-
-%  input:
-%    
-%    inifile      : croco initial file to process (netcdf)
-% 
-%  Further Information:  
-%  http://www.croco-ocean.org
-%  
-%  This file is part of CROCOTOOLS
-%
-%  CROCOTOOLS is free software; you can redistribute it and/or modify
-%  it under the terms of the GNU General Public License as published
-%  by the Free Software Foundation; either version 2 of the License,
-%  or (at your option) any later version.
-%
-%  CROCOTOOLS is distributed in the hope that it will be useful, but
-%  WITHOUT ANY WARRANTY; without even the implied warranty of
-%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-%  GNU General Public License for more details.
-%
-%  You should have received a copy of the GNU General Public License
-%  along with this program; if not, write to the Free Software
-%  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-%  MA  02111-1307  USA
-%
-%  Copyright (c) 2001-2006 by Pierrick Penven 
-%  e-mail:Pierrick.Penven@ird.fr  
-%
-%  Updated in 2005 by Patrick Marchesiello
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-theta=0.2;
-%
-disp('Add_ini_zoo: creating variable and attribute')
-%
-% open the initial file  
-% 
-nc=netcdf(inifile,'write');
-time= nc{'scrum_time'}(:);
-tlen=length(time);
-%%redef(nc);
-nc{'ZOO'} = ncdouble('time','s_rho','eta_rho','xi_rho') ;
-nc{'ZOO'}.long_name = ncchar('Zooplankton');
-nc{'ZOO'}.long_name = 'Zooplankton';
-nc{'ZOO'}.units = ncchar('mMol N m-3');
-nc{'ZOO'}.units = 'mMol N m-3';
-nc{'ZOO'}.fields = ncchar('ZOO, scalar, series');
-nc{'ZOO'}.fields = 'ZOO, scalar, series';
-%%endef(nc);
-%
-% loop on time
-%
-for l=1:tlen
-  disp(['time index: ',num2str(l),' of total: ',num2str(tlen)])
-  nc{'ZOO'}(l,:,:,:)=theta*squeeze(nc{'CHLA'}(l,:,:,:));
-end
-close(nc);
-return
diff --git a/Preprocessing_tools/add_no3.m b/Preprocessing_tools/add_no3.m
deleted file mode 100644
index 1670583b..00000000
--- a/Preprocessing_tools/add_no3.m
+++ /dev/null
@@ -1,185 +0,0 @@
-function add_no3(oafile,climfile,inifile,gridfile,seas_datafile,...
-                 ann_datafile,cycle,makeoa,makeclim);
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  function [longrd,latgrd,no3]=add_no3(climfile,gridfile,...
-%                                       seas_datafile,ann_datafile,...
-%                                       cycle);
-%
-%  Add nitrate (mMol N m-3) in a CROCO climatology file
-%  take seasonal data for the upper levels and annual data for the
-%  lower levels
-%
-%  input:
-%    
-%    climfile      : croco climatology file to process (netcdf)
-%    gridfile      : croco grid file (netcdf)
-%    seas_datafile : regular longitude - latitude - z seasonal data 
-%                    file used for the upper levels  (netcdf)
-%    ann_datafile  : regular longitude - latitude - z annual data 
-%                    file used for the lower levels  (netcdf)
-%    cycle         : time length (days) of climatology cycle (ex:360 for
-%                    annual cycle) - 0 if no cycle.
-%
-%   output:
-%
-%    [longrd,latgrd,no3] : surface field to plot (as an illustration)
-% 
-%  Further Information:  
-%  http://www.croco-ocean.org
-%  
-%  This file is part of CROCOTOOLS
-%
-%  CROCOTOOLS is free software; you can redistribute it and/or modify
-%  it under the terms of the GNU General Public License as published
-%  by the Free Software Foundation; either version 2 of the License,
-%  or (at your option) any later version.
-%
-%  CROCOTOOLS is distributed in the hope that it will be useful, but
-%  WITHOUT ANY WARRANTY; without even the implied warranty of
-%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-%  GNU General Public License for more details.
-%
-%  You should have received a copy of the GNU General Public License
-%  along with this program; if not, write to the Free Software
-%  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-%  MA  02111-1307  USA
-%
-%  Copyright (c) 2001-2006 by Pierrick Penven 
-%  e-mail:Pierrick.Penven@ird.fr  
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% Read in the grid
-%
-nc=netcdf(gridfile,'r');
-hmax=max(max(nc{'h'}(:)));
-close(nc);
-%
-% read in the datafiles 
-%
-nc=netcdf(seas_datafile,'r');
-t=nc{'T'}(:);
-t;
-close(nc)
-nc=netcdf(ann_datafile,'r');
-zno3=nc{'Z'}(:);
-kmax=max(find(zno3<hmax))-1;
-zno3=zno3(1:kmax);
-%disp('Size zno3=')
-size(zno3);
-close(nc)
-%
-% open the OA file  
-% 
-if (makeoa)
-  disp('Add_no3: creating variables and attributes for the OA file')
-  nc=netcdf(oafile,'write');
- % redef(nc);
-  
-  %Create Dimensions
-  nc('no3_time') = length(t);
-  %Create Variable
-  nc{'no3_time'} = ncdouble('no3_time') ;
-%
-%%
-%
-  %Create Dimensions
-  nc('Zno3') = length(zno3);  
-  %Create Variable
-  nc{'Zno3'} = ncdouble('Zno3') ;
-%
-%%
-%    
-  %Create Variable
-  nc{'NO3'} = ncdouble('no3_time','Zno3','eta_rho','xi_rho') ;
-%
-%%
-%    
-  %Create Attribute
-  
-  nc{'no3_time'}.long_name = ncchar('time for nitrate');
-  nc{'no3_time'}.long_name = 'time for nitrate';
-  nc{'no3_time'}.units = ncchar('day');
-  nc{'no3_time'}.units = 'day';
-  if cycle~=0
-    nc{'no3_time'}.cycle_length = cycle;
-  end
-%%%
-  nc{'Zno3'}.long_name = ncchar('Depth for NO3');
-  nc{'Zno3'}.long_name = 'Depth for NO3';
-  nc{'Zno3'}.units = ncchar('m');
-  nc{'Zno3'}.units = 'm';
-%%%
-  nc{'NO3'}.long_name = ncchar('Nitrate');
-  nc{'NO3'}.long_name = 'Nitrate';
-  nc{'NO3'}.units = ncchar('mMol N m-3');
-  nc{'NO3'}.units = 'mMol N m-3';
-  nc{'NO3'}.fields = ncchar('NO3, scalar, series');
-  nc{'NO3'}.fields = 'NO3, scalar, series';
-%%%
-%%  endef(nc);
-%
-%% Write variables
-%% record depth and time and close
-%
-  nc{'no3_time'}(:)=t*30; % if time in month in the dataset !!!
-  nc{'Zno3'}(:)=zno3;
-  close(nc)
-end
-%
-% Same thing for the Clim file
-%
-if (makeclim)
-  disp('Add_no3: creating variables and attributes for the Climatology file')
-%
-% open the clim file  
-% 
-  nc=netcdf(climfile,'write');
- % redef(nc);
-  nc('no3_time') = length(t);;
-  nc{'no3_time'} = ncdouble('no3_time') ;
-  nc{'NO3'} = ncdouble('no3_time','s_rho','eta_rho','xi_rho') ;
-%
-  nc{'no3_time'}.long_name = ncchar('time for nitrate');
-  nc{'no3_time'}.long_name = 'time for nitrate';
-  nc{'no3_time'}.units = ncchar('day');
-  nc{'no3_time'}.units = 'day';
-  if cycle~=0
-    nc{'no3_time'}.cycle_length = cycle;
-  end
-%
-  nc{'NO3'}.long_name = ncchar('Nitrate');
-  nc{'NO3'}.long_name = 'Nitrate';
-  nc{'NO3'}.units = ncchar('mMol N m-3');
-  nc{'NO3'}.units = 'mMol N m-3';
-  nc{'NO3'}.fields = ncchar('NO3, scalar, series');
-  nc{'NO3'}.fields = 'NO3, scalar, series';
-%
-%%  endef(nc);
-%
-% record the time and close
-%
-  nc{'no3_time'}(:)=t*30; % if time in month in the dataset !!!
-  close(nc)
-end
-%
-% Same thing for the Initial file
-%
-%disp('Add_no3: creating variables and attributes for the Initial file')
-%
-% open the clim file  
-% 
-%nc=netcdf(inifile,'write');
-%redef(nc);
-%nc{'NO3'} = ncdouble('time','s_rho','eta_rho','xi_rho') ;
-%
-%nc{'NO3'}.long_name = ncchar('Nitrate');
-%nc{'NO3'}.long_name = 'Nitrate';
-%nc{'NO3'}.units = ncchar('mMol N m-3');
-%nc{'NO3'}.units = 'mMol N m-3';
-%
-%endef(nc);
-%close(nc)
-
-return
diff --git a/Preprocessing_tools/add_o2.m b/Preprocessing_tools/add_o2.m
deleted file mode 100644
index 86321ce1..00000000
--- a/Preprocessing_tools/add_o2.m
+++ /dev/null
@@ -1,126 +0,0 @@
-function add_o2(oafile,climfile,inifile,gridfile,month_datafile,...
-                 ann_datafile,cycle,makeoa,makeclim);
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  function [longrd,latgrd,o2]=add_o2(climfile,gridfile,...
-%                                       month_datafile,ann_datafile,...
-%                                       cycle);
-%
-%  pierrick 2001
-%
-%  Add oxygen (mMol 0 m-3) in a CROCO climatology file
-%  take monthly data for the upper levels and annual data for the
-%  lower levels
-%
-%  input:
-%    
-%    climfile      : croco climatology file to process (netcdf)
-%    gridfile      : croco grid file (netcdf)
-%    month_datafile : regular longitude - latitude - z monthly data 
-%                    file used for the upper levels  (netcdf)
-%    ann_datafile  : regular longitude - latitude - z annual data 
-%                    file used for the lower levels  (netcdf)
-%    cycle         : time length (days) of climatology cycle (ex:360 for
-%                    annual cycle) - 0 if no cycle.
-%
-%   output:
-%
-%    [longrd,latgrd,o2] : surface field to plot (as an illustration)
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% Read in the grid
-%
-nc=netcdf(gridfile,'r');
-hmax=max(max(nc{'h'}(:)));
-close(nc);
-%
-% read in the datafiles 
-%
-nc=netcdf(month_datafile,'r');
-t=nc{'T'}(:);
-close(nc)
-nc=netcdf(ann_datafile,'r');
-zo2=nc{'Z'}(:);
-kmax=max(find(zo2<hmax))-1;
-zo2=zo2(1:kmax);
-close(nc)
-%
-% open the OA file  
-% 
-if (makeoa)
-  disp('Add_o2: creating variables and attributes for the OA file')
-  nc=netcdf(oafile,'write');
-%%  redef(nc);
-  nc('o2_time') = length(t);
-  nc{'o2_time'} = ncdouble('o2_time') ;
-  nc('Zo2') = length(zo2);
-  nc{'Zo2'} = ncdouble('Zo2') ;
-  nc{'O2'} = ncdouble('o2_time','Zo2','eta_rho','xi_rho') ;
-%
-  nc{'o2_time'}.long_name = ncchar('time for oxygen');
-  nc{'o2_time'}.long_name = 'time for oxygen';
-  nc{'o2_time'}.units = ncchar('day');
-  nc{'o2_time'}.units = 'day';
-  if cycle~=0
-    nc{'o2_time'}.cycle_length = cycle;
-  end
-%
-  nc{'Zo2'}.long_name = ncchar('Depth for O2');
-  nc{'Zo2'}.long_name = 'Depth for O2';
-  nc{'Zo2'}.units = ncchar('m');
-  nc{'Zo2'}.units = 'm';
-%
-  nc{'O2'}.long_name = ncchar('Oxygen');
-  nc{'O2'}.long_name = 'Oxygen';
-  nc{'O2'}.units = ncchar('mMol O m-3');
-  nc{'O2'}.units = 'mMol O m-3';
-  nc{'O2'}.fields = ncchar('O2, scalar, series');
-  nc{'O2'}.fields = 'O2, scalar, series';
-%
-%%  endef(nc);
-%
-% record depth and time and close
-%
-  nc{'o2_time'}(:)=t*30;  % ojo aqui quite *30 % if time in month in the dataset !!!
-  nc{'Zo2'}(:)=squeeze(zo2);
-  close(nc)
-end
-%
-% Same thing for the Clim file
-%
-if (makeclim)
-  disp('Add_o2: creating variables and attributes for the Climatology file')
-%
-% open the clim file  
-% 
-  nc=netcdf(climfile,'write');
- %% redef(nc);
-  nc('o2_time') = length(t);
-  nc{'o2_time'} = ncdouble('o2_time') ;
-  nc{'O2'} = ncdouble('o2_time','s_rho','eta_rho','xi_rho') ;
-%
-  nc{'o2_time'}.long_name = ncchar('time for oxygen');
-  nc{'o2_time'}.long_name = 'time for oxygen';
-  nc{'o2_time'}.units = ncchar('day');
-  nc{'o2_time'}.units = 'day';
-  if cycle~=0
-    nc{'o2_time'}.cycle_length = cycle;
-  end
-%
-  nc{'O2'}.long_name = ncchar('Oxygen');
-  nc{'O2'}.long_name = 'Oxygen';
-  nc{'O2'}.units = ncchar('mMol O m-3');
-  nc{'O2'}.units = 'mMol O m-3';
-  nc{'O2'}.fields = ncchar('O2, scalar, series');
-  nc{'O2'}.fields = 'O2, scalar, series';
-%
-%%  endef(nc);
-%
-% record the time and close
-%
-  nc{'o2_time'}(:,:)=t*30; % if time in month in the dataset !!!
-  close(nc)
-end
-
-return
diff --git a/Preprocessing_tools/add_phyto.m b/Preprocessing_tools/add_phyto.m
deleted file mode 100644
index c38091ca..00000000
--- a/Preprocessing_tools/add_phyto.m
+++ /dev/null
@@ -1,85 +0,0 @@
-function add_phyto(climfile);
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  function add_phyto(climfile);
-%
-%  Add phytoplancton (mMol N m-3)  in a CROCO climatology file.
-%  take the chlorophyll (mg C) from the climatology file and
-%  multiply by the ratio chlorophyll / phytoplancton derived
-%  from previous simulations.
-%
-%  phyto = 0.5 * chla
-%
-%  input:
-%    
-%    climfile      : croco climatology file to process (netcdf)
-% 
-%  Further Information:  
-%  http://www.croco-ocean.org
-%  
-%  This file is part of CROCOTOOLS
-%
-%  CROCOTOOLS is free software; you can redistribute it and/or modify
-%  it under the terms of the GNU General Public License as published
-%  by the Free Software Foundation; either version 2 of the License,
-%  or (at your option) any later version.
-%
-%  CROCOTOOLS is distributed in the hope that it will be useful, but
-%  WITHOUT ANY WARRANTY; without even the implied warranty of
-%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-%  GNU General Public License for more details.
-%
-%  You should have received a copy of the GNU General Public License
-%  along with this program; if not, write to the Free Software
-%  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-%  MA  02111-1307  USA
-%
-%  Copyright (c) 2001-2006 by Pierrick Penven 
-%  e-mail:Pierrick.Penven@ird.fr  
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-theta=0.5;
-%
-disp('Add_phyto: creating variable and attribute')
-%
-% open the clim file  
-% 
-nc=netcdf(climfile,'write');
-time= nc{'chla_time'}(:);
-cycle= nc{'chla_time'}.cycle_length(:);
-tlen=length(time);
-%%redef(nc);
-nc('phyto_time') = tlen;
-nc{'phyto_time'} = ncdouble('phyto_time') ;
-nc{'PHYTO'} = ncdouble('phyto_time','s_rho','eta_rho','xi_rho') ;
-%
-nc{'phyto_time'}.long_name = ncchar('time for phytoplankton');
-nc{'phyto_time'}.long_name = 'time for phytoplankton';
-nc{'phyto_time'}.units = ncchar('day');
-nc{'phyto_time'}.units = 'day';
-if cycle~=0
-  nc{'phyto_time'}.cycle_length = cycle;
-end
-%
-nc{'PHYTO'}.long_name = ncchar('Phytoplankton');
-nc{'PHYTO'}.long_name = 'Phytoplankton';
-nc{'PHYTO'}.units = ncchar('mMol N m-3');
-nc{'PHYTO'}.units = 'mMol N m-3';
-nc{'PHYTO'}.fields = ncchar('PHYTO, scalar, series');
-nc{'PHYTO'}.fields = 'PHYTO, scalar, series';
-%
-%%endef(nc);
-%
-% record the time
-%
-nc{'phyto_time'}(:)=time;
-%
-% loop on time
-%
-for l=1:tlen
-  disp(['time index: ',num2str(l),' of total: ',num2str(tlen)])
-  nc{'PHYTO'}(l,:,:,:)=theta*squeeze(nc{'CHLA'}(l,:,:,:));
-end
-close(nc);
-return
diff --git a/Preprocessing_tools/add_po4.m b/Preprocessing_tools/add_po4.m
deleted file mode 100644
index 0c442009..00000000
--- a/Preprocessing_tools/add_po4.m
+++ /dev/null
@@ -1,144 +0,0 @@
-function add_po4(oafile,climfile,inifile,gridfile,seas_datafile,...
-                 ann_datafile,cycle,makeoa,makeclim);
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  function [longrd,latgrd,po4]=add_po4(climfile,gridfile,...
-%                                       seas_datafile,ann_datafile,...
-%                                       cycle);
-%
-%  pierrick 2001
-%
-%  Add phosphate (mMol P m-3) in a CROCO climatology file
-%  take seasonal data for the upper levels and annual data for the
-%  lower levels
-%
-%  input:
-%    
-%    climfile      : croco climatology file to process (netcdf)
-%    gridfile      : croco grid file (netcdf)
-%    seas_datafile : regular longitude - latitude - z seasonal data 
-%                    file used for the upper levels  (netcdf)
-%    ann_datafile  : regular longitude - latitude - z annual data 
-%                    file used for the lower levels  (netcdf)
-%    cycle         : time length (days) of climatology cycle (ex:360 for
-%                    annual cycle) - 0 if no cycle.
-%
-%   output:
-%
-%    [longrd,latgrd,po4] : surface field to plot (as an illustration)
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% Read in the grid
-%
-nc=netcdf(gridfile,'r');
-hmax=max(max(nc{'h'}(:)));
-close(nc);
-%
-% read in the datafiles 
-%
-nc=netcdf(seas_datafile,'r');
-t=nc{'T'}(:);
-close(nc)
-nc=netcdf(ann_datafile,'r');
-zpo4=nc{'Z'}(:);
-kmax=max(find(zpo4<hmax))-1;
-zpo4=zpo4(1:kmax);
-close(nc)
-%
-% open the OA file  
-% 
-if (makeoa)
-  disp('Add_po4: creating variables and attributes for the OA file')
-  nc=netcdf(oafile,'write');
-%%  redef(nc);
-  nc('po4_time') = length(t);
-  nc{'po4_time'} = ncdouble('po4_time') ;
-  nc('Zpo4') = length(zpo4);
-  nc{'Zpo4'} = ncdouble('Zpo4') ;
-  nc{'PO4'} = ncdouble('po4_time','Zpo4','eta_rho','xi_rho') ;
-%
-  nc{'po4_time'}.long_name = ncchar('time for phosphate');
-  nc{'po4_time'}.long_name = 'time for phosphate';
-  nc{'po4_time'}.units = ncchar('day');
-  nc{'po4_time'}.units = 'day';
-  if cycle~=0
-    nc{'po4_time'}.cycle_length = cycle;
-  end
-%
-  nc{'Zpo4'}.long_name = ncchar('Depth for PO4');
-  nc{'Zpo4'}.long_name = 'Depth for PO4';
-  nc{'Zpo4'}.units = ncchar('m');
-  nc{'Zpo4'}.units = 'm';
-%
-  nc{'PO4'}.long_name = ncchar('Phosphate');
-  nc{'PO4'}.long_name = 'Phosphate';
-  nc{'PO4'}.units = ncchar('mMol P m-3');
-  nc{'PO4'}.units = 'mMol P m-3';
-  nc{'PO4'}.fields = ncchar('PO4, scalar, series');
-  nc{'PO4'}.fields = 'PO4, scalar, series';
-%
-%%  endef(nc);
-%
-% record deth and time and close
-%
-  nc{'po4_time'}(:)=t*30; % if time in month in the dataset !!!
-  nc{'Zpo4'}(:)=zpo4;
-  close(nc)
-end
-%
-% Same thing for the Clim file
-%
-if (makeclim)
-  disp('Add_po4: creating variables and attributes for the Climatology file')
-%
-% open the clim file  
-% 
-  nc=netcdf(climfile,'write');
-%%  redef(nc);
-  nc('po4_time') = length(t);;
-  nc{'po4_time'} = ncdouble('po4_time') ;
-  nc{'PO4'} = ncdouble('po4_time','s_rho','eta_rho','xi_rho') ;
-%
-  nc{'po4_time'}.long_name = ncchar('time for phosphate');
-  nc{'po4_time'}.long_name = 'time for phosphate';
-  nc{'po4_time'}.units = ncchar('day');
-  nc{'po4_time'}.units = 'day';
-  if cycle~=0
-    nc{'po4_time'}.cycle_length = cycle;
-  end
-%
-  nc{'PO4'}.long_name = ncchar('Phosphate');
-  nc{'PO4'}.long_name = 'Phosphate';
-  nc{'PO4'}.units = ncchar('mMol P m-3');
-  nc{'PO4'}.units = 'mMol P m-3';
-  nc{'PO4'}.fields = ncchar('PO4, scalar, series');
-  nc{'PO4'}.fields = 'PO4, scalar, series';
-%
-%%  endef(nc);
-%
-% record the time and close
-%
-  nc{'po4_time'}(:)=t*30; % if time in month in the dataset !!!
-  close(nc)
-end
-%
-% Same thing for the Initial file
-%
-%disp('Add_no3: creating variables and attributes for the Initial file')
-%
-% open the clim file  
-% 
-%nc=netcdf(inifile,'write');
-%redef(nc);
-%nc{'NO3'} = ncdouble('time','s_rho','eta_rho','xi_rho') ;
-%
-%nc{'NO3'}.long_name = ncchar('Nitrate');
-%nc{'NO3'}.long_name = 'Nitrate';
-%nc{'NO3'}.units = ncchar('mMol N m-3');
-%nc{'NO3'}.units = 'mMol N m-3';
-%
-%endef(nc);
-%close(nc)
-
-return
diff --git a/Preprocessing_tools/add_sio3.m b/Preprocessing_tools/add_sio3.m
deleted file mode 100644
index b5be4d2d..00000000
--- a/Preprocessing_tools/add_sio3.m
+++ /dev/null
@@ -1,144 +0,0 @@
-function add_sio3(oafile,climfile,inifile,gridfile,seas_datafile,...
-                 ann_datafile,cycle,makeoa,makeclim);
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  function [longrd,latgrd,sio3]=add_sio3(climfile,gridfile,...
-%                                       seas_datafile,ann_datafile,...
-%                                       cycle);
-%
-%  pierrick 2001
-%
-%  Add silicate (mMol Si m-3) in a CROCO climatology file
-%  take seasonal data for the upper levels and annual data for the
-%  lower levels
-%
-%  input:
-%    
-%    climfile      : croco climatology file to process (netcdf)
-%    gridfile      : croco grid file (netcdf)
-%    seas_datafile : regular longitude - latitude - z seasonal data 
-%                    file used for the upper levels  (netcdf)
-%    ann_datafile  : regular longitude - latitude - z annual data 
-%                    file used for the lower levels  (netcdf)
-%    cycle         : time length (days) of climatology cycle (ex:360 for
-%                    annual cycle) - 0 if no cycle.
-%
-%   output:
-%
-%    [longrd,latgrd,SiO3] : surface field to plot (as an illustration)
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% Read in the grid
-%
-nc=netcdf(gridfile,'r');
-hmax=max(max(nc{'h'}(:)));
-close(nc);
-%
-% read in the datafiles 
-%
-nc=netcdf(seas_datafile,'r');
-t=nc{'T'}(:);
-close(nc)
-nc=netcdf(ann_datafile,'r');
-zsi=nc{'Z'}(:);
-kmax=max(find(zsi<hmax))-1;
-zsi=zsi(1:kmax);
-close(nc)
-%
-% open the OA file  
-% 
-if (makeoa)
-  disp('Add_sio3: creating variables and attributes for the OA file')
-  nc=netcdf(oafile,'write');
-%%  redef(nc);
-  nc('si_time') = length(t);
-  nc{'si_time'} = ncdouble('si_time') ;
-  nc('Zsi') = length(zsi);
-  nc{'Zsi'} = ncdouble('Zsi') ;
-  nc{'Si'} = ncdouble('si_time','Zsi','eta_rho','xi_rho') ;
-%
-  nc{'si_time'}.long_name = ncchar('time for silicate');
-  nc{'si_time'}.long_name = 'time for silicate';
-  nc{'si_time'}.units = ncchar('day');
-  nc{'si_time'}.units = 'day';
-  if cycle~=0
-    nc{'si_time'}.cycle_length = cycle;
-  end
-%
-  nc{'Zsi'}.long_name = ncchar('Depth for Si');
-  nc{'Zsi'}.long_name = 'Depth for Si';
-  nc{'Zsi'}.units = ncchar('m');
-  nc{'Zsi'}.units = 'm';
-%
-  nc{'Si'}.long_name = ncchar('Silicate');
-  nc{'Si'}.long_name = 'Silicate';
-  nc{'Si'}.units = ncchar('mMol Si m-3');
-  nc{'Si'}.units = 'mMol Si m-3';
-  nc{'Si'}.fields = ncchar('Si, scalar, series');
-  nc{'Si'}.fields = 'Si, scalar, series';
-%
-%%  endef(nc);
-%
-% record deth and time and close
-%
-  nc{'si_time'}(:)=t*30; % if time in month in the dataset !!!
-  nc{'Zsi'}(:)=zsi;
-  close(nc)
-end
-%
-% Same thing for the Clim file
-%
-if (makeclim)
-  disp('Add_sio3: creating variables and attributes for the Climatology file')
-%
-% open the clim file  
-% 
-  nc=netcdf(climfile,'write');
-%%  redef(nc);
-  nc('si_time') = length(t);;
-  nc{'si_time'} = ncdouble('si_time') ;
-  nc{'Si'} = ncdouble('si_time','s_rho','eta_rho','xi_rho') ;
-%
-  nc{'si_time'}.long_name = ncchar('time for silicate');
-  nc{'si_time'}.long_name = 'time for silicate';
-  nc{'si_time'}.units = ncchar('day');
-  nc{'si_time'}.units = 'day';
-  if cycle~=0
-    nc{'si_time'}.cycle_length = cycle;
-  end
-%
-  nc{'Si'}.long_name = ncchar('Silicate');
-  nc{'Si'}.long_name = 'Silicate';
-  nc{'Si'}.units = ncchar('mMol Si m-3');
-  nc{'Si'}.units = 'mMol Si m-3';
-  nc{'Si'}.fields = ncchar('Si, scalar, series');
-  nc{'Si'}.fields = 'Si, scalar, series';
-%
-%%  endef(nc);
-%
-% record the time and close
-%
-  nc{'si_time'}(:)=t*30; % if time in month in the dataset !!!
-  close(nc)
-end
-%
-% Same thing for the Initial file
-%
-%disp('Add_no3: creating variables and attributes for the Initial file')
-%
-% open the clim file  
-% 
-%nc=netcdf(inifile,'write');
-%redef(nc);
-%nc{'NO3'} = ncdouble('time','s_rho','eta_rho','xi_rho') ;
-%
-%nc{'NO3'}.long_name = ncchar('Nitrate');
-%nc{'NO3'}.long_name = 'Nitrate';
-%nc{'NO3'}.units = ncchar('mMol N m-3');
-%nc{'NO3'}.units = 'mMol N m-3';
-%
-%endef(nc);
-%close(nc)
-
-return
diff --git a/Preprocessing_tools/add_talk.m b/Preprocessing_tools/add_talk.m
deleted file mode 100644
index 1bdf16b7..00000000
--- a/Preprocessing_tools/add_talk.m
+++ /dev/null
@@ -1,144 +0,0 @@
-function add_talk(oafile,climfile,inifile,gridfile,seas_datafile,...
-                 ann_datafile,cycle,makeoa,makeclim);
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  function [longrd,latgrd,talk]=add_talk(climfile,gridfile,...
-%                                       seas_datafile,ann_datafile,...
-%                                       cycle);
-%
-%  pierrick 2001
-%
-%  Add talk (mMol P m-3) in a CROCO climatology file
-%  take seasonal data for the upper levels and annual data for the
-%  lower levels
-%
-%  input:
-%    
-%    climfile      : croco climatology file to process (netcdf)
-%    gridfile      : croco grid file (netcdf)
-%    seas_datafile : regular longitude - latitude - z seasonal data 
-%                    file used for the upper levels  (netcdf)
-%    ann_datafile  : regular longitude - latitude - z annual data 
-%                    file used for the lower levels  (netcdf)
-%    cycle         : time length (days) of climatology cycle (ex:360 for
-%                    annual cycle) - 0 if no cycle.
-%
-%   output:
-%
-%    [longrd,latgrd,talk] : surface field to plot (as an illustration)
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% Read in the grid
-%
-nc=netcdf(gridfile,'r');
-hmax=max(max(nc{'h'}(:)));
-close(nc);
-%
-% read in the datafiles 
-%
-nc=netcdf(seas_datafile,'r');
-t=nc{'T'}(:);
-close(nc)
-nc=netcdf(ann_datafile,'r');
-ztalk=nc{'Z'}(:);
-kmax=max(find(ztalk<hmax))-1;
-ztalk=ztalk(1:kmax);
-close(nc)
-%
-% open the OA file  
-% 
-if (makeoa)
-  disp('Add_talk: creating variables and attributes for the OA file')
-  nc=netcdf(oafile,'write');
-%%  redef(nc);
-  nc('talk_time') = length(t);
-  nc{'talk_time'} = ncdouble('talk_time') ;
-  nc('Ztalk') = length(ztalk);
-  nc{'Ztalk'} = ncdouble('Ztalk') ;
-  nc{'TALK'} = ncdouble('talk_time','Ztalk','eta_rho','xi_rho') ;
-%
-  nc{'talk_time'}.long_name = ncchar('time for TALK');
-  nc{'talk_time'}.long_name = 'time for TALK';
-  nc{'talk_time'}.units = ncchar('day');
-  nc{'talk_time'}.units = 'day';
-  if cycle~=0
-    nc{'talk_time'}.cycle_length = cycle;
-  end
-%
-  nc{'Ztalk'}.long_name = ncchar('Depth for TALK');
-  nc{'Ztalk'}.long_name = 'Depth for TALK';
-  nc{'Ztalk'}.units = ncchar('m');
-  nc{'Ztalk'}.units = 'm';
-%
-  nc{'TALK'}.long_name = ncchar('TALK');
-  nc{'TALK'}.long_name = 'TALK';
-  nc{'TALK'}.units = ncchar('mMol C m-3');
-  nc{'TALK'}.units = 'mMol C m-3';
-  nc{'TALK'}.fields = ncchar('TALK, scalar, series');
-  nc{'TALK'}.fields = 'TALK, scalar, series';
-%
-%%  endef(nc);
-%
-% record deth and time and close
-%
-  nc{'talk_time'}(:)=t*30; % if time in month in the dataset !!!
-  nc{'Ztalk'}(:)=ztalk;
-  close(nc)
-end
-%
-% Same thing for the Clim file
-%
-if (makeclim)
-  disp('Add_talk: creating variables and attributes for the Climatology file')
-%
-% open the clim file  
-% 
-  nc=netcdf(climfile,'write');
-%%  redef(nc);
-  nc('talk_time') = length(t);;
-  nc{'talk_time'} = ncdouble('talk_time') ;
-  nc{'TALK'} = ncdouble('talk_time','s_rho','eta_rho','xi_rho') ;
-%
-  nc{'talk_time'}.long_name = ncchar('time for TALK');
-  nc{'talk_time'}.long_name = 'time for TALK';
-  nc{'talk_time'}.units = ncchar('day');
-  nc{'talk_time'}.units = 'day';
-  if cycle~=0
-    nc{'talk_time'}.cycle_length = cycle;
-  end
-%
-  nc{'TALK'}.long_name = ncchar('TALK');
-  nc{'TALK'}.long_name = 'TALK';
-  nc{'TALK'}.units = ncchar('mMol C m-3');
-  nc{'TALK'}.units = 'mMol C m-3';
-  nc{'TALK'}.fields = ncchar('TALK, scalar, series');
-  nc{'TALK'}.fields = 'TALK, scalar, series';
-%
-%%  endef(nc);
-%
-% record the time and close
-%
-  nc{'talk_time'}(:)=t*30; % if time in month in the dataset !!!
-  close(nc)
-end
-%
-% Same thing for the Initial file
-%
-%disp('Add_no3: creating variables and attributes for the Initial file')
-%
-% open the clim file  
-% 
-%nc=netcdf(inifile,'write');
-%redef(nc);
-%nc{'NO3'} = ncdouble('time','s_rho','eta_rho','xi_rho') ;
-%
-%nc{'NO3'}.long_name = ncchar('Nitrate');
-%nc{'NO3'}.long_name = 'Nitrate';
-%nc{'NO3'}.units = ncchar('mMol N m-3');
-%nc{'NO3'}.units = 'mMol N m-3';
-%
-%endef(nc);
-%close(nc)
-
-return
diff --git a/Preprocessing_tools/add_zoo.m b/Preprocessing_tools/add_zoo.m
deleted file mode 100644
index 597a1c10..00000000
--- a/Preprocessing_tools/add_zoo.m
+++ /dev/null
@@ -1,87 +0,0 @@
-function add_zoo(climfile);
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  function add_zoo(climfile);
-%
-%  Add zooplancton (mMol N m-3) in a CROCO climatology file.
-%  take the chlorophyll (mg C) from the climatology file and
-%  multiply by the ratio chlorophyll / phytoplancton derived
-%  from previous simulations (Gruber et al., 2005)
-%
-%  zoo = 0.2 * chla
-%
-%  input:
-%    
-%    climfile      : croco climatology file to process (netcdf)
-% 
-%  Further Information:  
-%  http://www.croco-ocean.org
-%  
-%  This file is part of CROCOTOOLS
-%
-%  CROCOTOOLS is free software; you can redistribute it and/or modify
-%  it under the terms of the GNU General Public License as published
-%  by the Free Software Foundation; either version 2 of the License,
-%  or (at your option) any later version.
-%
-%  CROCOTOOLS is distributed in the hope that it will be useful, but
-%  WITHOUT ANY WARRANTY; without even the implied warranty of
-%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-%  GNU General Public License for more details.
-%
-%  You should have received a copy of the GNU General Public License
-%  along with this program; if not, write to the Free Software
-%  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-%  MA  02111-1307  USA
-%
-%  Copyright (c) 2001-2006 by Pierrick Penven 
-%  e-mail:Pierrick.Penven@ird.fr  
-%
-%  Updated    2005 by Patrick Marchesiello (IRD)
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-theta=0.2;
-%
-disp('Add_zoo: creating variable and attribute')
-%
-% open the clim file  
-% 
-nc=netcdf(climfile,'write');
-time= nc{'chla_time'}(:);
-cycle= nc{'chla_time'}.cycle_length(:);
-tlen=length(time);
-%%redef(nc);
-nc('zoo_time') = tlen;
-nc{'zoo_time'} = ncdouble('zoo_time') ;
-nc{'ZOO'} = ncdouble('zoo_time','s_rho','eta_rho','xi_rho') ;
-%
-nc{'zoo_time'}.long_name = ncchar('time for zooplankton');
-nc{'zoo_time'}.long_name = 'time for zooplankton';
-nc{'zoo_time'}.units = ncchar('day');
-nc{'zoo_time'}.units = 'day';
-if cycle~=0
-  nc{'zoo_time'}.cycle_length = cycle;
-end
-%
-nc{'ZOO'}.long_name = ncchar('Zooplankton');
-nc{'ZOO'}.long_name = 'Zooplankton';
-nc{'ZOO'}.units = ncchar('mMol N m-3');
-nc{'ZOO'}.units = 'mMol N m-3';
-nc{'ZOO'}.fields = ncchar('ZOO, scalar, series');
-nc{'ZOO'}.fields = 'ZOO, scalar, series';
-%
-%%endef(nc);
-%
-% record the time
-%
-nc{'zoo_time'}(:)=time;
-%
-% loop on time
-%
-for l=1:tlen
-  disp(['time index: ',num2str(l),' of total: ',num2str(tlen)])
-  nc{'ZOO'}(l,:,:,:)=theta*squeeze(nc{'CHLA'}(l,:,:,:));
-end
-close(nc);
-return
diff --git a/Preprocessing_tools/make_clim_bioebus.m b/Preprocessing_tools/make_clim_bioebus.m
deleted file mode 100644
index b9a9f2fa..00000000
--- a/Preprocessing_tools/make_clim_bioebus.m
+++ /dev/null
@@ -1,159 +0,0 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  Build a CROCO initial file from Global Atlas (WOA or CARS)
-%
-%  Extrapole and interpole fields from a
-%  Climatology to get initial conditions for
-%  CROCO (initial netcdf files) .
-%
-%  Data input format (netcdf):
-%     variable(T, Z, Y, X)
-%     T : time [Months]
-%     Z : Depth [m]
-%     Y : Latitude [degree north]
-%     X : Longitude [degree east]
-%
-%  Data source : IRI/LDEO Climate Data Library (World Ocean Atlas 1998)
-%    http://ingrid.ldgo.columbia.edu/
-%    http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NODC/.WOA98/
-%
-%  Pierrick Penven, IRD, 2005.
-%  Olivier Aumont, IRD, 2006.
-%  Patricio Marchesiello, IRD 2007
-%  Christophe Eugene Raoul Menkes, IRD 2013
-%  Elodie Gutknecht, 2013
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-clear all
-close all
-%%%%%%%%%%%%%%%%%%%%% USERS DEFINED VARIABLES %%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  Title 
-%
-crocotools_param
-%
-%  Data climatologies file names:
-%
-
-no3_seas_data  =  [climato_dir,'no3_month.cdf'];
-no3_ann_data   =  [climato_dir,'no3_ann.cdf'];
-o2_seas_data   =  [climato_dir,'o2_month.cdf'];
-o2_ann_data    =  [climato_dir,'o2_ann.cdf'];
-chla_seas_data =  [chla_dir,'chla_seas.cdf'];
-
-NO3min=0.01;
-O2min=0.01;
-%
-%
-%%%%%%%%%%%%%%%%%%% END USERS DEFINED VARIABLES %%%%%%%%%%%%%%%%%%%%%%%
-disp('')
-disp('====================================================== ')
-disp('=> You need the croco_oa.nc file created by make_clim.m ')
-disp('=> with makeoa=1 from crocotools_param.m                ')
-disp('====================================================== ')
-
-%
-% Add variables in the files
-%
-add_no3(oaname,clmname,ininame,grdname,no3_seas_data,...
-        no3_ann_data,woa_cycle,makeoa,makeclim)
-
-add_o2(oaname,clmname,ininame,grdname,o2_seas_data,...
-        o2_ann_data,woa_cycle,makeoa,makeclim)
-
-	
-%
-% Horizontal extrapolation
-%
-if (makeoa)
-
-  ext_tracers(oaname,no3_seas_data,no3_ann_data,...
-              'nitrate','NO3','no3_time','Zno3',Roa);
-
-  ext_tracers(oaname,o2_seas_data,o2_ann_data,...
-              'oxygen','O2','o2_time','Zo2',Roa);
-
-end
-
-
-%
-% Vertical interpolations 
-%
-if (makeclim)
-  disp(' ')
-  disp(' Vertical interpolations')
-  disp(' ')
-  disp(' O2...')
-  vinterp_clm(clmname,grdname,oaname,'O2','o2_time','Zo2',0,'r');  
-  disp(' ')
-  disp(' NO3...')
-  vinterp_clm(clmname,grdname,oaname,'NO3','no3_time','Zno3',0,'r');
-%
-% Remove low values for oligotrophic areas
-%
-  nc=netcdf(clmname,'write');
-  tlen=length(nc('no3_time'));
-  for l=1:tlen
-    NO3=nc{'NO3'}(l,:,:,:);
-    NO3(NO3<NO3min)=NO3min;
-    nc{'NO3'}(l,:,:,:)=NO3;
-  end
-  close(nc)
-  
-  nc=netcdf(clmname,'write');
-  tlen=length(nc('o2_time'));
-  for l=1:tlen
-    O2=nc{'O2'}(l,:,:,:);
-    O2(O2<O2min)=O2min;
-    nc{'O2'}(l,:,:,:)=O2;
-  end
-  close(nc)
- 
-  
-%
-%  CHla		 
-  disp(' ')
-  disp(' CHla...')
-  add_chla(clmname,grdname,chla_seas_data,woa_cycle,Roa);
-%
-%  Phyto		 
-  disp(' ')
-  disp(' SPhyto and LPhyto...')
-  add_Sphyto_Lphyto(clmname);
-%
-%  Zoo
-  disp(' ')
-  disp(' SZoo and LZoo...')
-  add_Szoo_Lzoo(clmname);
-
-end
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%
-% Make a few plots
-%
-
-if (makeplot)
-  disp(' ')
-  disp(' Make a few plots...')
-  test_clim(clmname,grdname,'O2',1,coastfileplot)
-  figure
-  test_clim(clmname,grdname,'NO3',1,coastfileplot)
-  figure
-  test_clim(clmname,grdname,'CHLA',1,coastfileplot)
-  figure
-  test_clim(clmname,grdname,'SPHYTO',1,coastfileplot)
-  figure
-  test_clim(clmname,grdname,'LPHYTO',1,coastfileplot)
-  figure
-  test_clim(clmname,grdname,'SZOO',1,coastfileplot)
-  figure
-  test_clim(clmname,grdname,'LZOO',1,coastfileplot)
-end 
-
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-
-
diff --git a/Preprocessing_tools/make_clim_npzd.m b/Preprocessing_tools/make_clim_npzd.m
deleted file mode 100644
index 0f31acb2..00000000
--- a/Preprocessing_tools/make_clim_npzd.m
+++ /dev/null
@@ -1,152 +0,0 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  Build a CROCO initial file from Global Atlas (WOA or CARS)
-%
-%  Extrapole and interpole fields from a
-%  Climatology to get initial conditions for
-%  CROCO (initial netcdf files) .
-%
-%  Data input format (netcdf):
-%     variable(T, Z, Y, X)
-%     T : time [Months]
-%     Z : Depth [m]
-%     Y : Latitude [degree north]
-%     X : Longitude [degree east]
-%
-%  Data source : IRI/LDEO Climate Data Library (World Ocean Atlas 1998)
-%    http://ingrid.ldgo.columbia.edu/
-%    http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NODC/.WOA98/
-%
-%  Pierrick Penven, IRD, 2005.
-%  Olivier Aumont, IRD, 2006.
-%  Patricio Marchesiello, IRD 2007
-%  Christophe Eugene Raoul Menkes, IRD 2013
-%  Elodie Gutknecht, 2013
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-clear all
-close all
-%%%%%%%%%%%%%%%%%%%%% USERS DEFINED VARIABLES %%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  Title 
-%
-crocotools_param
-%
-%  Data climatologies file names:
-%
-no3_seas_data=[climato_dir,'no3_seas.cdf'];
-no3_ann_data=[climato_dir,'no3_ann.cdf'];
-o2_seas_data=[climato_dir,'o2_seas.cdf'];
-o2_ann_data=[climato_dir,'o2_ann.cdf'];
-chla_seas_data=[chla_dir,'chla_seas.cdf'];
-
-NO3min=0.01;
-O2min=0.01;
-%
-%
-%%%%%%%%%%%%%%%%%%% END USERS DEFINED VARIABLES %%%%%%%%%%%%%%%%%%%%%%%
-disp('')
-disp('====================================================== ')
-disp('=> You need the croco_oa.nc file created by make_clim.m ')
-disp('=> with makeoa=1 from crocotools_param.m                ')
-disp('====================================================== ')
-%
-% Add variables in the files
-%
-add_no3(oaname,clmname,ininame,grdname,no3_seas_data,...
-        no3_ann_data,woa_cycle,makeoa,makeclim)
-
-add_o2(oaname,clmname,ininame,grdname,o2_seas_data,...
-        o2_ann_data,woa_cycle,makeoa,makeclim)
-
-	
-%
-% Horizontal extrapolation
-%
-if (makeoa)
-
-  ext_tracers(oaname,no3_seas_data,no3_ann_data,...
-              'nitrate','NO3','no3_time','Zno3',Roa);
-
-  ext_tracers(oaname,o2_seas_data,o2_ann_data,...
-              'oxygen','O2','o2_time','Zo2',Roa);
-
-end
-
-
-%
-% Vertical interpolations 
-%
-if (makeclim)
-  disp(' ')
-  disp(' Vertical interpolations')
-  disp(' ')
-  disp(' O2...')
-  vinterp_clm(clmname,grdname,oaname,'O2','o2_time','Zo2',0,'r');  
-  disp(' ')
-  disp(' NO3...')
-  vinterp_clm(clmname,grdname,oaname,'NO3','no3_time','Zno3',0,'r');
-%
-% Remove low values for oligotrophic areas
-%
-  nc=netcdf(clmname,'write');
-  tlen=length(nc('no3_time'));
-  for l=1:tlen
-    NO3=nc{'NO3'}(l,:,:,:);
-    NO3(NO3<NO3min)=NO3min;
-    nc{'NO3'}(l,:,:,:)=NO3;
-  end
-  close(nc)
-  
-  nc=netcdf(clmname,'write');
-  tlen=length(nc('o2_time'));
-  for l=1:tlen
-    O2=nc{'O2'}(l,:,:,:);
-    O2(O2<O2min)=O2min;
-    nc{'O2'}(l,:,:,:)=O2;
-  end
-  close(nc)
- 
-  
-%
-%  CHla		 
-  disp(' ')
-  disp(' CHla...')
-  add_chla(clmname,grdname,chla_seas_data,woa_cycle,Roa);
-%
-%  Phyto		 
-  disp(' ')
-  disp(' Phyto...')
-  add_phyto(clmname);
-%
-%  Zoo
-  disp(' ')
-  disp(' Zoo...')
-  add_zoo(clmname);
-
-end
-
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%
-% Make a few plots
-%
-
-if (makeplot)
-  disp(' ')
-  disp(' Make a few plots...')
-  test_clim(clmname,grdname,'O2',1,coastfileplot)
-  figure
-  test_clim(clmname,grdname,'NO3',1,coastfileplot)
-  figure
-  test_clim(clmname,grdname,'CHLA',1,coastfileplot)
-  figure
-  test_clim(clmname,grdname,'PHYTO',1,coastfileplot)
-end 
-
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-
-
diff --git a/Preprocessing_tools/make_clim_pisces.m b/Preprocessing_tools/make_clim_pisces.m
deleted file mode 100644
index a3bc593a..00000000
--- a/Preprocessing_tools/make_clim_pisces.m
+++ /dev/null
@@ -1,221 +0,0 @@
-clear all
-close all
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  Extrapole and interpole biology data and write in climatology file
-%
-%  Data source : IRI/LDEO Climate Data Library (World Ocean Atlas 1998)
-%    http://ingrid.ldgo.columbia.edu/
-%    http://iridl.ldeo.columbia.edu/SOURCES/.NOAA/.NODC/.WOA2001/
-%
-%  Pierrick Penven, IRD, 2005.
-%  Olivier Aumont the master, IRD, 2006.
-%  Patricio Marchesiello, chief, IRD, 2007.
-%  Christophe Eugene Raoul Menkes, the slave, IRD, 2007.
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-clear all
-close all
-%%%%%%%%%%%%%%%%%%%%% USERS DEFINED VARIABLES %%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  Switches for selecting what to process (1=ON)
-%
-crocotools_param
-%
-% Climatology files
-%
-%
-no3_seas_data  = [woapisces_dir,'no3_seas.cdf'];
-no3_ann_data   = [woapisces_dir,'no3_ann.cdf'];
-po4_seas_data  = [woapisces_dir,'po4_seas.cdf'];
-po4_ann_data   = [woapisces_dir,'po4_ann.cdf'];
-o2_seas_data   = [woapisces_dir,'o2_seas.cdf'];
-o2_ann_data    = [woapisces_dir,'o2_ann.cdf'];
-sio3_seas_data = [woapisces_dir,'sio3_seas.cdf'];
-sio3_ann_data  = [woapisces_dir,'sio3_ann.cdf'];
-dic_seas_data  = [woapisces_dir,'dic_seas.cdf'];
-dic_ann_data   = [woapisces_dir,'dic_ann.cdf'];
-talk_seas_data = [woapisces_dir,'talk_seas.cdf'];
-talk_ann_data  = [woapisces_dir,'talk_ann.cdf'];
-doc_seas_data  = [woapisces_dir,'doc_seas.cdf'];
-doc_ann_data   = [woapisces_dir,'doc_ann.cdf'];
-fer_seas_data  = [woapisces_dir,'fer_seas.cdf'];
-fer_ann_data   = [woapisces_dir,'fer_ann.cdf'];
-dust_seas_data = [woapisces_dir,'dust_seas.cdf'];
-dust_ann_data  = [woapisces_dir,'dust_ann.cdf'];
-%
-cycle=woa_cycle;
-NO3min=1;
-if strcmp(climato_dir,cars2009_dir);
-    err_msg=sprintf(['Error : you need to use woadir when creating the croco_oa.nc (Z) \n'...
-                     'files to be compatible with PISCES'])
-    error(err_msg)
-end
-    
-%
-%%%%%%%%%%%%%%%%%%% END USERS DEFINED VARIABLES %%%%%%%%%%%%%%%%%%%%%%%
-%
-% Add variables in the files
-%
-disp('')
-disp('====================================================== ')
-disp('=> You need the croco_oa.nc file created by make_clim.m ')
-disp('=> with makeoa=1 from crocotools_param.m                ')
-disp('====================================================== ')
-add_no3(oaname,clmname,ininame,grdname,no3_seas_data,...
-        no3_ann_data,cycle,makeoa,makeclim)
-
-add_po4(oaname,clmname,ininame,grdname,po4_seas_data,...
-        po4_ann_data,cycle,makeoa,makeclim)
-
-add_sio3(oaname,clmname,ininame,grdname,sio3_seas_data,...
-        sio3_ann_data,cycle,makeoa,makeclim)
-
-add_o2(oaname,clmname,ininame,grdname,o2_seas_data,...
-        o2_ann_data,cycle,makeoa,makeclim)
-
-add_dic(oaname,clmname,ininame,grdname,dic_seas_data,...
-       dic_ann_data,cycle,makeoa,makeclim)
-
-add_talk(oaname,clmname,ininame,grdname,talk_seas_data,...
-       talk_ann_data,cycle,makeoa,makeclim)
-
-add_doc(oaname,clmname,ininame,grdname,doc_seas_data,...
-       doc_ann_data,cycle,makeoa,makeclim)
-            
-add_fer(oaname,clmname,ininame,grdname,fer_seas_data,...
-       fer_ann_data,cycle,makeoa,makeclim)
-
-%
-% Horizontal extrapolation
-%
-if (makeoa)
-  ext_tracers(oaname,no3_seas_data,no3_ann_data,...
-              'nitrate','NO3','no3_time','Zno3',Roa);
-
-  ext_tracers(oaname,po4_seas_data,po4_ann_data,...
-              'phosphate','PO4','po4_time','Zpo4',Roa);
-
-  ext_tracers(oaname,sio3_seas_data,sio3_ann_data,...
-              'silicate','Si','si_time','Zsi',Roa);
-
-  ext_tracers(oaname,o2_seas_data,o2_ann_data,...
-              'oxygen','O2','o2_time','Zo2',Roa);
-
-  ext_tracers(oaname,dic_seas_data,dic_ann_data,...
-             'dic','DIC','dic_time','Zdic',Roa);
-
-  ext_tracers(oaname,talk_seas_data,talk_ann_data,...
-              'talk','TALK','talk_time','Ztalk',Roa);
-
-  ext_tracers(oaname,doc_seas_data,doc_ann_data,...
-             'doc','DOC','doc_time','Zdoc',Roa);
-
-  ext_tracers(oaname,fer_seas_data,fer_ann_data,...
-             'fer','FER','fer_time','Zfer',Roa);
-end
-%
-% Vertical interpolations 
-%
-if (makeclim)
-  disp(' ')
-  disp(' Vertical interpolations')
-  disp(' ')
-  disp(' NO3...')
-  vinterp_clm(clmname,grdname,oaname,'NO3','no3_time','Zno3',0,'r');
-%
-%  PO4
-%
-  disp(' ')
-  disp(' Vertical interpolations')
-  disp(' ')
-  disp(' PO4...')
-  vinterp_clm(clmname,grdname,oaname,'PO4','po4_time','Zpo4',0,'r');
- %
- %  Si
- %
-  disp(' ')
-  disp(' Vertical interpolations')
-  disp(' ')
-  disp(' Si...')
-  vinterp_clm(clmname,grdname,oaname,'Si','si_time','Zsi',0,'r');
-%
-%  O2
-%
-  disp(' ')
-  disp(' Vertical interpolations')
-  disp(' ')
-  disp(' O2...')
-  vinterp_clm(clmname,grdname,oaname,'O2','o2_time','Zo2',0,'r');
-
-%
-% DIC 
-%
-  disp(' ')
-  disp(' Vertical interpolations')
-  disp(' ')
-  disp(' DIC...')
-  vinterp_clm(clmname,grdname,oaname,'DIC','dic_time','Zdic',0,'r');
-%
-% TALK
-%
-  disp(' ')
-  disp(' Vertical interpolations')
-  disp(' ')
-  disp(' TALK...')
-  vinterp_clm(clmname,grdname,oaname,'TALK','talk_time','Ztalk',0,'r');
-
-%
-% DOC
-%
-  disp(' ')
-  disp(' Vertical interpolations')
-  disp(' ')
-  disp(' DOC...')
-  vinterp_clm(clmname,grdname,oaname,'DOC','doc_time','Zdoc',0,'r');
-%
-% FER
-%
-  disp(' ')
-  disp(' Vertical interpolations')
-  disp(' ')
-  disp(' FER...')
-  vinterp_clm(clmname,grdname,oaname,'FER','fer_time','Zfer',0,'r');
-end
-
-
-if (makeplot)
-disp(' ')
-disp(' Make a few plots...')
-test_clim(clmname,grdname,'NO3',1,coastfileplot)
-figure
-test_clim(clmname,grdname,'PO4',1,coastfileplot)
-figure
-test_clim(clmname,grdname,'Si',1,coastfileplot)
-figure
-test_clim(clmname,grdname,'O2',1,coastfileplot)
-figure
-test_clim(clmname,grdname,'DIC',1,coastfileplot)
-figure
-test_clim(clmname,grdname,'TALK',1,coastfileplot)
-figure
-test_clim(clmname,grdname,'DOC',1,coastfileplot)
-figure
-test_clim(clmname,grdname,'FER',1,coastfileplot)
-end
-%
-% End
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Preprocessing_tools/vinterp_bry_bgc.m b/Preprocessing_tools/vinterp_bry_bgc.m
deleted file mode 100644
index 154fb011..00000000
--- a/Preprocessing_tools/vinterp_bry_bgc.m
+++ /dev/null
@@ -1,109 +0,0 @@
-function vinterp_bry_bgc(bryname,grdname,Zbryname,time,vname,obcndx)
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  Vertical interpolation from a Z-grid to a sigma-grid in the
-%  case of boundary (bry) files.
-% 
-%  Further Information:  
-%  http://www.croco-ocean.org
-%  
-%  This file is part of CROCOTOOLS
-%
-%  CROCOTOOLS is free software; you can redistribute it and/or modify
-%  it under the terms of the GNU General Public License as published
-%  by the Free Software Foundation; either version 2 of the License,
-%  or (at your option) any later version.
-%
-%  CROCOTOOLS is distributed in the hope that it will be useful, but
-%  WITHOUT ANY WARRANTY; without even the implied warranty of
-%  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-%  GNU General Public License for more details.
-%
-%  You should have received a copy of the GNU General Public License
-%  along with this program; if not, write to the Free Software
-%  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
-%  MA  02111-1307  USA
-%
-%  Copyright (c) 2005-2006 by Pierrick Penven 
-%  e-mail:Pierrick.Penven@ird.fr  
-%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-% open the grid file  
-% 
-ng=netcdf(grdname,'r');
-L=length(ng('xi_rho'));
-M=length(ng('eta_rho'));
-if obcndx==1
-  h=ng{'h'}(1,:);
-elseif obcndx==2
-  h=ng{'h'}(:,L);
-elseif obcndx==3
-  h=ng{'h'}(M,:);
-elseif obcndx==4
-  h=ng{'h'}(:,1);
-end
-close(ng);
-%
-% open the boundary file  
-% 
-nc=netcdf(bryname,'write');
-theta_s = nc{'theta_s'}(:);
-theta_b =  nc{'theta_b'}(:);
-hc  =  nc{'hc'}(:);
-N =  length(nc('s_rho'));
-vtransform = nc{'Vtransform'}(:);
-if  ~exist('vtransform')
-    vtransform=1; %Old Vtransform
-    disp([' NO VTRANSFORM parameter found'])
-    disp([' USE TRANSFORM default value vtransform = 1'])
-end
-% open the oa file  
-% 
-noa=netcdf(Zbryname,'r');
-z=-noa{'Z'}(:);
-t=noa{time}(:);
-tlen=length(t);
-Nz0=length(z);
-%
-% Get the sigma depths
-%
-zcroco=squeeze(zlevs(h,0.*h,theta_s,theta_b,hc,N,'r',vtransform));
-zmin=min(min(zcroco));
-zmax=max(max(zcroco));
-%
-% Check if the min z level is below the min sigma level 
-%    (if not add a deep layer)
-%
-addsurf=max(z)<zmax;
-addbot=min(z)>zmin;
-if addsurf
- z=[100;z];
-end
-if addbot
- z=[z;-100000];
-end
-Nz=min(find(z<zmin));
-z=z(1:Nz);
-%
-% loop on time
-%
-
-for l=1:tlen
-%for l=1:1
-  disp([' Time index: ',num2str(l),' of total: ',num2str(tlen)])
-  var=squeeze(noa{vname}(l,:));
-%  disp(['SIZE VAR=',num2str(size(var))])
-  if addsurf
-    var=cat(1,var(1,:),var);
-  end
-  if addbot
-    var=cat(1,var,var(end,:));
-  end
-  var=var(1:Nz,:);
-  nc{vname}(l,:,:)=ztosigma_1d(flipdim(var,1),zcroco,flipud(z));
-end
-close(nc);
-close(noa);
-
-return
-- 
GitLab