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 7837 for branches/UKMO/dev_r5785_SSS_obsoper/NEMOGCM/NEMO/OPA_SRC/OBS/obs_sstbias.F90 – NEMO

Ignore:
Timestamp:
2017-03-27T10:50:24+02:00 (7 years ago)
Author:
mattmartin
Message:

First version of generic obs oper which works at NEMO3.6 with other GO6 branches.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/UKMO/dev_r5785_SSS_obsoper/NEMOGCM/NEMO/OPA_SRC/OBS/obs_sstbias.F90

    r7773 r7837  
    4949      !! History :  
    5050      !!      ! :  2014-08 (J. While) Bias correction code for SST obs, 
    51       !!      !                      based on obs_rea_altbias 
     51      !!      !                       based on obs_rea_altbias 
    5252      !!---------------------------------------------------------------------- 
    5353      !! * Modules used 
     
    6969      INTEGER :: jpisstbias   ! Number of grid point in latitude for the bias 
    7070      INTEGER :: jpjsstbias   ! Number of grid point in longitude for the bias 
    71       INTEGER :: iico         ! Grid point indices 
    72       INTEGER :: ijco 
    7371      INTEGER :: jt 
    7472      INTEGER :: i_nx_id      ! Index to read the NetCDF file 
     
    129127         CALL iom_open( cl_bias_files(jtype), numsstbias, ldstop=.FALSE. ) 
    130128 
    131          IF (numsstbias .GT. 0) THEN 
     129         IF (numsstbias > 0) THEN 
    132130      
    133131            !Read the bias type from the file 
     
    137135            iret=NF90_OPEN(TRIM(cl_bias_files(jtype)), NF90_NOWRITE, incfile) 
    138136            iret=NF90_GET_ATT( incfile, NF90_GLOBAL, "SST_source", & 
    139                               ifile_source ) 
     137                               ifile_source ) 
    140138            ibiastypes(jtype) = ifile_source                  
    141139            iret=NF90_CLOSE(incfile)        
     
    151149            ! Close the file 
    152150            CALL iom_close(numsstbias) 
    153       
     151            IF ( lwp ) WRITE(numout,*) 'Read in bias for type: ',ibiastypes(jtype) 
    154152         ELSE 
    155153            CALL ctl_stop('obs_read_sstbias: File '// &  
     
    178176      END DO 
    179177 
    180       CALL obs_int_comm_2d( 2, 2, sstdata%nsurf, & 
     178      CALL obs_int_comm_2d( 2, 2, sstdata%nsurf, jpi, jpj, & 
    181179         &                  igrdi, igrdj, glamt, zglam ) 
    182       CALL obs_int_comm_2d( 2, 2, sstdata%nsurf, & 
     180      CALL obs_int_comm_2d( 2, 2, sstdata%nsurf, jpi, jpj, & 
    183181         &                  igrdi, igrdj, gphit, zgphi ) 
    184       CALL obs_int_comm_2d( 2, 2, sstdata%nsurf, & 
     182      CALL obs_int_comm_2d( 2, 2, sstdata%nsurf, jpi, jpj, & 
    185183         &                  igrdi, igrdj, tmask(:,:,1), zmask ) 
    186184 
    187185      DO jtype = 1, knumtypes 
    188186          
    189          !Find the number observations of type 
    190          !and alllocate tempory arrays 
     187         !Find the number observations of this type 
     188         !and allocate tempory arrays 
    191189         inumtype = COUNT( sstdata%ntyp(:) == ibiastypes(jtype) ) 
    192190 
     
    199197            & zbias( 2,2,inumtype ) ) 
    200198 
     199         IF ( lwp ) WRITE(numout,*) 'Number of obs of type: ',ibiastypes(jtype),' is: ',inumtype 
     200          
    201201         jt=1 
    202202         DO jobs = 1, sstdata%nsurf  
     
    207207               zglam_tmp(:,:,jt) = zglam(:,:,jobs) 
    208208               zgphi_tmp(:,:,jt) = zgphi(:,:,jobs) 
    209                zgphi_tmp(:,:,jt) = zgphi(:,:,jobs) 
    210209               zmask_tmp(:,:,jt) = zmask(:,:,jobs) 
    211210 
     
    215214         END DO 
    216215                          
    217          CALL obs_int_comm_2d( 2, 2, inumtype, & 
     216         CALL obs_int_comm_2d( 2, 2, inumtype, jpi, jpj,       & 
    218217               &           igrdi_tmp(:,:,:), igrdj_tmp(:,:,:), & 
    219218               &           z_sstbias(:,:,jtype), zbias(:,:,:) ) 
     
    225224               zlam = sstdata%rlam(jobs) 
    226225               zphi = sstdata%rphi(jobs) 
    227                iico = sstdata%mi(jobs) 
    228                ijco = sstdata%mj(jobs)          
    229  
    230                CALL obs_int_h2d_init( 1, 1, k2dint, zlam, zphi,         & 
    231                   &                   zglam_tmp(:,:,jt), & 
    232                   &                   zgphi_tmp(:,:,jt), & 
     226 
     227               CALL obs_int_h2d_init( 1, 1, k2dint, zlam, zphi,             & 
     228                  &                   zglam_tmp(:,:,jt), zgphi_tmp(:,:,jt), & 
    233229                  &                   zmask_tmp(:,:,jt), zweig, zobsmask ) 
    234230 
     
    236232 
    237233               ! adjust sst with bias field 
    238                sstdata%robs(jobs,1) = & 
    239                   &    sstdata%robs(jobs,1) - zext(1) 
     234               sstdata%robs(jobs,1) = sstdata%robs(jobs,1) - zext(1) 
    240235 
    241236               jt=jt+1 
     
    243238            ENDIF 
    244239         END DO  
    245                 
     240 
     241         IF ( lwp ) THEN 
     242            WRITE(numout,*) 'Applied bias to obs of type: ',ibiastypes(jtype) 
     243            WRITE(numout,*) 'Max/min of bias: ', maxval(zbias(:,:,:)), minval(zbias(:,:,:)) 
     244         ENDIF 
     245 
    246246         !Deallocate arrays 
    247247         DEALLOCATE( & 
Note: See TracChangeset for help on using the changeset viewer.