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 3586 for branches/2012/dev_MERCATOR_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/OBS – NEMO

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

add modification from dev_r3342_MERCATOR7_SST in dev_MERCATOR_2012_rev3555

Location:
branches/2012/dev_MERCATOR_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/OBS
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/2012/dev_MERCATOR_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90

    r3294 r3586  
    106106   LOGICAL, DIMENSION(:), ALLOCATABLE :: & 
    107107      & ld_velav     !: Velocity data is daily averaged 
     108   LOGICAL, DIMENSION(:), ALLOCATABLE :: & 
     109      & ld_sstnight  !: SST observation corresponds to night mean 
    108110 
    109111   !!---------------------------------------------------------------------- 
     
    737739         ALLOCATE(sstdata(nsstsets)) 
    738740         ALLOCATE(sstdatqc(nsstsets)) 
     741         ALLOCATE(ld_sstnight(nsstsets)) 
    739742         sstdata(:)%nsurf=0 
    740          sstdatqc(:)%nsurf=0          
     743         sstdatqc(:)%nsurf=0     
     744         ld_sstnight(:)=.false. 
    741745 
    742746         nsstsets = 0 
     
    745749 
    746750            nsstsets = nsstsets + 1 
     751 
     752            ld_sstnight(nsstsets) = .TRUE. 
    747753 
    748754            CALL obs_rea_sst_rey( reysstname, reysstfmt, sstdata(nsstsets), & 
     
    757763         
    758764            nsstsets = nsstsets + 1 
     765 
     766            ld_sstnight(nsstsets) = .TRUE. 
    759767           
    760768            CALL obs_rea_sst( 1, sstdata(nsstsets), jnumsst, & 
     
    774782             
    775783               nsstsets = nsstsets + 1 
     784 
     785               ld_sstnight(nsstsets) = .TRUE. 
    776786             
    777787               CALL obs_rea_sst( 0, sstdata(nsstsets), 1, & 
     
    10921102      IF ( ln_sst ) THEN 
    10931103         DO jsstset = 1, nsstsets 
    1094             CALL obs_sst_opt( sstdatqc(jsstset),                 & 
    1095                &              kstp, jpi, jpj, nit000, tsn(:,:,1,jp_tem), & 
    1096                &              tmask(:,:,1), n2dint ) 
     1104            CALL obs_sst_opt( sstdatqc(jsstset),                & 
     1105               &              kstp, jpi, jpj, nit000, idaystp,  & 
     1106               &              tsn(:,:,1,jp_tem), tmask(:,:,1),  & 
     1107               &              n2dint, ld_sstnight(jsstset) ) 
    10971108         END DO 
    10981109      ENDIF 
  • branches/2012/dev_MERCATOR_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/OBS/obs_oper.F90

    r2715 r3586  
    614614   END SUBROUTINE obs_sla_opt 
    615615 
    616    SUBROUTINE obs_sst_opt( sstdatqc, kt, kpi, kpj, kit000, & 
    617       &                    psstn, psstmask, k2dint ) 
    618  
     616   SUBROUTINE obs_sst_opt( sstdatqc, kt, kpi, kpj, kit000, kdaystp, & 
     617      &                    psstn, psstmask, k2dint, ld_nightav ) 
    619618      !!----------------------------------------------------------------------- 
    620619      !! 
     
    647646      !! * Modules used 
    648647      USE obs_surf_def  ! Definition of storage space for surface observations 
     648      USE sbcdcy 
    649649 
    650650      IMPLICIT NONE 
     
    659659                                       !   (kit000-1 = restart time) 
    660660      INTEGER, INTENT(IN) :: k2dint    ! Horizontal interpolation type (see header) 
     661      INTEGER, INTENT(IN) :: kdaystp   ! Number of time steps per day   
    661662      REAL(KIND=wp), INTENT(IN), DIMENSION(kpi,kpj) :: & 
    662663         & psstn,  &    ! Model SST field 
    663664         & psstmask     ! Land-sea mask 
    664           
     665 
    665666      !! * Local declarations 
    666667      INTEGER :: ji 
     
    670671      INTEGER :: isst 
    671672      INTEGER :: iobs 
     673      INTEGER :: idayend 
    672674      REAL(KIND=wp) :: zlam 
    673675      REAL(KIND=wp) :: zphi 
    674676      REAL(KIND=wp) :: zext(1), zobsmask(1) 
     677      REAL(KIND=wp) :: zdaystp 
     678      INTEGER, DIMENSION(:,:), SAVE, ALLOCATABLE :: & 
     679         & icount_sstnight,      & 
     680         & imask_night 
     681      REAL(kind=wp), DIMENSION(:,:), SAVE, ALLOCATABLE :: & 
     682         & zintmp, & 
     683         & zouttmp, &  
     684         & zmeanday    ! to compute model sst in region of 24h daylight (pole) 
    675685      REAL(kind=wp), DIMENSION(2,2,1) :: & 
    676686         & zweig 
     
    678688         & zmask, & 
    679689         & zsstl, & 
     690         & zsstm, & 
    680691         & zglam, & 
    681692         & zgphi 
     
    683694         & igrdi, & 
    684695         & igrdj 
     696      LOGICAL, INTENT(IN) :: ld_nightav 
    685697 
    686698      !----------------------------------------------------------------------- 
     
    690702      inrc = kt - kit000 + 2 
    691703      isst = sstdatqc%nsstp(inrc) 
     704 
     705      IF ( ld_nightav ) THEN 
     706 
     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 
     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 
     746    
     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) & 
     757                    &                        / icount_sstnight(ji,jj)  
     758               ELSE 
     759                  sstdatqc%vdmean(ji,jj) = zmeanday(ji,jj) * zdaystp 
     760               ENDIF 
     761            END DO 
     762         END DO 
     763      ENDIF 
     764 
     765      ENDIF 
    692766 
    693767      ! Get the data for interpolation 
     
    722796      CALL obs_int_comm_2d( 2, 2, isst, & 
    723797         &                  igrdi, igrdj, psstn, zsstl ) 
    724        
     798 
     799      ! At the end of the day get interpolated means 
     800      IF ( idayend == 0 .AND. ld_nightav ) THEN 
     801 
     802         ALLOCATE( & 
     803            & zsstm(2,2,isst)  & 
     804            & ) 
     805 
     806         CALL obs_int_comm_2d( 2, 2, isst, igrdi, igrdj, & 
     807            &               sstdatqc%vdmean(:,:), zsstm ) 
     808 
     809      ENDIF 
     810 
    725811      ! Loop over observations 
    726812 
     
    756842             
    757843         ! Interpolate the model SST to the observation point  
    758          CALL obs_int_h2d( 1, 1,      & 
     844 
     845         IF ( ld_nightav ) THEN 
     846 
     847           IF ( idayend == 0 )  THEN 
     848               ! Daily averaged/diurnal cycle of SST  data 
     849               CALL obs_int_h2d( 1, 1,      &  
     850                     &              zweig, zsstm(:,:,iobs), zext ) 
     851            ELSE  
     852               CALL ctl_stop( ' ld_nightav is set to true: a nonzero' //     & 
     853                     &           ' number of night SST data should' // & 
     854                     &           ' only occur at the end of a given day' ) 
     855            ENDIF 
     856 
     857         ELSE 
     858 
     859            CALL obs_int_h2d( 1, 1,      & 
    759860            &              zweig, zsstl(:,:,iobs),  zext ) 
     861 
     862         ENDIF 
    760863          
    761864         sstdatqc%rmod(jobs,1) = zext(1) 
     
    772875         & zsstl  & 
    773876         & ) 
     877 
     878      ! At the end of the day also get interpolated means 
     879      IF ( idayend == 0 .AND. ld_nightav ) THEN 
     880         DEALLOCATE( & 
     881            & zsstm  & 
     882            & ) 
     883      ENDIF 
    774884       
    775885      sstdatqc%nsurfup = sstdatqc%nsurfup + isst 
  • branches/2012/dev_MERCATOR_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/OBS/obs_read_seaice.F90

    r2287 r3586  
    326326         &               iindx   ) 
    327327       
    328       CALL obs_surf_alloc( seaicedata, iobs, kvars, kextr, kstp ) 
     328      CALL obs_surf_alloc( seaicedata, iobs, &  
     329                           kvars, kextr, kstp, jpi, jpj ) 
    329330       
    330331      ! * Read obs/positions, QC, all variable and assign to seaicedata 
  • branches/2012/dev_MERCATOR_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/OBS/obs_read_sla.F90

    r2287 r3586  
    391391         &               iindx   ) 
    392392       
    393       CALL obs_surf_alloc( sladata, iobs, kvars, kextr, kstp ) 
     393      CALL obs_surf_alloc( sladata, iobs, kvars, kextr, & 
     394         &                 jpi, jpj, kstp ) 
    394395       
    395396      ! * Read obs/positions, QC, all variable and assign to sladata 
  • branches/2012/dev_MERCATOR_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/OBS/obs_read_sst.F90

    r2287 r3586  
    326326         &               iindx   ) 
    327327       
    328       CALL obs_surf_alloc( sstdata, iobs, kvars, kextr, kstp ) 
     328      CALL obs_surf_alloc( sstdata, iobs, kvars, kextr, kstp, jpi, jpj ) 
    329329       
    330330      ! * Read obs/positions, QC, all variable and assign to sstdata 
     
    701701      ! Allocate obs_surf data structure for time sorted data 
    702702          
    703       CALL obs_surf_alloc( sstdata, inumobs, kvars, kextra, kstp ) 
     703      CALL obs_surf_alloc( sstdata, inumobs, kvars, kextra, kstp, jpi, jpj ) 
    704704 
    705705      pjul = pjulini + 1 
  • branches/2012/dev_MERCATOR_2012_rev3555/NEMOGCM/NEMO/OPA_SRC/OBS/obs_surf_def.F90

    r2287 r3586  
    4747      INTEGER :: nextra     !: Number of extra fields at observation points 
    4848      INTEGER :: nstp       !: Number of time steps 
     49      INTEGER :: npi        !: Number of 3D grid points 
     50      INTEGER :: npj 
    4951      INTEGER :: nsurfup    !: Observation counter used in obs_oper 
    5052 
     
    7981         & rext           !: Extra fields interpolated to observation points 
    8082 
     83      REAL(KIND=wp), POINTER, DIMENSION(:,:) :: & 
     84         & vdmean         !: Time averaged of model field 
     85 
    8186      ! Arrays with size equal to the number of time steps in the window 
    8287 
     
    103108CONTAINS 
    104109    
    105    SUBROUTINE obs_surf_alloc( surf, ksurf, kvar, kextra, kstp ) 
     110   SUBROUTINE obs_surf_alloc( surf, ksurf, kvar, kextra, kstp, kpi, kpj ) 
    106111      !!---------------------------------------------------------------------- 
    107112      !!                     ***  ROUTINE obs_surf_alloc  *** 
     
    120125      INTEGER, INTENT(IN) :: kextra  ! Number of extra fields at observation points 
    121126      INTEGER, INTENT(IN) :: kstp    ! Number of time steps 
     127      INTEGER, INTENT(IN) :: kpi     ! Number of 3D grid points 
     128      INTEGER, INTENT(IN) :: kpj 
    122129 
    123130      !!* Local variables 
     
    131138      surf%nvar     = kvar 
    132139      surf%nstp     = kstp 
     140      surf%npi      = kpi 
     141      surf%npj      = kpj 
    133142       
    134143      ! Allocate arrays of number of surface data size 
     
    174183         & ) 
    175184 
     185      ! Allocate arrays of size number of grid points 
     186 
     187      ALLOCATE( & 
     188         & surf%vdmean(kpi,kpj) & 
     189         & ) 
     190 
    176191      ! Set defaults for compression indices 
    177192       
     
    242257         & ) 
    243258 
     259      ! Deallocate arrays of size number of grid points size times 
     260      ! number of variables 
     261 
     262      DEALLOCATE( & 
     263         & surf%vdmean & 
     264         & ) 
     265 
    244266      ! Deallocate arrays of number of time step size 
    245267 
     
    300322      IF ( lallocate ) THEN 
    301323         CALL obs_surf_alloc( newsurf,  insurf, surf%nvar, & 
    302             & surf%nextra, surf%nstp ) 
     324            & surf%nextra, surf%nstp, surf%npi, surf%npj ) 
    303325      ENDIF 
    304326 
Note: See TracChangeset for help on using the changeset viewer.