Initialse grid related variables

INTERFACE:

    subroutine init_grid_ncdf(ncid,init3d,x_dim,y_dim,z_dim)
DESCRIPTION:

This routine creates netCDF variables in an already existing netCDF file in define mode with netCDF file-id "ncid". All variables are related the numerical grid and the bathymetery. If the logical flag "init3d" evaluates false, no information about the vertical grid is initalised (e.g. if results from a horizontally integrated run are stored). Output arguments are the dimension id's for the netCDF dimensions, which may be needed for creating other, not grid related, netCDF variables. USES:

    use exceptions
    use netcdf
    use ncdf_common, only: set_attributes
    use grid_ncdf
    use domain, only: imin,imax,jmin,jmax,kmax
    use domain, only: grid_type,vert_cord
    use domain, only: have_lonlat,have_xy
    use output, only: save_metrics,save_masks
    IMPLICIT NONE
INPUT PARAMETERS:
    integer, intent(in)            :: ncid
    logical, intent(in)            :: init3d
INPUT PARAMETERS:
    integer, intent(out)           :: x_dim
    integer, intent(out)           :: y_dim
    integer, intent(out), optional :: z_dim
REVISION HISTORY:
    Original author(s): Lars Umlauf
LOCAL VARIABLES:
    integer                   :: status
    integer                   :: id
    integer                   :: axisdim(1)
    integer                   :: f2_dims(2)
    REALTYPE                  :: fv,mv,vr(2)
    character(32)             :: xname,yname,zname
    character(32)             :: xxname,yxname
    character(32)             :: xunits,yunits,zunits