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

Ignore:
Timestamp:
2018-01-08T13:36:41+01:00 (6 years ago)
Author:
dford
Message:

Reduce duplication of log transforms.

File:
1 edited

Legend:

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

    r9191 r9192  
    892892      INTEGER :: jvar              ! Variable number 
    893893      INTEGER :: ji, jj            ! Loop counters 
    894       REAL(wp) :: tiny                  ! small number 
     894      REAL(wp) :: tiny             ! small number 
    895895      REAL(wp), POINTER, DIMENSION(:,:,:) :: & 
    896896         & zprofvar1, &            ! Model values for 1st variable in a prof ob 
     
    907907         & zgphi1,    &            ! Model latitudes for prof variable 1 
    908908         & zgphi2                  ! Model latitudes for prof variable 2 
     909      LOGICAL :: llog10            ! Perform log10 transform of variable 
    909910 
    910911 
     
    11601161            !Defaults which might be changed 
    11611162            zsurfmask(:,:) = tmask(:,:,1) 
     1163            llog10 = .FALSE. 
    11621164 
    11631165            SELECT CASE ( TRIM(cobstypessurf(jtype)) ) 
     
    12051207                  &           ' but no biogeochemical model appears to have been defined' ) 
    12061208#endif 
    1207                zsurfmask(:,:) = tmask(:,:,1)         ! create a special mask to exclude certain things 
    1208                ! Take the log10 where we can, otherwise exclude 
    1209                tiny = 1.0e-20 
    1210                WHERE(zsurfvar(:,:) > tiny .AND. zsurfvar(:,:) /= obfillflt ) 
    1211                   zsurfvar(:,:)  = LOG10(zsurfvar(:,:)) 
    1212                ELSEWHERE 
    1213                   zsurfvar(:,:)  = obfillflt 
    1214                   zsurfmask(:,:) = 0 
    1215                END WHERE 
     1209               llog10 = .TRUE. 
    12161210 
    12171211            CASE('slchldia') 
     
    12291223                  &           ' but no biogeochemical model appears to have been defined' ) 
    12301224#endif 
    1231                zsurfmask(:,:) = tmask(:,:,1)         ! create a special mask to exclude certain things 
    1232                ! Take the log10 where we can, otherwise exclude 
    1233                tiny = 1.0e-20 
    1234                WHERE(zsurfvar(:,:) > tiny .AND. zsurfvar(:,:) /= obfillflt ) 
    1235                   zsurfvar(:,:)  = LOG10(zsurfvar(:,:)) 
    1236                ELSEWHERE 
    1237                   zsurfvar(:,:)  = obfillflt 
    1238                   zsurfmask(:,:) = 0 
    1239                END WHERE 
     1225               llog10 = .TRUE. 
    12401226 
    12411227            CASE('slchlnon') 
     
    12541240                  &           ' but no biogeochemical model appears to have been defined' ) 
    12551241#endif 
    1256                zsurfmask(:,:) = tmask(:,:,1)         ! create a special mask to exclude certain things 
    1257                ! Take the log10 where we can, otherwise exclude 
    1258                tiny = 1.0e-20 
    1259                WHERE(zsurfvar(:,:) > tiny .AND. zsurfvar(:,:) /= obfillflt ) 
    1260                   zsurfvar(:,:)  = LOG10(zsurfvar(:,:)) 
    1261                ELSEWHERE 
    1262                   zsurfvar(:,:)  = obfillflt 
    1263                   zsurfmask(:,:) = 0 
    1264                END WHERE 
     1242               llog10 = .TRUE. 
    12651243 
    12661244            CASE('slchldin') 
     
    12781256                  &           ' but no biogeochemical model appears to have been defined' ) 
    12791257#endif 
    1280                zsurfmask(:,:) = tmask(:,:,1)         ! create a special mask to exclude certain things 
    1281                ! Take the log10 where we can, otherwise exclude 
    1282                tiny = 1.0e-20 
    1283                WHERE(zsurfvar(:,:) > tiny .AND. zsurfvar(:,:) /= obfillflt ) 
    1284                   zsurfvar(:,:)  = LOG10(zsurfvar(:,:)) 
    1285                ELSEWHERE 
    1286                   zsurfvar(:,:)  = obfillflt 
    1287                   zsurfmask(:,:) = 0 
    1288                END WHERE 
     1258               llog10 = .TRUE. 
    12891259 
    12901260            CASE('slchlmic') 
     
    13021272                  &           ' but no biogeochemical model appears to have been defined' ) 
    13031273#endif 
    1304                zsurfmask(:,:) = tmask(:,:,1)         ! create a special mask to exclude certain things 
    1305                ! Take the log10 where we can, otherwise exclude 
    1306                tiny = 1.0e-20 
    1307                WHERE(zsurfvar(:,:) > tiny .AND. zsurfvar(:,:) /= obfillflt ) 
    1308                   zsurfvar(:,:)  = LOG10(zsurfvar(:,:)) 
    1309                ELSEWHERE 
    1310                   zsurfvar(:,:)  = obfillflt 
    1311                   zsurfmask(:,:) = 0 
    1312                END WHERE 
     1274               llog10 = .TRUE. 
    13131275 
    13141276            CASE('slchlnan') 
     
    13261288                  &           ' but no biogeochemical model appears to have been defined' ) 
    13271289#endif 
    1328                zsurfmask(:,:) = tmask(:,:,1)         ! create a special mask to exclude certain things 
    1329                ! Take the log10 where we can, otherwise exclude 
    1330                tiny = 1.0e-20 
    1331                WHERE(zsurfvar(:,:) > tiny .AND. zsurfvar(:,:) /= obfillflt ) 
    1332                   zsurfvar(:,:)  = LOG10(zsurfvar(:,:)) 
    1333                ELSEWHERE 
    1334                   zsurfvar(:,:)  = obfillflt 
    1335                   zsurfmask(:,:) = 0 
    1336                END WHERE 
     1290               llog10 = .TRUE. 
    13371291 
    13381292            CASE('slchlpic') 
     
    13501304                  &           ' but no biogeochemical model appears to have been defined' ) 
    13511305#endif 
    1352                zsurfmask(:,:) = tmask(:,:,1)         ! create a special mask to exclude certain things 
    1353                ! Take the log10 where we can, otherwise exclude 
    1354                tiny = 1.0e-20 
    1355                WHERE(zsurfvar(:,:) > tiny .AND. zsurfvar(:,:) /= obfillflt ) 
    1356                   zsurfvar(:,:)  = LOG10(zsurfvar(:,:)) 
    1357                ELSEWHERE 
    1358                   zsurfvar(:,:)  = obfillflt 
    1359                   zsurfmask(:,:) = 0 
    1360                END WHERE 
     1306               llog10 = .TRUE. 
    13611307 
    13621308            CASE('schltot') 
     
    13751321                  &           ' but no biogeochemical model appears to have been defined' ) 
    13761322#endif 
    1377                zsurfmask(:,:) = tmask(:,:,1)         ! create a special mask to exclude certain things 
    13781323 
    13791324            CASE('sspm') 
     
    14531398 
    14541399            END SELECT 
     1400             
     1401            IF ( llog10 ) THEN 
     1402               ! Take the log10 where we can, otherwise exclude 
     1403               tiny = 1.0e-20 
     1404               WHERE(zsurfvar(:,:) > tiny .AND. zsurfvar(:,:) /= obfillflt ) 
     1405                  zsurfvar(:,:)  = LOG10(zsurfvar(:,:)) 
     1406               ELSEWHERE 
     1407                  zsurfvar(:,:)  = obfillflt 
     1408                  zsurfmask(:,:) = 0 
     1409               END WHERE 
     1410            ENDIF 
    14551411 
    14561412            CALL obs_surf_opt( surfdataqc(jtype), kstp, jpi, jpj,       & 
Note: See TracChangeset for help on using the changeset viewer.