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

Ignore:
Timestamp:
2016-08-08T12:26:45+02:00 (8 years ago)
Author:
dford
Message:

Initial implementation of observation operator for LogChl?.

File:
1 edited

Legend:

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

    r6406 r6854  
    2121   USE par_oce 
    2222   USE dom_oce                  ! Ocean space and time domain variables 
     23   USE obs_const, ONLY: obfillflt ! Fill value 
    2324   USE obs_fbm, ONLY: ln_cl4    ! Class 4 diagnostic switch 
    2425   USE obs_read_prof            ! Reading and allocation of observations (Coriolis) 
     
    2930   USE obs_read_seaice          ! Reading and allocation of Sea Ice observations   
    3031   USE obs_read_vel             ! Reading and allocation of velocity component observations 
     32   USE obs_read_logchl          ! Reading and allocation of logchl observations 
    3133   USE obs_prep                 ! Preparation of obs. (grid search etc). 
    3234   USE obs_oper                 ! Observation operators 
     
    4042   USE obs_sst                  ! SST data storage 
    4143   USE obs_seaice               ! Sea Ice data storage 
     44   USE obs_logchl               ! logchl data storage 
    4245   USE obs_types                ! Definitions for observation types 
    4346   USE mpp_map                  ! MPP mapping 
     
    8184   LOGICAL, PUBLIC :: ln_velhradcp   !: Logical switch for raw high freq netCDF ADCP vel. data  
    8285   LOGICAL, PUBLIC :: ln_velfb       !: Logical switch for velocities from feedback files 
     86   LOGICAL, PUBLIC :: ln_logchl      !: Logical switch for log10(chlorophyll) 
     87   LOGICAL, PUBLIC :: ln_logchlfb    !: Logical switch for logchl from feedback files 
    8388   LOGICAL, PUBLIC :: ln_ssh         !: Logical switch for sea surface height 
    8489   LOGICAL, PUBLIC :: ln_sss         !: Logical switch for sea surface salinity 
     
    164169      CHARACTER(len=128) :: velhradcpfiles(MaxNumFiles) 
    165170      CHARACTER(len=128) :: velfbfiles(MaxNumFiles) 
     171      CHARACTER(len=128) :: logchlfiles(MaxNumFiles) 
     172      CHARACTER(len=128) :: logchlfbfiles(MaxNumFiles) 
    166173      CHARACTER(LEN=128) :: reysstname 
    167174      CHARACTER(LEN=12)  :: reysstfmt 
     
    188195         &            ln_velhradcp, velhradcpfiles,                   & 
    189196         &            ln_velfb, velfbfiles, ln_velfb_av,              & 
     197         &            ln_logchl, ln_logchlfb,                         & 
     198         &            logchlfiles, logchlfbfiles,                     & 
    190199         &            ln_profb_enatim, ln_ignmis, ln_cl4,             & 
    191200         &            ln_sstbias, sstbias_files 
     
    209218      INTEGER :: jnumvelhradcp    
    210219      INTEGER :: jnumvelfb 
     220      INTEGER :: jnumlogchl 
     221      INTEGER :: jnumlogchlfb 
    211222      INTEGER :: ji 
    212223      INTEGER :: jset 
     
    217228      ! Read namelist parameters 
    218229      !----------------------------------------------------------------------- 
     230 
     231      ln_logchl   = .FALSE. 
     232      ln_logchlfb = .FALSE. 
    219233       
    220234      !Initalise all values in namelist arrays 
     
    237251      velcurfiles(:) = '' 
    238252      veladcpfiles(:) = '' 
     253      logchlfiles(:) = '' 
     254      logchlfbfiles(:) = '' 
    239255      sstbias_files(:) = '' 
    240256      endailyavtypes(:) = -1 
     
    335351         jnumvelfb = COUNT(lmask) 
    336352         lmask(:) = .FALSE. 
     353      ENDIF 
     354      IF (ln_logchl) THEN 
     355         lmask(:) = .FALSE. 
     356         WHERE (logchlfiles(:) /= '') lmask(:) = .TRUE. 
     357         jnumlogchl = COUNT(lmask) 
     358      ENDIF 
     359      IF (ln_logchlfb) THEN 
     360         lmask(:) = .FALSE. 
     361         WHERE (logchlfbfiles(:) /= '') lmask(:) = .TRUE. 
     362         jnumlogchlfb = COUNT(lmask) 
    337363      ENDIF 
    338364       
     
    366392         WRITE(numout,*) '             Logical switch for velocity high freq. ADCP  ln_velhradcp = ', ln_velhradcp 
    367393         WRITE(numout,*) '             Logical switch for feedback velocity data        ln_velfb = ', ln_velfb 
     394         WRITE(numout,*) '             Logical switch for logchl observations          ln_logchl = ', ln_logchl 
     395         WRITE(numout,*) '             Logical switch for feedback logchl data       ln_logchlfb = ', ln_logchlfb 
    368396         WRITE(numout,*) '             Global distribtion of observations         ln_grid_global = ',ln_grid_global 
    369397         WRITE(numout,*) & 
     
    462490                     TRIM(velfbfiles(ji)) 
    463491               ENDIF 
     492            END DO 
     493         ENDIF 
     494         IF (ln_logchl) THEN 
     495            DO ji = 1, jnumlogchl 
     496               WRITE(numout,'(1X,2A)') '             logchl input observation file name        logchlfiles = ', & 
     497                  TRIM(logchlfiles(ji)) 
     498            END DO 
     499         ENDIF 
     500         IF (ln_logchlfb) THEN 
     501            DO ji = 1, jnumlogchlfb 
     502               WRITE(numout,'(1X,2A)') '        Feedback logchl input observation file name  logchlfbfiles = ', & 
     503                  TRIM(logchlfbfiles(ji)) 
    464504            END DO 
    465505         ENDIF 
     
    498538         & ( .NOT. ln_vel3d ).AND.                                         & 
    499539         & ( .NOT. ln_ssh ).AND.( .NOT. ln_sst ).AND.( .NOT. ln_sss ).AND. & 
    500          & ( .NOT. ln_seaice ).AND.( .NOT. ln_vel3d ) ) THEN 
     540         & ( .NOT. ln_seaice ).AND.( .NOT. ln_vel3d ).AND.( .NOT. ln_logchl ) ) THEN 
    501541         IF(lwp) WRITE(numout,cform_war) 
    502542         IF(lwp) WRITE(numout,*) ' key_diaobs is activated but logical flags', & 
    503             &                    ' ln_t3d, ln_s3d, ln_sla, ln_ssh, ln_sst, ln_sss, ln_seaice, ln_vel3d are all set to .FALSE.' 
     543            &                    ' ln_t3d, ln_s3d, ln_sla, ln_ssh, ln_sst, ln_sss, ln_seaice, ln_vel3d,', & 
     544            &                    ' ln_logchl are all set to .FALSE.' 
    504545         nwarn = nwarn + 1 
    505546      ENDIF 
     
    9991040 
    10001041      ENDIF 
     1042 
     1043      !  - log10(chlorophyll) 
     1044       
     1045      IF ( ln_logchl ) THEN 
     1046 
     1047         ! Set the number of variables for logchl to 1 
     1048         nlogchlvars = 1 
     1049 
     1050         ! Set the number of extra variables for logchl to 0 
     1051         nlogchlextr = 0 
     1052          
     1053         IF ( ln_logchlfb ) THEN 
     1054            nlogchlsets = jnumlogchlfb 
     1055         ELSE 
     1056            nlogchlsets = 1 
     1057         ENDIF 
     1058 
     1059         ALLOCATE(logchldata(nlogchlsets)) 
     1060         ALLOCATE(logchldatqc(nlogchlsets)) 
     1061         logchldata(:)%nsurf=0 
     1062         logchldatqc(:)%nsurf=0 
     1063 
     1064         nlogchlsets = 0 
     1065 
     1066         IF ( ln_logchlfb ) THEN             ! Feedback file format 
     1067 
     1068            DO jset = 1, jnumlogchlfb 
     1069             
     1070               nlogchlsets = nlogchlsets + 1 
     1071 
     1072               CALL obs_rea_logchl( 0, logchldata(nlogchlsets), 1, & 
     1073                  &                 logchlfbfiles(jset:jset), & 
     1074                  &                 nlogchlvars, nlogchlextr, nitend-nit000+2, & 
     1075                  &                 dobsini, dobsend, ln_ignmis, .FALSE. ) 
     1076 
     1077               CALL obs_pre_logchl( logchldata(nlogchlsets), logchldatqc(nlogchlsets), & 
     1078                  &                 ln_logchl, ln_nea ) 
     1079             
     1080            ENDDO 
     1081 
     1082         ELSE                              ! Original file format 
     1083 
     1084            nlogchlsets = nlogchlsets + 1 
     1085 
     1086            CALL obs_rea_logchl( 1, logchldata(nlogchlsets), jnumlogchl, & 
     1087               &                 logchlfiles(1:jnumlogchl), & 
     1088               &                 nlogchlvars, nlogchlextr, nitend-nit000+2, & 
     1089               &                 dobsini, dobsend, ln_ignmis, .FALSE. ) 
     1090 
     1091            CALL obs_pre_logchl( logchldata(nlogchlsets), logchldatqc(nlogchlsets), & 
     1092               &                 ln_logchl, ln_nea ) 
     1093 
     1094         ENDIF 
     1095  
     1096      ENDIF 
    10011097      
    10021098   END SUBROUTINE dia_obs_init 
     
    10161112      !!               - Sea surface salinity 
    10171113      !!               - Velocity component (U,V) profiles 
     1114      !!               - Sea surface log10(chlorophyll) 
    10181115      !! 
    10191116      !! ** Action  :  
     
    10531150         & frld 
    10541151#endif 
     1152#if defined key_hadocc 
     1153      USE trc, ONLY :  &                ! HadOCC chlorophyll 
     1154         & HADOCC_CHL, & 
     1155         & HADOCC_FILL_FLT 
     1156#elif defined key_medusa && defined key_foam_medusa 
     1157      USE trc, ONLY :  &                ! MEDUSA chlorophyll 
     1158         & MEDUSA_CHL, & 
     1159         & MEDUSA_FILL_FLT 
     1160#elif defined key_fabm 
     1161      !USE ???                           ! ERSEM chlorophyll 
     1162#endif 
    10551163      IMPLICIT NONE 
    10561164 
     
    10641172      INTEGER :: jseaiceset             ! sea ice data set loop variable 
    10651173      INTEGER :: jveloset               ! velocity profile data loop variable 
     1174      INTEGER :: jlogchlset             ! logchl data set loop variable 
    10661175      INTEGER :: jvar                   ! Variable number     
    10671176#if ! defined key_lim2 && ! defined key_lim3 
    10681177      REAL(wp), POINTER, DIMENSION(:,:) :: frld    
    10691178#endif 
     1179      REAL(wp) :: tiny                  ! small number 
     1180      REAL(wp), DIMENSION(jpi,jpj) :: & 
     1181         logchl                         ! array for log chlorophyll 
     1182      REAL(wp), DIMENSION(jpi,jpj) :: & 
     1183         maskchl                        ! array for special chlorophyll mask 
    10701184      CHARACTER(LEN=20) :: datestr=" ",timestr=" " 
    10711185  
     
    11771291      ENDIF 
    11781292 
     1293      IF ( ln_logchl ) THEN 
     1294 
     1295#if defined key_hadocc 
     1296         logchl(:,:)  = HADOCC_CHL(:,:,1)    ! (not log) chlorophyll from HadOCC 
     1297#elif defined key_medusa && defined key_foam_medusa 
     1298         logchl(:,:)  = MEDUSA_CHL(:,:,1)    ! (not log) chlorophyll from HadOCC 
     1299#elif defined key_fabm 
     1300         !logchl(:,:)  =  ???                 ! (not log) chlorophyll from ERSEM 
     1301         CALL ctl_stop( ' Trying to run logchl observation operator', & 
     1302            &           ' but not properly implemented for FABM-ERSEM yet' ) 
     1303#else 
     1304         CALL ctl_stop( ' Trying to run logchl observation operator', & 
     1305            &           ' but no biogeochemical model appears to have been defined' ) 
     1306#endif 
     1307 
     1308         maskchl(:,:) = tmask(:,:,1)         ! create a special mask to exclude certain things 
     1309 
     1310         ! Take the log10 where we can, otherwise exclude 
     1311         tiny = 1.0e-20 
     1312         WHERE(logchl(:,:) > tiny .AND. logchl(:,:) /= obfillflt ) 
     1313            logchl(:,:)  = LOG10(logchl(:,:)) 
     1314         ELSEWHERE 
     1315            logchl(:,:)  = obfillflt 
     1316            maskchl(:,:) = 0 
     1317         END WHERE 
     1318 
     1319         DO jlogchlset = 1, nlogchlsets 
     1320             CALL obs_logchl_opt( logchldatqc(jlogchlset),             & 
     1321               &                  kstp, jpi, jpj, nit000, logchl(:,:), & 
     1322               &                  maskchl(:,:), n2dint ) 
     1323         END DO          
     1324      ENDIF  
     1325 
    11791326#if ! defined key_lim2 && ! defined key_lim3 
    11801327      CALL wrk_dealloc(jpi,jpj,frld)  
     
    12091356      INTEGER :: jsstset                  ! SST data set loop variable 
    12101357      INTEGER :: jseaiceset               ! Sea Ice data set loop variable 
     1358      INTEGER :: jlogchlset               ! logchl data set loop variable 
    12111359      INTEGER :: jset 
    12121360      INTEGER :: jfbini 
     
    14531601         ENDIF 
    14541602          
     1603      ENDIF 
     1604 
     1605      !  - log10(chlorophyll) 
     1606      IF ( ln_logchl ) THEN 
     1607 
     1608         ! Copy data from logchldatqc to logchldata structures 
     1609         DO jlogchlset = 1, nlogchlsets 
     1610 
     1611            CALL obs_surf_decompress( logchldatqc(jlogchlset), & 
     1612                 &                    logchldata(jlogchlset), .TRUE., numout ) 
     1613 
     1614         END DO 
     1615          
     1616         ! Mark as bad observations with no valid model counterpart due to activities in dia_obs 
     1617         ! Seem to need to set to fill value rather than marking as bad to be effective, so do both 
     1618         DO jlogchlset = 1, nlogchlsets 
     1619            WHERE ( logchldata(jlogchlset)%rmod(:,1) == obfillflt ) 
     1620               logchldata(jlogchlset)%nqc(:)    = 1 
     1621               logchldata(jlogchlset)%robs(:,1) = obfillflt 
     1622            END WHERE 
     1623         END DO 
     1624 
     1625         ! Write the logchl data 
     1626         DO jlogchlset = 1, nlogchlsets 
     1627       
     1628            WRITE(cdtmp,'(A,I2.2)')'logchlfb_',jlogchlset 
     1629            CALL obs_wri_logchl( cdtmp, logchldata(jlogchlset) ) 
     1630 
     1631         END DO 
     1632 
    14551633      ENDIF 
    14561634 
Note: See TracChangeset for help on using the changeset viewer.