*IF DEF,OCEAN                                                              DRINTFO1.2      
C ******************************COPYRIGHT******************************    DRINTFO1.3      
C (c) CROWN COPYRIGHT 1998, METEOROLOGICAL OFFICE, All Rights Reserved.    DRINTFO1.4      
C                                                                          DRINTFO1.5      
C Use, duplication or disclosure of this code is subject to the            DRINTFO1.6      
C restrictions as set forth in the contract.                               DRINTFO1.7      
C                                                                          DRINTFO1.8      
C                Meteorological Office                                     DRINTFO1.9      
C                London Road                                               DRINTFO1.10     
C                BRACKNELL                                                 DRINTFO1.11     
C                Berkshire UK                                              DRINTFO1.12     
C                RG12 2SZ                                                  DRINTFO1.13     
C                                                                          DRINTFO1.14     
C If no contract has been raised with this copy of the code, the use,      DRINTFO1.15     
C duplication or disclosure of it is strictly prohibited.  Permission      DRINTFO1.16     
C to do so must first be obtained in writing from the Head of Numerical    DRINTFO1.17     
C Modelling at the above address.                                          DRINTFO1.18     
C ******************************COPYRIGHT******************************    DRINTFO1.19     
C                                                                          DRINTFO1.20     
CLL Subroutine DERV_INTF_O -------------------------------------------     DRINTFO1.21     
C                                                                          DRINTFO1.22     
CLL  Purpose: To set up array dimensions for ocean boundary data           DRINTFO1.23     
CLL                                                                        DRINTFO1.24     
CLL  Model            Modification history from model version 4.5          DRINTFO1.25     
CLL version  Date                                                          DRINTFO1.26     
CLL  4.5   3/09/98    New deck added M.J.Bell                              DRINTFO1.27     
CLL                                                                        DRINTFO1.28     
CLLEND ---------------------------------------------------------------     DRINTFO1.29     

      SUBROUTINE DERV_INTF_O (TOT_LEN_INTFO_P,TOT_LEN_INTFO_U,              1DRINTFO1.30     
     &                      MAX_INTF_P_LEVELS_O,N_INTF_O)                  DRINTFO1.31     
                                                                           DRINTFO1.32     
CL Purpose: Sets values for TOT_LEN_INTFO_P, TOT_LEN_INTFO_U               DRINTFO1.33     
CL          and MAX_INTF_P_LEVELS_O, used as array dimensions.             DRINTFO1.34     
CL          Also sets LEN_INTFO_P and LEN_INTFO_U in CINTFO.               DRINTFO1.35     
                                                                           DRINTFO1.36     
      IMPLICIT NONE                                                        DRINTFO1.37     
                                                                           DRINTFO1.38     
      Integer TOT_LEN_INTFO_P    ! OUT                                     DRINTFO1.39     
      Integer TOT_LEN_INTFO_U    ! OUT                                     DRINTFO1.40     
      Integer MAX_INTF_P_LEVELS_O ! OUT                                    DRINTFO1.41     
      Integer N_INTF_O           ! IN                                      DRINTFO1.42     
                                                                           DRINTFO1.43     
*CALL CMAXSIZO                                                             DRINTFO1.44     
*CALL CINTFO                                                               DRINTFO1.45     
                                                                           DRINTFO1.46     
CL Locals                                                                  DRINTFO1.47     
      Integer JINTF ! do loop index over output files                      DRINTFO1.48     
                                                                           DRINTFO1.49     
CL Namelist to read                                                        DRINTFO1.50     
*CALL CNAMINFO                                                             DRINTFO1.51     
!-----------------------------------------------------------------         DRINTFO1.52     
                                                                           DRINTFO1.53     
      REWIND 5                                                             DRINTFO1.54     
      READ(5,INTFCNSTO)                                                    DRINTFO1.55     
      REWIND 5                                                             DRINTFO1.56     
                                                                           DRINTFO1.57     
      IF (N_INTF_O.GT.0) THEN                                              DRINTFO1.58     
         TOT_LEN_INTFO_P=0                                                 DRINTFO1.59     
         TOT_LEN_INTFO_U=0                                                 DRINTFO1.60     
         MAX_INTF_P_LEVELS_O=0                                             DRINTFO1.61     
                                                                           DRINTFO1.62     
