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 7375 – NEMO

Changeset 7375


Ignore:
Timestamp:
2016-11-29T18:18:55+01:00 (7 years ago)
Author:
mattmartin
Message:

Added code to branch to allow sla model counterpart to be a time-average.

Location:
branches/UKMO/dev_r4650_general_vert_coord_obsoper_removetides/NEMOGCM/NEMO/OPA_SRC/OBS
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/UKMO/dev_r4650_general_vert_coord_obsoper_removetides/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90

    r6990 r7375  
    9393   REAL(KIND=dp), PUBLIC :: dobsend   !: Observation window end date YYYYMMDD.HHMMSS 
    9494   
     95   REAL(KIND=wp), PUBLIC ::  & 
     96                      SLAMeanPeriodHours = 24. + (5./6.) !: Meaning period for SLA data. 
     97 
    9598   INTEGER, PUBLIC :: n1dint       !: Vertical interpolation method 
    9699   INTEGER, PUBLIC :: n2dint       !: Horizontal interpolation method  
     
    674677               &              slafilesact(1:jnumslaact), & 
    675678               &              nslavars, nslaextr, nitend-nit000+2, & 
    676                &              dobsini, dobsend, ln_ignmis, .FALSE. ) 
     679               &              dobsini, dobsend, ln_ignmis, .FALSE., SLAMeanPeriodHours ) 
    677680            CALL obs_pre_sla( sladata(nslasets), sladatqc(nslasets), & 
    678681               &              ln_sla, ln_nea ) 
     
    685688               &              slafilespas(1:jnumslapas), & 
    686689               &              nslavars, nslaextr, nitend-nit000+2, & 
    687                &              dobsini, dobsend, ln_ignmis, .FALSE. ) 
     690               &              dobsini, dobsend, ln_ignmis, .FALSE., SLAMeanPeriodHours ) 
    688691             
    689692            CALL obs_pre_sla( sladata(nslasets), sladatqc(nslasets), & 
     
    703706                  &              slafbfiles(jset:jset), & 
    704707                  &              nslavars, nslaextr, nitend-nit000+2, & 
    705                   &              dobsini, dobsend, ln_ignmis, .FALSE. ) 
     708                  &              dobsini, dobsend, ln_ignmis, .FALSE., SLAMeanPeriodHours ) 
    706709               CALL obs_pre_sla( sladata(nslasets), sladatqc(nslasets), & 
    707710                  &              ln_sla, ln_nea ) 
     
    10621065      !! * Local declarations 
    10631066      INTEGER :: idaystp                ! Number of timesteps per day 
     1067      INTEGER :: imeanstp               ! Number of timesteps for sla averaging 
    10641068      INTEGER :: jprofset               ! Profile data set loop variable 
    10651069      INTEGER :: jslaset                ! SLA data set loop variable 
     
    11381142      !  - Sea surface anomaly 
    11391143      IF ( ln_sla ) THEN 
     1144         !Number of time-steps in meaning period 
     1145         imeanstp = NINT( ( SLAMeanPeriodHours * 60. * 60. ) / rdt ) 
    11401146         DO jslaset = 1, nslasets 
    11411147            CALL obs_sla_opt( sladatqc(jslaset),            & 
    11421148               &              kstp, jpi, jpj, nit000, sshn, & 
    1143                &              tmask(:,:,1), n2dint ) 
     1149               &              tmask(:,:,1), n2dint, kmeanstp = imeanstp ) 
    11441150         END DO          
    11451151      ENDIF 
  • branches/UKMO/dev_r4650_general_vert_coord_obsoper_removetides/NEMOGCM/NEMO/OPA_SRC/OBS/obs_oper.F90

    r6301 r7375  
    10631063  
    10641064   SUBROUTINE obs_sla_opt( sladatqc, kt, kpi, kpj, kit000, & 
    1065       &                    psshn, psshmask, k2dint ) 
     1065      &                    psshn, psshmask, k2dint, kmeanstp ) 
    10661066      !!----------------------------------------------------------------------- 
    10671067      !! 
     
    11001100      !! * Arguments 
    11011101      TYPE(obs_surf), INTENT(INOUT) :: sladatqc     ! Subset of surface data not failing screening 
    1102       INTEGER, INTENT(IN) :: kt      ! Time step 
    1103       INTEGER, INTENT(IN) :: kpi     ! Model grid parameters 
     1102      INTEGER, INTENT(IN) :: kt       ! Time step 
     1103      INTEGER, INTENT(IN) :: kpi      ! Model grid parameters 
    11041104      INTEGER, INTENT(IN) :: kpj 
    11051105      INTEGER, INTENT(IN) :: kit000   ! Number of the first time step  
    11061106                                      !   (kit000-1 = restart time) 
    11071107      INTEGER, INTENT(IN) :: k2dint   ! Horizontal interpolation type (see header) 
     1108      INTEGER, INTENT(IN), OPTIONAL :: & 
     1109                             kmeanstp ! Number of time steps for the time meaning 
     1110                                      ! Averaging is triggered if present and greater than one                     
    11081111      REAL(KIND=wp), INTENT(IN), DIMENSION(kpi,kpj) :: & 
    11091112         & psshn,  &    ! Model SSH field 
     
    11171120      INTEGER :: isla 
    11181121      INTEGER :: iobs 
     1122      INTEGER :: imeanend 
    11191123      REAL(KIND=wp) :: zlam 
    11201124      REAL(KIND=wp) :: zphi 
    11211125      REAL(KIND=wp) :: zext(1), zobsmask(1) 
     1126      REAL(KIND=wp) :: zmeanstp 
    11221127      REAL(kind=wp), DIMENSION(2,2,1) :: & 
    11231128         & zweig 
     
    11261131         & zsshl, & 
    11271132         & zglam, & 
    1128          & zgphi 
     1133         & zgphi, & 
     1134         & zssh_tmean 
    11291135      INTEGER, DIMENSION(:,:,:), ALLOCATABLE :: & 
    11301136         & igrdi, & 
    11311137         & igrdj 
     1138 
     1139      LOGICAL :: l_sla_timemean 
    11321140 
    11331141      !------------------------------------------------------------------------ 
     
    11371145      inrc = kt - kit000 + 2 
    11381146      isla = sladatqc%nsstp(inrc) 
     1147 
     1148      l_sla_timemean = .FALSE. 
     1149      IF ( PRESENT( kmeanstp ) ) THEN 
     1150         IF ( kmeanstp > 1 ) l_sla_timemean = .TRUE. 
     1151      ENDIF 
     1152 
     1153      IF ( l_sla_timemean ) THEN 
     1154         ! Initialize time mean for first timestep 
     1155         imeanend = MOD( kt - kit000 + 1, kmeanstp ) 
     1156         IF (lwp) WRITE(numout,*) 'SLA time mean ', kt, kit000, kmeanstp, imeanend 
     1157 
     1158         ! Added kt == 0 test to catch restart case  
     1159         IF ( ( imeanend == 1 ) .OR. ( kt == 0 ) ) THEN 
     1160            IF (lwp) WRITE(numout,*) 'Reset sladatqc%vdmean on time-step: ',kt 
     1161            DO jj = 1, jpj 
     1162               DO ji = 1, jpi 
     1163                  sladatqc%vdmean(ji,jj) = 0.0 
     1164               END DO 
     1165            END DO 
     1166         ENDIF 
     1167 
     1168         ! On each time-step, increment the SLA field for computing time mean 
     1169         IF (lwp) WRITE(numout,*)'Accumulating sladataqc%vdmean on time-step: ',kt 
     1170         DO jj = 1, jpj 
     1171            DO ji = 1, jpi 
     1172               sladatqc%vdmean(ji,jj) = sladatqc%vdmean(ji,jj) & 
     1173                  &                        + psshn(ji,jj) 
     1174            END DO 
     1175         END DO 
     1176 
     1177         ! Compute the time mean at the end of time period 
     1178         IF ( imeanend == 0 ) THEN 
     1179            zmeanstp = 1.0 / REAL( kmeanstp ) 
     1180            IF (lwp) WRITE(numout,*)'Calculating sladataqc%vdmean time mean on time-step: ',kt,' with weight: ',zmeanstp 
     1181            DO jj = 1, jpj 
     1182               DO ji = 1, jpi 
     1183                  sladatqc%vdmean(ji,jj) = sladatqc%vdmean(ji,jj) & 
     1184                  &                        * zmeanstp 
     1185               END DO 
     1186            END DO 
     1187         ENDIF 
     1188      ENDIF !l_sla_timemean 
     1189 
    11391190 
    11401191      ! Get the data for interpolation 
     
    11671218      CALL obs_int_comm_2d( 2, 2, isla, & 
    11681219         &                  igrdi, igrdj, psshmask, zmask ) 
    1169       CALL obs_int_comm_2d( 2, 2, isla, & 
    1170          &                  igrdi, igrdj, psshn, zsshl ) 
     1220 
     1221      ! At the end of the averaging period get interpolated means 
     1222      IF ( l_sla_timemean ) THEN 
     1223         IF ( imeanend == 0 ) THEN 
     1224 
     1225            ALLOCATE( zssh_tmean(2,2,isla) ) 
     1226            IF (lwp) WRITE(numout,*)' Interpolating the time mean values on time step: ',kt 
     1227            CALL obs_int_comm_2d( 2, 2, isla, & 
     1228               &                  igrdi, igrdj, sladatqc%vdmean(:,:), zssh_tmean ) 
     1229         ENDIF 
     1230      ELSE 
     1231         CALL obs_int_comm_2d( 2, 2, isla, & 
     1232            &                  igrdi, igrdj, psshn, zsshl ) 
     1233 
     1234      ENDIF 
    11711235 
    11721236      ! Loop over observations 
     
    11941258         ENDIF 
    11951259          
    1196          zlam = sladatqc%rlam(jobs) 
    1197          zphi = sladatqc%rphi(jobs) 
    1198  
    1199          ! Get weights to interpolate the model SSH to the observation point 
    1200          CALL obs_int_h2d_init( 1, 1, k2dint, zlam, zphi,         & 
    1201             &                   zglam(:,:,iobs), zgphi(:,:,iobs), & 
    1202             &                   zmask(:,:,iobs), zweig, zobsmask ) 
    12031260          
    12041261 
    12051262         ! Interpolate the model SSH to the observation point 
    1206          CALL obs_int_h2d( 1, 1,      & 
    1207             &              zweig, zsshl(:,:,iobs),  zext ) 
    1208           
    1209          sladatqc%rext(jobs,1) = zext(1) 
    1210          ! ... Remove the MDT at the observation point 
    1211          sladatqc%rmod(jobs,1) = sladatqc%rext(jobs,1) - sladatqc%rext(jobs,2) 
     1263         IF ( l_sla_timemean ) THEN 
     1264            IF ( imeanend == 0 ) THEN 
     1265               zlam = sladatqc%rlam(jobs) 
     1266               zphi = sladatqc%rphi(jobs) 
     1267               ! Get weights to interpolate the model SSH to the observation point 
     1268               CALL obs_int_h2d_init( 1, 1, k2dint, zlam, zphi,         & 
     1269                  &                   zglam(:,:,iobs), zgphi(:,:,iobs), & 
     1270                  &                   zmask(:,:,iobs), zweig, zobsmask ) 
     1271               CALL obs_int_h2d( 1, 1,      & 
     1272                  &              zweig, zssh_tmean(:,:,iobs),  zext ) 
     1273               sladatqc%rext(jobs,1) = zext(1) 
     1274               ! ... Remove the MDT at the observation point 
     1275               sladatqc%rmod(jobs,1) = sladatqc%rext(jobs,1) - sladatqc%rext(jobs,2) 
     1276 
     1277            ENDIF 
     1278         ELSE 
     1279            zlam = sladatqc%rlam(jobs) 
     1280            zphi = sladatqc%rphi(jobs) 
     1281            ! Get weights to interpolate the model SSH to the observation point 
     1282            CALL obs_int_h2d_init( 1, 1, k2dint, zlam, zphi,         & 
     1283               &                   zglam(:,:,iobs), zgphi(:,:,iobs), & 
     1284               &                   zmask(:,:,iobs), zweig, zobsmask ) 
     1285            CALL obs_int_h2d( 1, 1,      & 
     1286               &              zweig, zsshl(:,:,iobs),  zext ) 
     1287            sladatqc%rext(jobs,1) = zext(1) 
     1288            ! ... Remove the MDT at the observation point 
     1289            sladatqc%rmod(jobs,1) = sladatqc%rext(jobs,1) - sladatqc%rext(jobs,2) 
     1290         ENDIF 
     1291 
    12121292 
    12131293      END DO 
     
    12221302         & zsshl  & 
    12231303         & ) 
     1304 
     1305      ! At the end of the averaging period also deallocate interpolated time means 
     1306      IF ( ( l_sla_timemean ) .AND. ( imeanend == 0 ) ) THEN 
     1307         DEALLOCATE( zssh_tmean ) 
     1308      ENDIF 
    12241309 
    12251310      sladatqc%nsurfup = sladatqc%nsurfup + isla 
  • branches/UKMO/dev_r4650_general_vert_coord_obsoper_removetides/NEMOGCM/NEMO/OPA_SRC/OBS/obs_read_sla.F90

    r5838 r7375  
    4343      &                    sladata, knumfiles, cfilenames, & 
    4444      &                    kvars, kextr, kstp, ddobsini, ddobsend, & 
    45       &                    ldignmis, ldmod, ldobstd ) 
     45      &                    ldignmis, ldmod, MeanPeriodHours, ldobstd ) 
    4646      !!--------------------------------------------------------------------- 
    4747      !! 
     
    7878      REAL(KIND=dp), INTENT(IN) :: ddobsini  ! Obs. ini time in YYYYMMDD.HHMMSS 
    7979      REAL(KIND=dp), INTENT(IN) :: ddobsend  ! Obs. end time in YYYYMMDD.HHMMSS 
     80      REAL(KIND=wp), INTENT(IN) :: MeanPeriodHours ! Averaging period in hours 
    8081          
    8182      !! * Local declarations 
     
    267268               inpfiles(jj)%iobsj = -1 
    268269            ENDIF 
     270             
     271            !If the observations are representing a time mean then set the time 
     272            !of the obs to the end of that meaning period relative to the start of the run 
     273            IF ( MeanPeriodHours > 0._wp ) THEN 
     274               IF (lwp) WRITE(numout,*)'Adjusting time of sla obs to end of meaning period: ', djulini(jj) + (MeanPeriodHours/24.) 
     275               DO ji = 1, inpfiles(jj)%nobs 
     276                  inpfiles(jj)%ptim(ji) = & 
     277                        & djulini(jj) + (MeanPeriodHours/24.) 
     278               END DO 
     279            ENDIF 
     280 
    269281            inowin = 0 
    270282            DO ji = 1, inpfiles(jj)%nobs 
Note: See TracChangeset for help on using the changeset viewer.