;+
;
; @file_comments
; load ORCA grid from the NetCDF meshmask file created by NEMO
;
; @categories
; Grid
;
; @param meshfilein {in}{optional}{default='mesh_mask.nc'}{type=scalar string}
; Name of the meshmask file to read. If this name does not contain any "/"
; and if iodirectory keyword is not specified, then the common variable
; iodir will be used to define the mesh file path.
;
; @param jpkin {in}{optional}{default=the one contained in the grid}{type=scalar}
; Number of vertical levels to load
;
; @keyword STRIDE {default=[1, 1, 1]}{type=3 elements vector}
; Specify the stride in x, y and z direction. The resulting
; value will be stored in the common (cm_4mesh) variable key_stride
;
; @keyword _EXTRA
; Used to pass keywords to ncdf_meshread
;
; @returns
; nothing but define common variables in cm_4mesh,
; cm_4data and cm_4cal
;
; @uses
; cm_4mesh
; cm_4data
; cm_4cal
;
; @restrictions
; works only for ORCA grid (because of the specific periodicity)
;
; @examples
; IDL> load_orca, 'toto_meshmask.nc'
; IDL> load_orca, 'toto_meshmask.nc', 1
;
; @history
; April. 2010, Sebastien Masson: Creation
;
; @version
; $Id$
;
;-
PRO load_orca, meshfilein, jpkin, stride = stride, _extra = ex
; jpkin: optional.t
;
@common
;----------------------------------------------------------
; define meshfile and check if the file exist
;----------------------------------------------------------
IF n_elements(meshfilein) EQ 0 THEN meshfilein = 'mesh_mask.nc'
meshfile = isafile(meshfilein, iodirectory = iodir, title = 'define the NetCDF mesh-file')
IF size(meshfile, /type) NE 7 THEN return
; grid size
cdfid = ncdf_open(meshfile)
ncdf_diminq, cdfid, 'x', name, jpiglo
ncdf_diminq, cdfid, 'y', name, jpjglo
ncdf_diminq, cdfid, 'z', name, jpkglo
ncdf_close, cdfid
;----------------------------------------------------------
; suppress overlapping bondaries
;----------------------------------------------------------
ixminmesh = 1
ixmaxmesh = jpiglo-2
;
iyminmesh = 0
iymaxmesh = jpjglo -1 + (jpjglo EQ 511)
;
izminmesh = 0
IF n_elements(jpkin) EQ 0 THEN jpkin = jpkglo ELSE jpkin = jpkin < jpkglo
izmaxmesh = jpkin-1
;
jpt = 1
time = 0
;------------------------------------------------------
; read grid parameters
;------------------------------------------------------
IF n_elements(stride) EQ 3 THEN key_stride = stride ELSE key_stride = [1, 1, 1]
ncdf_meshread, meshfile, glamboundary = [20.25, 380.25] - 0.25*(jpiglo eq 182), _extra = ex
;-------------------------------------------------------------
domdef
;
triangles_list = triangule(keep_cont = jpiglo NE 182)
;----------------------------------------------------------
; define reading parameters
;----------------------------------------------------------
jpidta = jpiglo
jpjdta = jpjglo
jpkdta = jpkglo
ixmindta = 0
ixmaxdta = jpidta-1
iymindta = 0
iymaxdta = jpjdta-1
izmindta = 0
izmaxdta = jpkdta-1
;
@updateold
;
return
END