CL Note that no corner points are discarded in ocean files                 DRINTFO1.63     
                                                                           DRINTFO1.64     
         DO JINTF=1,N_INTF_O                                               DRINTFO1.65     
            LEN_INTFO_P(JINTF)=( INTFO_ROW_LENGTH(JINTF)+                  DRINTFO1.66     
     &      INTFO_P_ROWS(JINTF) ) * 2 * INTFWIDTHO(JINTF)                  DRINTFO1.67     
            LEN_INTFO_U(JINTF)=LEN_INTFO_P(JINTF)-4*INTFWIDTHO(JINTF)      DRINTFO1.68     
            TOT_LEN_INTFO_P=TOT_LEN_INTFO_P+LEN_INTFO_P(JINTF)             DRINTFO1.69     
            TOT_LEN_INTFO_U=TOT_LEN_INTFO_U+LEN_INTFO_U(JINTF)             DRINTFO1.70     
            MAX_INTF_P_LEVELS_O=MAX(MAX_INTF_P_LEVELS_O,                   DRINTFO1.71     
     &      INTFO_P_LEVELS(JINTF))                                         DRINTFO1.72     
         ENDDO                                                             DRINTFO1.73     
                                                                           DRINTFO1.74     
         WRITE (6,*) ' '                                                   DRINTFO1.75     
         DO jintf=1,n_intf_o                                               DRINTFO1.76     
            write (6,*) ' jintf ',jintf,' len_intfo_p ',                   DRINTFO1.77     
     &      len_intfo_p(jintf), ' len_intfo_u ',len_intfo_u(jintf)         DRINTFO1.78     
         ENDDO                                                             DRINTFO1.79     
         WRITE (6,*) ' tot_len_intfo_p ',tot_len_intfo_p                   DRINTFO1.80     
         WRITE (6,*) ' tot_len_intfo_u ',tot_len_intfo_u                   DRINTFO1.81     
         WRITE (6,*) ' max_intf_p_levels_o ',max_intf_p_levels_o           DRINTFO1.82     
                                                                           DRINTFO1.83     
      ELSE                                                                 DRINTFO1.84     
                                                                           DRINTFO1.85     
!        No boundary conditions to be generated.                           DRINTFO1.86     
!        Initialise to prevent zero length dynamic allocation.             DRINTFO1.87     
                                                                           DRINTFO1.88     
         WRITE (6,*) ' n_intf_o ',n_intf_o                                 DRINTFO1.89     
                                                                           DRINTFO1.90     
         N_INTF_O = 0                                                      DRINTFO1.91     
         TOT_LEN_INTFO_P = 1                                               DRINTFO1.92     
         TOT_LEN_INTFO_U = 1                                               DRINTFO1.93     
         MAX_INTF_P_LEVELS_O = 1                                           DRINTFO1.94     
                                                                           DRINTFO1.95     
         write (6,*) ' n_intf_o ',n_intf_o                                 DRINTFO1.96     
         write (6,*) ' tot_len_intfo_p ',tot_len_intfo_p                   DRINTFO1.97     
         write (6,*) ' tot_len_intfo_u ',tot_len_intfo_u                   DRINTFO1.98     
         write (6,*) ' max_intf_p_levels ',max_intf_p_levels_o             DRINTFO1.99     
                                                                           DRINTFO1.100    
      ENDIF                                                                DRINTFO1.101    
                                                                           DRINTFO1.102    
      RETURN                                                               DRINTFO1.103    
      END                                                                  DRINTFO1.104    
*ENDIF                                                                     DRINTFO1.105