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 6856 for branches – NEMO

Changeset 6856 for branches


Ignore:
Timestamp:
2016-08-08T17:22:29+02:00 (8 years ago)
Author:
dford
Message:

Initial implementation of observation operator for fCO2.

Location:
branches/UKMO/dev_r4650_general_vert_coord_obsoper_surf_bgc/NEMOGCM/NEMO/OPA_SRC/OBS
Files:
4 edited
4 copied

Legend:

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

    r6855 r6856  
    3232   USE obs_read_logchl          ! Reading and allocation of logchl observations 
    3333   USE obs_read_spm             ! Reading and allocation of spm observations 
     34   USE obs_read_fco2            ! Reading and allocation of fco2 observations 
    3435   USE obs_prep                 ! Preparation of obs. (grid search etc). 
    3536   USE obs_oper                 ! Observation operators 
     
    4546   USE obs_logchl               ! logchl data storage 
    4647   USE obs_spm                  ! spm data storage 
     48   USE obs_fco2                 ! fco2 data storage 
    4749   USE obs_types                ! Definitions for observation types 
    4850   USE mpp_map                  ! MPP mapping 
     
    9092   LOGICAL, PUBLIC :: ln_spm         !: Logical switch for spm 
    9193   LOGICAL, PUBLIC :: ln_spmfb       !: Logical switch for spm from feedback files 
     94   LOGICAL, PUBLIC :: ln_fco2        !: Logical switch for fco2 
     95   LOGICAL, PUBLIC :: ln_fco2fb      !: Logical switch for fco2 from feedback files 
    9296   LOGICAL, PUBLIC :: ln_ssh         !: Logical switch for sea surface height 
    9397   LOGICAL, PUBLIC :: ln_sss         !: Logical switch for sea surface salinity 
     
    177181      CHARACTER(len=128) :: spmfiles(MaxNumFiles) 
    178182      CHARACTER(len=128) :: spmfbfiles(MaxNumFiles) 
     183      CHARACTER(len=128) :: fco2files(MaxNumFiles) 
     184      CHARACTER(len=128) :: fco2fbfiles(MaxNumFiles) 
    179185      CHARACTER(LEN=128) :: reysstname 
    180186      CHARACTER(LEN=12)  :: reysstfmt 
     
    205211         &            ln_spm, ln_spmfb,                               & 
    206212         &            spmfiles, spmfbfiles,                           & 
     213         &            ln_fco2, ln_fco2fb,                             & 
     214         &            fco2files, fco2fbfiles,                         & 
    207215         &            ln_profb_enatim, ln_ignmis, ln_cl4,             & 
    208216         &            ln_sstbias, sstbias_files 
     
    230238      INTEGER :: jnumspm 
    231239      INTEGER :: jnumspmfb 
     240      INTEGER :: jnumfco2 
     241      INTEGER :: jnumfco2fb 
    232242      INTEGER :: ji 
    233243      INTEGER :: jset 
     
    243253      ln_spm      = .FALSE. 
    244254      ln_spmfb    = .FALSE. 
     255      ln_fco2     = .FALSE. 
     256      ln_fco2fb   = .FALSE. 
    245257       
    246258      !Initalise all values in namelist arrays 
     
    267279      spmfiles(:) = '' 
    268280      spmfbfiles(:) = '' 
     281      fco2files(:) = '' 
     282      fco2fbfiles(:) = '' 
    269283      sstbias_files(:) = '' 
    270284      endailyavtypes(:) = -1 
     
    385399         WHERE (spmfbfiles(:) /= '') lmask(:) = .TRUE. 
    386400         jnumspmfb = COUNT(lmask) 
     401      ENDIF 
     402      IF (ln_fco2) THEN 
     403         lmask(:) = .FALSE. 
     404         WHERE (fco2files(:) /= '') lmask(:) = .TRUE. 
     405         jnumfco2 = COUNT(lmask) 
     406      ENDIF 
     407      IF (ln_fco2fb) THEN 
     408         lmask(:) = .FALSE. 
     409         WHERE (fco2fbfiles(:) /= '') lmask(:) = .TRUE. 
     410         jnumfco2fb = COUNT(lmask) 
    387411      ENDIF 
    388412       
     
    420444         WRITE(numout,*) '             Logical switch for spm observations                ln_spm = ', ln_spm 
    421445         WRITE(numout,*) '             Logical switch for feedback spm data             ln_spmfb = ', ln_spmfb 
     446         WRITE(numout,*) '             Logical switch for fco2 observations              ln_fco2 = ', ln_fco2 
     447         WRITE(numout,*) '             Logical switch for feedback fco2 data           ln_fco2fb = ', ln_fco2fb 
    422448         WRITE(numout,*) '             Global distribtion of observations         ln_grid_global = ',ln_grid_global 
    423449         WRITE(numout,*) & 
     
    540566               WRITE(numout,'(1X,2A)') '             Feedback spm input observation file name   spmfbfiles = ', & 
    541567                  TRIM(spmfbfiles(ji)) 
     568            END DO 
     569         ENDIF 
     570         IF (ln_fco2) THEN 
     571            DO ji = 1, jnumfco2 
     572               WRITE(numout,'(1X,2A)') '             fco2 input observation file name  fco2files = ', & 
     573                  TRIM(fco2files(ji)) 
     574            END DO 
     575         ENDIF 
     576         IF (ln_fco2fb) THEN 
     577            DO ji = 1, jnumfco2fb 
     578               WRITE(numout,'(1X,2A)') '             Feedback fco2 input observation file name  fco2fbfiles = ', & 
     579                  TRIM(fco2fbfiles(ji)) 
    542580            END DO 
    543581         ENDIF 
     
    577615         & ( .NOT. ln_ssh ).AND.( .NOT. ln_sst ).AND.( .NOT. ln_sss ).AND. & 
    578616         & ( .NOT. ln_seaice ).AND.( .NOT. ln_vel3d ).AND.( .NOT. ln_logchl ).AND. & 
    579          & ( .NOT. ln_spm ) ) THEN 
     617         & ( .NOT. ln_spm ).AND.( .NOT. ln_fco2 ) ) THEN 
    580618         IF(lwp) WRITE(numout,cform_war) 
    581619         IF(lwp) WRITE(numout,*) ' key_diaobs is activated but logical flags', & 
    582620            &                    ' ln_t3d, ln_s3d, ln_sla, ln_ssh, ln_sst, ln_sss, ln_seaice, ln_vel3d,', & 
    583             &                    ' ln_logchl, ln_spm are all set to .FALSE.' 
     621            &                    ' ln_logchl, ln_spm, ln_fco2 are all set to .FALSE.' 
    584622         nwarn = nwarn + 1 
    585623      ENDIF 
     
    11891227  
    11901228      ENDIF 
     1229 
     1230      !  - fco2 
     1231       
     1232      IF ( ln_fco2 ) THEN 
     1233 
     1234         ! Set the number of variables for fco2 to 1 
     1235         nfco2vars = 1 
     1236 
     1237         ! Set the number of extra variables for fco2 to 0 
     1238         nfco2extr = 0 
     1239          
     1240         IF ( ln_fco2fb ) THEN 
     1241            nfco2sets = jnumfco2fb 
     1242         ELSE 
     1243            nfco2sets = 1 
     1244         ENDIF 
     1245 
     1246         ALLOCATE(fco2data(nfco2sets)) 
     1247         ALLOCATE(fco2datqc(nfco2sets)) 
     1248         fco2data(:)%nsurf=0 
     1249         fco2datqc(:)%nsurf=0 
     1250 
     1251         nfco2sets = 0 
     1252 
     1253         IF ( ln_fco2fb ) THEN             ! Feedback file format 
     1254 
     1255            DO jset = 1, jnumfco2fb 
     1256             
     1257               nfco2sets = nfco2sets + 1 
     1258 
     1259               CALL obs_rea_fco2( 0, fco2data(nfco2sets), 1, & 
     1260                  &                 fco2fbfiles(jset:jset), & 
     1261                  &                 nfco2vars, nfco2extr, nitend-nit000+2, & 
     1262                  &                 dobsini, dobsend, ln_ignmis, .FALSE. ) 
     1263 
     1264               CALL obs_pre_fco2( fco2data(nfco2sets), fco2datqc(nfco2sets), & 
     1265                  &                 ln_fco2, ln_nea ) 
     1266             
     1267            ENDDO 
     1268 
     1269         ELSE                              ! Original file format 
     1270 
     1271            nfco2sets = nfco2sets + 1 
     1272 
     1273            CALL obs_rea_fco2( 1, fco2data(nfco2sets), jnumfco2, & 
     1274               &                 fco2files(1:jnumfco2), & 
     1275               &                 nfco2vars, nfco2extr, nitend-nit000+2, & 
     1276               &                 dobsini, dobsend, ln_ignmis, .FALSE. ) 
     1277 
     1278            CALL obs_pre_fco2( fco2data(nfco2sets), fco2datqc(nfco2sets), & 
     1279               &                 ln_fco2, ln_nea ) 
     1280 
     1281         ENDIF 
     1282  
     1283      ENDIF 
    11911284      
    11921285   END SUBROUTINE dia_obs_init 
     
    12081301      !!               - Sea surface log10(chlorophyll) 
    12091302      !!               - Sea surface spm 
     1303      !!               - Sea surface fco2 
    12101304      !! 
    12111305      !! ** Action  :  
     
    12461340#endif 
    12471341#if defined key_hadocc 
    1248       USE trc, ONLY :  &                ! HadOCC chlorophyll 
     1342      USE trc, ONLY :  &                ! HadOCC chlorophyll and fCO2 
    12491343         & HADOCC_CHL, & 
     1344         & HADOCC_FCO2, & 
    12501345         & HADOCC_FILL_FLT 
    12511346#elif defined key_medusa && defined key_foam_medusa 
    1252       USE trc, ONLY :  &                ! MEDUSA chlorophyll 
     1347      USE trc, ONLY :  &                ! MEDUSA chlorophyll and fCO2 
    12531348         & MEDUSA_CHL, & 
     1349         & MEDUSA_FCO2, & 
    12541350         & MEDUSA_FILL_FLT 
    12551351#elif defined key_fabm 
    1256       !USE ???                           ! ERSEM chlorophyll 
     1352      !USE ???                           ! ERSEM chlorophyll and fCO2 
    12571353#endif 
    12581354#if defined key_spm 
     
    12731369      INTEGER :: jlogchlset             ! logchl data set loop variable 
    12741370      INTEGER :: jspmset                ! spm data set loop variable 
     1371      INTEGER :: jfco2set               ! fco2 data set loop variable 
    12751372      INTEGER :: jvar                   ! Variable number     
    12761373#if ! defined key_lim2 && ! defined key_lim3 
     
    12841381      REAL(wp), DIMENSION(jpi,jpj) :: & 
    12851382         spm                            ! array for spm 
     1383      REAL(wp), DIMENSION(jpi,jpj) :: & 
     1384         fco2                           ! array for fco2 
     1385      REAL(wp), DIMENSION(jpi,jpj) :: & 
     1386         maskfco2                       ! array for special fco2 mask 
    12861387      INTEGER :: jn                     ! loop index 
    12871388      CHARACTER(LEN=20) :: datestr=" ",timestr=" " 
     
    14451546      ENDIF 
    14461547 
     1548      IF ( ln_fco2 ) THEN 
     1549         maskfco2(:,:) = tmask(:,:,1)         ! create a special mask to exclude certain things 
     1550#if defined key_hadocc 
     1551         fco2(:,:) = HADOCC_FCO2(:,:)    ! fCO2 from HadOCC 
     1552         IF ( ( MINVAL( HADOCC_FCO2 ) == HADOCC_FILL_FLT ).AND.( MAXVAL( HADOCC_FCO2 ) == HADOCC_FILL_FLT ) ) THEN 
     1553            fco2(:,:) = obfillflt 
     1554            maskfco2(:,:) = 0 
     1555            CALL ctl_warn( ' HadOCC fCO2 values masked out for observation operator', & 
     1556               &           ' on timestep ' // TRIM(STR(kstp)),                              & 
     1557               &           ' as HADOCC_FCO2(:,:) == HADOCC_FILL_FLT' ) 
     1558         ENDIF 
     1559#elif defined key_medusa && defined key_foam_medusa 
     1560         fco2(:,:) = MEDUSA_FCO2(:,:)    ! fCO2 from MEDUSA 
     1561         IF ( ( MINVAL( MEDUSA_FCO2 ) == MEDUSA_FILL_FLT ).AND.( MAXVAL( MEDUSA_FCO2 ) == MEDUSA_FILL_FLT ) ) THEN 
     1562            fco2(:,:) = obfillflt 
     1563            maskfco2(:,:) = 0 
     1564            CALL ctl_warn( ' MEDUSA fCO2 values masked out for observation operator', & 
     1565               &           ' on timestep ' // TRIM(STR(kstp)),                              & 
     1566               &           ' as MEDUSA_FCO2(:,:) == MEDUSA_FILL_FLT' ) 
     1567         ENDIF 
     1568#elif defined key_fabm 
     1569         !fco2(:,:)  =  ???                 ! fCO2 from ERSEM 
     1570         CALL ctl_stop( ' Trying to run fco2 observation operator', & 
     1571            &           ' but not properly implemented for FABM-ERSEM yet' ) 
     1572#else 
     1573         CALL ctl_stop( ' Trying to run fco2 observation operator', & 
     1574            &           ' but no biogeochemical model appears to have been defined' ) 
     1575#endif 
     1576 
     1577         DO jfco2set = 1, nfco2sets 
     1578             CALL obs_fco2_opt( fco2datqc(jfco2set),                      & 
     1579               &                kstp, jpi, jpj, nit000, fco2(:,:), & 
     1580               &                maskfco2(:,:), n2dint ) 
     1581         END DO 
     1582      ENDIF 
     1583 
    14471584#if ! defined key_lim2 && ! defined key_lim3 
    14481585      CALL wrk_dealloc(jpi,jpj,frld)  
     
    14791616      INTEGER :: jlogchlset               ! logchl data set loop variable 
    14801617      INTEGER :: jspmset                  ! spm data set loop variable 
     1618      INTEGER :: jfco2set                 ! fco2 data set loop variable 
    14811619      INTEGER :: jset 
    14821620      INTEGER :: jfbini 
     
    17711909            WRITE(cdtmp,'(A,I2.2)')'spmfb_',jspmset 
    17721910            CALL obs_wri_spm( cdtmp, spmdata(jspmset) ) 
     1911 
     1912         END DO 
     1913 
     1914      ENDIF 
     1915 
     1916      !  - fco2 
     1917      IF ( ln_fco2 ) THEN 
     1918 
     1919         ! Copy data from fco2datqc to fco2data structures 
     1920         DO jfco2set = 1, nfco2sets 
     1921 
     1922            CALL obs_surf_decompress( fco2datqc(jfco2set), & 
     1923                 &                    fco2data(jfco2set), .TRUE., numout ) 
     1924 
     1925         END DO 
     1926          
     1927         ! Mark as bad observations with no valid model counterpart due to fCO2 not being in the restart 
     1928         ! Seem to need to set to fill value rather than marking as bad to be effective, so do both 
     1929         DO jfco2set = 1, nfco2sets 
     1930            WHERE ( fco2data(jfco2set)%rmod(:,1) == obfillflt ) 
     1931               fco2data(jfco2set)%nqc(:)    = 1 
     1932               fco2data(jfco2set)%robs(:,1) = obfillflt 
     1933            END WHERE 
     1934         END DO 
     1935 
     1936         ! Write the fco2 data 
     1937         DO jfco2set = 1, nfco2sets 
     1938       
     1939            WRITE(cdtmp,'(A,I2.2)')'fco2fb_',jfco2set 
     1940            CALL obs_wri_fco2( cdtmp, fco2data(jfco2set) ) 
    17731941 
    17741942         END DO 
  • branches/UKMO/dev_r4650_general_vert_coord_obsoper_surf_bgc/NEMOGCM/NEMO/OPA_SRC/OBS/obs_fco2.F90

    r6854 r6856  
    1 MODULE obs_logchl 
     1MODULE obs_fco2 
    22   !!===================================================================== 
    3    !!                       ***  MODULE  obs_logchl  *** 
    4    !! Observation diagnostics: Storage space for logchl observations 
     3   !!                       ***  MODULE  obs_fco2  *** 
     4   !! Observation diagnostics: Storage space for fco2 observations 
    55   !!                          arrays and additional flags etc. 
    66   !!===================================================================== 
     
    2222   PRIVATE 
    2323 
    24    PUBLIC nlogchlvars, nlogchlextr, nlogchlsets, logchldata, logchldatqc 
     24   PUBLIC nfco2vars, nfco2extr, nfco2sets, fco2data, fco2datqc 
    2525 
    2626   !! * Shared Module variables 
    27    INTEGER :: nlogchlvars                               ! Number of logchldata variables 
    28    INTEGER :: nlogchlextr                               ! Number of logchldata extra  
    29                                                         ! variables 
    30    INTEGER :: nlogchlsets                               ! Number of logchldata sets 
    31    TYPE(obs_surf), POINTER, DIMENSION(:) :: logchldata  ! Initial logchl data 
    32    TYPE(obs_surf), POINTER, DIMENSION(:) :: logchldatqc ! Sea ice data after quality control 
     27   INTEGER :: nfco2vars                               ! Number of fco2data variables 
     28   INTEGER :: nfco2extr                               ! Number of fco2data extra  
     29                                                      ! variables 
     30   INTEGER :: nfco2sets                               ! Number of fco2data sets 
     31   TYPE(obs_surf), POINTER, DIMENSION(:) :: fco2data  ! Initial fco2 data 
     32   TYPE(obs_surf), POINTER, DIMENSION(:) :: fco2datqc ! Sea ice data after quality control 
    3333 
    34 END MODULE obs_logchl 
     34END MODULE obs_fco2 
    3535 
  • branches/UKMO/dev_r4650_general_vert_coord_obsoper_surf_bgc/NEMOGCM/NEMO/OPA_SRC/OBS/obs_fco2_io.F90

    r6854 r6856  
    1 MODULE obs_logchl_io 
     1MODULE obs_fco2_io 
    22   !!====================================================================== 
    3    !!                       ***  MODULE obs_logchl_io  *** 
    4    !! Observation operators : I/O for logchl files 
     3   !!                       ***  MODULE obs_fco2_io  *** 
     4   !! Observation operators : I/O for fco2 files 
    55   !!====================================================================== 
    66   !! History :  
     
    88   !!---------------------------------------------------------------------- 
    99   !!---------------------------------------------------------------------- 
    10    !!   read_logchlfile    :  Read a obfbdata structure from a logchl file 
     10   !!   read_fco2file    :  Read a obfbdata structure from a fco2 file 
    1111   !!---------------------------------------------------------------------- 
    1212   USE par_kind 
     
    2626CONTAINS 
    2727 
    28 #include "obslogchl_io.h90" 
     28#include "obsfco2_io.h90" 
    2929 
    30 END MODULE obs_logchl_io 
     30END MODULE obs_fco2_io 
  • branches/UKMO/dev_r4650_general_vert_coord_obsoper_surf_bgc/NEMOGCM/NEMO/OPA_SRC/OBS/obs_oper.F90

    r6855 r6856  
    2626   !!                    observations 
    2727   !!   obs_spm_opt :    Compute the model counterpart of spm 
     28   !!                    observations 
     29   !!   obs_fco2_opt :   Compute the model counterpart of fco2 
    2830   !!                    observations 
    2931   !!---------------------------------------------------------------------- 
     
    6971      &   obs_vel_opt, &  ! Compute the model counterpart of velocity profile data 
    7072      &   obs_logchl_opt, & ! Compute the model counterpart of logchl data 
    71       &   obs_spm_opt     ! Compute the model counterpart of spm data 
     73      &   obs_spm_opt, &  ! Compute the model counterpart of spm data 
     74      &   obs_fco2_opt    ! Compute the model counterpart of fco2 data 
    7275 
    7376   INTEGER, PARAMETER, PUBLIC :: imaxavtypes = 20 ! Max number of daily avgd obs types 
     
    23782381   END SUBROUTINE obs_spm_opt 
    23792382 
     2383   SUBROUTINE obs_fco2_opt( fco2datqc, kt, kpi, kpj, kit000, & 
     2384      &                    pfco2n, pfco2mask, k2dint ) 
     2385 
     2386      !!----------------------------------------------------------------------- 
     2387      !! 
     2388      !!                     ***  ROUTINE obs_fco2_opt  *** 
     2389      !! 
     2390      !! ** Purpose : Compute the model counterpart of fco2 
     2391      !!              data by interpolating from the model grid to the  
     2392      !!              observation point. 
     2393      !! 
     2394      !! ** Method  : Linearly interpolate to each observation point using  
     2395      !!              the model values at the corners of the surrounding grid box. 
     2396      !! 
     2397      !!    The now model fco2 is first computed at the obs (lon, lat) point. 
     2398      !! 
     2399      !!    Several horizontal interpolation schemes are available: 
     2400      !!        - distance-weighted (great circle) (k2dint = 0) 
     2401      !!        - distance-weighted (small angle)  (k2dint = 1) 
     2402      !!        - bilinear (geographical grid)     (k2dint = 2) 
     2403      !!        - bilinear (quadrilateral grid)    (k2dint = 3) 
     2404      !!        - polynomial (quadrilateral grid)  (k2dint = 4) 
     2405      !! 
     2406      !! 
     2407      !! ** Action  : 
     2408      !! 
     2409      !! History : 
     2410      !!       
     2411      !!----------------------------------------------------------------------- 
     2412 
     2413      !! * Modules used 
     2414      USE obs_surf_def  ! Definition of storage space for surface observations 
     2415 
     2416      IMPLICIT NONE 
     2417 
     2418      !! * Arguments 
     2419      TYPE(obs_surf), INTENT(INOUT) :: fco2datqc     ! Subset of surface data not failing screening 
     2420      INTEGER, INTENT(IN) :: kt       ! Time step 
     2421      INTEGER, INTENT(IN) :: kpi      ! Model grid parameters 
     2422      INTEGER, INTENT(IN) :: kpj 
     2423      INTEGER, INTENT(IN) :: kit000   ! Number of the first time step  
     2424                                      !   (kit000-1 = restart time) 
     2425      INTEGER, INTENT(IN) :: k2dint   ! Horizontal interpolation type (see header) 
     2426      REAL(KIND=wp), INTENT(IN), DIMENSION(kpi,kpj) :: & 
     2427         & pfco2n,  &    ! Model fco2 field 
     2428         & pfco2mask     ! Land-sea mask 
     2429          
     2430      !! * Local declarations 
     2431      INTEGER :: ji 
     2432      INTEGER :: jj 
     2433      INTEGER :: jobs 
     2434      INTEGER :: inrc 
     2435      INTEGER :: ifco2 
     2436      INTEGER :: iobs 
     2437        
     2438      REAL(KIND=wp) :: zlam 
     2439      REAL(KIND=wp) :: zphi 
     2440      REAL(KIND=wp) :: zext(1), zobsmask(1) 
     2441      REAL(kind=wp), DIMENSION(2,2,1) :: & 
     2442         & zweig 
     2443      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: & 
     2444         & zmask, & 
     2445         & zfco2l, & 
     2446         & zglam, & 
     2447         & zgphi 
     2448      INTEGER, DIMENSION(:,:,:), ALLOCATABLE :: & 
     2449         & igrdi, & 
     2450         & igrdj 
     2451 
     2452      !------------------------------------------------------------------------ 
     2453      ! Local initialization  
     2454      !------------------------------------------------------------------------ 
     2455      ! ... Record and data counters 
     2456      inrc = kt - kit000 + 2 
     2457      ifco2 = fco2datqc%nsstp(inrc) 
     2458 
     2459      ! Get the data for interpolation 
     2460       
     2461      ALLOCATE( & 
     2462         & igrdi(2,2,ifco2), & 
     2463         & igrdj(2,2,ifco2), & 
     2464         & zglam(2,2,ifco2), & 
     2465         & zgphi(2,2,ifco2), & 
     2466         & zmask(2,2,ifco2), & 
     2467         & zfco2l(2,2,ifco2)  & 
     2468         & ) 
     2469       
     2470      DO jobs = fco2datqc%nsurfup + 1, fco2datqc%nsurfup + ifco2 
     2471         iobs = jobs - fco2datqc%nsurfup 
     2472         igrdi(1,1,iobs) = fco2datqc%mi(jobs)-1 
     2473         igrdj(1,1,iobs) = fco2datqc%mj(jobs)-1 
     2474         igrdi(1,2,iobs) = fco2datqc%mi(jobs)-1 
     2475         igrdj(1,2,iobs) = fco2datqc%mj(jobs) 
     2476         igrdi(2,1,iobs) = fco2datqc%mi(jobs) 
     2477         igrdj(2,1,iobs) = fco2datqc%mj(jobs)-1 
     2478         igrdi(2,2,iobs) = fco2datqc%mi(jobs) 
     2479         igrdj(2,2,iobs) = fco2datqc%mj(jobs) 
     2480      END DO 
     2481       
     2482      CALL obs_int_comm_2d( 2, 2, ifco2, & 
     2483         &                  igrdi, igrdj, glamt, zglam ) 
     2484      CALL obs_int_comm_2d( 2, 2, ifco2, & 
     2485         &                  igrdi, igrdj, gphit, zgphi ) 
     2486      CALL obs_int_comm_2d( 2, 2, ifco2, & 
     2487         &                  igrdi, igrdj, pfco2mask, zmask ) 
     2488      CALL obs_int_comm_2d( 2, 2, ifco2, & 
     2489         &                  igrdi, igrdj, pfco2n, zfco2l ) 
     2490       
     2491      DO jobs = fco2datqc%nsurfup + 1, fco2datqc%nsurfup + ifco2 
     2492          
     2493         iobs = jobs - fco2datqc%nsurfup 
     2494          
     2495         IF ( kt /= fco2datqc%mstp(jobs) ) THEN 
     2496             
     2497            IF(lwp) THEN 
     2498               WRITE(numout,*) 
     2499               WRITE(numout,*) ' E R R O R : Observation',              & 
     2500                  &            ' time step is not consistent with the', & 
     2501                  &            ' model time step' 
     2502               WRITE(numout,*) ' =========' 
     2503               WRITE(numout,*) 
     2504               WRITE(numout,*) ' Record  = ', jobs,                & 
     2505                  &            ' kt      = ', kt,                  & 
     2506                  &            ' mstp    = ', fco2datqc%mstp(jobs), & 
     2507                  &            ' ntyp    = ', fco2datqc%ntyp(jobs) 
     2508            ENDIF 
     2509            CALL ctl_stop( 'obs_fco2_opt', 'Inconsistent time' ) 
     2510             
     2511         ENDIF 
     2512          
     2513         zlam = fco2datqc%rlam(jobs) 
     2514         zphi = fco2datqc%rphi(jobs) 
     2515          
     2516         ! Get weights to interpolate the model fco2 to the observation point 
     2517         CALL obs_int_h2d_init( 1, 1, k2dint, zlam, zphi,         & 
     2518            &                   zglam(:,:,iobs), zgphi(:,:,iobs), & 
     2519            &                   zmask(:,:,iobs), zweig, zobsmask ) 
     2520          
     2521         ! ... Interpolate the model fco2 to the observation point 
     2522         CALL obs_int_h2d( 1, 1,      & 
     2523            &              zweig, zfco2l(:,:,iobs),  zext ) 
     2524          
     2525         fco2datqc%rmod(jobs,1) = zext(1) 
     2526          
     2527      END DO 
     2528       
     2529      ! Deallocate the data for interpolation 
     2530      DEALLOCATE( & 
     2531         & igrdi,    & 
     2532         & igrdj,    & 
     2533         & zglam,    & 
     2534         & zgphi,    & 
     2535         & zmask,    & 
     2536         & zfco2l  & 
     2537         & ) 
     2538       
     2539      fco2datqc%nsurfup = fco2datqc%nsurfup + ifco2 
     2540 
     2541   END SUBROUTINE obs_fco2_opt 
     2542 
    23802543END MODULE obs_oper 
    23812544 
  • branches/UKMO/dev_r4650_general_vert_coord_obsoper_surf_bgc/NEMOGCM/NEMO/OPA_SRC/OBS/obs_prep.F90

    r6855 r6856  
    1414   !!   obs_pre_logchl : First level check and screening of logchl obs. 
    1515   !!   obs_pre_spm  : First level check and screening of spm obs. 
     16   !!   obs_pre_fco2 : First level check and screening of fco2 obs. 
    1617   !!   obs_scr      : Basic screening of the observations 
    1718   !!   obs_coo_tim  : Compute number of time steps to the observation time 
     
    4546      & obs_pre_logchl, & ! First level check and screening of logchl data 
    4647      & obs_pre_spm, &    ! First level check and screening of spm data 
     48      & obs_pre_fco2, &   ! First level check and screening of fco2 data 
    4749      & calc_month_len     ! Calculate the number of days in the months of a year   
    4850 
     
    15561558   END SUBROUTINE obs_pre_spm 
    15571559 
     1560   SUBROUTINE obs_pre_fco2( fco2data, fco2datqc, ld_fco2, ld_nea ) 
     1561      !!---------------------------------------------------------------------- 
     1562      !!                    ***  ROUTINE obs_pre_fco2  *** 
     1563      !! 
     1564      !! ** Purpose : First level check and screening of fco2 observations 
     1565      !! 
     1566      !! ** Method  : First level check and screening of fco2 observations 
     1567      !! 
     1568      !! ** Action  :  
     1569      !! 
     1570      !! References : 
     1571      !!    
     1572      !! History : 
     1573      !!---------------------------------------------------------------------- 
     1574      !! * Modules used 
     1575      USE domstp              ! Domain: set the time-step 
     1576      USE par_oce             ! Ocean parameters 
     1577      USE dom_oce, ONLY : &   ! Geographical information 
     1578         & glamt,   & 
     1579         & gphit,   & 
     1580         & tmask 
     1581      !! * Arguments 
     1582      TYPE(obs_surf), INTENT(INOUT) :: fco2data     ! Full set of fco2 data 
     1583      TYPE(obs_surf), INTENT(INOUT) :: fco2datqc    ! Subset of fco2 data not failing screening 
     1584      LOGICAL :: ld_fco2     ! Switch for fco2 data 
     1585      LOGICAL :: ld_nea        ! Switch for rejecting observation near land 
     1586      !! * Local declarations 
     1587      INTEGER :: iyea0         ! Initial date 
     1588      INTEGER :: imon0         !  - (year, month, day, hour, minute) 
     1589      INTEGER :: iday0     
     1590      INTEGER :: ihou0     
     1591      INTEGER :: imin0 
     1592      INTEGER :: icycle       ! Current assimilation cycle 
     1593                              ! Counters for observations that 
     1594      INTEGER :: iotdobs      !  - outside time domain 
     1595      INTEGER :: iosdsobs     !  - outside space domain 
     1596      INTEGER :: ilansobs     !  - within a model land cell 
     1597      INTEGER :: inlasobs     !  - close to land 
     1598      INTEGER :: igrdobs      !  - fail the grid search 
     1599                              ! Global counters for observations that 
     1600      INTEGER :: iotdobsmpp   !  - outside time domain 
     1601      INTEGER :: iosdsobsmpp  !  - outside space domain 
     1602      INTEGER :: ilansobsmpp  !  - within a model land cell 
     1603      INTEGER :: inlasobsmpp  !  - close to land 
     1604      INTEGER :: igrdobsmpp   !  - fail the grid search 
     1605      LOGICAL, DIMENSION(:), ALLOCATABLE :: &  
     1606         & llvalid            ! data selection 
     1607      INTEGER :: jobs         ! Obs. loop variable 
     1608      INTEGER :: jstp         ! Time loop variable 
     1609      INTEGER :: inrc         ! Time index variable 
     1610 
     1611      IF (lwp) WRITE(numout,*)'obs_pre_fco2 : Preparing the fco2 observations...' 
     1612 
     1613      ! Initial date initialization (year, month, day, hour, minute) 
     1614      iyea0 =   ndate0 / 10000 
     1615      imon0 = ( ndate0 - iyea0 * 10000 ) / 100 
     1616      iday0 =   ndate0 - iyea0 * 10000 - imon0 * 100 
     1617      ihou0 = 0 
     1618      imin0 = 0 
     1619 
     1620      icycle = no     ! Assimilation cycle 
     1621 
     1622      ! Diagnostics counters for various failures. 
     1623 
     1624      iotdobs  = 0 
     1625      igrdobs  = 0 
     1626      iosdsobs = 0 
     1627      ilansobs = 0 
     1628      inlasobs = 0 
     1629 
     1630      ! ----------------------------------------------------------------------- 
     1631      ! Find time coordinate for fco2 data 
     1632      ! ----------------------------------------------------------------------- 
     1633 
     1634      CALL obs_coo_tim( icycle, & 
     1635         &              iyea0,   imon0,   iday0,   ihou0,   imin0,      & 
     1636         &              fco2data%nsurf,   fco2data%nyea, fco2data%nmon, & 
     1637         &              fco2data%nday,    fco2data%nhou, fco2data%nmin, & 
     1638         &              fco2data%nqc,     fco2data%mstp, iotdobs        ) 
     1639      CALL obs_mpp_sum_integer( iotdobs, iotdobsmpp ) 
     1640      ! ----------------------------------------------------------------------- 
     1641      ! Check for fco2 data failing the grid search 
     1642      ! ----------------------------------------------------------------------- 
     1643 
     1644      CALL obs_coo_grd( fco2data%nsurf,   fco2data%mi, fco2data%mj, & 
     1645         &              fco2data%nqc,     igrdobs                         ) 
     1646      CALL obs_mpp_sum_integer( igrdobs, igrdobsmpp ) 
     1647 
     1648      ! ----------------------------------------------------------------------- 
     1649      ! Check for land points.  
     1650      ! ----------------------------------------------------------------------- 
     1651 
     1652      CALL obs_coo_spc_2d( fco2data%nsurf,                 & 
     1653         &                 jpi,             jpj,             & 
     1654         &                 fco2data%mi,   fco2data%mj,   &  
     1655         &                 fco2data%rlam, fco2data%rphi, & 
     1656         &                 glamt,           gphit,           & 
     1657         &                 tmask(:,:,1),    fco2data%nqc,  & 
     1658         &                 iosdsobs,        ilansobs,        & 
     1659         &                 inlasobs,        ld_nea           )  
     1660          
     1661      CALL obs_mpp_sum_integer( iosdsobs, iosdsobsmpp ) 
     1662      CALL obs_mpp_sum_integer( ilansobs, ilansobsmpp ) 
     1663      CALL obs_mpp_sum_integer( inlasobs, inlasobsmpp ) 
     1664 
     1665      ! ----------------------------------------------------------------------- 
     1666      ! Copy useful data from the fco2data data structure to 
     1667      ! the fco2datqc data structure  
     1668      ! ----------------------------------------------------------------------- 
     1669 
     1670      ! Allocate the selection arrays 
     1671 
     1672      ALLOCATE( llvalid(fco2data%nsurf) ) 
     1673       
     1674      ! We want all data which has qc flags <= 0 
     1675 
     1676      llvalid(:)  = ( fco2data%nqc(:)  <= 10 ) 
     1677 
     1678      ! The actual copying 
     1679 
     1680      CALL obs_surf_compress( fco2data,     fco2datqc,       .TRUE.,  numout, & 
     1681         &                    lvalid=llvalid ) 
     1682 
     1683      ! Dellocate the selection arrays 
     1684      DEALLOCATE( llvalid ) 
     1685 
     1686      ! ----------------------------------------------------------------------- 
     1687      ! Print information about what observations are left after qc 
     1688      ! ----------------------------------------------------------------------- 
     1689 
     1690      ! Update the total observation counter array 
     1691       
     1692      IF(lwp) THEN 
     1693         WRITE(numout,*) 
     1694         WRITE(numout,*) 'obs_pre_fco2 :' 
     1695         WRITE(numout,*) '~~~~~~~~~~~' 
     1696         WRITE(numout,*) 
     1697         WRITE(numout,*) ' fco2 data outside time domain                  = ', & 
     1698            &            iotdobsmpp 
     1699         WRITE(numout,*) ' Remaining fco2 data that failed grid search    = ', & 
     1700            &            igrdobsmpp 
     1701         WRITE(numout,*) ' Remaining fco2 data outside space domain       = ', & 
     1702            &            iosdsobsmpp 
     1703         WRITE(numout,*) ' Remaining fco2 data at land points             = ', & 
     1704            &            ilansobsmpp 
     1705         IF (ld_nea) THEN 
     1706            WRITE(numout,*) ' Remaining fco2 data near land points (removed) = ', & 
     1707               &            inlasobsmpp 
     1708         ELSE 
     1709            WRITE(numout,*) ' Remaining fco2 data near land points (kept)    = ', & 
     1710               &            inlasobsmpp 
     1711         ENDIF 
     1712         WRITE(numout,*) ' fco2 data accepted                             = ', & 
     1713            &            fco2datqc%nsurfmpp 
     1714 
     1715         WRITE(numout,*) 
     1716         WRITE(numout,*) ' Number of observations per time step :' 
     1717         WRITE(numout,*) 
     1718         WRITE(numout,1997) 
     1719         WRITE(numout,1998) 
     1720      ENDIF 
     1721       
     1722      DO jobs = 1, fco2datqc%nsurf 
     1723         inrc = fco2datqc%mstp(jobs) + 2 - nit000 
     1724         fco2datqc%nsstp(inrc)  = fco2datqc%nsstp(inrc) + 1 
     1725      END DO 
     1726       
     1727      CALL obs_mpp_sum_integers( fco2datqc%nsstp, fco2datqc%nsstpmpp, & 
     1728         &                       nitend - nit000 + 2 ) 
     1729 
     1730      IF ( lwp ) THEN 
     1731         DO jstp = nit000 - 1, nitend 
     1732            inrc = jstp - nit000 + 2 
     1733            WRITE(numout,1999) jstp, fco2datqc%nsstpmpp(inrc) 
     1734         END DO 
     1735      ENDIF 
     1736 
     17371997  FORMAT(10X,'Time step',5X,'fco2 data') 
     17381998  FORMAT(10X,'---------',5X,'------------') 
     17391999  FORMAT(10X,I9,5X,I17) 
     1740       
     1741   END SUBROUTINE obs_pre_fco2 
     1742 
    15581743   SUBROUTINE obs_coo_tim( kcycle, & 
    15591744      &                    kyea0,   kmon0,   kday0,   khou0,   kmin0,     & 
  • branches/UKMO/dev_r4650_general_vert_coord_obsoper_surf_bgc/NEMOGCM/NEMO/OPA_SRC/OBS/obs_read_fco2.F90

    r6854 r6856  
    1 MODULE obs_read_logchl 
     1MODULE obs_read_fco2 
    22   !!====================================================================== 
    3    !!                       ***  MODULE obs_read_logchl  *** 
    4    !! Observation diagnostics: Read the along track logchl data from 
    5    !!                          GHRSST or any logchl data from feedback files 
     3   !!                       ***  MODULE obs_read_fco2  *** 
     4   !! Observation diagnostics: Read the along track fco2 data from 
     5   !!                          GHRSST or any fco2 data from feedback files 
    66   !!====================================================================== 
    77 
    88   !!---------------------------------------------------------------------- 
    9    !!   obs_rea_logchl : Driver for reading logchl data from the feedback 
     9   !!   obs_rea_fco2 : Driver for reading fco2 data from the feedback 
    1010   !!---------------------------------------------------------------------- 
    1111 
     
    2121   USE obs_surf_def             ! Surface observation definitions 
    2222   USE obs_types                ! Observation type definitions 
    23    USE obs_logchl_io            ! I/O for logchl files 
     23   USE obs_fco2_io            ! I/O for fco2 files 
    2424   USE iom                      ! I/O 
    2525   USE netcdf                   ! NetCDF library 
     
    3030   PRIVATE 
    3131 
    32    PUBLIC obs_rea_logchl      ! Read the logchl observations from the point data 
     32   PUBLIC obs_rea_fco2      ! Read the fco2 observations from the point data 
    3333    
    3434   !!---------------------------------------------------------------------- 
     
    4040CONTAINS 
    4141 
    42    SUBROUTINE obs_rea_logchl( kformat, & 
    43       &                    logchldata, knumfiles, cfilenames, & 
     42   SUBROUTINE obs_rea_fco2( kformat, & 
     43      &                    fco2data, knumfiles, cfilenames, & 
    4444      &                    kvars, kextr, kstp, ddobsini, ddobsend, & 
    4545      &                    ldignmis, ldmod ) 
    4646      !!--------------------------------------------------------------------- 
    4747      !! 
    48       !!                   *** ROUTINE obs_rea_logchl *** 
    49       !! 
    50       !! ** Purpose : Read from file the logchl data 
     48      !!                   *** ROUTINE obs_rea_fco2 *** 
     49      !! 
     50      !! ** Purpose : Read from file the fco2 data 
    5151      !! 
    5252      !! ** Method  : Depending on kformat either old or new style 
     
    6666      !                    ! 1: Old-style feedback 
    6767      TYPE(obs_surf), INTENT(INOUT) :: & 
    68          & logchldata     ! logchl data to be read 
     68         & fco2data     ! fco2 data to be read 
    6969      INTEGER, INTENT(IN) :: knumfiles   ! Number of corio format files to read in 
    7070      CHARACTER(LEN=128), INTENT(IN) :: cfilenames(knumfiles) ! File names to read in 
    71       INTEGER, INTENT(IN) :: kvars    ! Number of variables in logchldata 
    72       INTEGER, INTENT(IN) :: kextr    ! Number of extra fields for each var in logchldata 
     71      INTEGER, INTENT(IN) :: kvars    ! Number of variables in fco2data 
     72      INTEGER, INTENT(IN) :: kextr    ! Number of extra fields for each var in fco2data 
    7373      INTEGER, INTENT(IN) :: kstp     ! Ocean time-step index 
    7474      LOGICAL, INTENT(IN) :: ldignmis   ! Ignore missing files 
     
    7878          
    7979      !! * Local declarations 
    80       CHARACTER(LEN=14), PARAMETER :: cpname='obs_rea_logchl' 
     80      CHARACTER(LEN=14), PARAMETER :: cpname='obs_rea_fco2' 
    8181      INTEGER :: ji 
    8282      INTEGER :: jj 
     
    9595         & irefdate 
    9696      INTEGER :: iobsmpp 
    97       INTEGER, PARAMETER :: ilogchlmaxtype = 1024 
    98       INTEGER, DIMENSION(0:ilogchlmaxtype) :: & 
     97      INTEGER, PARAMETER :: ifco2maxtype = 1024 
     98      INTEGER, DIMENSION(0:ifco2maxtype) :: & 
    9999         & ityp, & 
    100100         & itypmpp 
     
    105105         & iindx,    & 
    106106         & ifileidx, & 
    107          & ilogchlidx 
     107         & ifco2idx 
    108108      INTEGER :: itype 
    109109      REAL(wp), DIMENSION(:), ALLOCATABLE :: & 
     
    143143      ALLOCATE( inpfiles(inobf) ) 
    144144 
    145       logchl_files : DO jj = 1, inobf 
     145      fco2_files : DO jj = 1, inobf 
    146146           
    147147         !--------------------------------------------------------------------- 
     
    150150         IF(lwp) THEN 
    151151            WRITE(numout,*) 
    152             WRITE(numout,*) ' obs_rea_logchl : Reading from file = ', & 
     152            WRITE(numout,*) ' obs_rea_fco2 : Reading from file = ', & 
    153153               & TRIM( TRIM( cfilenames(jj) ) ) 
    154154            WRITE(numout,*) ' ~~~~~~~~~~~~~~' 
     
    200200               ENDIF 
    201201            ELSEIF ( kformat == 1) THEN 
    202                CALL read_logchl( TRIM( cfilenames(jj) ), inpfiles(jj), & 
     202               CALL read_fco2( TRIM( cfilenames(jj) ), inpfiles(jj), & 
    203203               &                 numout, lwp, .TRUE. ) 
    204204            ELSE 
     
    291291         ENDIF 
    292292 
    293       END DO logchl_files 
     293      END DO fco2_files 
    294294 
    295295      !----------------------------------------------------------------------- 
     
    311311 
    312312      ALLOCATE( iindx(iobstot), ifileidx(iobstot), & 
    313          &      ilogchlidx(iobstot), zdat(iobstot) ) 
     313         &      ifco2idx(iobstot), zdat(iobstot) ) 
    314314      jk = 0 
    315315      DO jj = 1, inobf 
     
    319319               jk = jk + 1 
    320320               ifileidx(jk) = jj 
    321                ilogchlidx(jk) = ji 
     321               ifco2idx(jk) = ji 
    322322               zdat(jk)     = inpfiles(jj)%ptim(ji) 
    323323            ENDIF 
     
    328328         &               iindx   ) 
    329329       
    330       CALL obs_surf_alloc( logchldata, iobs, &  
     330      CALL obs_surf_alloc( fco2data, iobs, &  
    331331                           kvars, kextr, kstp, jpi, jpj ) 
    332332       
    333       ! * Read obs/positions, QC, all variable and assign to logchldata 
     333      ! * Read obs/positions, QC, all variable and assign to fco2data 
    334334  
    335335      iobs = 0 
     
    343343          
    344344         jj = ifileidx(iindx(jk)) 
    345          ji = ilogchlidx(iindx(jk)) 
     345         ji = ifco2idx(iindx(jk)) 
    346346         IF ( ( inpfiles(jj)%ptim(ji) >  djulini(jj) ) .AND.  & 
    347347            & ( inpfiles(jj)%ptim(ji) <= djulend(jj) ) ) THEN 
     
    370370 
    371371 
    372                ! logchl time coordinates 
    373                logchldata%nyea(iobs) = iyea 
    374                logchldata%nmon(iobs) = imon 
    375                logchldata%nday(iobs) = iday 
    376                logchldata%nhou(iobs) = ihou 
    377                logchldata%nmin(iobs) = imin 
     372               ! fco2 time coordinates 
     373               fco2data%nyea(iobs) = iyea 
     374               fco2data%nmon(iobs) = imon 
     375               fco2data%nday(iobs) = iday 
     376               fco2data%nhou(iobs) = ihou 
     377               fco2data%nmin(iobs) = imin 
    378378                
    379                ! logchl space coordinates 
    380                logchldata%rlam(iobs) = inpfiles(jj)%plam(ji) 
    381                logchldata%rphi(iobs) = inpfiles(jj)%pphi(ji) 
     379               ! fco2 space coordinates 
     380               fco2data%rlam(iobs) = inpfiles(jj)%plam(ji) 
     381               fco2data%rphi(iobs) = inpfiles(jj)%pphi(ji) 
    382382 
    383383               ! Coordinate search parameters 
    384                logchldata%mi  (iobs) = inpfiles(jj)%iobsi(ji,1) 
    385                logchldata%mj  (iobs) = inpfiles(jj)%iobsj(ji,1) 
     384               fco2data%mi  (iobs) = inpfiles(jj)%iobsi(ji,1) 
     385               fco2data%mj  (iobs) = inpfiles(jj)%iobsj(ji,1) 
    386386                
    387387               ! Instrument type 
     
    392392                  itype = 0 
    393393               ENDIF 
    394                logchldata%ntyp(iobs) = itype 
    395                IF ( itype < ilogchlmaxtype + 1 ) THEN 
     394               fco2data%ntyp(iobs) = itype 
     395               IF ( itype < ifco2maxtype + 1 ) THEN 
    396396                  ityp(itype+1) = ityp(itype+1) + 1 
    397397               ELSE 
    398                   IF(lwp)WRITE(numout,*)'WARNING:Increase ilogchlmaxtype in ',& 
     398                  IF(lwp)WRITE(numout,*)'WARNING:Increase ifco2maxtype in ',& 
    399399                     &                  cpname 
    400400               ENDIF 
    401401 
    402402               ! Bookkeeping data to match observations 
    403                logchldata%nsidx(iobs) = iobs 
    404                logchldata%nsfil(iobs) = iindx(jk) 
     403               fco2data%nsidx(iobs) = iobs 
     404               fco2data%nsfil(iobs) = iindx(jk) 
    405405 
    406406               ! QC flags 
    407                logchldata%nqc(iobs) = inpfiles(jj)%ivqc(ji,1) 
     407               fco2data%nqc(iobs) = inpfiles(jj)%ivqc(ji,1) 
    408408 
    409409               ! Observed value 
    410                logchldata%robs(iobs,1) = inpfiles(jj)%pob(1,ji,1) 
     410               fco2data%robs(iobs,1) = inpfiles(jj)%pob(1,ji,1) 
    411411 
    412412 
    413413               ! Model and MDT is set to fbrmdi unless read from file 
    414414               IF ( ldmod ) THEN 
    415                   logchldata%rmod(iobs,1) = inpfiles(jj)%padd(1,ji,1,1) 
     415                  fco2data%rmod(iobs,1) = inpfiles(jj)%padd(1,ji,1,1) 
    416416               ELSE 
    417                   logchldata%rmod(iobs,1) = fbrmdi 
     417                  fco2data%rmod(iobs,1) = fbrmdi 
    418418               ENDIF 
    419419            ENDIF 
     
    434434 
    435435         WRITE(numout,*) 
    436          WRITE(numout,'(1X,A)')'logchl data types' 
     436         WRITE(numout,'(1X,A)')'fco2 data types' 
    437437         WRITE(numout,'(1X,A)')'-----------------' 
    438438         DO jj = 1,8 
     
    450450      ! Deallocate temporary data 
    451451      !----------------------------------------------------------------------- 
    452       DEALLOCATE( ifileidx, ilogchlidx, zdat ) 
     452      DEALLOCATE( ifileidx, ifco2idx, zdat ) 
    453453 
    454454      !----------------------------------------------------------------------- 
     
    460460      DEALLOCATE( inpfiles ) 
    461461 
    462    END SUBROUTINE obs_rea_logchl 
    463  
    464 END MODULE obs_read_logchl 
    465  
     462   END SUBROUTINE obs_rea_fco2 
     463 
     464END MODULE obs_read_fco2 
     465 
  • branches/UKMO/dev_r4650_general_vert_coord_obsoper_surf_bgc/NEMOGCM/NEMO/OPA_SRC/OBS/obs_write.F90

    r6855 r6856  
    1313   !!   obs_wri_logchl: Write logchl observation related diagnostics 
    1414   !!   obs_wri_spm   : Write spm observation related diagnostics 
     15   !!   obs_wri_fco2  : Write fco2 observation related diagnostics 
    1516   !!   obs_wri_stats : Print basic statistics on the data being written out 
    1617   !!---------------------------------------------------------------------- 
     
    4950      &   obs_wri_logchl, & ! Write logchl observation related diagnostics 
    5051      &   obs_wri_spm, &    ! Write spm observation related diagnostics 
     52      &   obs_wri_fco2, &   ! Write fco2 observation related diagnostics 
    5153      &   obswriinfo 
    5254    
     
    12321234   END SUBROUTINE obs_wri_spm 
    12331235 
     1236   SUBROUTINE obs_wri_fco2( cprefix, fco2data, padd, pext ) 
     1237      !!----------------------------------------------------------------------- 
     1238      !! 
     1239      !!                     *** ROUTINE obs_wri_fco2  *** 
     1240      !! 
     1241      !! ** Purpose : Write fco2 observation diagnostics 
     1242      !!              related  
     1243      !! 
     1244      !! ** Method  : NetCDF 
     1245      !!  
     1246      !! ** Action  : 
     1247      !! 
     1248      !!----------------------------------------------------------------------- 
     1249 
     1250      !! * Modules used 
     1251      IMPLICIT NONE 
     1252 
     1253      !! * Arguments 
     1254      CHARACTER(LEN=*), INTENT(IN) :: cprefix       ! Prefix for output files 
     1255      TYPE(obs_surf), INTENT(INOUT) :: fco2data   ! Full set of fco2 
     1256      TYPE(obswriinfo), OPTIONAL :: padd            ! Additional info for each variable 
     1257      TYPE(obswriinfo), OPTIONAL :: pext            ! Extra info 
     1258 
     1259      !! * Local declarations  
     1260      TYPE(obfbdata) :: fbdata 
     1261      CHARACTER(LEN=40) :: cfname             ! netCDF filename 
     1262      CHARACTER(LEN=12), PARAMETER :: cpname = 'obs_wri_fco2' 
     1263      INTEGER :: jo 
     1264      INTEGER :: ja 
     1265      INTEGER :: je 
     1266      INTEGER :: nadd 
     1267      INTEGER :: next 
     1268 
     1269      IF ( PRESENT( padd ) ) THEN 
     1270         nadd = padd%inum 
     1271      ELSE 
     1272         nadd = 0 
     1273      ENDIF 
     1274 
     1275      IF ( PRESENT( pext ) ) THEN 
     1276         next = pext%inum 
     1277      ELSE 
     1278         next = 0 
     1279      ENDIF 
     1280 
     1281      CALL init_obfbdata( fbdata ) 
     1282 
     1283      CALL alloc_obfbdata( fbdata, 1, fco2data%nsurf, 1, & 
     1284         &                 1 + nadd, next, .TRUE. ) 
     1285 
     1286      fbdata%cname(1)      = 'fco2' 
     1287      fbdata%coblong(1)    = 'fco2' 
     1288      fbdata%cobunit(1)    = 'uatm' 
     1289      DO je = 1, next 
     1290         fbdata%cextname(je) = pext%cdname(je) 
     1291         fbdata%cextlong(je) = pext%cdlong(je,1) 
     1292         fbdata%cextunit(je) = pext%cdunit(je,1) 
     1293      END DO 
     1294      fbdata%caddname(1)   = 'Hx' 
     1295      fbdata%caddlong(1,1) = 'Model interpolated fco2' 
     1296      fbdata%caddunit(1,1) = 'uatm' 
     1297      fbdata%cgrid(1)      = 'T' 
     1298      DO ja = 1, nadd 
     1299         fbdata%caddname(1+ja) = padd%cdname(ja) 
     1300         fbdata%caddlong(1+ja,1) = padd%cdlong(ja,1) 
     1301         fbdata%caddunit(1+ja,1) = padd%cdunit(ja,1) 
     1302      END DO 
     1303 
     1304      WRITE(cfname, FMT="(A,'_fdbk_',I4.4,'.nc')") TRIM(cprefix), nproc 
     1305 
     1306      IF(lwp) THEN 
     1307         WRITE(numout,*) 
     1308         WRITE(numout,*)'obs_wri_fco2 :' 
     1309         WRITE(numout,*)'~~~~~~~~~~~~~~~~' 
     1310         WRITE(numout,*)'Writing fco2 feedback file : ',TRIM(cfname) 
     1311      ENDIF 
     1312 
     1313      ! Transform obs_prof data structure into obfbdata structure 
     1314      fbdata%cdjuldref = '19500101000000' 
     1315      DO jo = 1, fco2data%nsurf 
     1316         fbdata%plam(jo)      = fco2data%rlam(jo) 
     1317         fbdata%pphi(jo)      = fco2data%rphi(jo) 
     1318         WRITE(fbdata%cdtyp(jo),'(I4)') fco2data%ntyp(jo) 
     1319         fbdata%ivqc(jo,:)    = 0 
     1320         fbdata%ivqcf(:,jo,:) = 0 
     1321         IF ( fco2data%nqc(jo) > 10 ) THEN 
     1322            fbdata%ioqc(jo)    = 4 
     1323            fbdata%ioqcf(1,jo) = 0 
     1324            fbdata%ioqcf(2,jo) = fco2data%nqc(jo) - 10 
     1325         ELSE 
     1326            fbdata%ioqc(jo)    = MAX(fco2data%nqc(jo),1) 
     1327            fbdata%ioqcf(:,jo) = 0 
     1328         ENDIF 
     1329         fbdata%ipqc(jo)      = 0 
     1330         fbdata%ipqcf(:,jo)   = 0 
     1331         fbdata%itqc(jo)      = 0 
     1332         fbdata%itqcf(:,jo)   = 0 
     1333         fbdata%cdwmo(jo)     = '' 
     1334         fbdata%kindex(jo)    = fco2data%nsfil(jo) 
     1335         IF (ln_grid_global) THEN 
     1336            fbdata%iobsi(jo,1) = fco2data%mi(jo) 
     1337            fbdata%iobsj(jo,1) = fco2data%mj(jo) 
     1338         ELSE 
     1339            fbdata%iobsi(jo,1) = mig(fco2data%mi(jo)) 
     1340            fbdata%iobsj(jo,1) = mjg(fco2data%mj(jo)) 
     1341         ENDIF 
     1342         CALL greg2jul( 0, & 
     1343            &           fco2data%nmin(jo), & 
     1344            &           fco2data%nhou(jo), & 
     1345            &           fco2data%nday(jo), & 
     1346            &           fco2data%nmon(jo), & 
     1347            &           fco2data%nyea(jo), & 
     1348            &           fbdata%ptim(jo),   & 
     1349            &           krefdate = 19500101 ) 
     1350         fbdata%padd(1,jo,1,1) = fco2data%rmod(jo,1) 
     1351         fbdata%pob(1,jo,1)    = fco2data%robs(jo,1) 
     1352         fbdata%pdep(1,jo)     = 0.0 
     1353         fbdata%idqc(1,jo)     = 0 
     1354         fbdata%idqcf(:,1,jo)  = 0 
     1355         IF ( fco2data%nqc(jo) > 10 ) THEN 
     1356            fbdata%ivlqc(1,jo,1) = 4 
     1357            fbdata%ivlqcf(1,1,jo,1) = 0 
     1358            fbdata%ivlqcf(2,1,jo,1) = fco2data%nqc(jo) - 10 
     1359         ELSE 
     1360            fbdata%ivlqc(1,jo,1) = MAX(fco2data%nqc(jo),1) 
     1361            fbdata%ivlqcf(:,1,jo,1) = 0 
     1362         ENDIF 
     1363         fbdata%iobsk(1,jo,1)  = 0 
     1364         DO ja = 1, nadd 
     1365            fbdata%padd(1,jo,1+ja,1) = & 
     1366               & fco2data%rext(jo,padd%ipoint(ja)) 
     1367         END DO 
     1368         DO je = 1, next 
     1369            fbdata%pext(1,jo,je) = & 
     1370               & fco2data%rext(jo,pext%ipoint(je)) 
     1371         END DO 
     1372 
     1373      END DO 
     1374 
     1375      ! Write the obfbdata structure 
     1376      CALL write_obfbdata( cfname, fbdata ) 
     1377       
     1378      ! Output some basic statistics 
     1379      CALL obs_wri_stats( fbdata ) 
     1380 
     1381      CALL dealloc_obfbdata( fbdata ) 
     1382 
     1383   END SUBROUTINE obs_wri_fco2 
     1384 
    12341385   SUBROUTINE obs_wri_stats( fbdata ) 
    12351386      !!----------------------------------------------------------------------- 
  • branches/UKMO/dev_r4650_general_vert_coord_obsoper_surf_bgc/NEMOGCM/NEMO/OPA_SRC/OBS/obsfco2_io.h90

    r6854 r6856  
    55   !!---------------------------------------------------------------------- 
    66 
    7    SUBROUTINE read_logchl( cdfilename, inpfile, kunit, ldwp, ldgrid ) 
     7   SUBROUTINE read_fco2( cdfilename, inpfile, kunit, ldwp, ldgrid ) 
    88      !!--------------------------------------------------------------------- 
    99      !! 
    10       !!                     ** ROUTINE read_logchl ** 
    11       !! 
    12       !! ** Purpose : Read from file the logchl observations. 
     10      !!                     ** ROUTINE read_fco2 ** 
     11      !! 
     12      !! ** Purpose : Read from file the fco2 observations. 
    1313      !! 
    1414      !! ** Method  : The data file is a NetCDF file.  
     
    2828      LOGICAL          :: ldgrid     ! Save grid info in data structure 
    2929      !! * Local declarations 
    30       CHARACTER(LEN=12),PARAMETER :: cpname = 'read_logchl' 
     30      CHARACTER(LEN=12),PARAMETER :: cpname = 'read_fco2' 
    3131      INTEGER :: i_file_id    ! netcdf IDS 
    3232      INTEGER :: i_time_id 
     
    4141         & i_dtime, &       ! Offset in seconds since reference time 
    4242         & i_qc,    &       ! Quality control flag. 
    43          & i_type           ! Type of logchl measurement.             
     43         & i_type           ! Type of fco2 measurement.             
    4444      REAL(wp), DIMENSION(:), POINTER :: & 
    4545         & z_phi,   &       ! Latitudes 
    4646         & z_lam            ! Longitudes 
    4747      REAL(wp), DIMENSION(:,:), POINTER :: & 
    48          & z_logchl         ! logchl data      
     48         & z_fco2         ! fco2 data      
    4949      INTEGER, PARAMETER :: imaxdim = 2    ! Assumed maximum for no. dims. in file 
    5050      INTEGER, DIMENSION(2) :: idims       ! Dimensions in file 
     
    9494         & z_phi        ( i_data                 ), &    
    9595         & z_lam        ( i_data                 ), &   
    96          & z_logchl        ( i_data,i_time  )  & 
     96         & z_fco2        ( i_data,i_time  )  & 
    9797         & ) 
    9898       
     
    124124      ! Get list of times for each ob in seconds relative to reference time 
    125125       
    126       CALL chkerr( nf90_inq_varid( i_file_id, 'LogChl_dtime', i_var_id ), &  
     126      CALL chkerr( nf90_inq_varid( i_file_id, 'fco2_dtime', i_var_id ), &  
    127127         &       cpname, __LINE__ ) 
    128128      idims(1) = i_data 
     
    164164         &         cpname, __LINE__ ) 
    165165       
    166       ! Get logchl data 
    167        
    168       CALL chkerr( nf90_inq_varid( i_file_id, 'LogChl', & 
     166      ! Get fco2 data 
     167       
     168      CALL chkerr( nf90_inq_varid( i_file_id, 'fco2', & 
    169169         &                         i_var_id ), &  
    170170         &         cpname, __LINE__ ) 
     
    172172      idims(2) = i_time 
    173173      CALL chkdim( i_file_id, i_var_id, 2, idims, cpname, __LINE__ ) 
    174       CALL chkerr( nf90_get_var  ( i_file_id, i_var_id, z_logchl), & 
     174      CALL chkerr( nf90_get_var  ( i_file_id, i_var_id, z_fco2), & 
    175175         &       cpname, __LINE__ ) 
    176176      zoff = 0. 
     
    192192            &                       "_FillValue",zfill), cpname, __LINE__ ) 
    193193      ENDIF 
    194       WHERE(z_logchl(:,:) /=  zfill) 
    195          z_logchl(:,:) = (zsca * z_logchl(:,:)) + zoff 
     194      WHERE(z_fco2(:,:) /=  zfill) 
     195         z_fco2(:,:) = (zsca * z_fco2(:,:)) + zoff 
    196196      ELSEWHERE 
    197          z_logchl(:,:) = fbrmdi 
     197         z_fco2(:,:) = fbrmdi 
    198198      END WHERE 
    199199       
     
    208208            &       cpname, __LINE__ ) 
    209209       
    210       ! Get logchl obs type 
     210      ! Get fco2 obs type 
    211211       
    212212      i_type(:,:)=1 
     
    223223      CALL init_obfbdata( inpfile ) 
    224224      CALL alloc_obfbdata( inpfile, 1, iobs, 1, 0, 0, ldgrid ) 
    225       inpfile%cname(1) = 'LOGCHL' 
     225      inpfile%cname(1) = 'fco2' 
    226226 
    227227      ! Fill the obfbdata structure from input data 
     
    233233            iobs = iobs + 1 
    234234            ! Characters 
    235             WRITE(inpfile%cdwmo(iobs),'(A6,A2)') 'logchl','  ' 
     235            WRITE(inpfile%cdwmo(iobs),'(A6,A2)') 'fco2','  ' 
    236236            WRITE(inpfile%cdtyp(iobs),'(I4)') i_type(jobs,jtim) 
    237237            ! Real values 
    238238            inpfile%plam(iobs)         = z_lam(jobs) 
    239239            inpfile%pphi(iobs)         = z_phi(jobs) 
    240             inpfile%pob(1,iobs,1)      = z_logchl(jobs,jtim) 
     240            inpfile%pob(1,iobs,1)      = z_fco2(jobs,jtim) 
    241241            inpfile%ptim(iobs)         = & 
    242242               & REAL(i_reftime(jtim))/(60.*60.*24.) + & 
     
    245245            ! Integers 
    246246            inpfile%kindex(iobs)       = iobs 
    247             IF ( z_logchl(jobs,jtim) == fbrmdi ) THEN 
     247            IF ( z_fco2(jobs,jtim) == fbrmdi ) THEN 
    248248               inpfile%ioqc(iobs)      = 4 
    249249               inpfile%ivqc(iobs,1)    = 4  
     
    266266      END DO 
    267267 
    268    END SUBROUTINE read_logchl 
    269  
    270  
     268   END SUBROUTINE read_fco2 
     269 
     270 
Note: See TracChangeset for help on using the changeset viewer.