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 8723 for branches/2017/dev_r8657_UKMO_OBSoper/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90 – NEMO

Ignore:
Timestamp:
2017-11-16T13:18:57+01:00 (6 years ago)
Author:
mattmartin
Message:

Commit changes to obs operator to work with SST bias correction and with the horizontal averaging operator.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2017/dev_r8657_UKMO_OBSoper/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90

    r8667 r8723  
    4848   LOGICAL, PUBLIC :: ln_diaobs   !: Logical switch for the obs operator 
    4949   LOGICAL :: ln_sstnight         !: Logical switch for night mean SST obs 
    50     
     50   LOGICAL :: ln_sla_fp_indegs    !: T=> SLA obs footprint size specified in degrees, F=> in metres 
     51   LOGICAL :: ln_sst_fp_indegs    !: T=> SST obs footprint size specified in degrees, F=> in metres 
     52   LOGICAL :: ln_sss_fp_indegs    !: T=> SSS obs footprint size specified in degrees, F=> in metres 
     53   LOGICAL :: ln_sic_fp_indegs    !: T=> sea-ice obs footprint size specified in degrees, F=> in metres 
     54 
     55   REAL(wp) :: rn_sla_avglamscl !: E/W diameter of SLA observation footprint (metres) 
     56   REAL(wp) :: rn_sla_avgphiscl !: N/S diameter of SLA observation footprint (metres) 
     57   REAL(wp) :: rn_sst_avglamscl !: E/W diameter of SST observation footprint (metres) 
     58   REAL(wp) :: rn_sst_avgphiscl !: N/S diameter of SST observation footprint (metres) 
     59   REAL(wp) :: rn_sss_avglamscl !: E/W diameter of SSS observation footprint (metres) 
     60   REAL(wp) :: rn_sss_avgphiscl !: N/S diameter of SSS observation footprint (metres) 
     61   REAL(wp) :: rn_sic_avglamscl !: E/W diameter of sea-ice observation footprint (metres) 
     62   REAL(wp) :: rn_sic_avgphiscl !: N/S diameter of sea-ice observation footprint (metres) 
     63 
    5164   INTEGER :: nn_1dint       !: Vertical interpolation method 
    52    INTEGER :: nn_2dint       !: Horizontal interpolation method 
     65   INTEGER :: nn_2dint       !: Default horizontal interpolation method 
     66   INTEGER :: nn_2dint_sla   !: SLA horizontal interpolation method  
     67   INTEGER :: nn_2dint_sst   !: SST horizontal interpolation method  
     68   INTEGER :: nn_2dint_sss   !: SSS horizontal interpolation method  
     69   INTEGER :: nn_2dint_sic   !: Seaice horizontal interpolation method  
    5370   INTEGER, DIMENSION(imaxavtypes) :: & 
    5471      & nn_profdavtypes      !: Profile data types representing a daily average 
     
    6178      & nextrprof, &         !: Number of profile extra variables 
    6279      & nextrsurf            !: Number of surface extra variables 
    63    INTEGER, PUBLIC, ALLOCATABLE, DIMENSION(:) :: sstbias_type !SST bias type     
     80   INTEGER, DIMENSION(:), ALLOCATABLE :: & 
     81      & n2dintsurf           !: Interpolation option for surface variables 
     82   REAL(wp), DIMENSION(:), ALLOCATABLE :: & 
     83      & ravglamscl, &        !: E/W diameter of averaging footprint for surface variables 
     84      & ravgphiscl           !: N/S diameter of averaging footprint for surface variables 
     85   LOGICAL, DIMENSION(:), ALLOCATABLE :: & 
     86      & lfpindegs, &         !: T=> surface obs footprint size specified in degrees, F=> in metres 
     87      & llnightav            !: Logical for calculating night-time averages 
     88 
    6489   TYPE(obs_surf), PUBLIC, POINTER, DIMENSION(:) :: & 
    6590      & surfdata, &          !: Initial surface data 
     
    116141         & cn_profbfiles, &      ! T/S profile input filenames 
    117142         & cn_sstfbfiles, &      ! Sea surface temperature input filenames 
     143         & cn_sssfbfiles, &      ! Sea surface salinity input filenames 
    118144         & cn_slafbfiles, &      ! Sea level anomaly input filenames 
    119145         & cn_sicfbfiles, &      ! Seaice concentration input filenames 
    120146         & cn_velfbfiles, &      ! Velocity profile input filenames 
    121          & cn_sstbias_files      ! SST bias input filenames 
     147         & cn_sstbiasfiles      ! SST bias input filenames 
    122148      CHARACTER(LEN=128) :: & 
    123149         & cn_altbiasfile        ! Altimeter bias input filename 
     
    130156      LOGICAL :: ln_sla          ! Logical switch for sea level anomalies  
    131157      LOGICAL :: ln_sst          ! Logical switch for sea surface temperature 
     158      LOGICAL :: ln_sss          ! Logical switch for sea surface salinity 
    132159      LOGICAL :: ln_sic          ! Logical switch for sea ice concentration 
    133160      LOGICAL :: ln_vel3d        ! Logical switch for velocity (u,v) obs 
    134161      LOGICAL :: ln_nea          ! Logical switch to remove obs near land 
    135162      LOGICAL :: ln_altbias      ! Logical switch for altimeter bias 
    136       LOGICAL :: ln_sstbias     !: Logical switch for bias corection of SST  
     163      LOGICAL :: ln_sstbias      ! Logical switch for bias corection of SST  
    137164      LOGICAL :: ln_ignmis       ! Logical switch for ignoring missing files 
    138165      LOGICAL :: ln_s_at_t       ! Logical switch to compute model S at T obs 
     166      LOGICAL :: ln_bound_reject ! Logical to remove obs near boundaries in LAMs. 
    139167      LOGICAL :: llvar1          ! Logical for profile variable 1 
    140168      LOGICAL :: llvar2          ! Logical for profile variable 1 
    141       LOGICAL :: llnightav       ! Logical for calculating night-time averages 
    142169      LOGICAL, DIMENSION(jpmaxnfiles) :: lmask ! Used for finding number of sstbias files 
    143170 
     
    189216      ! Read namelist parameters 
    190217      !----------------------------------------------------------------------- 
    191        
    192       !Initalise all values in namelist arrays 
    193       ALLOCATE(sstbias_type(jpmaxnfiles)) 
    194218      ! Some namelist arrays need initialising 
    195219      cn_profbfiles(:) = '' 
     
    199223      cn_velfbfiles(:) = '' 
    200224      cn_sssfbfiles(:)    = '' 
    201       cn_sstbias_files(:) = '' 
     225      cn_sstbiasfiles(:) = '' 
    202226      nn_profdavtypes(:) = -1 
    203227 
     
    262286      IF (ln_sstbias) THEN  
    263287         lmask(:) = .FALSE.  
    264          WHERE (cn_sstbias_files(:) /= '') lmask(:) = .TRUE.  
     288         WHERE (cn_sstbiasfiles(:) /= '') lmask(:) = .TRUE.  
    265289         jnumsstbias = COUNT(lmask)  
    266290         lmask(:) = .FALSE.  
     
    463487            nvarssurf(jtype) = 1 
    464488            nextrsurf(jtype) = 0 
    465             llnightav = .FALSE. 
     489            llnightav(jtype) = .FALSE. 
    466490            IF ( TRIM(cobstypessurf(jtype)) == 'sla' ) nextrsurf(jtype) = 2 
    467             IF ( TRIM(cobstypessurf(jtype)) == 'sst' ) llnightav = ln_sstnight 
     491            IF ( TRIM(cobstypessurf(jtype)) == 'sst' ) llnightav(jtype) = ln_sstnight 
    468492 
    469493            !Read in surface obs types 
     
    581605         & zgphi1,    &            ! Model latitudes for prof variable 1 
    582606         & zgphi2                  ! Model latitudes for prof variable 2 
    583       LOGICAL :: llnightav        ! Logical for calculating night-time average 
    584607 
    585608      !Allocate local work arrays 
     
    971994   END SUBROUTINE fin_date 
    972995    
     996    SUBROUTINE obs_settypefiles( ntypes, jpmaxnfiles, jtype, ctypein, & 
     997       &                         cfilestype, ifiles, cobstypes, cfiles ) 
     998 
     999    INTEGER, INTENT(IN) :: ntypes      ! Total number of obs types 
     1000    INTEGER, INTENT(IN) :: jpmaxnfiles ! Maximum number of files allowed for each type 
     1001    INTEGER, INTENT(IN) :: jtype       ! Index of the current type of obs 
     1002    INTEGER, DIMENSION(ntypes), INTENT(INOUT) :: & 
     1003       &                   ifiles      ! Out appended number of files for this type 
     1004 
     1005    CHARACTER(len=6), INTENT(IN) :: ctypein  
     1006    CHARACTER(len=128), DIMENSION(jpmaxnfiles), INTENT(IN) :: & 
     1007       &                   cfilestype  ! In list of files for this obs type 
     1008    CHARACTER(len=6), DIMENSION(ntypes), INTENT(INOUT) :: & 
     1009       &                   cobstypes   ! Out appended list of obs types 
     1010    CHARACTER(len=128), DIMENSION(ntypes, jpmaxnfiles), INTENT(INOUT) :: & 
     1011       &                   cfiles      ! Out appended list of files for all types 
     1012 
     1013    !Local variables 
     1014    INTEGER :: jfile 
     1015 
     1016    cfiles(jtype,:) = cfilestype(:) 
     1017    cobstypes(jtype) = ctypein 
     1018    ifiles(jtype) = 0 
     1019    DO jfile = 1, jpmaxnfiles 
     1020       IF ( trim(cfiles(jtype,jfile)) /= '' ) & 
     1021                 ifiles(jtype) = ifiles(jtype) + 1 
     1022    END DO 
     1023 
     1024    IF ( ifiles(jtype) == 0 ) THEN 
     1025         CALL ctl_stop( 'Logical for observation type '//TRIM(ctypein)//   & 
     1026            &           ' set to true but no files available to read' ) 
     1027    ENDIF 
     1028 
     1029    IF(lwp) THEN     
     1030       WRITE(numout,*) '             '//cobstypes(jtype)//' input observation file names:' 
     1031       DO jfile = 1, ifiles(jtype) 
     1032          WRITE(numout,*) '                '//TRIM(cfiles(jtype,jfile)) 
     1033       END DO 
     1034    ENDIF 
     1035 
     1036    END SUBROUTINE obs_settypefiles 
     1037 
     1038    SUBROUTINE obs_setinterpopts( ntypes, jtype, ctypein,             & 
     1039               &                  n2dint_default, n2dint_type,        & 
     1040               &                  ravglamscl_type, ravgphiscl_type,   & 
     1041               &                  lfp_indegs_type, lavnight_type,     & 
     1042               &                  n2dint, ravglamscl, ravgphiscl,     & 
     1043               &                  lfpindegs, lavnight ) 
     1044 
     1045    INTEGER, INTENT(IN)  :: ntypes             ! Total number of obs types 
     1046    INTEGER, INTENT(IN)  :: jtype              ! Index of the current type of obs 
     1047    INTEGER, INTENT(IN)  :: n2dint_default     ! Default option for interpolation type 
     1048    INTEGER, INTENT(IN)  :: n2dint_type        ! Option for interpolation type 
     1049    REAL(wp), INTENT(IN) :: & 
     1050       &                    ravglamscl_type, & !E/W diameter of obs footprint for this type 
     1051       &                    ravgphiscl_type    !N/S diameter of obs footprint for this type 
     1052    LOGICAL, INTENT(IN)  :: lfp_indegs_type    !T=> footprint in degrees, F=> in metres 
     1053    LOGICAL, INTENT(IN)  :: lavnight_type      !T=> obs represent night time average 
     1054    CHARACTER(len=6), INTENT(IN) :: ctypein  
     1055 
     1056    INTEGER, DIMENSION(ntypes), INTENT(INOUT) :: & 
     1057       &                    n2dint  
     1058    REAL(wp), DIMENSION(ntypes), INTENT(INOUT) :: & 
     1059       &                    ravglamscl, ravgphiscl 
     1060    LOGICAL, DIMENSION(ntypes), INTENT(INOUT) :: & 
     1061       &                    lfpindegs, lavnight 
     1062 
     1063    lavnight(jtype) = lavnight_type 
     1064 
     1065    IF ( (n2dint_type >= 1) .AND. (n2dint_type <= 6) ) THEN 
     1066       n2dint(jtype) = n2dint_type 
     1067    ELSE 
     1068       n2dint(jtype) = n2dint_default 
     1069    ENDIF 
     1070 
     1071    ! For averaging observation footprints set options for size of footprint  
     1072    IF ( (n2dint(jtype) > 4) .AND. (n2dint(jtype) <= 6) ) THEN 
     1073       IF ( ravglamscl_type > 0._wp ) THEN 
     1074          ravglamscl(jtype) = ravglamscl_type 
     1075       ELSE 
     1076          CALL ctl_stop( 'Incorrect value set for averaging footprint '// & 
     1077                         'scale (ravglamscl) for observation type '//TRIM(ctypein) )       
     1078       ENDIF 
     1079 
     1080       IF ( ravgphiscl_type > 0._wp ) THEN 
     1081          ravgphiscl(jtype) = ravgphiscl_type 
     1082       ELSE 
     1083          CALL ctl_stop( 'Incorrect value set for averaging footprint '// & 
     1084                         'scale (ravgphiscl) for observation type '//TRIM(ctypein) )       
     1085       ENDIF 
     1086 
     1087       lfpindegs(jtype) = lfp_indegs_type  
     1088 
     1089    ENDIF 
     1090 
     1091    ! Write out info  
     1092    IF(lwp) THEN 
     1093       IF ( n2dint(jtype) <= 4 ) THEN 
     1094          WRITE(numout,*) '             '//TRIM(ctypein)// & 
     1095             &            ' model counterparts will be interpolated horizontally' 
     1096       ELSE IF ( n2dint(jtype) <= 6 ) THEN 
     1097          WRITE(numout,*) '             '//TRIM(ctypein)// & 
     1098             &            ' model counterparts will be averaged horizontally' 
     1099          WRITE(numout,*) '             '//'    with E/W scale: ',ravglamscl(jtype) 
     1100          WRITE(numout,*) '             '//'    with N/S scale: ',ravgphiscl(jtype) 
     1101          IF ( lfpindegs(jtype) ) THEN 
     1102              WRITE(numout,*) '             '//'    (in degrees)' 
     1103          ELSE 
     1104              WRITE(numout,*) '             '//'    (in metres)' 
     1105          ENDIF 
     1106       ENDIF 
     1107    ENDIF 
     1108 
     1109    END SUBROUTINE obs_setinterpopts 
     1110 
    9731111END MODULE diaobs 
Note: See TracChangeset for help on using the changeset viewer.