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.
Users/SetupNewConfiguration/OPABAT – NEMO
wiki:Users/SetupNewConfiguration/OPABAT

Version 9 (modified by nicolasmartin, 7 years ago) (diff)

--

OPABAT Tool

Last edition: Wikinfo(changed_ts)? by Wikinfo(changed_by)?

OPABAT is a set of Fortran and IDL procedures allowing to build a bathymetry filed on the grid of OPA, the oceanic dynamic component of the NEMO system. The bathymetry's construction is an essential step when setting up an new configuration of the sydtem : the choice of the trsehholds, of the passage's width and dorsal's height, to sum up the choice of the realism of the bathymetry at the given resolution conditions at the first order the oceanic flows computed by the model. This aspect of the problem imposes a manual intervention during the construction, in order to control the precision.

However, this manual intervention is increasingly light with the raise in resolution, the limit of resolution equalizing the precision of the data. With OPA model, bathymetry is calculated in vertical levels at the point of mass T of the C-Arakawa grid, with for value, zero, for the continents, of 1 with jpk for the oceanic bottom.

The development of the field of bathymetry is carried out in two times :

  • By the automatic construction of an outline through FORTRAN programs by using a bathymetric data file high resolution.
  • In one second step by the manual correction under IDL of the field.

You can download the tools here: IDL_OPABAT3.tar

And find some documentation here (in French): report and annexe

An example of IDL procedures can be found at the bottom of the page.

Automatic contruction of the files

The construction schedules of the outline file of bathymetry were conceived for fields of the model with relative small dimension, 100x100 with 1000x1000 points on the horizontal one, based on the handling of large data files and on expensive interpolations in computing times. These programs were initially conceived in 1993 to build the bathymetry of the first version world ocean OPA and were based on a set of FORTRAN programs and programs of layouts NCAR to validate the results. They were re-examined into 1997/98 per Anne-Marie Tréguier (LPO) within the framework of the CLIPPER project and with the LODYC for construction, inter alia, of the bathymetry for model ORCA. The graphic part and certain developments was given up or appreciably modified by the use of IDL which adds employment opportunities, in particular the use of the mouse. The programs, developed in FORTRAN 77 for an initial application, then used in several other contexts of the years afterwards, do not present the desired finished aspect and comprise sometimes abandoned developments, obsolete comments and certainly of the errors which we will perhaps have time and courage to begin again.

Up to now, two data files of bathymetry were used :

  • ETOP5 Released by the Marine Geology and Geophysics Division/National Geophysical Dated Center, covering the sphere and 5 minutes per 5 minutes of
    PARAMETER( JPITP5 = 4320, JPJTP5 = 2160 )
    
  • Smith and Sandwel file covering the sphere of 72 S with 72 N and integrating the recent data satellitales, 2 minutes resolution per 2 minutes:

(David T. Sandwell, Walter H. F. Smith, Stuart M. Smith, and Christopher Small, Institute for Geophysics and Planetary Physics, SIO, Geodynamics Laboratory, NOAA - Geological Data Center, SIO - Lamont Doherty Earth Observatory) (look at http://topex.ucsd.edu/marine_topo/mar_topo.html ).

PARAMETER( JPIBAT = 10800, JPJBAT = 6336)

Nota bene : If the field of the model covers areas in high latitudes, it is necessary to resort simultaneously to the two files.

Two methods of interpolation are employed:

  • A bilinear interpolation using the four points of data framing the point of grid. Variable lopa_method=.false. in the namelist file.
  • An average of the data of bathymetry contained in an areaof the grid of the model. Variable lopa_method=.true. in the namelist file.

This last method is more complex to carry out when the model uses an irregular grid with a symmetry east- west. It is recommended when the model is of weak resolution. The bilinear method is necessary when the resolution approaches the resolution of the data, the averages becoming nonsignificant.

To use IDL utility, it is necessary to build two files of outline of bathymetry, i.e. to carry out these programs twice to obtain a file with the resolution of the model, a file of highher resolution which will be used as file of control in the choices of the levels of bathymetry and will replace the use of the initial files of topography which are often difficult to handle and covering all the sphere. Typically the file of the model will be built by using an average by area, the file of control, to which the resolution is closer to the data, with a bilinear interpolation.

Example of parameters used for the construction of the bathymetry of configuration ORCA :

CC MODEL DATA SIZE
CC ---------------
CC JPI : FIRST HORIZONTAL DIMENSION
CC JPJ : SECOND
CC JPK : NUMBER OF VERTICAL LEVELS
CC
    INTEGER jpiglo,jpjglo,jpidta,jpjdta,jpi,jpj,jpk
    PARAMETER(JPIGLO = 182,JPJGLO = 149)
C

Second execution, bathymetry of finer resolution, in the case of ORCA, the precision was increased by a factor 12 in both direction of space thus a point of bathymetry is compared with a whole of 144 values :

   INTEGER NRES
     PARAMETER(NRES=12)
C si haute resolution
    PARAMETER(JPIGLO = 182*NRES,JPJGLO = 149*NRES)
    PARAMETER(JPI = jpiglo,JPJ = jpjglo )
     PARAMETER(JPIDTA = jpiglo,JPJDTA = jpjglo ).

The whole of the programs is called OPABAT :

  • OPABAT : main program, reading of the file namelist, call of the routines.
    • DOMHGR : programme OPA, définition de la grille horizontale et des facteurs d'échelle.
      • HGRCOO : program OPA, definition of the horizontal grid and scale factors.programme OPA lecture de la grille horizontale si NTOPO=1.
    • DOMZGR : program OPA, definition of the vertical grid.
    • DOMMSK : programe OPA , masks computing.
    • BATLEG : reading of the data file.
    • BATGUE : interpolation and creation of the outline file.
    • BATMOD : possible corrections of the file.
    • BATWRI : saving the file.

A makefile allows to obtain a binary.

A file opabat.h allows to initialize the size of arrays.

The namelist file allows to initialize the context of the experiment and the choice of the variables.

Nota Bene :
The files of bathymetry have as a unit the levels of model, the file of outline is in whole value varying from 0 (ground) with jpk, ocean floor.
The file of control is to express in floating value between 0. and float(jpk), to see program batwri.

Manual file improvement

The realization of a bathymetry file in an automatic way is not fully satisfactory for the reasons which we indicated in introduction. It is thus necessary to check the coherence of the results visually, to correct and sometimes modify after validation by a simulation with the model. The manual correction is not easy and several methods were tried in the past. The systematic checking is tiresome and it must be limited to the principal thresholds as soon as the field comprises more than 10000 points of grid. The use of IDL allows us :

  • To post bathymetry.
  • To select a under-field on which one wishes to make checks or modifications.
  • To modify and save.
  • To index islands if necessary.

The utility was developed using software IDL and was used on the machine rhodes.idris.fr of the IDRIS. The whole of IDL procedures are called IDL_OPABAT and use files made up at the first step.

  • BATINI, procedure initializing dimensions, to modify.
  • BATEXP, reading of the files, pretreatment of the file so necessary, selection of a under-field, posting.
  • BATMOD, work, modification level by level.
  • BATSAV, save, indentation of the islands.

Example

rhodes-rrup448: idl
IDL Version 5.1 (IRIX mipseb). Research Systems, Inc.
Installation number: 12072-0.
Licensed for use by: IDRIS/CNRS
For basic information, enter "IDLInfo" at the IDL> prompt.

We execute step by step the following parts:

  • @batini : re-initialization of array size
  • batexp : construction d un zoomreading of the files, removal of the ponds (see A3), construction of a zoom
  • batmod: work on the zoom of bathymetry, level by level
  • batsav : handing-over of the islands to -n (see A2A2) and save of a file of bathymetry

Initialization part

IDL> @batini
PROCEDURE IDL pour la BATHYMETRIE CLIPPER
=========================================
% Compiled module: LOADCT.
% LOADCT: Loading table Arc en Ciel / Phase
fin de l initialisation
Vous pouvez faire appel a d autres procedures :
@batini : Reinitialisation des dimensions et tableaux communs
batexp : lecture des fichiers, suppression des mares
et construction d'un zoom
batmod : travail sur le zoom de la bathymetrie, niveau par niveau
batsav : remise des iles a -n et sauvegarde d un fichier bathy

Launching reading procedures

IDL> batexp
% Compiled module: BATEXP.
Lecture des fichiers, noms par défaut : global.bin, global.bat
-> -> -> -> -> -> voulez-vous :
lire les bathymetries initiales , y or n(implicit)?
:y
lecture des bathymetries initiales
% Compiled module: BATLEC.
bathymetrie haute resolution nom = global.bin, y(implicit) or n?
:y
haute resolution lue
% Compiled module: BATLEC2.
bathymetrie basse resolution nom = global.bat, y(implicit) or n?
: n
------>> rentrez un nom de fichier ?
: bathy_ebauche
OK lecture bathy_ebauche
basse resolution lue

Possible treatments:

For more information on the channels, refer to the appendix A3

-> -> -> -> -> -> voulez-vous :
traiter les mares et chenaux, y or n(implicit)?
:n

Selection of a under-field by clicking the mouse on a zone

-> -> -> -> -> -> voulez-vous :
positionner le zoom , y or n(implicit)?
: y
% Compiled module: BATCLIC.
-> -> -> -> positionner et cliquer la souris
-> -> -> -> -> -> le zoom vous convient-il, y(implicit) or n?
: y
reduction et zoom pour pave 1320 1164
% Compiled module: BATZOOM.

Posting if desired the file of bathymetry and file of control with a higher resolution:

-> -> -> -> -> -> voulez-vous :
affichez le zoom de la basse resolution, y or n(implicit)?
:y
affichage
-> -> -> -> -> -> voulez-vous :
afficher le zoom de la basse resolution avec chenaux, y or n(implicit)?

For more information on the channels please refer to appendix A2:

n
-> -> -> -> -> -> voulez-vous :
affichez le zoom de la haute resolution, y or n(implicit)?
:y
affichage
Fin de la procedure BATEXP

Launching the working procedure

IDL> batmod
% Compiled module: BATMOD.
% LOADCT: Loading table Arc en Ciel / Phase
entrez le niveau?

One selected a level expressed in model level

20
on va visualiser le niveau 20
On peut changer de niveau en cliquant un bouton de la souris
-> -> -> -> -> -> positionner et cliquer la souris
bouton gauche -> informations
milieu -> modifier
droite -> sortir

Action with the mouse

-> -> -> -> changement de niveau de 0 a jpk ou n?
: 25

The under-field is posted with a pallet of colors corresponding to the two levels directly above (hot colors) or below (cold colors) the level selected (yellow color), in isolignes black contours of the file of control :

Possibly, we can modify the levels posted.

Two modes can be selected via the mouse :

  • An indicative mode, while clicking on the mouse, we post the level of an area and the maximum and minimum values of the file of control in this area.

Action with the mouse

pt ( 124, 120) BR= 25.5000
Haute resolution min 24.6479 moy 25.9379 max 26.6315

Action with the mouse

pt ( 125, 120) BR= 25.5000
Haute resolution min 25.8304 moy 26.6145 max 27.2046
  • A modification mode, where, with the mouse, we increase or decrease by a model level, example: passage from 24 to 25 for the item (123, 120) :
    bouton gauche --> monter (combler) new jk=jk-1
    milieu --> descendre (creuser) new jk=jk+1
    droite --> sortir
    

Action with the mouse

pt ( 123, 120) BR= 24.5000
Haute resolution min 23.5273 moy 24.9224 max 26.0350{

Action with the mouse

--> descendu de 24.5000 a 25.5000
pt ( 123, 120) BR= 25.5000
Haute resolution min 23.5273 moy 24.9224 max 26.0350

Action with the mouse

--> monte de 25.5000 a 24.5000

Exit of the procedure and save the modifications in the under-field

Action with the mouse

-> -> -> -> changement de niveau de 0 a jpk ou n?
: n
sortir

Safeguard

Voulez-vous mettre a jour le tableau BATHY
en prenant en compte les corrections faite sur ce ZOOM ?
y or n ?
:y
sauvegarde
% Compiled module: BATSAV.

We can number the islands before saving. (further informations, see appendix A3)

-> -> -> -> remplissage des iles, y ou n(implicit)?
Sauvegarde de bathy
------>> rentrez un nom de fichier ?
: nouvelle_bathy
procedure terminee:
Vous pouvez faire appel a d autres procedures :
@batini : Reinitialisation des dimensions et tableaux communs
batexp : lecture des fichiers, suppression des mares
et construction d un zoom
batmod : travail sur le zoom de la bathymetrie, niveau par niveau
batsav : remise des iles a -n et sauvegarde d un fichier bathy
-> -> -> -> -> -> voulez-vous :
affichez le zoom de la nouvelle bathy, y or n(implicit)?
: n
Vous pouvez faire appel a d autres procedures …
IDL>

A call of the procedures can be reiterated as many times as wanted to make posting and correction of under-field then leave IDL.

Appendix

A1: Mouth of the rivers

An additional procedure RUNOFF is under development for, starting from a first file of outline and layout of the coasts, to correct the localization and the distribution (on one or more points of grid) the mouth of the rivers.

A2: Channels removal

The outline file of bathymetry created automatically using FORTRAN programs involves the appearance in the file of ponds (major isolated points) or of channels (deep corridors). Initially a subroutine made it possible to fill them. It seemed more relevant to defer this algorithm in procedure BATEXP of IDL to make it possible to the user to operate a choice on the way of correcting them.

-> -> -> -> -> -> voulez-vous :
traiter les mares et cheneaux, y or n(implicit)?
: y
-> -> -> -> -> -> voulez-vous :
supprimer les points ocean quasi-isoles , y or n(implicit) ?
: y
affichage des points isoles, passage numero : 1
nombre de points isoles trouves : 5
continuer la suppression ? , y or n(implicit)?
: y
affichage des points isoles, passage numero : 2
: y
nombre de points isoles trouves : 2
continuer la suppression ? , y or n(implicit)?
: n
affichage des points isoles supprimes
nombre de points retouches EN TOUT sur 3 iterations : 8
enregistrer ces suppressions sur bathy? , y(implicit) or n?
: y
suppression enregistree
-> -> -> -> -> -> voulez-vous :
elargissement des cheneaux, y or n(implicit) ?
: y
affichage des cheneaux, passage numero : 1
probleme chenal 140 102 entre continent/iles ! 18 0 0
nombre de points cheneaux trouves N-S : 0
nombre de points cheneaux trouves E-W : 1
continuer la correction ? , y or n(implicit)?
affichage des points cheneaux corriges
nombre de points N-S EN TOUT sur 1 iterations : 0
nombre de points E-W EN TOUT sur 1 iterations : 1
enregistrer ces modifications sur bathy? , y(implicit) or n?
modification enregistree

A3: Islands classification

When the field has islands, for example fourteen for model ORCA, the corresponding areas are initially put at 0 by the programs and procedures, corresponding to continent. In the file of bathymetry of model OPA, these islands are numbered with negative values. Once bathymetry to finalize, one can thus carry out this operation starting from procedure BATSAV. This algorithm rises from programs worked out by Anne-Marie Tréguier (LPO).

IDL> batsav
-> -> -> -> remplissage des iles, y ou n(implicit)?
: y
Remplissage des iles
-> -> -> -> -> -> positionner et cliquer la souris
si probleme : droite --> sortir
-1 est valeur par defaut de l ile, OK, y or n ?

Attachments (3)