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 6855 for branches/UKMO/dev_r4650_general_vert_coord_obsoper_surf_bgc/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90 – NEMO

Ignore:
Timestamp:
2016-08-08T14:55:55+02:00 (8 years ago)
Author:
dford
Message:

Initial implementation of observation operator for SPM.

File:
1 edited

Legend:

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

    r6854 r6855  
    3131   USE obs_read_vel             ! Reading and allocation of velocity component observations 
    3232   USE obs_read_logchl          ! Reading and allocation of logchl observations 
     33   USE obs_read_spm             ! Reading and allocation of spm observations 
    3334   USE obs_prep                 ! Preparation of obs. (grid search etc). 
    3435   USE obs_oper                 ! Observation operators 
     
    4344   USE obs_seaice               ! Sea Ice data storage 
    4445   USE obs_logchl               ! logchl data storage 
     46   USE obs_spm                  ! spm data storage 
    4547   USE obs_types                ! Definitions for observation types 
    4648   USE mpp_map                  ! MPP mapping 
     
    8688   LOGICAL, PUBLIC :: ln_logchl      !: Logical switch for log10(chlorophyll) 
    8789   LOGICAL, PUBLIC :: ln_logchlfb    !: Logical switch for logchl from feedback files 
     90   LOGICAL, PUBLIC :: ln_spm         !: Logical switch for spm 
     91   LOGICAL, PUBLIC :: ln_spmfb       !: Logical switch for spm from feedback files 
    8892   LOGICAL, PUBLIC :: ln_ssh         !: Logical switch for sea surface height 
    8993   LOGICAL, PUBLIC :: ln_sss         !: Logical switch for sea surface salinity 
     
    171175      CHARACTER(len=128) :: logchlfiles(MaxNumFiles) 
    172176      CHARACTER(len=128) :: logchlfbfiles(MaxNumFiles) 
     177      CHARACTER(len=128) :: spmfiles(MaxNumFiles) 
     178      CHARACTER(len=128) :: spmfbfiles(MaxNumFiles) 
    173179      CHARACTER(LEN=128) :: reysstname 
    174180      CHARACTER(LEN=12)  :: reysstfmt 
     
    197203         &            ln_logchl, ln_logchlfb,                         & 
    198204         &            logchlfiles, logchlfbfiles,                     & 
     205         &            ln_spm, ln_spmfb,                               & 
     206         &            spmfiles, spmfbfiles,                           & 
    199207         &            ln_profb_enatim, ln_ignmis, ln_cl4,             & 
    200208         &            ln_sstbias, sstbias_files 
     
    220228      INTEGER :: jnumlogchl 
    221229      INTEGER :: jnumlogchlfb 
     230      INTEGER :: jnumspm 
     231      INTEGER :: jnumspmfb 
    222232      INTEGER :: ji 
    223233      INTEGER :: jset 
     
    231241      ln_logchl   = .FALSE. 
    232242      ln_logchlfb = .FALSE. 
     243      ln_spm      = .FALSE. 
     244      ln_spmfb    = .FALSE. 
    233245       
    234246      !Initalise all values in namelist arrays 
     
    253265      logchlfiles(:) = '' 
    254266      logchlfbfiles(:) = '' 
     267      spmfiles(:) = '' 
     268      spmfbfiles(:) = '' 
    255269      sstbias_files(:) = '' 
    256270      endailyavtypes(:) = -1 
     
    361375         WHERE (logchlfbfiles(:) /= '') lmask(:) = .TRUE. 
    362376         jnumlogchlfb = COUNT(lmask) 
     377      ENDIF 
     378      IF (ln_spm) THEN 
     379         lmask(:) = .FALSE. 
     380         WHERE (spmfiles(:) /= '') lmask(:) = .TRUE. 
     381         jnumspm = COUNT(lmask) 
     382      ENDIF 
     383      IF (ln_spmfb) THEN 
     384         lmask(:) = .FALSE. 
     385         WHERE (spmfbfiles(:) /= '') lmask(:) = .TRUE. 
     386         jnumspmfb = COUNT(lmask) 
    363387      ENDIF 
    364388       
     
    394418         WRITE(numout,*) '             Logical switch for logchl observations          ln_logchl = ', ln_logchl 
    395419         WRITE(numout,*) '             Logical switch for feedback logchl data       ln_logchlfb = ', ln_logchlfb 
     420         WRITE(numout,*) '             Logical switch for spm observations                ln_spm = ', ln_spm 
     421         WRITE(numout,*) '             Logical switch for feedback spm data             ln_spmfb = ', ln_spmfb 
    396422         WRITE(numout,*) '             Global distribtion of observations         ln_grid_global = ',ln_grid_global 
    397423         WRITE(numout,*) & 
     
    502528               WRITE(numout,'(1X,2A)') '        Feedback logchl input observation file name  logchlfbfiles = ', & 
    503529                  TRIM(logchlfbfiles(ji)) 
     530            END DO 
     531         ENDIF 
     532         IF (ln_spm) THEN 
     533            DO ji = 1, jnumspm 
     534               WRITE(numout,'(1X,2A)') '             spm input observation file name              spmfiles = ', & 
     535                  TRIM(spmfiles(ji)) 
     536            END DO 
     537         ENDIF 
     538         IF (ln_spmfb) THEN 
     539            DO ji = 1, jnumspmfb 
     540               WRITE(numout,'(1X,2A)') '             Feedback spm input observation file name   spmfbfiles = ', & 
     541                  TRIM(spmfbfiles(ji)) 
    504542            END DO 
    505543         ENDIF 
     
    538576         & ( .NOT. ln_vel3d ).AND.                                         & 
    539577         & ( .NOT. ln_ssh ).AND.( .NOT. ln_sst ).AND.( .NOT. ln_sss ).AND. & 
    540          & ( .NOT. ln_seaice ).AND.( .NOT. ln_vel3d ).AND.( .NOT. ln_logchl ) ) THEN 
     578         & ( .NOT. ln_seaice ).AND.( .NOT. ln_vel3d ).AND.( .NOT. ln_logchl ).AND. & 
     579         & ( .NOT. ln_spm ) ) THEN 
    541580         IF(lwp) WRITE(numout,cform_war) 
    542581         IF(lwp) WRITE(numout,*) ' key_diaobs is activated but logical flags', & 
    543582            &                    ' ln_t3d, ln_s3d, ln_sla, ln_ssh, ln_sst, ln_sss, ln_seaice, ln_vel3d,', & 
    544             &                    ' ln_logchl are all set to .FALSE.' 
     583            &                    ' ln_logchl, ln_spm are all set to .FALSE.' 
    545584         nwarn = nwarn + 1 
    546585      ENDIF 
     
    10951134  
    10961135      ENDIF 
     1136 
     1137      !  - spm 
     1138       
     1139      IF ( ln_spm ) THEN 
     1140 
     1141         ! Set the number of variables for spm to 1 
     1142         nspmvars = 1 
     1143 
     1144         ! Set the number of extra variables for spm to 0 
     1145         nspmextr = 0 
     1146          
     1147         IF ( ln_spmfb ) THEN 
     1148            nspmsets = jnumspmfb 
     1149         ELSE 
     1150            nspmsets = 1 
     1151         ENDIF 
     1152 
     1153         ALLOCATE(spmdata(nspmsets)) 
     1154         ALLOCATE(spmdatqc(nspmsets)) 
     1155         spmdata(:)%nsurf=0 
     1156         spmdatqc(:)%nsurf=0 
     1157 
     1158         nspmsets = 0 
     1159 
     1160         IF ( ln_spmfb ) THEN             ! Feedback file format 
     1161 
     1162            DO jset = 1, jnumspmfb 
     1163             
     1164               nspmsets = nspmsets + 1 
     1165 
     1166               CALL obs_rea_spm( 0, spmdata(nspmsets), 1, & 
     1167                  &                 spmfbfiles(jset:jset), & 
     1168                  &                 nspmvars, nspmextr, nitend-nit000+2, & 
     1169                  &                 dobsini, dobsend, ln_ignmis, .FALSE. ) 
     1170 
     1171               CALL obs_pre_spm( spmdata(nspmsets), spmdatqc(nspmsets), & 
     1172                  &                 ln_spm, ln_nea ) 
     1173             
     1174            ENDDO 
     1175 
     1176         ELSE                              ! Original file format 
     1177 
     1178            nspmsets = nspmsets + 1 
     1179 
     1180            CALL obs_rea_spm( 1, spmdata(nspmsets), jnumspm, & 
     1181               &                 spmfiles(1:jnumspm), & 
     1182               &                 nspmvars, nspmextr, nitend-nit000+2, & 
     1183               &                 dobsini, dobsend, ln_ignmis, .FALSE. ) 
     1184 
     1185            CALL obs_pre_spm( spmdata(nspmsets), spmdatqc(nspmsets), & 
     1186               &                 ln_spm, ln_nea ) 
     1187 
     1188         ENDIF 
     1189  
     1190      ENDIF 
    10971191      
    10981192   END SUBROUTINE dia_obs_init 
     
    11131207      !!               - Velocity component (U,V) profiles 
    11141208      !!               - Sea surface log10(chlorophyll) 
     1209      !!               - Sea surface spm 
    11151210      !! 
    11161211      !! ** Action  :  
     
    11611256      !USE ???                           ! ERSEM chlorophyll 
    11621257#endif 
     1258#if defined key_spm 
     1259      USE par_spm, ONLY: &              ! ERSEM/SPM sediments 
     1260         & jp_spm 
     1261#endif 
    11631262      IMPLICIT NONE 
    11641263 
     
    11731272      INTEGER :: jveloset               ! velocity profile data loop variable 
    11741273      INTEGER :: jlogchlset             ! logchl data set loop variable 
     1274      INTEGER :: jspmset                ! spm data set loop variable 
    11751275      INTEGER :: jvar                   ! Variable number     
    11761276#if ! defined key_lim2 && ! defined key_lim3 
     
    11821282      REAL(wp), DIMENSION(jpi,jpj) :: & 
    11831283         maskchl                        ! array for special chlorophyll mask 
     1284      REAL(wp), DIMENSION(jpi,jpj) :: & 
     1285         spm                            ! array for spm 
     1286      INTEGER :: jn                     ! loop index 
    11841287      CHARACTER(LEN=20) :: datestr=" ",timestr=" " 
    11851288  
     
    13241427      ENDIF  
    13251428 
     1429      IF ( ln_spm ) THEN 
     1430#if defined key_spm 
     1431         spm(:,:) = 0.0 
     1432         DO jn = 1, jp_spm 
     1433            spm(:,:) = spm(:,:) + trn(:,:,1,jn)   ! sum SPM sizes 
     1434         END DO 
     1435#else 
     1436         CALL ctl_stop( ' Trying to run spm observation operator', & 
     1437            &           ' but no spm model appears to have been defined' ) 
     1438#endif 
     1439 
     1440         DO jspmset = 1, nspmsets 
     1441             CALL obs_spm_opt( spmdatqc(jspmset),                & 
     1442               &               kstp, jpi, jpj, nit000, spm(:,:), & 
     1443               &               tmask(:,:,1), n2dint ) 
     1444         END DO          
     1445      ENDIF 
     1446 
    13261447#if ! defined key_lim2 && ! defined key_lim3 
    13271448      CALL wrk_dealloc(jpi,jpj,frld)  
     
    13571478      INTEGER :: jseaiceset               ! Sea Ice data set loop variable 
    13581479      INTEGER :: jlogchlset               ! logchl data set loop variable 
     1480      INTEGER :: jspmset                  ! spm data set loop variable 
    13591481      INTEGER :: jset 
    13601482      INTEGER :: jfbini 
     
    16281750            WRITE(cdtmp,'(A,I2.2)')'logchlfb_',jlogchlset 
    16291751            CALL obs_wri_logchl( cdtmp, logchldata(jlogchlset) ) 
     1752 
     1753         END DO 
     1754 
     1755      ENDIF 
     1756 
     1757      !  - spm 
     1758      IF ( ln_spm ) THEN 
     1759 
     1760         ! Copy data from spmdatqc to spmdata structures 
     1761         DO jspmset = 1, nspmsets 
     1762 
     1763            CALL obs_surf_decompress( spmdatqc(jspmset), & 
     1764                 &                    spmdata(jspmset), .TRUE., numout ) 
     1765 
     1766         END DO 
     1767 
     1768         ! Write the spm data 
     1769         DO jspmset = 1, nspmsets 
     1770       
     1771            WRITE(cdtmp,'(A,I2.2)')'spmfb_',jspmset 
     1772            CALL obs_wri_spm( cdtmp, spmdata(jspmset) ) 
    16301773 
    16311774         END DO 
Note: See TracChangeset for help on using the changeset viewer.