New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 12080 for utils/tools/SIREN/src/create_bathy.f90 – NEMO

Ignore:
Timestamp:
2019-12-06T10:30:14+01:00 (4 years ago)
Author:
jpaul
Message:

update nemo trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • utils/tools/SIREN/src/create_bathy.f90

    r9598 r12080  
    33!---------------------------------------------------------------------- 
    44! 
    5 ! PROGRAM: create_bathy 
    6 ! 
    75! DESCRIPTION: 
    86!> @file 
    9 !> @brief  
    107!> This program creates fine grid bathymetry file. 
    118!> 
    12 !> @details 
    139!> @section sec1 method 
    14 !> Bathymetry could be extracted from fine grid Bathymetry file, interpolated 
    15 !> from coarse grid Bathymetry file, or manually written. 
     10!> This bathymetry could be : 
     11!> - extracted from a wider fine grid bathymetry file 
     12!> - interpolated from a wider coarse grid bathymetry file 
     13!> - handwritten 
     14!> 
     15!> @image html  bathy_40.png  
     16!> <center>@image latex bathy_30.png 
     17!> </center> 
    1618!> 
    1719!> @section sec2 how to 
    18 !>    to create fine grid bathymetry file:<br/> 
    19 !> @code{.sh} 
    20 !>    ./SIREN/bin/create_bathy create_bathy.nam 
    21 !> @endcode 
    22 !> <br/>     
    23 !> \image html  bathy_40.png  
    24 !> <center>\image latex bathy_30.png 
    25 !> </center> 
    26 !> 
    27 !> @note  
    28 !>    you could find a template of the namelist in templates directory. 
    29 !> 
    30 !>    create_bathy.nam contains 7 namelists:<br/> 
    31 !>       - logger namelist (namlog) 
    32 !>       - config namelist (namcfg) 
    33 !>       - coarse grid namelist (namcrs) 
    34 !>       - fine grid namelist (namfin) 
    35 !>       - variable namelist (namvar) 
    36 !>       - nesting namelist (namnst) 
    37 !>       - output namelist (namout) 
    38 !>     
    39 !>    * _logger namelist (namlog)_:<br/> 
    40 !>       - cn_logfile   : log filename 
    41 !>       - cn_verbosity : verbosity ('trace','debug','info', 
    42 !> 'warning','error','fatal','none') 
    43 !>       - in_maxerror  : maximum number of error allowed 
    44 !> 
    45 !>    * _config namelist (namcfg)_:<br/> 
    46 !>       - cn_varcfg : variable configuration file  
    47 !> (see ./SIREN/cfg/variable.cfg) 
    48 !>       - cn_dimcfg : dimension configuration file. defines dimension allowed 
    49 !> (see ./SIREN/cfg/dimension.cfg). 
    50 !>       - cn_dumcfg : useless (dummy) configuration file, for useless  
    51 !> dimension or variable (see ./SIREN/cfg/dummy.cfg). 
    52 !> 
    53 !>    * _coarse grid namelist (namcrs)_:<br/> 
    54 !>       - cn_coord0 : coordinate file 
    55 !>       - in_perio0 : NEMO periodicity index (see Model Boundary Condition in 
    56 !> [NEMO documentation](http://www.nemo-ocean.eu/About-NEMO/Reference-manuals)) 
    57 !> 
    58 !>    * _fine grid namelist (namfin)_:<br/> 
    59 !>       - cn_coord1 : coordinate file 
    60 !>       - in_perio1 : periodicity index 
    61 !>       - ln_fillclosed : fill closed sea or not (default is .TRUE.) 
    62 !> 
    63 !>    * _variable namelist (namvar)_:<br/> 
    64 !>       - cn_varfile : list of variable, and corresponding file.<br/>  
    65 !>          *cn_varfile* is the path and filename of the file where find 
    66 !>          variable. 
    67 !>          @note  
    68 !>             *cn_varfile* could be a matrix of value, if you want to filled 
    69 !>             manually variable value.<br/> 
    70 !>             the variable array of value is split into equal subdomain.<br/> 
    71 !>             Each subdomain is filled with the corresponding value  
    72 !>             of the matrix.<br/>           
    73 !>             separators used to defined matrix are: 
    74 !>                - ',' for line 
    75 !>                - '/' for row 
    76 !>                Example:<br/> 
    77 !>                   3,2,3/1,4,5  =>  @f$ \left( \begin{array}{ccc} 
    78 !>                                         3 & 2 & 3 \\ 
    79 !>                                         1 & 4 & 5 \end{array} \right) @f$ 
    80 !> 
    81 !>          Examples:  
    82 !>             - 'Bathymetry:gridT.nc' 
    83 !>             - 'Bathymetry:5000,5000,5000/5000,3000,5000/5000,5000,5000' 
    84 !> 
    85 !>       - cn_varinfo : list of variable and extra information about request(s)  
    86 !>       to be used.<br/> 
    87 !>          each elements of *cn_varinfo* is a string character 
    88 !>          (separated by ',').<br/> 
    89 !>          it is composed of the variable name follow by ':',  
    90 !>          then request(s) to be used on this variable.<br/>  
    91 !>          request could be: 
    92 !>             - int = interpolation method 
    93 !>             - ext = extrapolation method 
    94 !>             - flt = filter method 
    95 !>             - min = minimum value 
    96 !>             - max = maximum value 
    97 !>             - unt = new units 
    98 !>             - unf = unit scale factor (linked to new units) 
    99 !> 
    100 !>                requests must be separated by ';'.<br/> 
    101 !>                order of requests does not matter.<br/> 
    102 !> 
    103 !>          informations about available method could be find in @ref interp, 
    104 !>          @ref extrap and @ref filter modules.<br/> 
    105 !>          Example: 'Bathymetry: flt=2*hamming(2,3); min=0' 
    106 !>          @note  
    107 !>             If you do not specify a method which is required,  
    108 !>             default one is apply. 
    109 !>          @warning  
    110 !>             variable name must be __Bathymetry__ here. 
    111 !> 
    112 !>    * _nesting namelist (namnst)_:<br/> 
    113 !>       - in_rhoi  : refinement factor in i-direction 
    114 !>       - in_rhoj  : refinement factor in j-direction 
     20!> USAGE: create_bathy create_bathy.nam [-v] [-h]<br/> 
     21!>    - positional arguments:<br/> 
     22!>       - create_bathy.nam<br/> 
     23!>          namelist of create_bathy 
     24!>          @note 
     25!>             a template of the namelist could be created running (in templates directory): 
     26!>             @code{.sh} 
     27!>                python create_templates.py create_bathy 
     28!>             @endcode 
     29!> 
     30!>    - optional arguments:<br/> 
     31!>       - -h, --help<br/> 
     32!>          show this help message (and exit)<br/> 
     33!>       - -v, --version<br/> 
     34!>          show Siren's version   (and exit) 
     35!> 
     36!> @section sec_bathy create_bathy.nam 
     37!>    create_bathy.nam contains 7 sub-namelists:<br/> 
     38!>       - **namlog** to set logger parameters 
     39!>       - **namcfg** to set configuration file parameters 
     40!>       - **namsrc** to set source/coarse grid parameters 
     41!>       - **namtgt** to set target/fine grid parameters 
     42!>       - **namvar** to set variable parameters 
     43!>       - **namnst** to set sub domain and nesting paramters 
     44!>       - **namout** to set output parameters 
     45!> 
     46!>    here after, each sub-namelist parameters is detailed. 
     47!>    @note  
     48!>       default values are specified between brackets 
     49!> 
     50!> @subsection sublog namlog 
     51!>    the logger sub-namelist parameters are : 
     52!> 
     53!>    - **cn_logfile** [@a create_bathy.log]<br/> 
     54!>       logger filename 
     55!> 
     56!>    - **cn_verbosity** [@a warning]<br/> 
     57!>       verbosity level, choose between : 
     58!>          - trace 
     59!>          - debug 
     60!>          - info 
     61!>          - warning 
     62!>          - error 
     63!>          - fatal 
     64!>          - none 
     65!> 
     66!>    - **in_maxerror** [@a 5]<br/>  
     67!>       maximum number of error allowed 
     68!> 
     69!> @subsection subcfg namcfg 
     70!>    the configuration sub-namelist parameters are : 
     71!> 
     72!>    - **cn_varcfg** [@a ./cfg/variable.cfg]<br/> 
     73!>       path to the variable configuration file.<br/> 
     74!>       the variable configuration file defines standard name,  
     75!>       default interpolation method, axis,...  
     76!>       to be used for some known variables.<br/>  
     77!> 
     78!>    - **cn_dimcfg** [@a ./cfg/dimension.cfg]<br/>  
     79!>       path to the dimension configuration file.<br/>  
     80!>       the dimension configuration file defines dimensions allowed.<br/>  
     81!> 
     82!>    - **cn_dumcfg** [@a ./cfg/dummy.cfg]<br/>  
     83!>       path to the useless (dummy) configuration file.<br/> 
     84!>       the dummy configuration file defines useless  
     85!>       dimension or variable. these dimension(s) or variable(s) will not be 
     86!>       processed.<br/> 
     87!> 
     88!> @subsection subsrc namsrc  
     89!>    the source/coarse grid sub-namelist parameters are : 
     90!> 
     91!>    - **cn_coord0** [@a ]<br/>  
     92!>       path to the coordinate file 
     93!> 
     94!>    - **in_perio0** [@a ]<br/>  
     95!>       NEMO periodicity index<br/>  
     96!>       the NEMO periodicity could be choose between 0 to 6: 
     97!>       <dl> 
     98!>          <dt>in_perio=0</dt> 
     99!>          <dd>standard regional model</dd> 
     100!>          <dt>in_perio=1</dt> 
     101!>          <dd>east-west cyclic model</dd> 
     102!>          <dt>in_perio=2</dt> 
     103!>          <dd>model with symmetric boundary condition across the equator</dd> 
     104!>          <dt>in_perio=3</dt> 
     105!>          <dd>regional model with North fold boundary and T-point pivot</dd> 
     106!>          <dt>in_perio=4</dt> 
     107!>          <dd>global model with a T-point pivot.<br/> 
     108!>          example: ORCA2, ORCA025, ORCA12</dd> 
     109!>          <dt>in_perio=5</dt> 
     110!>          <dd>regional model with North fold boundary and F-point pivot</dd> 
     111!>          <dt>in_perio=6</dt> 
     112!>          <dd>global model with a F-point pivot<br/> 
     113!>          example: ORCA05</dd> 
     114!>          </dd> 
     115!>       </dl> 
     116!>       @sa For more information see @ref md_src_docsrc_6_perio 
     117!>       and Model Boundary Condition paragraph in the  
     118!>       [NEMO documentation](https://forge.ipsl.jussieu.fr/nemo/chrome/site/doc/NEMO/manual/pdf/NEMO_manual.pdf) 
     119!> 
     120!> @subsection subtgt namtgt  
     121!>    the target/fine grid sub-namelist parameters are : 
     122!> 
     123!>    - **cn_coord1** [@a ]<br/>  
     124!>       path to coordinate file 
     125!> 
     126!>    - **in_perio1** [@a ]<br/> 
     127!>       NEMO periodicity index (see above) 
     128!>    @note if the fine/target coordinates file (cn_coord1) was created by SIREN, you do 
     129!>    not need to fill this parameter. SIREN will read it on the global attributes of 
     130!>    the coordinates file. 
     131!> 
     132!>    - **ln_fillclosed** [@a .TRUE.]<br/> 
     133!>       logical to fill closed sea or not 
     134!> 
     135!> @subsection subvar namvar  
     136!>    the variable sub-namelist parameters are : 
     137!> 
     138!>    - **cn_varfile** [@a ]<br/>  
     139!>       list of variable, and associated file  
     140!>       @warning  
     141!>          variable name must be __Bathymetry__ here. 
     142!> 
     143!>       *cn_varfile* is the path and filename of the file where find 
     144!>       variable. 
    115145!>       @note  
    116 !>          coarse grid indices will be deduced from fine grid 
    117 !>          coordinate file. 
    118 !> 
    119 !>    * _output namelist (namout)_:<br/> 
    120 !>       - cn_fileout : output bathymetry file 
    121 !> 
     146!>          *cn_varfile* could be a matrix of value, if you want to handwrite 
     147!>          variable value.<br/> 
     148!>          the variable array of value is split into equal subdomain.<br/> 
     149!>          each subdomain is filled with the corresponding value  
     150!>          of the matrix.<br/>           
     151!>          separators used to defined matrix are: 
     152!>             - ',' for line 
     153!>             - '/' for row 
     154!>             Example:<br/> 
     155!>                3,2,3/1,4,5  =>  @f$ \left( \begin{array}{ccc} 
     156!>                                      3 & 2 & 3 \\ 
     157!>                                      1 & 4 & 5 \end{array} \right) @f$ 
     158!> 
     159!>       Examples:  
     160!>          - 'Bathymetry:gridT.nc' 
     161!>          - 'Bathymetry:5000,5000,5000/5000,3000,5000/5000,5000,5000'<br/> 
     162!> 
     163!>       @note  
     164!>          Optionnaly, NEMO periodicity could be added following the filename. 
     165!>          the periodicity must be separated by ';' 
     166!> 
     167!>       Example: 
     168!>          - 'Bathymetry:gridT.nc ; perio=4'<br/> 
     169!> 
     170!>    - **cn_varinfo** [@a ]<br/>  
     171!>       list of variable and extra information about request(s) to be used<br/> 
     172!> 
     173!>       each elements of *cn_varinfo* is a string character (separated by ',').<br/> 
     174!>       it is composed of the variable name follow by ':',  
     175!>       then request(s) to be used on this variable.<br/>  
     176!>       request could be: 
     177!>          - int = interpolation method 
     178!>          - ext = extrapolation method 
     179!>          - flt = filter method 
     180!>          - min = minimum value 
     181!>          - max = maximum value 
     182!>          - unt = new units 
     183!>          - unf = unit scale factor (linked to new units) 
     184!> 
     185!>             requests must be separated by ';'.<br/> 
     186!>             order of requests does not matter.<br/> 
     187!> 
     188!>       informations about available method could be find in @ref interp, 
     189!>       @ref extrap and @ref filter modules.<br/> 
     190!>       Example:  
     191!>          - 'Bathymetry: flt=2*hamming(2,3); min=0' 
     192!> 
     193!>       @note  
     194!>          If you do not specify a method which is required,  
     195!>          default one is apply. 
     196!> 
     197!>    - **ln_rand** [@a .False.]<br/>  
     198!>          logical to add random value to Bathymetry<br/> 
     199!>          Only for handmade Bathymetry.  
     200!>          A random value (+/- 0.1% of the maximum depth) will 
     201!>          will be added to avoid flat Bathymetry (which may cause issue). 
     202!> 
     203!> @subsection subnst namnst  
     204!>    the nesting sub-namelist parameters are : 
     205!> 
     206!>    - **in_rhoi**  [@a 1]<br/>  
     207!>       refinement factor in i-direction 
     208!> 
     209!>    - **in_rhoj**  [@a 1]<br/>  
     210!>       refinement factor in j-direction 
     211!> 
     212!>    @note  
     213!>       coarse grid indices will be deduced from fine grid 
     214!>       coordinate file. 
     215!> 
     216!> @subsection subout namout  
     217!>    the output sub-namelist parameter is : 
     218!> 
     219!>    - **cn_fileout** [@a bathy_fine.nc]<br/> 
     220!>       output bathymetry filename 
     221!> 
     222!> <hr> 
    122223!> @author J.Paul 
    123 ! REVISION HISTORY: 
     224!> 
    124225!> @date November, 2013 - Initial Version 
    125226!> @date Sepember, 2014  
     
    138239!> @date October, 2016 
    139240!> - dimension to be used select from configuration file 
    140 ! 
     241!> @date July, 2017 
     242!> - add random value to avoid flat bathymetry 
     243!> @date January, 2019 
     244!> - add option to add random value to a flat Bathymetry 
     245!> - create and clean file structure to avoid memory leaks 
     246!> - check dimension of matrix for 'handmade' bathymetry 
     247!> - add url path to global attributes of output file(s) 
     248!> @date February, 2019 
     249!> - rename sub namelist namcrs to namsrc 
     250!> - rename sub namelist namfin to namtgt 
     251!> @date August, 2019 
     252!> - use periodicity read from namelist, and store in multi structure 
     253!> @date Ocober, 2019 
     254!> - add help and version optional arguments 
     255!> 
    141256!> @todo 
    142257!> - check tl_multi is not empty 
    143258!> 
    144 !> @note Software governed by the CeCILL licence     (./LICENSE) 
     259!> @note Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt) 
    145260!---------------------------------------------------------------------- 
    146261PROGRAM create_bathy 
     
    168283   IMPLICIT NONE 
    169284 
     285   ! parameters 
     286   CHARACTER(LEN=lc), PARAMETER  :: cp_myname = "create_bathy" 
     287 
    170288   ! local variable 
     289   CHARACTER(LEN=lc)                                  :: cl_arg 
    171290   CHARACTER(LEN=lc)                                  :: cl_namelist 
    172291   CHARACTER(LEN=lc)                                  :: cl_date 
    173292   CHARACTER(LEN=lc)                                  :: cl_data 
     293   CHARACTER(LEN=lc)                                  :: cl_url 
     294   CHARACTER(LEN=lc)                                  :: cl_errormsg 
    174295 
    175296   INTEGER(i4)                                        :: il_narg 
    176297   INTEGER(i4)                                        :: il_status 
    177298   INTEGER(i4)                                        :: il_fileid 
     299   INTEGER(i4)                                        :: il_varid 
    178300   INTEGER(i4)                                        :: il_attid 
    179301   INTEGER(i4)                                        :: il_imin0 
     
    206328   TYPE(TDIM)       , DIMENSION(ip_maxdim)            :: tl_dim 
    207329 
     330   TYPE(TFILE)                                        :: tl_file 
     331 
    208332   TYPE(TMULTI)                                       :: tl_multi 
    209333 
     
    217341   ! namelist variable 
    218342   ! namlog 
    219    CHARACTER(LEN=lc)                       :: cn_logfile = 'create_bathy.log'  
    220    CHARACTER(LEN=lc)                       :: cn_verbosity = 'warning'  
    221    INTEGER(i4)                             :: in_maxerror = 5 
     343   CHARACTER(LEN=lc)                       :: cn_logfile    = 'create_bathy.log'  
     344   CHARACTER(LEN=lc)                       :: cn_verbosity  = 'warning'  
     345   INTEGER(i4)                             :: in_maxerror   = 5 
    222346 
    223347   ! namcfg 
    224    CHARACTER(LEN=lc)                       :: cn_varcfg = './cfg/variable.cfg'  
    225    CHARACTER(LEN=lc)                       :: cn_dimcfg = './cfg/dimension.cfg'  
    226    CHARACTER(LEN=lc)                       :: cn_dumcfg = './cfg/dummy.cfg'  
    227  
    228    ! namcrs 
    229    CHARACTER(LEN=lc)                       :: cn_coord0 = ''  
    230    INTEGER(i4)                             :: in_perio0 = -1 
    231  
    232    ! namfin 
    233    CHARACTER(LEN=lc)                       :: cn_coord1 = '' 
    234    INTEGER(i4)                             :: in_perio1 = -1 
     348   CHARACTER(LEN=lc)                       :: cn_varcfg  = './cfg/variable.cfg'  
     349   CHARACTER(LEN=lc)                       :: cn_dimcfg  = './cfg/dimension.cfg' 
     350   CHARACTER(LEN=lc)                       :: cn_dumcfg  = './cfg/dummy.cfg' 
     351 
     352   ! namsrc 
     353   CHARACTER(LEN=lc)                       :: cn_coord0  = ''  
     354   INTEGER(i4)                             :: in_perio0  = -1 
     355 
     356   ! namtgt 
     357   CHARACTER(LEN=lc)                       :: cn_coord1  = '' 
     358   INTEGER(i4)                             :: in_perio1  = -1 
    235359   LOGICAL                                 :: ln_fillclosed = .TRUE. 
    236360 
     
    238362   CHARACTER(LEN=lc), DIMENSION(ip_maxvar) :: cn_varfile = '' 
    239363   CHARACTER(LEN=lc), DIMENSION(ip_maxvar) :: cn_varinfo = '' 
     364   LOGICAL                                 :: ln_rand    = .FALSE. 
    240365 
    241366   ! namnst 
    242    INTEGER(i4)                             :: in_rhoi  = 1 
    243    INTEGER(i4)                             :: in_rhoj  = 1 
     367   INTEGER(i4)                             :: in_rhoi    = 1 
     368   INTEGER(i4)                             :: in_rhoj    = 1 
    244369 
    245370   ! namout 
     
    247372   !------------------------------------------------------------------- 
    248373 
    249    NAMELIST /namlog/ &   !< logger namelist 
    250    &  cn_logfile,    &   !< log file 
    251    &  cn_verbosity,  &   !< log verbosity 
    252    &  in_maxerror        !< logger maximum error 
    253  
    254    NAMELIST /namcfg/ &   !< configuration namelist 
    255    &  cn_varcfg, &       !< variable configuration file 
    256    &  cn_dimcfg, &       !< dimension configuration file 
    257    &  cn_dumcfg          !< dummy configuration file 
    258  
    259    NAMELIST /namcrs/ &   !< coarse grid namelist 
    260    &  cn_coord0,  &      !< coordinate file 
    261    &  in_perio0          !< periodicity index 
    262     
    263    NAMELIST /namfin/ &   !< fine grid namelist 
    264    &  cn_coord1,   &     !< coordinate file 
    265    &  in_perio1,   &     !< periodicity index 
    266    &  ln_fillclosed      !< fill closed sea 
     374   NAMELIST /namlog/ &  !< logger namelist 
     375   &  cn_logfile,    &  !< log file 
     376   &  cn_verbosity,  &  !< log verbosity 
     377   &  in_maxerror       !< logger maximum error 
     378 
     379   NAMELIST /namcfg/ &  !< configuration namelist 
     380   &  cn_varcfg,     &  !< variable configuration file 
     381   &  cn_dimcfg,     &  !< dimension configuration file 
     382   &  cn_dumcfg         !< dummy configuration file 
     383 
     384   NAMELIST /namsrc/ &  !< source/coarse grid namelist 
     385   &  cn_coord0,     &  !< coordinate file 
     386   &  in_perio0         !< periodicity index 
     387 
     388   NAMELIST /namtgt/ &  !< target/fine grid namelist 
     389   &  cn_coord1,     &  !< coordinate file 
     390   &  in_perio1,     &  !< periodicity index 
     391   &  ln_fillclosed     !< fill closed sea 
    267392  
    268    NAMELIST /namvar/ &   !< variable namelist 
    269    &  cn_varfile, &      !< list of variable file 
    270    &  cn_varinfo         !< list of variable and interpolation method to be used. (ex: 'votemper:linear','vosaline:cubic' ) 
    271     
    272    NAMELIST /namnst/ &   !< nesting namelist 
    273    &  in_rhoi,    &      !< refinement factor in i-direction 
    274    &  in_rhoj            !< refinement factor in j-direction 
    275  
    276    NAMELIST /namout/ &   !< output namlist 
    277    &  cn_fileout         !< fine grid bathymetry file 
     393   NAMELIST /namvar/ &  !< variable namelist 
     394   &  cn_varfile,    &  !< list of variable file 
     395   &  cn_varinfo,    &  !< list of variable and interpolation method to be used. (ex: 'votemper:linear','vosaline:cubic' ) 
     396   &  ln_rand           !< add random value to avoid flat bathymetry 
     397  
     398   NAMELIST /namnst/ &  !< nesting namelist 
     399   &  in_rhoi,       &  !< refinement factor in i-direction 
     400   &  in_rhoj           !< refinement factor in j-direction 
     401 
     402   NAMELIST /namout/ &  !< output namelist 
     403   &  cn_fileout        !< fine grid bathymetry file 
    278404   !------------------------------------------------------------------- 
    279405 
    280    ! namelist 
    281    ! get namelist 
     406   ! 
     407   ! Initialisation 
     408   ! -------------- 
     409   ! 
    282410   il_narg=COMMAND_ARGUMENT_COUNT() !f03 intrinsec 
    283    IF( il_narg/=1 )THEN 
    284       PRINT *,"ERROR in create_bathy: need a namelist" 
    285       STOP 
     411 
     412   ! Traitement des arguments fournis 
     413   ! -------------------------------- 
     414   IF( il_narg /= 1 )THEN 
     415      WRITE(cl_errormsg,*) ' ERROR : one argument is needed ' 
     416      CALL fct_help(cp_myname,cl_errormsg)  
     417      CALL EXIT(1) 
    286418   ELSE 
    287       CALL GET_COMMAND_ARGUMENT(1,cl_namelist) !f03 intrinsec 
     419 
     420      CALL GET_COMMAND_ARGUMENT(1,cl_arg) !f03 intrinsec 
     421      SELECT CASE (cl_arg) 
     422         CASE ('-v', '--version') 
     423 
     424            CALL fct_version(cp_myname) 
     425            CALL EXIT(0) 
     426 
     427         CASE ('-h', '--help') 
     428 
     429            CALL fct_help(cp_myname) 
     430            CALL EXIT(0) 
     431 
     432         CASE DEFAULT 
     433 
     434            cl_namelist=cl_arg 
     435 
     436            ! read namelist 
     437            INQUIRE(FILE=TRIM(cl_namelist), EXIST=ll_exist) 
     438            IF( ll_exist )THEN 
     439 
     440               il_fileid=fct_getunit() 
     441 
     442               OPEN( il_fileid, FILE=TRIM(cl_namelist),  & 
     443               &                FORM='FORMATTED',        & 
     444               &                ACCESS='SEQUENTIAL',     & 
     445               &                STATUS='OLD',            & 
     446               &                ACTION='READ',           & 
     447               &                IOSTAT=il_status) 
     448               CALL fct_err(il_status) 
     449               IF( il_status /= 0 )THEN 
     450                  WRITE(cl_errormsg,*) " ERROR : error opening "//TRIM(cl_namelist) 
     451                  CALL fct_help(cp_myname,cl_errormsg)  
     452                  CALL EXIT(1) 
     453               ENDIF 
     454 
     455               READ( il_fileid, NML = namlog ) 
     456  
     457               ! define logger file 
     458               CALL logger_open(TRIM(cn_logfile),TRIM(cn_verbosity),in_maxerror) 
     459               CALL logger_header() 
     460 
     461               READ( il_fileid, NML = namcfg ) 
     462               ! get variable extra information on configuration file 
     463               CALL var_def_extra(TRIM(cn_varcfg)) 
     464 
     465               ! get dimension allowed 
     466               CALL dim_def_extra(TRIM(cn_dimcfg)) 
     467 
     468               ! get dummy variable 
     469               CALL var_get_dummy(TRIM(cn_dumcfg)) 
     470               ! get dummy dimension 
     471               CALL dim_get_dummy(TRIM(cn_dumcfg)) 
     472               ! get dummy attribute 
     473               CALL att_get_dummy(TRIM(cn_dumcfg)) 
     474 
     475               READ( il_fileid, NML = namsrc ) 
     476               READ( il_fileid, NML = namtgt ) 
     477               READ( il_fileid, NML = namvar ) 
     478               ! add user change in extra information 
     479               CALL var_chg_extra( cn_varinfo ) 
     480               ! match variable with file 
     481               tl_multi=multi_init(cn_varfile) 
     482 
     483               READ( il_fileid, NML = namnst ) 
     484               READ( il_fileid, NML = namout ) 
     485 
     486               CLOSE( il_fileid, IOSTAT=il_status ) 
     487               CALL fct_err(il_status) 
     488               IF( il_status /= 0 )THEN 
     489                  CALL logger_error("CREATE BATHY: closing "//TRIM(cl_namelist)) 
     490               ENDIF 
     491 
     492            ELSE 
     493 
     494               WRITE(cl_errormsg,*) " ERROR : can't find "//TRIM(cl_namelist) 
     495               CALL fct_help(cp_myname,cl_errormsg)  
     496               CALL EXIT(1) 
     497 
     498            ENDIF 
     499 
     500      END SELECT 
    288501   ENDIF 
    289   
    290    ! read namelist 
    291    INQUIRE(FILE=TRIM(cl_namelist), EXIST=ll_exist) 
    292    IF( ll_exist )THEN 
    293   
    294       il_fileid=fct_getunit() 
    295  
    296       OPEN( il_fileid, FILE=TRIM(cl_namelist), & 
    297       &                FORM='FORMATTED',       & 
    298       &                ACCESS='SEQUENTIAL',    & 
    299       &                STATUS='OLD',           & 
    300       &                ACTION='READ',          & 
    301       &                IOSTAT=il_status) 
    302       CALL fct_err(il_status) 
    303       IF( il_status /= 0 )THEN 
    304          PRINT *,"ERROR in create_bathy: error opening "//TRIM(cl_namelist) 
    305          STOP 
    306       ENDIF 
    307  
    308       READ( il_fileid, NML = namlog ) 
    309       ! define log file 
    310       CALL logger_open(TRIM(cn_logfile),TRIM(cn_verbosity),in_maxerror) 
    311       CALL logger_header() 
    312  
    313       READ( il_fileid, NML = namcfg ) 
    314       ! get variable extra information 
    315       CALL var_def_extra(TRIM(cn_varcfg)) 
    316  
    317       ! get dimension allowed 
    318       CALL dim_def_extra(TRIM(cn_dimcfg)) 
    319  
    320       ! get dummy variable 
    321       CALL var_get_dummy(TRIM(cn_dumcfg)) 
    322       ! get dummy dimension 
    323       CALL dim_get_dummy(TRIM(cn_dumcfg)) 
    324       ! get dummy attribute 
    325       CALL att_get_dummy(TRIM(cn_dumcfg)) 
    326  
    327       READ( il_fileid, NML = namcrs ) 
    328       READ( il_fileid, NML = namfin ) 
    329       READ( il_fileid, NML = namvar ) 
    330       ! add user change in extra information 
    331       CALL var_chg_extra( cn_varinfo ) 
    332       ! match variable with file 
    333       tl_multi=multi_init(cn_varfile) 
    334   
    335       READ( il_fileid, NML = namnst ) 
    336       READ( il_fileid, NML = namout ) 
    337  
    338       CLOSE( il_fileid, IOSTAT=il_status ) 
    339       CALL fct_err(il_status) 
    340       IF( il_status /= 0 )THEN 
    341          CALL logger_error("CREATE BATHY: closing "//TRIM(cl_namelist)) 
    342       ENDIF 
    343  
    344    ELSE 
    345  
    346       PRINT *,"ERROR in create_bathy: can't find "//TRIM(cl_namelist) 
    347       STOP 
    348  
    349    ENDIF 
    350502 
    351503   CALL multi_print(tl_multi) 
    352504 
    353505   ! open files 
    354    IF( cn_coord0 /= '' )THEN 
    355       tl_coord0=mpp_init( file_init(TRIM(cn_coord0)), id_perio=in_perio0) 
     506   IF( TRIM(cn_coord0) /= '' )THEN 
     507      tl_file=file_init(TRIM(cn_coord0)) 
     508      tl_coord0=mpp_init( tl_file, id_perio=in_perio0) 
     509      ! clean 
     510      CALL file_clean(tl_file) 
    356511      CALL grid_get_info(tl_coord0) 
    357512   ELSE 
     
    361516 
    362517   IF( TRIM(cn_coord1) /= '' )THEN 
    363       tl_coord1=mpp_init( file_init(TRIM(cn_coord1)),id_perio=in_perio1) 
     518      tl_file=file_init(TRIM(cn_coord1)) 
     519      tl_coord1=mpp_init( tl_file, id_perio=in_perio1) 
     520      ! clean 
     521      CALL file_clean(tl_file) 
    364522      CALL grid_get_info(tl_coord1) 
    365523   ELSE 
     
    430588               jk=jk+1 
    431589               tl_tmp=var_copy(tl_multi%t_mpp(ji)%t_proc(1)%t_var(jj)) 
    432              
    433                tl_var(jk)=create_bathy_matrix(tl_tmp, tl_coord1) 
     590 
     591               IF( COUNT(tl_tmp%t_dim(:)%l_use) > 2 )THEN 
     592                  CALL logger_fatal("CREATE BATHY: input matrix use more "//& 
     593                     &              "than 2D. Check namelist.") 
     594               ENDIF 
     595               tl_var(jk)=create_bathy_matrix(tl_tmp, tl_coord1, ln_rand) 
    434596            ENDDO 
    435597            ! clean 
     
    438600         ELSE 
    439601 
    440             tl_mpp=mpp_init( file_init(TRIM(tl_multi%t_mpp(ji)%c_name)) ) 
     602            tl_file=file_init(TRIM(tl_multi%t_mpp(ji)%c_name), & 
     603               &              id_perio=tl_multi%t_mpp(ji)%i_perio) 
     604            tl_mpp=mpp_init( tl_file ) 
     605 
     606            ! clean 
     607            CALL file_clean(tl_file) 
    441608            CALL grid_get_info(tl_mpp) 
    442609 
     
    459626                  jk=jk+1 
    460627                  tl_tmp=var_copy(tl_multi%t_mpp(ji)%t_proc(1)%t_var(jj)) 
    461                 
     628  
    462629                  tl_var(jk)=create_bathy_extract( tl_tmp, tl_mpp, & 
    463630                  &                                tl_coord1 ) 
     
    548715 
    549716      ! add longitude 
    550       tl_lon=iom_mpp_read_var(tl_coord1,'longitude') 
     717      il_varid=var_get_id(tl_coord1%t_proc(1)%t_var(:),'longitude') 
     718      IF( il_varid == 0 )THEN 
     719         il_varid=var_get_id(tl_coord1%t_proc(1)%t_var(:),'longitude_T') 
     720      ENDIF 
     721      tl_lon=iom_mpp_read_var(tl_coord1, il_varid) 
    551722      CALL file_add_var(tl_fileout, tl_lon) 
    552723      CALL var_clean(tl_lon) 
    553724 
    554725      ! add latitude 
    555       tl_lat=iom_mpp_read_var(tl_coord1,'latitude') 
     726      il_varid=var_get_id(tl_coord1%t_proc(1)%t_var(:),'latitude') 
     727      IF( il_varid == 0 )THEN 
     728         il_varid=var_get_id(tl_coord1%t_proc(1)%t_var(:),'latitude_T') 
     729      ENDIF 
     730      tl_lat=iom_mpp_read_var(tl_coord1, il_varid) 
    556731      CALL file_add_var(tl_fileout, tl_lat) 
    557732      CALL var_clean(tl_lat) 
     
    581756   DEALLOCATE(tl_var) 
    582757 
     758   ! clean 
     759   CALL multi_clean(tl_multi) 
     760 
    583761   ! add some attribute 
    584762   tl_att=att_init("Created_by","SIREN create_bathy") 
    585763   CALL file_add_att(tl_fileout, tl_att) 
    586764 
     765   !add source url 
     766   cl_url=fct_split(fct_split(cp_url,2,'$'),2,'URL:') 
     767   tl_att=att_init("SIREN_url",cl_url) 
     768   CALL file_add_att(tl_fileout, tl_att) 
     769 
     770   ! add date of creation 
    587771   cl_date=date_print(date_now()) 
    588772   tl_att=att_init("Creation_date",cl_date) 
     
    631815 
    632816CONTAINS 
     817   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     818   FUNCTION create_bathy_matrix(td_var, td_coord, ld_rand) & 
     819         & RESULT (tf_var) 
    633820   !------------------------------------------------------------------- 
    634821   !> @brief 
     
    641828   !> Each subdomain is filled with the corresponding value of the matrix. 
    642829   !> 
     830   !> Optionaly, you could add a random value of 0.1% of maximum depth to each 
     831   !> points of the bathymetry 
     832   !> 
    643833   !> @author J.Paul 
    644834   !> @date November, 2013 - Initial Version 
     
    646836   !> @param[in] td_var    variable structure  
    647837   !> @param[in] td_coord  coordinate file structure 
     838   !> @param[in] ld_rand   add random value to bathymetry 
    648839   !> @return variable structure 
    649840   !------------------------------------------------------------------- 
    650    FUNCTION create_bathy_matrix(td_var, td_coord) 
     841 
    651842      IMPLICIT NONE 
     843 
    652844      ! Argument 
    653845      TYPE(TVAR), INTENT(IN) :: td_var 
    654846      TYPE(TMPP), INTENT(IN) :: td_coord 
     847      LOGICAL   , INTENT(IN) :: ld_rand 
    655848 
    656849      ! function 
    657       TYPE(TVAR) :: create_bathy_matrix 
     850      TYPE(TVAR)             :: tf_var 
    658851 
    659852      ! local variable 
    660853      INTEGER(i4)      , DIMENSION(2,2)                  :: il_xghost 
    661       INTEGER(i4)      , DIMENSION(3)                    :: il_dim 
    662       INTEGER(i4)      , DIMENSION(3)                    :: il_size 
    663       INTEGER(i4)      , DIMENSION(3)                    :: il_rest 
     854      INTEGER(i4)      , DIMENSION(2)                    :: il_dim 
     855      INTEGER(i4)      , DIMENSION(2)                    :: il_size 
     856      INTEGER(i4)      , DIMENSION(2)                    :: il_rest 
    664857 
    665858      INTEGER(i4)      , DIMENSION(:)      , ALLOCATABLE :: il_ishape 
    666859      INTEGER(i4)      , DIMENSION(:)      , ALLOCATABLE :: il_jshape 
    667       INTEGER(i4)      , DIMENSION(:)      , ALLOCATABLE :: il_kshape 
    668  
     860 
     861      REAL(dp)         , DIMENSION(:,:)    , ALLOCATABLE :: dl_ran 
    669862      REAL(dp)         , DIMENSION(:,:,:,:), ALLOCATABLE :: dl_value 
    670863 
     
    677870      INTEGER(i4) :: ji 
    678871      INTEGER(i4) :: jj 
    679       INTEGER(i4) :: jk 
    680872      !---------------------------------------------------------------- 
    681873 
     
    705897      ! write value on grid 
    706898      ! get matrix dimension 
    707       il_dim(:)=td_var%t_dim(1:3)%i_len 
     899      il_dim(:)=td_var%t_dim(1:2)%i_len 
    708900      ! output dimension 
    709901      tl_dim(:)=dim_copy(tl_lon%t_dim(:)) 
     
    712904 
    713905      ! split output domain in N subdomain depending of matrix dimension  
    714       il_size(:) = tl_dim(1:3)%i_len / il_dim(:) 
    715       il_rest(:) = MOD(tl_dim(1:3)%i_len, il_dim(:)) 
     906      il_size(:) = tl_dim(1:2)%i_len / il_dim(:) 
     907      il_rest(:) = MOD(tl_dim(1:2)%i_len, il_dim(:)) 
    716908 
    717909      ALLOCATE( il_ishape(il_dim(1)+1) ) 
     
    731923      il_jshape(il_dim(2)+1)=il_jshape(il_dim(2)+1)+il_rest(2) 
    732924 
    733       ALLOCATE( il_kshape(il_dim(3)+1) ) 
    734       il_kshape(:)=0 
    735       DO jk=2,il_dim(3)+1 
    736          il_kshape(jk)=il_kshape(jk-1)+il_size(3) 
    737       ENDDO 
    738       ! add rest to last cell 
    739       il_kshape(il_dim(3)+1)=il_kshape(il_dim(3)+1)+il_rest(3) 
    740  
    741925      ! write ouput array of value  
    742926      ALLOCATE(dl_value( tl_dim(1)%i_len, & 
     
    746930 
    747931      dl_value(:,:,:,:)=0 
    748  
    749       DO jk=2,il_dim(3)+1 
    750          DO jj=2,il_dim(2)+1 
    751             DO ji=2,il_dim(1)+1 
    752                 
    753                dl_value( 1+il_ishape(ji-1):il_ishape(ji), & 
    754                &         1+il_jshape(jj-1):il_jshape(jj), & 
    755                &         1+il_kshape(jk-1):il_kshape(jk), & 
    756                &         1 ) = td_var%d_value(ji-1,jj-1,jk-1,1) 
    757  
    758             ENDDO 
     932      DO jj=2,il_dim(2)+1 
     933         DO ji=2,il_dim(1)+1 
     934             
     935            dl_value( 1+il_ishape(ji-1):il_ishape(ji), & 
     936            &         1+il_jshape(jj-1):il_jshape(jj), & 
     937            &         1,1 ) = td_var%d_value(ji-1,jj-1,1,1) 
     938 
    759939         ENDDO 
    760940      ENDDO 
    761941 
     942 
     943      IF( ld_rand )THEN 
     944         ALLOCATE(dl_ran(tl_dim(1)%i_len, & 
     945         &               tl_dim(2)%i_len) ) 
     946       
     947         ! set random value between 0 and 1 
     948         CALL RANDOM_NUMBER(dl_ran(:,:)) 
     949         ! set random value between -0.5 and 0.5 
     950         dl_ran(:,:)=dl_ran(:,:)-0.5 
     951         ! set random value of 0.1% of maximum depth 
     952         dl_ran(:,:)=dl_ran(:,:)*1.e-4*MAXVAL(td_var%d_value(:,:,1,1)) 
     953 
     954         dl_value(:,:,1,1)=dl_value(:,:,1,1)+dl_ran(:,:) 
     955       
     956         DEALLOCATE(dl_ran) 
     957      ENDIF 
     958 
    762959      ! initialise variable with value 
    763       create_bathy_matrix=var_init(TRIM(td_var%c_name),dl_value(:,:,:,:)) 
     960      tf_var=var_init(TRIM(td_var%c_name),dl_value(:,:,:,:)) 
    764961 
    765962      DEALLOCATE(dl_value) 
    766963 
    767964      ! add ghost cell 
    768       CALL grid_add_ghost(create_bathy_matrix, il_xghost(:,:)) 
     965      CALL grid_add_ghost(tf_var, il_xghost(:,:)) 
    769966 
    770967      ! clean 
     
    772969 
    773970   END FUNCTION create_bathy_matrix 
     971   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     972   FUNCTION create_bathy_extract(td_var, td_mpp, td_coord) & 
     973         &  RESULT (tf_var) 
    774974   !------------------------------------------------------------------- 
    775975   !> @brief 
     
    785985   !> @return variable structure 
    786986   !------------------------------------------------------------------- 
    787    FUNCTION create_bathy_extract(td_var, td_mpp, & 
    788    &                             td_coord) 
     987 
    789988      IMPLICIT NONE 
     989 
    790990      ! Argument 
    791991      TYPE(TVAR), INTENT(IN) :: td_var   
     
    794994 
    795995      ! function 
    796       TYPE(TVAR) :: create_bathy_extract 
     996      TYPE(TVAR)             :: tf_var 
    797997 
    798998      ! local variable 
     
    8081008      TYPE(TATT)  :: tl_att 
    8091009 
    810       TYPE(TVAR)  :: tl_var 
    811        
    8121010      TYPE(TDOM)  :: tl_dom 
    8131011      ! loop indices 
     
    8431041 
    8441042         ! read variable on domain 
    845          tl_var=iom_dom_read_var(tl_mpp,TRIM(td_var%c_name),tl_dom) 
     1043         tf_var=iom_dom_read_var(tl_mpp,TRIM(td_var%c_name),tl_dom) 
    8461044 
    8471045         ! close mpp file 
     
    8491047 
    8501048         ! add ghost cell 
    851          CALL grid_add_ghost(tl_var,tl_dom%i_ghost(:,:)) 
     1049         CALL grid_add_ghost(tf_var,tl_dom%i_ghost(:,:)) 
    8521050 
    8531051         ! check result 
    854          IF( ANY( tl_var%t_dim(:)%l_use .AND. & 
    855          &        tl_var%t_dim(:)%i_len /= td_coord%t_dim(:)%i_len) )THEN 
     1052         IF( ANY( tf_var%t_dim(:)%l_use .AND. & 
     1053         &        tf_var%t_dim(:)%i_len /= td_coord%t_dim(:)%i_len) )THEN 
    8561054            CALL logger_debug("CREATE BATHY EXTRACT: "//& 
    8571055            &        "dimensoin of variable "//TRIM(td_var%c_name)//" "//& 
    858             &        TRIM(fct_str(tl_var%t_dim(1)%i_len))//","//& 
    859             &        TRIM(fct_str(tl_var%t_dim(2)%i_len))//","//& 
    860             &        TRIM(fct_str(tl_var%t_dim(3)%i_len))//","//& 
    861             &        TRIM(fct_str(tl_var%t_dim(4)%i_len)) ) 
     1056            &        TRIM(fct_str(tf_var%t_dim(1)%i_len))//","//& 
     1057            &        TRIM(fct_str(tf_var%t_dim(2)%i_len))//","//& 
     1058            &        TRIM(fct_str(tf_var%t_dim(3)%i_len))//","//& 
     1059            &        TRIM(fct_str(tf_var%t_dim(4)%i_len)) ) 
    8621060            CALL logger_debug("CREATE BATHY EXTRACT: "//& 
    8631061            &        "dimensoin of coordinate file "//& 
     
    8731071         ! add attribute to variable 
    8741072         tl_att=att_init('src_file',TRIM(fct_basename(tl_mpp%c_name))) 
    875          CALL var_move_att(tl_var, tl_att)          
     1073         CALL var_move_att(tf_var, tl_att)          
    8761074 
    8771075         tl_att=att_init('src_i_indices',(/tl_dom%i_imin, tl_dom%i_imax/)) 
    878          CALL var_move_att(tl_var, tl_att) 
     1076         CALL var_move_att(tf_var, tl_att) 
    8791077 
    8801078         tl_att=att_init('src_j_indices',(/tl_dom%i_jmin, tl_dom%i_jmax/)) 
    881          CALL var_move_att(tl_var, tl_att) 
    882  
    883          ! save result 
    884          create_bathy_extract=var_copy(tl_var) 
     1079         CALL var_move_att(tf_var, tl_att) 
    8851080 
    8861081         ! clean structure 
    8871082         CALL att_clean(tl_att) 
    888          CALL var_clean(tl_var) 
    8891083         CALL mpp_clean(tl_mpp) 
    8901084      ENDIF 
    8911085 
    8921086   END FUNCTION create_bathy_extract 
     1087   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     1088   FUNCTION create_bathy_get_var(td_var, td_mpp,   & 
     1089         &                       id_imin, id_jmin, & 
     1090         &                       id_imax, id_jmax, & 
     1091         &                       id_offset,        & 
     1092         &                       id_rho) & 
     1093         &  RESULT (tf_var) 
    8931094   !------------------------------------------------------------------- 
    8941095   !> @brief 
     
    9091110   !> @return variable structure 
    9101111   !------------------------------------------------------------------- 
    911    FUNCTION create_bathy_get_var(td_var, td_mpp,   & 
    912             &                    id_imin, id_jmin, & 
    913             &                    id_imax, id_jmax, & 
    914             &                    id_offset,        & 
    915             &                    id_rho ) 
     1112 
    9161113      IMPLICIT NONE 
     1114 
    9171115      ! Argument 
    9181116      TYPE(TVAR)                 , INTENT(IN) :: td_var   
     
    9261124 
    9271125      ! function 
    928       TYPE(TVAR) :: create_bathy_get_var 
     1126      TYPE(TVAR)                              :: tf_var 
    9291127 
    9301128      ! local variable 
    9311129      TYPE(TMPP)  :: tl_mpp 
    9321130      TYPE(TATT)  :: tl_att 
    933       TYPE(TVAR)  :: tl_var 
    9341131      TYPE(TDOM)  :: tl_dom 
    9351132 
     
    9591156 
    9601157      !- read variable value on domain 
    961       tl_var=iom_dom_read_var(tl_mpp,TRIM(td_var%c_name),tl_dom) 
     1158      tf_var=iom_dom_read_var(tl_mpp,TRIM(td_var%c_name),tl_dom) 
    9621159 
    9631160      !- close mpp files 
     
    9691166       
    9701167      !- interpolate variable 
    971       CALL create_bathy_interp(tl_var, il_rho(:), id_offset(:,:)) 
     1168      CALL create_bathy_interp(tf_var, il_rho(:), id_offset(:,:)) 
    9721169 
    9731170      !- remove extraband added to domain 
    974       CALL dom_del_extra( tl_var, tl_dom, il_rho(:) ) 
     1171      CALL dom_del_extra( tf_var, tl_dom, il_rho(:) ) 
    9751172 
    9761173      CALL dom_clean_extra( tl_dom ) 
    9771174 
    9781175      !- add ghost cell 
    979       CALL grid_add_ghost(tl_var,tl_dom%i_ghost(:,:)) 
     1176      CALL grid_add_ghost(tf_var,tl_dom%i_ghost(:,:)) 
    9801177  
    9811178      !- add attribute to variable 
    9821179      tl_att=att_init('src_file',TRIM(fct_basename(tl_mpp%c_name))) 
    983       CALL var_move_att(tl_var, tl_att) 
     1180      CALL var_move_att(tf_var, tl_att) 
    9841181 
    9851182      tl_att=att_init('src_i_indices',(/tl_dom%i_imin, tl_dom%i_imax/)) 
    986       CALL var_move_att(tl_var, tl_att) 
     1183      CALL var_move_att(tf_var, tl_att) 
    9871184 
    9881185      tl_att=att_init('src_j_indices',(/tl_dom%i_jmin, tl_dom%i_jmax/)) 
    989       CALL var_move_att(tl_var, tl_att) 
     1186      CALL var_move_att(tf_var, tl_att) 
    9901187 
    9911188      IF( .NOT. ALL(id_rho(:)==1) )THEN 
    9921189         tl_att=att_init("refinment_factor",(/id_rho(jp_I),id_rho(jp_J)/)) 
    993          CALL var_move_att(tl_var, tl_att) 
     1190         CALL var_move_att(tf_var, tl_att) 
    9941191      ENDIF 
    9951192 
    9961193      DEALLOCATE( il_rho ) 
    997  
    998       !- save result 
    999       create_bathy_get_var=var_copy(tl_var) 
    10001194 
    10011195      !- clean structure 
    10021196      CALL att_clean(tl_att) 
    1003       CALL var_clean(tl_var) 
    10041197      CALL mpp_clean(tl_mpp) 
    10051198  
    10061199   END FUNCTION create_bathy_get_var 
     1200   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     1201   SUBROUTINE create_bathy_interp(td_var, id_rho, id_offset, & 
     1202         &                        id_iext, id_jext) 
    10071203   !------------------------------------------------------------------- 
    10081204   !> @brief 
     
    10181214   !> @param[in] id_jext   j-direction size of extra bands (default=im_minext) 
    10191215   !------------------------------------------------------------------- 
    1020    SUBROUTINE create_bathy_interp( td_var,         & 
    1021    &                               id_rho,          & 
    1022    &                               id_offset,       & 
    1023    &                               id_iext, id_jext) 
    10241216 
    10251217      IMPLICIT NONE 
     
    11121304 
    11131305   END SUBROUTINE create_bathy_interp 
     1306   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     1307   SUBROUTINE create_bathy_check_depth(td_mpp, td_depth) 
    11141308   !------------------------------------------------------------------- 
    11151309   !> @brief 
     
    11251319   !> @param[inout] td_depth  depth variable structure  
    11261320   !------------------------------------------------------------------- 
    1127    SUBROUTINE create_bathy_check_depth( td_mpp, td_depth ) 
    11281321 
    11291322      IMPLICIT NONE 
     
    11641357       
    11651358   END SUBROUTINE create_bathy_check_depth 
     1359   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
     1360   SUBROUTINE create_bathy_check_time(td_mpp, td_time) 
    11661361   !------------------------------------------------------------------- 
    11671362   !> @brief 
     
    11771372   !> @param[inout] td_time  time variable structure  
    11781373   !------------------------------------------------------------------- 
    1179    SUBROUTINE create_bathy_check_time( td_mpp, td_time ) 
    11801374 
    11811375      IMPLICIT NONE 
     
    12201414       
    12211415   END SUBROUTINE create_bathy_check_time 
     1416   !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    12221417END PROGRAM create_bathy 
Note: See TracChangeset for help on using the changeset viewer.