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 15144 for NEMO/branches/UKMO/NEMO_4.0.4_generic_obs – NEMO

Ignore:
Timestamp:
2021-07-26T16:46:48+02:00 (3 years ago)
Author:
dford
Message:

Initial implementation of generic OBS interface.

Location:
NEMO/branches/UKMO/NEMO_4.0.4_generic_obs
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • NEMO/branches/UKMO/NEMO_4.0.4_generic_obs/cfgs/SHARED/namelist_ref

    r15089 r15144  
    12421242!!                                                                    !! 
    12431243!!   namobs       observation and model comparison                      (default: OFF) 
     1244!!   namobs_dta   observation and model comparison - external data      (see: namobs) 
    12441245!!   nam_asminc   assimilation increments                               ('key_asminc') 
    12451246!!====================================================================== 
    12461247! 
    12471248!----------------------------------------------------------------------- 
    1248 &namobs        !  observation usage switch                              (default: OFF) 
    1249 !----------------------------------------------------------------------- 
    1250    ln_diaobs   = .false.             ! Logical switch for the observation operator 
    1251    ! 
    1252    ln_t3d      = .false.             ! Logical switch for T profile observations 
    1253    ln_s3d      = .false.             ! Logical switch for S profile observations 
    1254    ln_sla      = .false.             ! Logical switch for SLA observations 
    1255    ln_sst      = .false.             ! Logical switch for SST observations 
    1256    ln_sss      = .false.             ! Logical swithc for SSS observations 
    1257    ln_sic      = .false.             ! Logical switch for Sea Ice observations 
    1258    ln_vel3d    = .false.             ! Logical switch for velocity observations 
    1259    ln_altbias  = .false.             ! Logical switch for altimeter bias correction 
    1260    ln_sstbias  = .false.             ! Logical switch for SST bias correction 
    1261    ln_nea      = .false.             ! Logical switch for rejection of observations near land 
    1262    ln_grid_global = .true.           ! Logical switch for global distribution of observations 
    1263    ln_grid_search_lookup = .false.   ! Logical switch for obs grid search w/lookup table 
    1264    ln_ignmis   = .true.              ! Logical switch for ignoring missing files 
    1265    ln_s_at_t   = .false.             ! Logical switch for computing model S at T obs if not there 
    1266    ln_sstnight = .false.             ! Logical switch for calculating night-time average for SST obs 
    1267    ln_bound_reject  = .false.        ! Logical to remove obs near boundaries in LAMs. 
    1268    ln_default_fp_indegs = .true.     ! Logical: T=> averaging footprint is in degrees, F=> in metres 
    1269    ln_sla_fp_indegs = .true.         ! Logical for SLA: T=> averaging footprint is in degrees, F=> in metres 
    1270    ln_sst_fp_indegs = .true.         ! Logical for SST: T=> averaging footprint is in degrees, F=> in metres 
    1271    ln_sss_fp_indegs = .true.         ! Logical for SSS: T=> averaging footprint is in degrees, F=> in metres 
    1272    ln_sic_fp_indegs = .true.         ! Logical for SIC: T=> averaging footprint is in degrees, F=> in metres 
    1273 ! All of the *files* variables below are arrays. Use namelist_cfg to add more files 
    1274    cn_profbfiles = 'profiles_01.nc'  ! Profile feedback input observation file names 
    1275    cn_slafbfiles = 'sla_01.nc'       ! SLA feedback input observation file names 
    1276    cn_sstfbfiles = 'sst_01.nc'       ! SST feedback input observation file names 
    1277    cn_sssfbfiles = 'sss_01.nc'       ! SSS feedback input observation file names 
    1278    cn_sicfbfiles = 'sic_01.nc'       ! SIC feedback input observation file names 
    1279    cn_velfbfiles = 'vel_01.nc'       ! Velocity feedback input observation file names 
    1280    cn_altbiasfile = 'altbias.nc'     ! Altimeter bias input file name 
    1281    cn_sstbiasfiles = 'sstbias.nc'    ! SST bias input file name 
    1282    cn_gridsearchfile ='gridsearch.nc' ! Grid search file name 
    1283    rn_gridsearchres = 0.5            ! Grid search resolution 
    1284    rn_default_avglamscl = 0.         ! Default E/W diameter of observation footprint (metres/degrees) 
    1285    rn_default_avgphiscl = 0.         ! Default N/S diameter of observation footprint (metres/degrees) 
    1286    rn_mdtcorr  = 1.61                ! MDT  correction 
    1287    rn_mdtcutoff = 65.0               ! MDT cutoff for computed correction 
    1288    rn_dobsini  = 00010101.000000     ! Initial date in window YYYYMMDD.HHMMSS 
    1289    rn_dobsend  = 00010102.000000     ! Final date in window YYYYMMDD.HHMMSS 
    1290    rn_sla_avglamscl = 0.             ! E/W diameter of SLA observation footprint (metres/degrees) 
    1291    rn_sla_avgphiscl = 0.             ! N/S diameter of SLA observation footprint (metres/degrees) 
    1292    rn_sst_avglamscl = 0.             ! E/W diameter of SST observation footprint (metres/degrees) 
    1293    rn_sst_avgphiscl = 0.             ! N/S diameter of SST observation footprint (metres/degrees) 
    1294    rn_sss_avglamscl = 0.             ! E/W diameter of SSS observation footprint (metres/degrees) 
    1295    rn_sss_avgphiscl = 0.             ! N/S diameter of SSS observation footprint (metres/degrees) 
    1296    rn_sic_avglamscl = 0.             ! E/W diameter of SIC observation footprint (metres/degrees) 
    1297    rn_sic_avgphiscl = 0.             ! N/S diameter of SIC observation footprint (metres/degrees) 
    1298    nn_1dint = 0                      ! Type of vertical interpolation method 
    1299    nn_2dint_default = 0              ! Default horizontal interpolation method 
    1300    nn_2dint_sla = 0                  ! Horizontal interpolation method for SLA 
    1301    nn_2dint_sst = 0                  ! Horizontal interpolation method for SST 
    1302    nn_2dint_sss = 0                  ! Horizontal interpolation method for SSS 
    1303    nn_2dint_sic = 0                  ! Horizontal interpolation method for SIC 
    1304    nn_msshc     = 0                  ! MSSH correction scheme 
    1305    nn_profdavtypes = -1              ! Profile daily average types - array 
     1249&namobs       !  observation and model comparison                       (default: OFF) 
     1250!----------------------------------------------------------------------- 
     1251   ln_diaobs             = .false.         ! Logical switch for the observation operator 
     1252   nn_obsgroups          = 0               ! Number of observation group namelists (namobs_dta) to read in 
     1253   ln_grid_global        = .true.          ! Logical switch for global distribution of observations 
     1254   ln_grid_search_lookup = .false.         ! Logical switch for obs grid search w/lookup table 
     1255   cn_gridsearchfile     = 'grid_search'   ! Grid search file name header 
     1256   rn_gridsearchres      = 0.5             ! Grid search resolution 
     1257   rn_dobsini            = 00010101.000000 ! Initial date in window YYYYMMDD.HHMMSS 
     1258   rn_dobsend            = 00010102.000000 ! Final date in window YYYYMMDD.HHMMSS 
     1259/ 
     1260!----------------------------------------------------------------------- 
     1261&namobs_dta    !  observation and model comparison - external data      (see: namobs) 
     1262!----------------------------------------------------------------------- 
     1263   cn_groupname         = ''               ! Name of obs group (for stdout) 
     1264   ln_enabled           = .true.           ! Logical switch for group being processed not ignored 
     1265   ln_prof              = .false.          ! Logical switch for profile data 
     1266   ln_surf              = .false.          ! Logical switch for surface data 
     1267   cn_obsfiles          = ''               ! Observation file names 
     1268   cn_obstypes          = ''               ! Observation types to read from files 
     1269   ln_nea               = .false.          ! Logical switch for rejecting observations near land 
     1270   ln_bound_reject      = .false.          ! Logical switch for rejecting obs near the boundary 
     1271   ln_ignmis            = .true.           ! Logical switch for ignoring missing files 
     1272   nn_2dint             = 0                ! Type of horizontal interpolation method 
     1273                                           ! Relevant if ln_prof = .true.: 
     1274   nn_1dint             = 0                !    Type of vertical interpolation method 
     1275   nn_profdavtypes      = -1               !    Profile data types representing a daily average 
     1276                                           ! Relevant if ln_surf = .true.: 
     1277   ln_fp_indegs         = .true.           !    Logical: T=> averaging footprint is in degrees, F=> in metres 
     1278   rn_avglamscl         = 0.               !    E/W diameter of observation footprint (metres/degrees) 
     1279   rn_avgphiscl         = 0.               !    N/S diameter of observation footprint (metres/degrees) 
     1280   ln_night             = .false.          !    Logical switch for calculating night-time average for obs 
     1281                                           ! Relevant if 'SST' in cn_obstypes: 
     1282   ln_sstbias           = .false.          !    Logical switch for SST bias correction 
     1283   cn_sstbiasfiles      = ''               !    SST bias input file names 
     1284                                           ! Relevant if 'SLA' in cn_obstypes: 
     1285   ln_altbias           = .false.          !    Logical switch for altimeter bias correction 
     1286   cn_altbiasfile       = ''               !    Altimeter bias input file name 
     1287   nn_msshc             = 0                !    MSSH correction scheme 
     1288   rn_mdtcorr           = 1.61             !    MDT correction 
     1289   rn_mdtcutoff         = 65.0             !    MDT cutoff for computed correction 
     1290   ln_time_mean_sla_bkg = .false.          !    Logical switch for applying time mean of SLA background to remove tidal signal 
     1291                                           ! Relevant if 'POTM' and/or 'PSAL' in cn_obstypes: 
     1292   ln_s_at_t            = .false.          !    Logical switch for computing model S at T obs if not there 
     1293   ln_output_clim       = .false.          !    Logical switch for writing climatological values to fdbk files 
    13061294/ 
    13071295!----------------------------------------------------------------------- 
  • NEMO/branches/UKMO/NEMO_4.0.4_generic_obs/src/OCE/OBS/diaobs.F90

    r15089 r15144  
    4444   USE obs_surf_def   ! Surface data definitions 
    4545   USE obs_types      ! Definitions for observation types 
     46   USE obs_field      ! Definitions for observation types 
    4647   ! 
    4748   USE mpp_map        ! MPP mapping 
     
    5859 
    5960   LOGICAL, PUBLIC :: ln_diaobs            !: Logical switch for the obs operator 
    60    LOGICAL         :: ln_sstnight          !  Logical switch for night mean SST obs 
    61    LOGICAL         :: ln_default_fp_indegs !  T=> Default obs footprint size specified in degrees, F=> in metres 
    62    LOGICAL         :: ln_sla_fp_indegs     !  T=> SLA obs footprint size specified in degrees, F=> in metres 
    63    LOGICAL         :: ln_sst_fp_indegs     !  T=> SST obs footprint size specified in degrees, F=> in metres 
    64    LOGICAL         :: ln_sss_fp_indegs     !  T=> SSS obs footprint size specified in degrees, F=> in metres 
    65    LOGICAL         :: ln_sic_fp_indegs     !  T=> sea-ice obs footprint size specified in degrees, F=> in metres 
    66  
    67    REAL(wp) ::   rn_default_avglamscl      ! E/W diameter of SLA observation footprint (metres) 
    68    REAL(wp) ::   rn_default_avgphiscl      ! N/S diameter of SLA observation footprint (metre 
    69    REAL(wp) ::   rn_sla_avglamscl          ! E/W diameter of SLA observation footprint (metres) 
    70    REAL(wp) ::   rn_sla_avgphiscl          ! N/S diameter of SLA observation footprint (metres) 
    71    REAL(wp) ::   rn_sst_avglamscl          ! E/W diameter of SST observation footprint (metres) 
    72    REAL(wp) ::   rn_sst_avgphiscl          ! N/S diameter of SST observation footprint (metres) 
    73    REAL(wp) ::   rn_sss_avglamscl          ! E/W diameter of SSS observation footprint (metres) 
    74    REAL(wp) ::   rn_sss_avgphiscl          ! N/S diameter of SSS observation footprint (metres) 
    75    REAL(wp) ::   rn_sic_avglamscl          ! E/W diameter of sea-ice observation footprint (metres) 
    76    REAL(wp) ::   rn_sic_avgphiscl          ! N/S diameter of sea-ice observation footprint (metres) 
    77  
    78    INTEGER :: nn_1dint                     ! Vertical interpolation method 
    79    INTEGER :: nn_2dint_default             ! Default horizontal interpolation method 
    80    INTEGER :: nn_2dint_sla                 ! SLA horizontal interpolation method  
    81    INTEGER :: nn_2dint_sst                 ! SST horizontal interpolation method  
    82    INTEGER :: nn_2dint_sss                 ! SSS horizontal interpolation method  
    83    INTEGER :: nn_2dint_sic                 ! Seaice horizontal interpolation method  
    84    INTEGER, DIMENSION(imaxavtypes) ::   nn_profdavtypes   ! Profile data types representing a daily average 
    85    INTEGER :: nproftypes     ! Number of profile obs types 
    86    INTEGER :: nsurftypes     ! Number of surface obs types 
    87    INTEGER , DIMENSION(:), ALLOCATABLE ::   nvarsprof, nvarssurf   ! Number of profile & surface variables 
    88    INTEGER , DIMENSION(:), ALLOCATABLE ::   nextrprof, nextrsurf   ! Number of profile & surface extra variables 
    89    INTEGER , DIMENSION(:), ALLOCATABLE ::   n2dintsurf             ! Interpolation option for surface variables 
    90    REAL(wp), DIMENSION(:), ALLOCATABLE ::   zavglamscl, zavgphiscl ! E/W & N/S diameter of averaging footprint for surface variables 
    91    LOGICAL , DIMENSION(:), ALLOCATABLE ::   lfpindegs              ! T=> surface obs footprint size specified in degrees, F=> in metres 
    92    LOGICAL , DIMENSION(:), ALLOCATABLE ::   llnightav              ! Logical for calculating night-time averages 
    93  
    94    TYPE(obs_surf), PUBLIC, POINTER, DIMENSION(:) ::   surfdata     !: Initial surface data 
    95    TYPE(obs_surf), PUBLIC, POINTER, DIMENSION(:) ::   surfdataqc   !: Surface data after quality control 
    96    TYPE(obs_prof), PUBLIC, POINTER, DIMENSION(:) ::   profdata     !: Initial profile data 
    97    TYPE(obs_prof), PUBLIC, POINTER, DIMENSION(:) ::   profdataqc   !: Profile data after quality control 
    98  
    99    CHARACTER(len=8), PUBLIC, DIMENSION(:), ALLOCATABLE ::   cobstypesprof, cobstypessurf   !: Profile & surface obs types 
     61    
     62   INTEGER :: nn_obsgroups 
     63 
     64   TYPE(obs_group), DIMENSION(:), ALLOCATABLE ::   sobsgroups   ! Obs groups 
    10065 
    10166   !!---------------------------------------------------------------------- 
     
    11782      !! 
    11883      !!---------------------------------------------------------------------- 
    119       INTEGER, PARAMETER ::   jpmaxnfiles = 1000    ! Maximum number of files for each obs type 
    120       INTEGER, DIMENSION(:), ALLOCATABLE ::   ifilesprof, ifilessurf   ! Number of profile & surface files 
     84      INTEGER, PARAMETER ::   jpmaxngroups = 1000    ! Maximum number of obs groups 
    12185      INTEGER :: ios             ! Local integer output status for namelist read 
    12286      INTEGER :: jtype           ! Counter for obs types 
    12387      INTEGER :: jvar            ! Counter for variables 
    12488      INTEGER :: jfile           ! Counter for files 
    125       INTEGER :: jnumsstbias     ! Number of SST bias files to read and apply 
    126       INTEGER :: n2dint_type     ! Local version of nn_2dint* 
     89      INTEGER :: jenabled 
     90      INTEGER :: jgroup 
    12791      ! 
    128       CHARACTER(len=128), DIMENSION(jpmaxnfiles) :: & 
    129          & cn_profbfiles, &      ! T/S profile input filenames 
    130          & cn_sstfbfiles, &      ! Sea surface temperature input filenames 
    131          & cn_sssfbfiles, &      ! Sea surface salinity input filenames 
    132          & cn_slafbfiles, &      ! Sea level anomaly input filenames 
    133          & cn_sicfbfiles, &      ! Seaice concentration input filenames 
    134          & cn_velfbfiles, &      ! Velocity profile input filenames 
    135          & cn_sstbiasfiles       ! SST bias input filenames 
    136       CHARACTER(LEN=128) :: & 
    137          & cn_altbiasfile        ! Altimeter bias input filename 
    138       CHARACTER(len=128), DIMENSION(:,:), ALLOCATABLE :: & 
    139          & clproffiles, &        ! Profile filenames 
    140          & clsurffiles           ! Surface filenames 
    141       CHARACTER(len=8), DIMENSION(:), ALLOCATABLE :: & 
    142          & clvars                ! Expected variable names 
    143          ! 
    144       LOGICAL :: ln_t3d          ! Logical switch for temperature profiles 
    145       LOGICAL :: ln_s3d          ! Logical switch for salinity profiles 
    146       LOGICAL :: ln_sla          ! Logical switch for sea level anomalies  
    147       LOGICAL :: ln_sst          ! Logical switch for sea surface temperature 
    148       LOGICAL :: ln_sss          ! Logical switch for sea surface salinity 
    149       LOGICAL :: ln_sic          ! Logical switch for sea ice concentration 
    150       LOGICAL :: ln_vel3d        ! Logical switch for velocity (u,v) obs 
    151       LOGICAL :: ln_nea          ! Logical switch to remove obs near land 
    152       LOGICAL :: ln_altbias      ! Logical switch for altimeter bias 
    153       LOGICAL :: ln_sstbias      ! Logical switch for bias corection of SST  
    154       LOGICAL :: ln_ignmis       ! Logical switch for ignoring missing files 
    155       LOGICAL :: ln_s_at_t       ! Logical switch to compute model S at T obs 
    156       LOGICAL :: ln_bound_reject ! Logical to remove obs near boundaries in LAMs. 
    157       LOGICAL :: ltype_fp_indegs ! Local version of ln_*_fp_indegs 
    158       LOGICAL :: ltype_night     ! Local version of ln_sstnight (false for other variables) 
    159       LOGICAL, DIMENSION(:), ALLOCATABLE :: llvar   ! Logical for profile variable read 
    160       LOGICAL, DIMENSION(jpmaxnfiles) :: lmask ! Used for finding number of sstbias files 
     92      LOGICAL, DIMENSION(:), ALLOCATABLE :: llvar 
    16193      ! 
    16294      REAL(dp) :: rn_dobsini      ! Obs window start date YYYYMMDD.HHMMSS 
    16395      REAL(dp) :: rn_dobsend      ! Obs window end date   YYYYMMDD.HHMMSS 
    164       REAL(wp) :: ztype_avglamscl ! Local version of rn_*_avglamscl 
    165       REAL(wp) :: ztype_avgphiscl ! Local version of rn_*_avgphiscl 
    166       REAL(wp), DIMENSION(:,:,:),   ALLOCATABLE :: zglam   ! Model longitudes for profile variables 
    167       REAL(wp), DIMENSION(:,:,:),   ALLOCATABLE :: zgphi   ! Model latitudes  for profile variables 
    168       REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE :: zmask   ! Model land/sea mask associated with variables 
    169       !! 
    170       NAMELIST/namobs/ln_diaobs, ln_t3d, ln_s3d, ln_sla,              & 
    171          &            ln_sst, ln_sic, ln_sss, ln_vel3d,               & 
    172          &            ln_altbias, ln_sstbias, ln_nea,                 & 
    173          &            ln_grid_global, ln_grid_search_lookup,          & 
    174          &            ln_ignmis, ln_s_at_t, ln_bound_reject,          & 
    175          &            ln_sstnight, ln_default_fp_indegs,              & 
    176          &            ln_sla_fp_indegs, ln_sst_fp_indegs,             & 
    177          &            ln_sss_fp_indegs, ln_sic_fp_indegs,             & 
    178          &            cn_profbfiles, cn_slafbfiles,                   & 
    179          &            cn_sstfbfiles, cn_sicfbfiles,                   & 
    180          &            cn_velfbfiles, cn_sssfbfiles,                   & 
    181          &            cn_sstbiasfiles, cn_altbiasfile,                & 
    182          &            cn_gridsearchfile, rn_gridsearchres,            & 
    183          &            rn_dobsini, rn_dobsend,                         & 
    184          &            rn_default_avglamscl, rn_default_avgphiscl,     & 
    185          &            rn_sla_avglamscl, rn_sla_avgphiscl,             & 
    186          &            rn_sst_avglamscl, rn_sst_avgphiscl,             & 
    187          &            rn_sss_avglamscl, rn_sss_avgphiscl,             & 
    188          &            rn_sic_avglamscl, rn_sic_avgphiscl,             & 
    189          &            nn_1dint, nn_2dint_default,                     & 
    190          &            nn_2dint_sla, nn_2dint_sst,                     & 
    191          &            nn_2dint_sss, nn_2dint_sic,                     & 
    192          &            nn_msshc, rn_mdtcorr, rn_mdtcutoff,             & 
    193          &            nn_profdavtypes 
     96      !! 
     97      NAMELIST/namobs/ln_diaobs, nn_obsgroups,               & 
     98         &            ln_grid_global, ln_grid_search_lookup, & 
     99         &            cn_gridsearchfile, rn_gridsearchres,   & 
     100         &            rn_dobsini, rn_dobsend 
    194101      !----------------------------------------------------------------------- 
    195102 
     
    197104      ! Read namelist parameters 
    198105      !----------------------------------------------------------------------- 
    199       ! Some namelist arrays need initialising 
    200       cn_profbfiles  (:) = '' 
    201       cn_slafbfiles  (:) = '' 
    202       cn_sstfbfiles  (:) = '' 
    203       cn_sicfbfiles  (:) = '' 
    204       cn_velfbfiles  (:) = '' 
    205       cn_sssfbfiles  (:) = '' 
    206       cn_sstbiasfiles(:) = '' 
    207       nn_profdavtypes(:) = -1 
    208  
     106      ! Initialise time window 
    209107      CALL ini_date( rn_dobsini ) 
    210108      CALL fin_date( rn_dobsend ) 
     
    230128         WRITE(numout,*) 'dia_obs_init : Observation diagnostic initialization' 
    231129         WRITE(numout,*) '~~~~~~~~~~~~' 
    232          WRITE(numout,*) '   Namelist namobs : set observation diagnostic parameters'  
    233          WRITE(numout,*) '      Logical switch for T profile observations                ln_t3d = ', ln_t3d 
    234          WRITE(numout,*) '      Logical switch for S profile observations                ln_s3d = ', ln_s3d 
    235          WRITE(numout,*) '      Logical switch for SLA observations                      ln_sla = ', ln_sla 
    236          WRITE(numout,*) '      Logical switch for SST observations                      ln_sst = ', ln_sst 
    237          WRITE(numout,*) '      Logical switch for Sea Ice observations                  ln_sic = ', ln_sic 
    238          WRITE(numout,*) '      Logical switch for velocity observations               ln_vel3d = ', ln_vel3d 
    239          WRITE(numout,*) '      Logical switch for SSS observations                      ln_sss = ', ln_sss 
     130         WRITE(numout,*) '   Namelist namobs : set observation diagnostic parameters' 
     131         WRITE(numout,*) '      Number of namobs_dta namelists to read             nn_obsgroups = ', nn_obsgroups 
    240132         WRITE(numout,*) '      Global distribution of observations              ln_grid_global = ', ln_grid_global 
    241133         WRITE(numout,*) '      Logical switch for obs grid search lookup ln_grid_search_lookup = ', ln_grid_search_lookup 
    242          IF (ln_grid_search_lookup) & 
     134         IF (ln_grid_search_lookup) THEN 
    243135            WRITE(numout,*) '      Grid search lookup file header                cn_gridsearchfile = ', cn_gridsearchfile 
    244          WRITE(numout,*) '      Initial date in window YYYYMMDD.HHMMSS               rn_dobsini = ', rn_dobsini 
    245          WRITE(numout,*) '      Final date in window YYYYMMDD.HHMMSS                 rn_dobsend = ', rn_dobsend 
    246          WRITE(numout,*) '      Type of vertical interpolation method                  nn_1dint = ', nn_1dint 
    247          WRITE(numout,*) '      Default horizontal interpolation method        nn_2dint_default = ', nn_2dint_default 
    248          WRITE(numout,*) '      Type of horizontal interpolation method for SLA    nn_2dint_sla = ', nn_2dint_sla 
    249          WRITE(numout,*) '      Type of horizontal interpolation method for SST    nn_2dint_sst = ', nn_2dint_sst 
    250          WRITE(numout,*) '      Type of horizontal interpolation method for SSS    nn_2dint_sss = ', nn_2dint_sss         
    251          WRITE(numout,*) '      Type of horizontal interpolation method for SIC    nn_2dint_sic = ', nn_2dint_sic 
    252          WRITE(numout,*) '      Default E/W diameter of obs footprint      rn_default_avglamscl = ', rn_default_avglamscl 
    253          WRITE(numout,*) '      Default N/S diameter of obs footprint      rn_default_avgphiscl = ', rn_default_avgphiscl 
    254          WRITE(numout,*) '      Default obs footprint in deg [T] or m [F]  ln_default_fp_indegs = ', ln_default_fp_indegs 
    255          WRITE(numout,*) '      SLA E/W diameter of obs footprint              rn_sla_avglamscl = ', rn_sla_avglamscl 
    256          WRITE(numout,*) '      SLA N/S diameter of obs footprint              rn_sla_avgphiscl = ', rn_sla_avgphiscl 
    257          WRITE(numout,*) '      SLA obs footprint in deg [T] or m [F]          ln_sla_fp_indegs = ', ln_sla_fp_indegs 
    258          WRITE(numout,*) '      SST E/W diameter of obs footprint              rn_sst_avglamscl = ', rn_sst_avglamscl 
    259          WRITE(numout,*) '      SST N/S diameter of obs footprint              rn_sst_avgphiscl = ', rn_sst_avgphiscl 
    260          WRITE(numout,*) '      SST obs footprint in deg [T] or m [F]          ln_sst_fp_indegs = ', ln_sst_fp_indegs 
    261          WRITE(numout,*) '      SIC E/W diameter of obs footprint              rn_sic_avglamscl = ', rn_sic_avglamscl 
    262          WRITE(numout,*) '      SIC N/S diameter of obs footprint              rn_sic_avgphiscl = ', rn_sic_avgphiscl 
    263          WRITE(numout,*) '      SIC obs footprint in deg [T] or m [F]          ln_sic_fp_indegs = ', ln_sic_fp_indegs 
    264          WRITE(numout,*) '      Rejection of observations near land switch               ln_nea = ', ln_nea 
    265          WRITE(numout,*) '      Rejection of obs near open bdys                 ln_bound_reject = ', ln_bound_reject 
    266          WRITE(numout,*) '      MSSH correction scheme                                 nn_msshc = ', nn_msshc 
    267          WRITE(numout,*) '      MDT  correction                                      rn_mdtcorr = ', rn_mdtcorr 
    268          WRITE(numout,*) '      MDT cutoff for computed correction                 rn_mdtcutoff = ', rn_mdtcutoff 
    269          WRITE(numout,*) '      Logical switch for alt bias                          ln_altbias = ', ln_altbias 
    270          WRITE(numout,*) '      Logical switch for sst bias                          ln_sstbias = ', ln_sstbias 
    271          WRITE(numout,*) '      Logical switch for ignoring missing files             ln_ignmis = ', ln_ignmis 
    272          WRITE(numout,*) '      Daily average types                             nn_profdavtypes = ', nn_profdavtypes 
    273          WRITE(numout,*) '      Logical switch for night-time SST obs               ln_sstnight = ', ln_sstnight 
     136            WRITE(numout,*) '      Grid search resolution                         rn_gridsearchres = ', rn_gridsearchres 
     137         ENDIF 
    274138      ENDIF 
    275       !----------------------------------------------------------------------- 
    276       ! Set up list of observation types to be used 
    277       ! and the files associated with each type 
    278       !----------------------------------------------------------------------- 
    279  
    280       nproftypes = COUNT( (/ln_t3d .OR. ln_s3d, ln_vel3d /) ) 
    281       nsurftypes = COUNT( (/ln_sla, ln_sst, ln_sic, ln_sss /) ) 
    282  
    283       IF( ln_sstbias ) THEN  
    284          lmask(:) = .FALSE.  
    285          WHERE( cn_sstbiasfiles(:) /= '' )   lmask(:) = .TRUE.  
    286          jnumsstbias = COUNT(lmask)  
    287          lmask(:) = .FALSE.  
    288       ENDIF       
    289  
    290       IF( nproftypes == 0 .AND. nsurftypes == 0 ) THEN 
    291          CALL ctl_warn( 'dia_obs_init: ln_diaobs is set to true, but all obs operator logical flags',   & 
    292             &           ' (ln_t3d, ln_s3d, ln_sla, ln_sst, ln_sic, ln_vel3d)',                          & 
    293             &           ' are set to .FALSE. so turning off calls to dia_obs'  ) 
     139 
     140      IF( ln_grid_global ) THEN 
     141         CALL ctl_warn( 'dia_obs_init: ln_grid_global=T may cause memory issues when used with a large number of processors' ) 
     142      ENDIF 
     143 
     144      !----------------------------------------------------------------------- 
     145      ! Read namobs_dta namelists and set up observation groups 
     146      !----------------------------------------------------------------------- 
     147 
     148      IF( nn_obsgroups == 0 ) THEN 
     149         CALL ctl_warn( 'dia_obs_init: ln_diaobs is set to true, but nn_obsgroups == 0',   & 
     150            &           ' so turning off calls to dia_obs'  ) 
    294151         ln_diaobs = .FALSE. 
    295152         RETURN 
    296153      ENDIF 
    297154 
    298       IF( nproftypes > 0 ) THEN 
    299          ! 
    300          ALLOCATE( cobstypesprof(nproftypes)             ) 
    301          ALLOCATE( ifilesprof   (nproftypes)             ) 
    302          ALLOCATE( clproffiles  (nproftypes,jpmaxnfiles) ) 
    303          ! 
    304          jtype = 0 
    305          IF( ln_t3d .OR. ln_s3d ) THEN 
    306             jtype = jtype + 1 
    307             cobstypesprof(jtype) = 'prof' 
    308             clproffiles(jtype,:) = cn_profbfiles 
     155      ALLOCATE( sobsgroups(nn_obsgroups) ) 
     156 
     157      jenabled = 0 
     158      DO jgroup = 1, nn_obsgroups 
     159         CALL obs_group_read ( sobsgroups(jgroup) ) 
     160         CALL obs_group_check( sobsgroups(jgroup), jgroup ) 
     161         IF (sobsgroups(jgroup)%lenabled) THEN 
     162            jenabled = jenabled + 1 
     163            IF( sobsgroups(jgroup)%lvel3d  .AND.  .NOT.ln_grid_global ) THEN 
     164               CALL ctl_stop( 'Velocity data only works with ln_grid_global=.true.' ) 
     165            ENDIF 
    309166         ENDIF 
    310          IF( ln_vel3d ) THEN 
    311             jtype = jtype + 1 
    312             cobstypesprof(jtype) = 'vel' 
    313             clproffiles(jtype,:) = cn_velfbfiles 
    314          ENDIF 
    315          ! 
    316          CALL obs_settypefiles( nproftypes, jpmaxnfiles, ifilesprof, cobstypesprof, clproffiles ) 
    317          ! 
    318       ENDIF 
    319  
    320       IF( nsurftypes > 0 ) THEN 
    321          ! 
    322          ALLOCATE( cobstypessurf(nsurftypes)             ) 
    323          ALLOCATE( ifilessurf   (nsurftypes)             ) 
    324          ALLOCATE( clsurffiles  (nsurftypes,jpmaxnfiles) ) 
    325          ALLOCATE( n2dintsurf   (nsurftypes)             ) 
    326          ALLOCATE( zavglamscl   (nsurftypes)             ) 
    327          ALLOCATE( zavgphiscl   (nsurftypes)             ) 
    328          ALLOCATE( lfpindegs    (nsurftypes)             ) 
    329          ALLOCATE( llnightav    (nsurftypes)             ) 
    330          ! 
    331          jtype = 0 
    332          IF( ln_sla ) THEN 
    333             jtype = jtype + 1 
    334             cobstypessurf(jtype) = 'sla' 
    335             clsurffiles(jtype,:) = cn_slafbfiles 
    336          ENDIF 
    337          IF( ln_sst ) THEN 
    338             jtype = jtype + 1 
    339             cobstypessurf(jtype) = 'sst' 
    340             clsurffiles(jtype,:) = cn_sstfbfiles 
    341          ENDIF 
    342 #if defined key_si3 || defined key_cice 
    343          IF( ln_sic ) THEN 
    344             jtype = jtype + 1 
    345             cobstypessurf(jtype) = 'sic' 
    346             clsurffiles(jtype,:) = cn_sicfbfiles 
    347          ENDIF 
    348 #endif 
    349          IF( ln_sss ) THEN 
    350             jtype = jtype + 1 
    351             cobstypessurf(jtype) = 'sss' 
    352             clsurffiles(jtype,:) = cn_sssfbfiles 
    353          ENDIF 
    354          ! 
    355          CALL obs_settypefiles( nsurftypes, jpmaxnfiles, ifilessurf, cobstypessurf, clsurffiles ) 
    356  
    357          DO jtype = 1, nsurftypes 
    358  
    359             IF ( TRIM(cobstypessurf(jtype)) == 'sla' ) THEN 
    360                IF ( nn_2dint_sla == -1 ) THEN 
    361                   n2dint_type  = nn_2dint_default 
    362                ELSE 
    363                   n2dint_type  = nn_2dint_sla 
    364                ENDIF 
    365                ztype_avglamscl = rn_sla_avglamscl 
    366                ztype_avgphiscl = rn_sla_avgphiscl 
    367                ltype_fp_indegs = ln_sla_fp_indegs 
    368                ltype_night     = .FALSE. 
    369             ELSE IF ( TRIM(cobstypessurf(jtype)) == 'sst' ) THEN 
    370                IF ( nn_2dint_sst == -1 ) THEN 
    371                   n2dint_type  = nn_2dint_default 
    372                ELSE 
    373                   n2dint_type  = nn_2dint_sst 
    374                ENDIF 
    375                ztype_avglamscl = rn_sst_avglamscl 
    376                ztype_avgphiscl = rn_sst_avgphiscl 
    377                ltype_fp_indegs = ln_sst_fp_indegs 
    378                ltype_night     = ln_sstnight 
    379             ELSE IF ( TRIM(cobstypessurf(jtype)) == 'sic' ) THEN 
    380                IF ( nn_2dint_sic == -1 ) THEN 
    381                   n2dint_type  = nn_2dint_default 
    382                ELSE 
    383                   n2dint_type  = nn_2dint_sic 
    384                ENDIF 
    385                ztype_avglamscl = rn_sic_avglamscl 
    386                ztype_avgphiscl = rn_sic_avgphiscl 
    387                ltype_fp_indegs = ln_sic_fp_indegs 
    388                ltype_night     = .FALSE. 
    389             ELSE IF ( TRIM(cobstypessurf(jtype)) == 'sss' ) THEN 
    390                IF ( nn_2dint_sss == -1 ) THEN 
    391                   n2dint_type  = nn_2dint_default 
    392                ELSE 
    393                   n2dint_type  = nn_2dint_sss 
    394                ENDIF 
    395                ztype_avglamscl = rn_sss_avglamscl 
    396                ztype_avgphiscl = rn_sss_avgphiscl 
    397                ltype_fp_indegs = ln_sss_fp_indegs 
    398                ltype_night     = .FALSE. 
    399             ELSE 
    400                n2dint_type     = nn_2dint_default 
    401                ztype_avglamscl = rn_default_avglamscl 
    402                ztype_avgphiscl = rn_default_avgphiscl 
    403                ltype_fp_indegs = ln_default_fp_indegs 
    404                ltype_night     = .FALSE. 
    405             ENDIF 
    406              
    407             CALL obs_setinterpopts( nsurftypes, jtype, TRIM(cobstypessurf(jtype)), & 
    408                &                    nn_2dint_default, n2dint_type,                 & 
    409                &                    ztype_avglamscl, ztype_avgphiscl,              & 
    410                &                    ltype_fp_indegs, ltype_night,                  & 
    411                &                    n2dintsurf, zavglamscl, zavgphiscl,            & 
    412                &                    lfpindegs, llnightav ) 
    413  
    414          END DO 
    415          ! 
    416       ENDIF 
    417  
    418  
    419       !----------------------------------------------------------------------- 
    420       ! Obs operator parameter checking and initialisations 
    421       !----------------------------------------------------------------------- 
    422       ! 
    423       IF( ln_vel3d  .AND.  .NOT.ln_grid_global ) THEN 
    424          CALL ctl_stop( 'Velocity data only works with ln_grid_global=.true.' ) 
     167      END DO 
     168 
     169      IF( jenabled == 0 ) THEN 
     170         CALL ctl_warn( 'dia_obs_init: ln_diaobs is set to true, and nn_obsgroups > 0',   & 
     171            &           ' but no groups are enabled so turning off calls to dia_obs'  ) 
     172         ln_diaobs = .FALSE. 
    425173         RETURN 
    426174      ENDIF 
    427       ! 
    428       IF( ln_grid_global ) THEN 
    429          CALL ctl_warn( 'dia_obs_init: ln_grid_global=T may cause memory issues when used with a large number of processors' ) 
    430       ENDIF 
    431       ! 
    432       IF( nn_1dint < 0  .OR.  nn_1dint > 1 ) THEN 
    433          CALL ctl_stop('dia_obs_init: Choice of vertical (1D) interpolation method is not available') 
    434       ENDIF 
    435       ! 
    436       IF( nn_2dint_default < 0  .OR.  nn_2dint_default > 6  ) THEN 
    437          CALL ctl_stop('dia_obs_init: Choice of default horizontal (2D) interpolation method is not available') 
    438       ENDIF 
     175 
     176 
     177      !----------------------------------------------------------------------- 
     178      ! Obs operator parameter checking and initialisations 
     179      !----------------------------------------------------------------------- 
    439180      ! 
    440181      CALL obs_typ_init 
     
    447188      !----------------------------------------------------------------------- 
    448189      ! 
    449       IF( nproftypes > 0 ) THEN 
    450          ! 
    451          ALLOCATE( profdata  (nproftypes) , nvarsprof (nproftypes) ) 
    452          ALLOCATE( profdataqc(nproftypes) , nextrprof (nproftypes) ) 
    453          ! 
    454          DO jtype = 1, nproftypes 
    455             ! 
    456             IF ( TRIM(cobstypesprof(jtype)) == 'prof' ) THEN 
    457                nvarsprof(jtype) = 2 
    458                nextrprof(jtype) = 1              
    459                ALLOCATE( llvar (nvarsprof(jtype)) ) 
    460                ALLOCATE( clvars(nvarsprof(jtype)) ) 
    461                ALLOCATE( zglam(jpi, jpj,      nvarsprof(jtype)) ) 
    462                ALLOCATE( zgphi(jpi, jpj,      nvarsprof(jtype)) ) 
    463                ALLOCATE( zmask(jpi, jpj, jpk, nvarsprof(jtype)) ) 
    464                llvar(1)       = ln_t3d 
    465                llvar(2)       = ln_s3d 
    466                clvars(1)      = 'POTM' 
    467                clvars(2)      = 'PSAL' 
    468                zglam(:,:,1)   = glamt(:,:) 
    469                zglam(:,:,2)   = glamt(:,:) 
    470                zgphi(:,:,1)   = gphit(:,:) 
    471                zgphi(:,:,2)   = gphit(:,:) 
    472                zmask(:,:,:,1) = tmask(:,:,:) 
    473                zmask(:,:,:,2) = tmask(:,:,:) 
    474             ELSE IF ( TRIM(cobstypesprof(jtype)) == 'vel' )  THEN 
    475                nvarsprof(jtype) = 2 
    476                nextrprof(jtype) = 2 
    477                ALLOCATE( llvar (nvarsprof(jtype)) ) 
    478                ALLOCATE( clvars(nvarsprof(jtype)) ) 
    479                ALLOCATE( zglam(jpi, jpj,      nvarsprof(jtype)) ) 
    480                ALLOCATE( zgphi(jpi, jpj,      nvarsprof(jtype)) ) 
    481                ALLOCATE( zmask(jpi, jpj, jpk, nvarsprof(jtype)) ) 
    482                llvar(1)       = ln_vel3d 
    483                llvar(2)       = ln_vel3d 
    484                clvars(1)      = 'UVEL' 
    485                clvars(2)      = 'VVEL' 
    486                zglam(:,:,1)   = glamu(:,:) 
    487                zglam(:,:,2)   = glamv(:,:) 
    488                zgphi(:,:,1)   = gphiu(:,:) 
    489                zgphi(:,:,2)   = gphiv(:,:) 
    490                zmask(:,:,:,1) = umask(:,:,:) 
    491                zmask(:,:,:,2) = vmask(:,:,:) 
    492             ELSE 
    493                nvarsprof(jtype) = 1 
    494                nextrprof(jtype) = 0 
    495                ALLOCATE( llvar (nvarsprof(jtype)) ) 
    496                ALLOCATE( clvars(nvarsprof(jtype)) ) 
    497                ALLOCATE( zglam(jpi, jpj,      nvarsprof(jtype)) ) 
    498                ALLOCATE( zgphi(jpi, jpj,      nvarsprof(jtype)) ) 
    499                ALLOCATE( zmask(jpi, jpj, jpk, nvarsprof(jtype)) ) 
    500                llvar(1)       = .TRUE. 
    501                zglam(:,:,1)   = glamt(:,:) 
    502                zgphi(:,:,1)   = gphit(:,:) 
    503                zmask(:,:,:,1) = tmask(:,:,:) 
     190      DO jgroup = 1, nn_obsgroups 
     191         IF (sobsgroups(jgroup)%lenabled) THEN 
     192            IF (sobsgroups(jgroup)%lprof) THEN 
     193               ! 
     194               ! Read in profile or profile obs types 
     195               ! 
     196               ALLOCATE( llvar(sobsgroups(jgroup)%nobstypes) ) 
     197               llvar(:) = .TRUE. 
     198               ! 
     199               CALL obs_rea_prof( sobsgroups(jgroup)%sprofdata, & 
     200                  &               sobsgroups(jgroup)%nobsfiles, & 
     201                  &               sobsgroups(jgroup)%cobsfiles, & 
     202                  &               sobsgroups(jgroup)%nobstypes, & 
     203                  &               sobsgroups(jgroup)%nextvars,  & 
     204                  &               nitend-nit000+2,              & 
     205                  &               rn_dobsini,                   & 
     206                  &               rn_dobsend,                   & 
     207                  &               llvar,                        & 
     208                  &               sobsgroups(jgroup)%lignmis,   & 
     209                  &               sobsgroups(jgroup)%ls_at_t,   & 
     210                  &               .FALSE.,                      & 
     211                  &               sobsgroups(jgroup)%cobstypes, & 
     212                  &               kdailyavtypes = sobsgroups(jgroup)%nprofdavtypes ) 
     213               ! 
     214               DO jvar = 1, sobsgroups(jgroup)%nobstypes 
     215                  CALL obs_prof_staend( sobsgroups(jgroup)%sprofdata, jvar ) 
     216               END DO 
     217               ! 
     218               CALL obs_pre_prof( sobsgroups(jgroup)%sprofdata,     & 
     219                  &               sobsgroups(jgroup)%sprofdataqc,   & 
     220                  &               llvar,                            & 
     221                  &               jpi, jpj, jpk,                    & 
     222                  &               sobsgroups(jgroup)%rmask,         & 
     223                  &               sobsgroups(jgroup)%rglam,         & 
     224                  &               sobsgroups(jgroup)%rgphi,         & 
     225                  &               sobsgroups(jgroup)%lnea,          & 
     226                  &               sobsgroups(jgroup)%lbound_reject, & 
     227                  &               kdailyavtypes = sobsgroups(jgroup)%nprofdavtypes ) 
     228               ! 
     229               DEALLOCATE( llvar ) 
     230               ! 
     231            ELSEIF (sobsgroups(jgroup)%lsurf) THEN 
     232               ! 
     233               ! Read in surface obs types 
     234               ! 
     235               CALL obs_rea_surf( sobsgroups(jgroup)%ssurfdata, & 
     236                  &               sobsgroups(jgroup)%nobsfiles, & 
     237                  &               sobsgroups(jgroup)%cobsfiles, & 
     238                  &               sobsgroups(jgroup)%nobstypes, & 
     239                  &               sobsgroups(jgroup)%nextvars,  & 
     240                  &               nitend-nit000+2,              & 
     241                  &               rn_dobsini,                   & 
     242                  &               rn_dobsend,                   & 
     243                  &               sobsgroups(jgroup)%lignmis,   & 
     244                  &               .FALSE.,                      & 
     245                  &               sobsgroups(jgroup)%lnight,    & 
     246                  &               sobsgroups(jgroup)%cobstypes ) 
     247                  ! 
     248               CALL obs_pre_surf( sobsgroups(jgroup)%ssurfdata,   & 
     249                  &               sobsgroups(jgroup)%ssurfdataqc, & 
     250                  &               sobsgroups(jgroup)%lnea,        & 
     251                  &               sobsgroups(jgroup)%lbound_reject ) 
     252               ! 
     253               IF( sobsgroups(jgroup)%lsla ) THEN 
     254                  CALL obs_rea_mdt( sobsgroups(jgroup)%ssurfdataqc, & 
     255                     &              sobsgroups(jgroup)%n2dint ) 
     256                  IF( sobsgroups(jgroup)%laltbias ) THEN 
     257                     CALL obs_rea_altbias( sobsgroups(jgroup)%ssurfdataqc, & 
     258                        &                  sobsgroups(jgroup)%n2dint,      & 
     259                        &                  sobsgroups(jgroup)%caltbiasfile ) 
     260                  ENDIF 
     261               ENDIF 
     262               ! 
     263               IF( sobsgroups(jgroup)%lsst .AND. sobsgroups(jgroup)%lsstbias ) THEN 
     264                  CALL obs_app_sstbias( sobsgroups(jgroup)%ssurfdataqc,   & 
     265                     &                  sobsgroups(jgroup)%n2dint,        &  
     266                     &                  sobsgroups(jgroup)%nsstbiasfiles, & 
     267                     &                  sobsgroups(jgroup)%csstbiasfiles )  
     268               ENDIF 
     269               ! 
    504270            ENDIF 
    505             ! 
    506             ! Read in profile or profile obs types 
    507             CALL obs_rea_prof( profdata(jtype), ifilesprof(jtype),       & 
    508                &               clproffiles(jtype,1:ifilesprof(jtype)), & 
    509                &               nvarsprof(jtype), nextrprof(jtype), nitend-nit000+2, & 
    510                &               rn_dobsini, rn_dobsend, llvar, & 
    511                &               ln_ignmis, ln_s_at_t, .FALSE., clvars, & 
    512                &               kdailyavtypes = nn_profdavtypes ) 
    513                ! 
    514             DO jvar = 1, nvarsprof(jtype) 
    515                CALL obs_prof_staend( profdata(jtype), jvar ) 
    516             END DO 
    517             ! 
    518             CALL obs_pre_prof( profdata(jtype), profdataqc(jtype), & 
    519                &               llvar, & 
    520                &               jpi, jpj, jpk, & 
    521                &               zmask, zglam, zgphi, & 
    522                &               ln_nea, ln_bound_reject, & 
    523                &               kdailyavtypes = nn_profdavtypes ) 
    524             ! 
    525             DEALLOCATE( llvar, clvars, zglam, zgphi, zmask ) 
    526             ! 
    527          END DO 
    528          ! 
    529          DEALLOCATE( ifilesprof, clproffiles ) 
    530          ! 
    531       ENDIF 
    532       ! 
    533       IF( nsurftypes > 0 ) THEN 
    534          ! 
    535          ALLOCATE( surfdata  (nsurftypes) , nvarssurf(nsurftypes) ) 
    536          ALLOCATE( surfdataqc(nsurftypes) , nextrsurf(nsurftypes) ) 
    537          ! 
    538          DO jtype = 1, nsurftypes 
    539             ! 
    540             nvarssurf(jtype) = 1 
    541             nextrsurf(jtype) = 0 
    542             llnightav(jtype) = .FALSE. 
    543             IF( TRIM(cobstypessurf(jtype)) == 'sla' )   nextrsurf(jtype) = 2 
    544             IF( TRIM(cobstypessurf(jtype)) == 'sst' )   llnightav(jtype) = ln_sstnight 
    545             ! 
    546             ALLOCATE( clvars( nvarssurf(jtype) ) ) 
    547             IF ( TRIM(cobstypessurf(jtype)) == 'sla' ) THEN 
    548                clvars(1) = 'SLA' 
    549             ELSE IF ( TRIM(cobstypessurf(jtype)) == 'sst' ) THEN 
    550                clvars(1) = 'SST' 
    551             ELSE IF ( TRIM(cobstypessurf(jtype)) == 'sic' ) THEN 
    552                clvars(1) = 'ICECONC' 
    553             ELSE IF ( TRIM(cobstypessurf(jtype)) == 'sss' ) THEN 
    554                clvars(1) = 'SSS' 
    555             ENDIF 
    556             ! 
    557             ! Read in surface obs types 
    558             CALL obs_rea_surf( surfdata(jtype), ifilessurf(jtype), & 
    559                &               clsurffiles(jtype,1:ifilessurf(jtype)), & 
    560                &               nvarssurf(jtype), nextrsurf(jtype), nitend-nit000+2, & 
    561                &               rn_dobsini, rn_dobsend, ln_ignmis, .FALSE., llnightav(jtype), & 
    562                &               clvars ) 
    563                ! 
    564             CALL obs_pre_surf( surfdata(jtype), surfdataqc(jtype), ln_nea, ln_bound_reject ) 
    565             ! 
    566             IF( TRIM(cobstypessurf(jtype)) == 'sla' ) THEN 
    567                CALL obs_rea_mdt( surfdataqc(jtype), n2dintsurf(jtype) ) 
    568                IF( ln_altbias )   & 
    569                   & CALL obs_rea_altbias ( surfdataqc(jtype), n2dintsurf(jtype), cn_altbiasfile ) 
    570             ENDIF 
    571             ! 
    572             IF( TRIM(cobstypessurf(jtype)) == 'sst' .AND. ln_sstbias ) THEN 
    573                jnumsstbias = 0 
    574                DO jfile = 1, jpmaxnfiles 
    575                   IF( TRIM(cn_sstbiasfiles(jfile)) /= '' )   jnumsstbias = jnumsstbias + 1 
    576                END DO 
    577                IF( jnumsstbias == 0 )   CALL ctl_stop("ln_sstbias set but no bias files to read in")     
    578                ! 
    579                CALL obs_app_sstbias( surfdataqc(jtype), n2dintsurf(jtype)             ,   &  
    580                   &                  jnumsstbias      , cn_sstbiasfiles(1:jnumsstbias) )  
    581             ENDIF 
    582             ! 
    583             DEALLOCATE( clvars ) 
    584          END DO 
    585          ! 
    586          DEALLOCATE( ifilessurf, clsurffiles ) 
    587          ! 
    588       ENDIF 
     271         ENDIF 
     272      END DO 
    589273      ! 
    590274   END SUBROUTINE dia_obs_init 
     
    623307      INTEGER :: jtype             ! Data loop variable 
    624308      INTEGER :: jvar              ! Variable number 
     309      INTEGER :: jgroup 
    625310      INTEGER :: ji, jj            ! Loop counters 
    626       REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE :: & 
     311      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: & 
    627312         & zprofvar                ! Model values for variables in a prof ob 
    628       REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE :: & 
    629          & zprofmask               ! Mask associated with zprofvar 
    630       REAL(wp), DIMENSION(jpi,jpj) :: & 
    631          & zsurfvar, &             ! Model values equivalent to surface ob. 
    632          & zsurfmask               ! Mask associated with surface variable 
    633       REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: & 
    634          & zglam,    &             ! Model longitudes for prof variables 
    635          & zgphi                   ! Model latitudes for prof variables 
     313      REAL(wp), DIMENSION(:,:), ALLOCATABLE :: & 
     314         & zsurfvar                ! Model values for variables in a surf ob 
    636315 
    637316      !----------------------------------------------------------------------- 
     
    649328      !----------------------------------------------------------------------- 
    650329 
    651       IF ( nproftypes > 0 ) THEN 
    652  
    653          DO jtype = 1, nproftypes 
    654  
    655             ! Allocate local work arrays 
    656             ALLOCATE( zprofvar (jpi, jpj, jpk, profdataqc(jtype)%nvar) ) 
    657             ALLOCATE( zprofmask(jpi, jpj, jpk, profdataqc(jtype)%nvar) ) 
    658             ALLOCATE( zglam    (jpi, jpj,      profdataqc(jtype)%nvar) ) 
    659             ALLOCATE( zgphi    (jpi, jpj,      profdataqc(jtype)%nvar) )   
    660                                
    661             ! Defaults which might change 
    662             DO jvar = 1, profdataqc(jtype)%nvar 
    663                zprofmask(:,:,:,jvar) = tmask(:,:,:) 
    664                zglam(:,:,jvar)       = glamt(:,:) 
    665                zgphi(:,:,jvar)       = gphit(:,:) 
    666             END DO 
    667  
    668             SELECT CASE ( TRIM(cobstypesprof(jtype)) ) 
    669             CASE('prof') 
    670                zprofvar(:,:,:,1) = tsn(:,:,:,jp_tem) 
    671                zprofvar(:,:,:,2) = tsn(:,:,:,jp_sal) 
    672             CASE('vel') 
    673                zprofvar(:,:,:,1) = un(:,:,:) 
    674                zprofvar(:,:,:,2) = vn(:,:,:) 
    675                zprofmask(:,:,:,1) = umask(:,:,:) 
    676                zprofmask(:,:,:,2) = vmask(:,:,:) 
    677                zglam(:,:,1) = glamu(:,:) 
    678                zglam(:,:,2) = glamv(:,:) 
    679                zgphi(:,:,1) = gphiu(:,:) 
    680                zgphi(:,:,2) = gphiv(:,:) 
    681             CASE DEFAULT 
    682                CALL ctl_stop( 'Unknown profile observation type '//TRIM(cobstypesprof(jtype))//' in dia_obs' ) 
    683             END SELECT 
    684  
    685             DO jvar = 1, profdataqc(jtype)%nvar 
    686                CALL obs_prof_opt( profdataqc(jtype), kstp, jpi, jpj, jpk,  & 
    687                   &               nit000, idaystp, jvar,                   & 
    688                   &               zprofvar(:,:,:,jvar),                    & 
    689                   &               gdept_n(:,:,:), gdepw_n(:,:,:),          &  
    690                   &               zprofmask(:,:,:,jvar),                   & 
    691                   &               zglam(:,:,jvar), zgphi(:,:,jvar),        & 
    692                   &               nn_1dint, nn_2dint_default,              & 
    693                   &               kdailyavtypes = nn_profdavtypes ) 
    694             END DO 
    695              
    696             DEALLOCATE( zprofvar, zprofmask, zglam, zgphi ) 
    697  
    698          END DO 
    699  
    700       ENDIF 
    701  
    702       IF ( nsurftypes > 0 ) THEN 
    703  
    704          DO jtype = 1, nsurftypes 
    705  
    706             !Defaults which might be changed 
    707             zsurfmask(:,:) = tmask(:,:,1) 
    708  
    709             SELECT CASE ( TRIM(cobstypessurf(jtype)) ) 
    710             CASE('sst') 
    711                zsurfvar(:,:) = tsn(:,:,1,jp_tem) 
    712             CASE('sla') 
    713                zsurfvar(:,:) = sshn(:,:) 
    714             CASE('sss') 
    715                zsurfvar(:,:) = tsn(:,:,1,jp_sal) 
    716             CASE('sic') 
    717                IF ( kstp == 0 ) THEN 
    718                   IF ( lwp .AND. surfdataqc(jtype)%nsstpmpp(1) > 0 ) THEN 
    719                      CALL ctl_warn( 'Sea-ice not initialised on zeroth '// & 
    720                         &           'time-step but some obs are valid then.' ) 
    721                      WRITE(numout,*)surfdataqc(jtype)%nsstpmpp(1), & 
    722                         &           ' sea-ice obs will be missed' 
    723                   ENDIF 
    724                   surfdataqc(jtype)%nsurfup = surfdataqc(jtype)%nsurfup + & 
    725                      &                        surfdataqc(jtype)%nsstp(1) 
    726                   CYCLE 
    727                ELSE 
     330      DO jgroup = 1, nn_obsgroups 
     331         IF (sobsgroups(jgroup)%lenabled) THEN 
     332 
     333            IF (sobsgroups(jgroup)%lprof) THEN 
     334 
     335               ALLOCATE( zprofvar(jpi,jpj,jpk) ) 
     336 
     337               DO jvar = 1, sobsgroups(jgroup)%nobstypes 
     338 
     339                  SELECT CASE ( TRIM(sobsgroups(jgroup)%cobstypes(jvar)) ) 
     340                  CASE('POTM') 
     341                     zprofvar(:,:,:) = tsn(:,:,:,jp_tem) 
     342                  CASE('PSAL') 
     343                     zprofvar(:,:,:) = tsn(:,:,:,jp_sal) 
     344                  CASE('UVEL') 
     345                     zprofvar(:,:,:) = un(:,:,:) 
     346                  CASE('VVEL') 
     347                     zprofvar(:,:,:) = vn(:,:,:) 
     348                  CASE DEFAULT 
     349                     CALL ctl_stop( 'Unknown profile observation type '//TRIM(sobsgroups(jgroup)%cobstypes(jvar))//' in dia_obs' ) 
     350                  END SELECT 
     351 
     352                  CALL obs_prof_opt( sobsgroups(jgroup)%sprofdataqc,       & 
     353                     &               kstp, jpi, jpj, jpk,                  & 
     354                     &               nit000, idaystp, jvar,                & 
     355                     &               zprofvar,                             & 
     356                     &               gdept_n,                              & 
     357                     &               gdepw_n,                              &  
     358                     &               sobsgroups(jgroup)%rmask(:,:,:,jvar), & 
     359                     &               sobsgroups(jgroup)%rglam(:,:,jvar),   & 
     360                     &               sobsgroups(jgroup)%rgphi(:,:,jvar),   & 
     361                     &               sobsgroups(jgroup)%n1dint,            & 
     362                     &               sobsgroups(jgroup)%n2dint,            & 
     363                     &               kdailyavtypes = sobsgroups(jgroup)%nprofdavtypes ) 
     364 
     365               END DO 
     366 
     367               DEALLOCATE( zprofvar ) 
     368 
     369            ELSEIF (sobsgroups(jgroup)%lsurf) THEN 
     370 
     371               ALLOCATE( zsurfvar(jpi,jpj) ) 
     372 
     373               DO jvar = 1, sobsgroups(jgroup)%nobstypes 
     374 
     375                  SELECT CASE ( TRIM(sobsgroups(jgroup)%cobstypes(jvar)) ) 
     376                  CASE('SST') 
     377                     zsurfvar(:,:) = tsn(:,:,1,jp_tem) 
     378                  CASE('SLA') 
     379                     zsurfvar(:,:) = sshn(:,:) 
     380                  CASE('SSS') 
     381                     zsurfvar(:,:) = tsn(:,:,1,jp_sal) 
     382                  CASE('ICECONC') 
     383                     IF ( kstp == 0 ) THEN 
     384                        IF ( lwp .AND. sobsgroups(jgroup)%ssurfdataqc%nsstpmpp(1) > 0 ) THEN 
     385                           CALL ctl_warn( 'Sea-ice not initialised on zeroth '// & 
     386                              &           'time-step but some obs are valid then.' ) 
     387                           WRITE(numout,*)sobsgroups(jgroup)%ssurfdataqc%nsstpmpp(1), & 
     388                              &           ' sea-ice obs will be missed' 
     389                        ENDIF 
     390!!! IS THIS ROBUST TO MULTIPLE TYPES IN A GROUP??? 
     391                        sobsgroups(jgroup)%ssurfdataqc%nsurfup = sobsgroups(jgroup)%ssurfdataqc%nsurfup + & 
     392                           &                                     sobsgroups(jgroup)%ssurfdataqc%nsstp(1) 
     393                        CYCLE 
     394                     ELSE 
    728395#if defined key_cice || defined key_si3 
    729                   zsurfvar(:,:) = fr_i(:,:) 
     396                        zsurfvar(:,:) = fr_i(:,:) 
    730397#else 
    731                   CALL ctl_stop( ' Trying to run sea-ice observation operator', & 
    732                      &           ' but no sea-ice model appears to have been defined' ) 
     398                        CALL ctl_stop( ' Trying to run sea-ice observation operator', & 
     399                           &           ' but no sea-ice model appears to have been defined' ) 
    733400#endif 
    734                ENDIF 
    735  
    736             END SELECT 
    737  
    738             CALL obs_surf_opt( surfdataqc(jtype), kstp, jpi, jpj,       & 
    739                &               nit000, idaystp, zsurfvar, zsurfmask,    & 
    740                &               n2dintsurf(jtype), llnightav(jtype),     & 
    741                &               zavglamscl(jtype), zavgphiscl(jtype),     & 
    742                &               lfpindegs(jtype) ) 
    743  
    744          END DO 
    745  
    746       ENDIF 
     401                     ENDIF 
     402                  END SELECT 
     403 
     404                  CALL obs_surf_opt( sobsgroups(jgroup)%ssurfdataqc,       & 
     405                     &               kstp, jpi, jpj,                       & 
     406                     &               nit000, idaystp,                      & 
     407                     &               zsurfvar,                             & 
     408                     &               sobsgroups(jgroup)%rmask(:,:,1,jvar), & 
     409                     &               sobsgroups(jgroup)%n2dint,            & 
     410                     &               sobsgroups(jgroup)%lnight,            & 
     411                     &               sobsgroups(jgroup)%ravglamscl,        & 
     412                     &               sobsgroups(jgroup)%ravgphiscl,        & 
     413                     &               sobsgroups(jgroup)%lfp_indegs ) 
     414 
     415               END DO 
     416 
     417               DEALLOCATE( zsurfvar ) 
     418 
     419            ENDIF 
     420 
     421         ENDIF 
     422      END DO 
    747423 
    748424   END SUBROUTINE dia_obs 
     
    772448 
    773449      !! * Local declarations 
    774       INTEGER :: jtype                    ! Data set loop variable 
     450      INTEGER :: jgroup                   ! Data set loop variable 
    775451      INTEGER :: jo, jvar, jk 
    776452      REAL(wp), DIMENSION(:), ALLOCATABLE :: & 
     
    782458      !----------------------------------------------------------------------- 
    783459 
    784       IF ( nproftypes > 0 ) THEN 
    785  
    786          DO jtype = 1, nproftypes 
    787  
    788             IF ( TRIM(cobstypesprof(jtype)) == 'vel' ) THEN 
    789  
    790                ! For velocity data, rotate the model velocities to N/S, E/W 
    791                ! using the compressed data structure. 
    792                ALLOCATE( & 
    793                   & zu(profdataqc(jtype)%nvprot(1)), & 
    794                   & zv(profdataqc(jtype)%nvprot(2))  & 
    795                   & ) 
    796  
    797                CALL obs_rotvel( profdataqc(jtype), nn_2dint_default, zu, zv ) 
    798  
    799                DO jo = 1, profdataqc(jtype)%nprof 
    800                   DO jvar = 1, 2 
    801                      DO jk = profdataqc(jtype)%npvsta(jo,jvar), profdataqc(jtype)%npvend(jo,jvar) 
    802  
    803                         IF ( jvar == 1 ) THEN 
    804                            profdataqc(jtype)%var(jvar)%vmod(jk) = zu(jk) 
    805                         ELSE 
    806                            profdataqc(jtype)%var(jvar)%vmod(jk) = zv(jk) 
    807                         ENDIF 
    808  
     460      DO jgroup = 1, nn_obsgroups 
     461         IF (sobsgroups(jgroup)%lenabled) THEN 
     462 
     463            IF (sobsgroups(jgroup)%lprof) THEN 
     464                
     465               IF ( sobsgroups(jgroup)%lvel3d ) THEN 
     466!!! THIS ISN'T GUARANTEED TO WORK AT THE MOMENT 
     467                  ! For velocity data, rotate the model velocities to N/S, E/W 
     468                  ! using the compressed data structure. 
     469                  ALLOCATE( & 
     470                     & zu(sobsgroups(jgroup)%sprofdataqc%nvprot(1)), & 
     471                     & zv(sobsgroups(jgroup)%sprofdataqc%nvprot(2))  & 
     472                     & ) 
     473 
     474                  CALL obs_rotvel( sobsgroups(jgroup)%sprofdataqc, sobsgroups(jgroup)%n2dint, zu, zv ) 
     475 
     476                  DO jo = 1, sobsgroups(jgroup)%sprofdataqc%nprof 
     477                     DO jvar = 1, 2 
     478                        DO jk = sobsgroups(jgroup)%sprofdataqc%npvsta(jo,jvar), sobsgroups(jgroup)%sprofdataqc%npvend(jo,jvar) 
     479 
     480                           IF ( jvar == 1 ) THEN 
     481                              sobsgroups(jgroup)%sprofdataqc%var(jvar)%vmod(jk) = zu(jk) 
     482                           ELSE 
     483                              sobsgroups(jgroup)%sprofdataqc%var(jvar)%vmod(jk) = zv(jk) 
     484                           ENDIF 
     485 
     486                        END DO 
    809487                     END DO 
    810488                  END DO 
    811                END DO 
    812  
    813                DEALLOCATE( zu ) 
    814                DEALLOCATE( zv ) 
    815  
    816             END IF 
    817  
    818             CALL obs_prof_decompress( profdataqc(jtype), & 
    819                &                      profdata(jtype), .TRUE., numout ) 
    820  
    821             CALL obs_wri_prof( profdata(jtype) ) 
    822  
    823          END DO 
    824  
    825       ENDIF 
    826  
    827       IF ( nsurftypes > 0 ) THEN 
    828  
    829          DO jtype = 1, nsurftypes 
    830  
    831             CALL obs_surf_decompress( surfdataqc(jtype), & 
    832                &                      surfdata(jtype), .TRUE., numout ) 
    833  
    834             CALL obs_wri_surf( surfdata(jtype) ) 
    835  
    836          END DO 
    837  
    838       ENDIF 
     489 
     490                  DEALLOCATE( zu ) 
     491                  DEALLOCATE( zv ) 
     492 
     493               END IF 
     494 
     495               CALL obs_prof_decompress( sobsgroups(jgroup)%sprofdataqc, & 
     496                  &                      sobsgroups(jgroup)%sprofdata, .TRUE., numout ) 
     497 
     498               CALL obs_wri_prof( sobsgroups(jgroup)%sprofdata ) 
     499 
     500            ELSEIF (sobsgroups(jgroup)%lsurf) THEN 
     501 
     502               CALL obs_surf_decompress( sobsgroups(jgroup)%ssurfdataqc, & 
     503                  &                      sobsgroups(jgroup)%ssurfdata, .TRUE., numout ) 
     504 
     505               CALL obs_wri_surf( sobsgroups(jgroup)%ssurfdata ) 
     506 
     507            ENDIF 
     508 
     509         ENDIF 
     510 
     511      END DO 
    839512 
    840513   END SUBROUTINE dia_obs_wri 
     
    855528      ! obs_grid deallocation 
    856529      CALL obs_grid_deallocate 
    857  
    858       ! diaobs deallocation 
    859       IF ( nproftypes > 0 ) & 
    860          &   DEALLOCATE( cobstypesprof, profdata, profdataqc, nvarsprof, nextrprof ) 
    861  
    862       IF ( nsurftypes > 0 ) & 
    863          &   DEALLOCATE( cobstypessurf, surfdata, surfdataqc, nvarssurf, nextrsurf, & 
    864          &               n2dintsurf, zavglamscl, zavgphiscl, lfpindegs, llnightav ) 
     530       
     531      !!! DEALLOC sdobsgroups/components? 
    865532 
    866533   END SUBROUTINE dia_obs_dealloc 
     
    1010677 
    1011678   END SUBROUTINE fin_date 
    1012     
    1013    SUBROUTINE obs_settypefiles( ntypes, jpmaxnfiles, ifiles, cobstypes, cfiles ) 
    1014  
    1015       INTEGER, INTENT(IN) :: ntypes      ! Total number of obs types 
    1016       INTEGER, INTENT(IN) :: jpmaxnfiles ! Maximum number of files allowed for each type 
    1017       INTEGER, DIMENSION(ntypes), INTENT(OUT) :: & 
    1018          &                   ifiles      ! Out number of files for each type 
    1019       CHARACTER(len=8), DIMENSION(ntypes), INTENT(IN) :: & 
    1020          &                   cobstypes   ! List of obs types 
    1021       CHARACTER(len=128), DIMENSION(ntypes, jpmaxnfiles), INTENT(IN) :: & 
    1022          &                   cfiles      ! List of files for all types 
    1023  
    1024       !Local variables 
    1025       INTEGER :: jfile 
    1026       INTEGER :: jtype 
    1027  
    1028       DO jtype = 1, ntypes 
    1029  
    1030          ifiles(jtype) = 0 
    1031          DO jfile = 1, jpmaxnfiles 
    1032             IF ( trim(cfiles(jtype,jfile)) /= '' ) & 
    1033                       ifiles(jtype) = ifiles(jtype) + 1 
    1034          END DO 
    1035  
    1036          IF ( ifiles(jtype) == 0 ) THEN 
    1037               CALL ctl_stop( 'Logical for observation type '//TRIM(cobstypes(jtype))//   & 
    1038                  &           ' set to true but no files available to read' ) 
    1039          ENDIF 
    1040  
    1041          IF(lwp) THEN     
    1042             WRITE(numout,*) '             '//cobstypes(jtype)//' input observation file names:' 
    1043             DO jfile = 1, ifiles(jtype) 
    1044                WRITE(numout,*) '                '//TRIM(cfiles(jtype,jfile)) 
    1045             END DO 
    1046          ENDIF 
    1047  
    1048       END DO 
    1049  
    1050    END SUBROUTINE obs_settypefiles 
    1051  
    1052    SUBROUTINE obs_setinterpopts( ntypes, jtype, ctypein,             & 
    1053               &                  n2dint_default, n2dint_type,        & 
    1054               &                  ravglamscl_type, ravgphiscl_type,   & 
    1055               &                  lfp_indegs_type, lavnight_type,     & 
    1056               &                  n2dint, ravglamscl, ravgphiscl,     & 
    1057               &                  lfpindegs, lavnight ) 
    1058  
    1059       INTEGER, INTENT(IN)  :: ntypes             ! Total number of obs types 
    1060       INTEGER, INTENT(IN)  :: jtype              ! Index of the current type of obs 
    1061       INTEGER, INTENT(IN)  :: n2dint_default     ! Default option for interpolation type 
    1062       INTEGER, INTENT(IN)  :: n2dint_type        ! Option for interpolation type 
    1063       REAL(wp), INTENT(IN) :: & 
    1064          &                    ravglamscl_type, & !E/W diameter of obs footprint for this type 
    1065          &                    ravgphiscl_type    !N/S diameter of obs footprint for this type 
    1066       LOGICAL, INTENT(IN)  :: lfp_indegs_type    !T=> footprint in degrees, F=> in metres 
    1067       LOGICAL, INTENT(IN)  :: lavnight_type      !T=> obs represent night time average 
    1068       CHARACTER(len=8), INTENT(IN) :: ctypein  
    1069  
    1070       INTEGER, DIMENSION(ntypes), INTENT(INOUT) :: & 
    1071          &                    n2dint  
    1072       REAL(wp), DIMENSION(ntypes), INTENT(INOUT) :: & 
    1073          &                    ravglamscl, ravgphiscl 
    1074       LOGICAL, DIMENSION(ntypes), INTENT(INOUT) :: & 
    1075          &                    lfpindegs, lavnight 
    1076  
    1077       lavnight(jtype) = lavnight_type 
    1078  
    1079       IF ( (n2dint_type >= 0) .AND. (n2dint_type <= 6) ) THEN 
    1080          n2dint(jtype) = n2dint_type 
    1081       ELSE IF ( n2dint_type == -1 ) THEN 
    1082          n2dint(jtype) = n2dint_default 
    1083       ELSE 
    1084          CALL ctl_stop(' Choice of '//TRIM(ctypein)//' horizontal (2D) interpolation method', & 
    1085            &                    ' is not available') 
    1086       ENDIF 
    1087  
    1088       ! For averaging observation footprints set options for size of footprint  
    1089       IF ( (n2dint(jtype) > 4) .AND. (n2dint(jtype) <= 6) ) THEN 
    1090          IF ( ravglamscl_type > 0._wp ) THEN 
    1091             ravglamscl(jtype) = ravglamscl_type 
    1092          ELSE 
    1093             CALL ctl_stop( 'Incorrect value set for averaging footprint '// & 
    1094                            'scale (ravglamscl) for observation type '//TRIM(ctypein) )       
    1095          ENDIF 
    1096  
    1097          IF ( ravgphiscl_type > 0._wp ) THEN 
    1098             ravgphiscl(jtype) = ravgphiscl_type 
    1099          ELSE 
    1100             CALL ctl_stop( 'Incorrect value set for averaging footprint '// & 
    1101                            'scale (ravgphiscl) for observation type '//TRIM(ctypein) )       
    1102          ENDIF 
    1103  
    1104          lfpindegs(jtype) = lfp_indegs_type  
    1105  
    1106       ENDIF 
    1107  
    1108       ! Write out info  
    1109       IF(lwp) THEN 
    1110          IF ( n2dint(jtype) <= 4 ) THEN 
    1111             WRITE(numout,*) '             '//TRIM(ctypein)// & 
    1112                &            ' model counterparts will be interpolated horizontally' 
    1113          ELSE IF ( n2dint(jtype) <= 6 ) THEN 
    1114             WRITE(numout,*) '             '//TRIM(ctypein)// & 
    1115                &            ' model counterparts will be averaged horizontally' 
    1116             WRITE(numout,*) '             '//'    with E/W scale: ',ravglamscl(jtype) 
    1117             WRITE(numout,*) '             '//'    with N/S scale: ',ravgphiscl(jtype) 
    1118             IF ( lfpindegs(jtype) ) THEN 
    1119                 WRITE(numout,*) '             '//'    (in degrees)' 
    1120             ELSE 
    1121                 WRITE(numout,*) '             '//'    (in metres)' 
    1122             ENDIF 
    1123          ENDIF 
    1124       ENDIF 
    1125  
    1126    END SUBROUTINE obs_setinterpopts 
    1127679 
    1128680END MODULE diaobs 
  • NEMO/branches/UKMO/NEMO_4.0.4_generic_obs/src/OCE/OBS/obs_oper.F90

    r15089 r15144  
    178178         ! Initialize daily mean for first timestep of the day 
    179179         IF ( idayend == 1 .OR. kt == 0 ) THEN 
    180             DO_3D( 1, 1, 1, 1, 1, jpk ) 
    181                prodatqc%vdmean(ji,jj,jk,kvar) = 0.0 
    182             END_3D 
    183          ENDIF 
    184  
    185          DO_3D( 1, 1, 1, 1, 1, jpk ) 
    186             ! Increment field 1 for computing daily mean 
    187             prodatqc%vdmean(ji,jj,jk,kvar) = prodatqc%vdmean(ji,jj,jk,kvar) & 
    188                &                           + pvar(ji,jj,jk) 
    189          END_3D 
     180            DO jk = 1, jpk 
     181               DO jj = 1, jpj 
     182                  DO ji = 1, jpi 
     183                     prodatqc%vdmean(ji,jj,jk,kvar) = 0.0 
     184                  END DO 
     185               END DO 
     186            END DO 
     187         ENDIF 
     188 
     189         DO jk = 1, jpk 
     190            DO jj = 1, jpj 
     191               DO ji = 1, jpi 
     192                  ! Increment field 1 for computing daily mean 
     193                  prodatqc%vdmean(ji,jj,jk,kvar) = prodatqc%vdmean(ji,jj,jk,kvar) & 
     194                     &                           + pvar(ji,jj,jk) 
     195               END DO 
     196            END DO 
     197         END DO 
    190198 
    191199         ! Compute the daily mean at the end of day 
     
    194202            IF (lwp) WRITE(numout,*) 'Calculating prodatqc%vdmean on time-step: ',kt 
    195203            CALL FLUSH(numout) 
    196             DO_3D( 1, 1, 1, 1, 1, jpk ) 
    197                prodatqc%vdmean(ji,jj,jk,kvar) = prodatqc%vdmean(ji,jj,jk,kvar) & 
    198                   &                           * zdaystp 
    199             END_3D 
     204            DO jk = 1, jpk 
     205               DO jj = 1, jpj 
     206                  DO ji = 1, jpi 
     207                     prodatqc%vdmean(ji,jj,jk,kvar) = prodatqc%vdmean(ji,jj,jk,kvar) & 
     208                        &                           * zdaystp 
     209                  END DO 
     210               END DO 
     211            END DO 
    200212         ENDIF 
    201213 
Note: See TracChangeset for help on using the changeset viewer.