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 3585 for branches/2012/dev_r3342_MERCATOR7_SST/NEMOGCM/NEMO/OPA_SRC/OBS/obs_oper.F90 – NEMO

Ignore:
Timestamp:
2012-11-16T18:14:12+01:00 (11 years ago)
Author:
cbricaud
Message:

commit modifications due to review for SST night operator

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2012/dev_r3342_MERCATOR7_SST/NEMOGCM/NEMO/OPA_SRC/OBS/obs_oper.F90

    r3411 r3585  
    663663         & psstn,  &    ! Model SST field 
    664664         & psstmask     ! Land-sea mask 
     665      LOGICAL, INTENT(IN) :: ld_nightav 
    665666 
    666667      !! * Local declarations 
     
    694695         & igrdi, & 
    695696         & igrdj 
    696       LOGICAL, INTENT(IN) :: ld_nightav 
    697697 
    698698      !----------------------------------------------------------------------- 
     
    705705      IF ( ld_nightav ) THEN 
    706706 
    707       ! Initialize array for night mean 
    708  
    709       IF ( kt .EQ. 0 ) THEN 
    710          ALLOCATE ( icount_sstnight(kpi,kpj) ) 
    711          ALLOCATE ( imask_night(kpi,kpj) ) 
    712          ALLOCATE ( zintmp(kpi,kpj) ) 
    713          ALLOCATE ( zouttmp(kpi,kpj) ) 
    714          ALLOCATE ( zmeanday(kpi,kpj) ) 
    715          nday_qsr = -1   ! initialisation flag for nbc_dcy 
    716       ENDIF 
    717  
    718       ! Initialize daily mean for first timestep 
    719       idayend = MOD( kt - kit000 + 1, kdaystp ) 
    720  
    721       ! Added kt == 0 test to catch restart case  
    722       IF ( idayend == 1 .OR. kt == 0) THEN 
    723          IF (lwp) WRITE(numout,*) 'Reset sstdatqc%vdmean on time-step: ',kt 
     707         ! Initialize array for night mean 
     708 
     709         IF ( kt .EQ. 0 ) THEN 
     710            ALLOCATE ( icount_sstnight(kpi,kpj) ) 
     711            ALLOCATE ( imask_night(kpi,kpj) ) 
     712            ALLOCATE ( zintmp(kpi,kpj) ) 
     713            ALLOCATE ( zouttmp(kpi,kpj) ) 
     714            ALLOCATE ( zmeanday(kpi,kpj) ) 
     715            nday_qsr = -1   ! initialisation flag for nbc_dcy 
     716         ENDIF 
     717 
     718         ! Initialize daily mean for first timestep 
     719         idayend = MOD( kt - kit000 + 1, kdaystp ) 
     720 
     721         ! Added kt == 0 test to catch restart case  
     722         IF ( idayend == 1 .OR. kt == 0) THEN 
     723            IF (lwp) WRITE(numout,*) 'Reset sstdatqc%vdmean on time-step: ',kt 
     724            DO jj = 1, jpj 
     725               DO ji = 1, jpi 
     726                  sstdatqc%vdmean(ji,jj) = 0.0 
     727                  zmeanday(ji,jj) = 0.0 
     728                  icount_sstnight(ji,jj) = 0 
     729               END DO 
     730            END DO 
     731         ENDIF 
     732 
     733         zintmp(:,:) = 0.0 
     734         zouttmp(:,:) = sbc_dcy( zintmp(:,:), .TRUE. ) 
     735         imask_night(:,:) = INT( zouttmp(:,:) ) 
     736 
    724737         DO jj = 1, jpj 
    725738            DO ji = 1, jpi 
    726                sstdatqc%vdmean(ji,jj) = 0.0 
    727                zmeanday(ji,jj) = 0.0 
    728                icount_sstnight(ji,jj) = 0 
     739               ! Increment the temperature field for computing night mean and counter 
     740               sstdatqc%vdmean(ji,jj) = sstdatqc%vdmean(ji,jj)  & 
     741                      &                        + psstn(ji,jj)*imask_night(ji,jj) 
     742               zmeanday(ji,jj)        = zmeanday(ji,jj) + psstn(ji,jj) 
     743               icount_sstnight(ji,jj) = icount_sstnight(ji,jj) + imask_night(ji,jj) 
    729744            END DO 
    730745         END DO 
    731       ENDIF 
    732  
    733       zintmp(:,:) = 0.0 
    734       zouttmp(:,:) = sbc_dcy( zintmp(:,:), .TRUE. ) 
    735       imask_night(:,:) = INT( zouttmp(:,:) ) 
    736  
    737       DO jj = 1, jpj 
    738          DO ji = 1, jpi 
    739             ! Increment the temperature field for computing night mean and counter 
    740             sstdatqc%vdmean(ji,jj) = sstdatqc%vdmean(ji,jj)  & 
    741                    &                        + psstn(ji,jj)*imask_night(ji,jj) 
    742             zmeanday(ji,jj)        = zmeanday(ji,jj) + psstn(ji,jj) 
    743             icount_sstnight(ji,jj) = icount_sstnight(ji,jj) + imask_night(ji,jj) 
    744          END DO 
    745       END DO 
    746746    
    747       ! Compute the daily mean at the end of day 
    748  
    749       zdaystp = 1.0 / REAL( kdaystp ) 
    750  
    751       IF ( idayend == 0 ) THEN  
    752          DO jj = 1, jpj 
    753             DO ji = 1, jpi 
    754                ! Test if "no night" point 
    755                IF ( icount_sstnight(ji,jj) .NE. 0 ) THEN 
    756                   sstdatqc%vdmean(ji,jj) = sstdatqc%vdmean(ji,jj) & 
     747         ! Compute the daily mean at the end of day 
     748 
     749         zdaystp = 1.0 / REAL( kdaystp ) 
     750 
     751         IF ( idayend == 0 ) THEN  
     752            DO jj = 1, jpj 
     753               DO ji = 1, jpi 
     754                  ! Test if "no night" point 
     755                  IF ( icount_sstnight(ji,jj) .NE. 0 ) THEN 
     756                     sstdatqc%vdmean(ji,jj) = sstdatqc%vdmean(ji,jj) & 
    757757                    &                        / icount_sstnight(ji,jj)  
    758                ELSE 
    759                   sstdatqc%vdmean(ji,jj) = zmeanday(ji,jj) * zdaystp 
    760                ENDIF 
     758                  ELSE 
     759                     sstdatqc%vdmean(ji,jj) = zmeanday(ji,jj) * zdaystp 
     760                  ENDIF 
     761               END DO 
    761762            END DO 
    762          END DO 
    763       ENDIF 
    764  
    765       ENDIF 
     763         ENDIF 
     764 
     765      ENDIF !ld_nightav 
    766766 
    767767      ! Get the data for interpolation 
Note: See TracChangeset for help on using the changeset viewer.