Changeset 8105
- Timestamp:
- 2017-05-31T17:35:14+02:00 (7 years ago)
- Location:
- branches/UKMO/dev_r4650_general_vert_coord_obsoper_pfts/NEMOGCM/NEMO/OPA_SRC/OBS
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/UKMO/dev_r4650_general_vert_coord_obsoper_pfts/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90
r7713 r8105 16 16 !!---------------------------------------------------------------------- 17 17 !! * Modules used 18 USE trc, ONLY: trn ! ERSEM state variables 18 19 USE wrk_nemo ! Memory Allocation 19 20 USE par_kind ! Precision variables … … 92 93 LOGICAL, PUBLIC :: ln_logchl !: Logical switch for log10(chlorophyll) 93 94 LOGICAL, PUBLIC :: ln_logchlfb !: Logical switch for logchl from feedback files 95 96 97 98 99 100 101 102 103 104 105 106 ! JOZEF ADDITION 107 108 109 LOGICAL, PUBLIC :: ln_logchlpft !: Logical switch for log10(chlorophyll) PFTs 110 LOGICAL, PUBLIC :: ln_logchlpftfb !: Logical switch for logchl PFTs from feedback files 111 112 INTEGER, PUBLIC :: nn_logchlpftscc = 4 ! Number of logchl PFTs 113 114 115 116 ! END 117 118 119 120 121 122 123 124 125 126 127 128 129 130 94 131 LOGICAL, PUBLIC :: ln_spm !: Logical switch for spm 95 132 LOGICAL, PUBLIC :: ln_spmfb !: Logical switch for spm from feedback files … … 117 154 118 155 INTEGER, PARAMETER :: MaxNumFiles = 1000 156 157 158 159 119 160 LOGICAL, DIMENSION(MaxNumFiles) :: & 120 161 & ln_profb_ena, & !: Is the feedback files from ENACT data ? … … 163 204 IMPLICIT NONE 164 205 206 165 207 !! * Local declarations 166 208 CHARACTER(len=128) :: enactfiles(MaxNumFiles) … … 183 225 CHARACTER(len=128) :: logchlfiles(MaxNumFiles) 184 226 CHARACTER(len=128) :: logchlfbfiles(MaxNumFiles) 227 228 229 230 231 232 ! JOZEF ADDITION 233 234 235 236 CHARACTER(len=128), DIMENSION(:,:), ALLOCATABLE :: logchlpftfiles 237 CHARACTER(len=128), DIMENSION(:,:), ALLOCATABLE :: logchlpftfbfiles 238 239 ! CHARACTER(len=128) :: logchlpftfiles(MaxNumFiles, nn_logchlpftscc) 240 ! CHARACTER(len=128) :: logchlpftfbfiles(MaxNumFiles, nn_logchlpftscc) 241 242 ! END 243 244 245 246 247 248 249 185 250 CHARACTER(len=128) :: spmfiles(MaxNumFiles) 186 251 CHARACTER(len=128) :: spmfbfiles(MaxNumFiles) … … 216 281 & ln_logchl, ln_logchlfb, & 217 282 & logchlfiles, logchlfbfiles, & 283 284 285 286 ! JOZEF ADDITION 287 288 & ln_logchlpft, ln_logchlpftfb, & 289 & logchlpftfiles, logchlpftfbfiles, & 290 291 ! END 292 293 294 295 218 296 & ln_spm, ln_spmfb, & 219 297 & spmfiles, spmfbfiles, & … … 245 323 INTEGER :: jnumlogchl 246 324 INTEGER :: jnumlogchlfb 325 326 327 328 329 ! JOZEF ADDITION 330 ! INTEGER :: nn_logchlpftscc 331 332 ! INTEGER, DIMENSION(:), ALLOCATABLE :: jnumlogchlpft 333 ! INTEGER, DIMENSION(:), ALLOCATABLE :: jnumlogchlpftfb 334 335 INTEGER :: jnumlogchlpft(nn_logchlpftscc) 336 INTEGER :: jnumlogchlpftfb(nn_logchlpftscc) 337 338 339 ! END 340 341 342 343 344 247 345 INTEGER :: jnumspm 248 346 INTEGER :: jnumspmfb … … 256 354 LOGICAL :: lmask(MaxNumFiles), ll_u3d, ll_v3d 257 355 356 357 ! JOZEF ADDITION 358 359 INTEGER :: pft 360 361 !END 362 363 364 258 365 !----------------------------------------------------------------------- 259 366 ! Read namelist parameters … … 262 369 ln_logchl = .FALSE. 263 370 ln_logchlfb = .FALSE. 371 372 373 374 375 376 377 ! JOZEF ADDITION 378 ln_logchlpft = .FALSE. 379 ln_logchlpftfb = .FALSE. 380 381 ! #if defined key_fabm 382 ! nn_logchlpftscc = 4 383 ! #elif defined key_medusa 384 ! nn_logchlpftscc = 2 385 ! #elif defined key_hadocc 386 ! nn_logchlpftscc = 1 387 ! #else 388 ! nn_logchlpftscc = 0 389 ! #fi 390 391 ! END 392 393 394 395 396 264 397 ln_spm = .FALSE. 265 398 ln_spmfb = .FALSE. … … 290 423 logchlfiles(:) = '' 291 424 logchlfbfiles(:) = '' 425 426 427 428 429 ! JOZEF ADDITION 430 431 ALLOCATE(logchlpftfiles(MaxNumFiles, nn_logchlpftscc)) 432 ALLOCATE(logchlpftfbfiles(MaxNumFiles, nn_logchlpftscc)) 433 434 DO pft = 1,nn_logchlpftscc 435 logchlpftfiles(:,pft) = '' 436 logchlpftfbfiles(:,pft) = '' 437 END DO 438 ! END 439 440 441 442 443 444 445 292 446 spmfiles(:) = '' 293 447 spmfbfiles(:) = '' … … 406 560 jnumlogchlfb = COUNT(lmask) 407 561 ENDIF 562 563 564 565 566 567 568 569 570 571 572 ! JOZEF ADDITION 573 574 DO pft=1,nn_logchlpftscc 575 576 IF (ln_logchlpft) THEN 577 578 lmask(:) = .FALSE. 579 WHERE (logchlpftfiles(:,pft) /= '') lmask(:) = .TRUE. 580 jnumlogchlpft(pft) = COUNT(lmask) 581 582 ENDIF 583 IF (ln_logchlpftfb) THEN 584 lmask(:) = .FALSE. 585 WHERE (logchlpftfbfiles(:,pft) /= '') lmask(:) = .TRUE. 586 jnumlogchlpftfb(pft) = COUNT(lmask) 587 588 589 ENDIF 590 591 !WRITE(numout,*)'jnumlogchlpftfb is', jnumlogchlpftfbfiles(:,pft) 592 593 END DO 594 ! END 595 596 597 598 WRITE(numout,*)'jnumlogchlpftfb is', logchlpftfbfiles 599 600 601 602 603 408 604 IF (ln_spm) THEN 409 605 lmask(:) = .FALSE. … … 468 664 WRITE(numout,*) ' Logical switch for logchl observations ln_logchl = ', ln_logchl 469 665 WRITE(numout,*) ' Logical switch for feedback logchl data ln_logchlfb = ', ln_logchlfb 666 667 668 669 670 671 ! JOZEF ADDITION 672 673 WRITE(numout,*) ' Logical switch for logchlpft observations ln_logchlpft = ', ln_logchlpft 674 WRITE(numout,*) ' Logical switch for feedback logchlpft data ln_logchlpftfb = ', ln_logchlpftfb 675 676 ! END 677 678 679 680 681 470 682 WRITE(numout,*) ' Logical switch for spm observations ln_spm = ', ln_spm 471 683 WRITE(numout,*) ' Logical switch for feedback spm data ln_spmfb = ', ln_spmfb … … 572 784 END DO 573 785 ENDIF 786 787 574 788 IF (ln_logchl) THEN 575 789 DO ji = 1, jnumlogchl … … 584 798 END DO 585 799 ENDIF 800 801 802 803 804 805 ! JOZEF ADDITION 806 807 IF (ln_logchlpft) THEN 808 809 DO pft=1,nn_logchlpftscc 810 811 DO ji = 1, jnumlogchlpft(pft) 812 WRITE(numout,'(1X,2A)') ' logchlpft input observation file name logchlfiles = ', & 813 TRIM(logchlpftfiles(ji,pft)) 814 END DO 815 END DO 816 ENDIF 817 IF (ln_logchlpftfb) THEN 818 819 DO pft=1,nn_logchlpftscc 820 821 DO ji = 1, jnumlogchlpftfb(pft) 822 WRITE(numout,'(1X,2A)') ' Feedback logchlpft input observation file name logchlfbfiles = ', & 823 TRIM(logchlpftfbfiles(ji,pft)) 824 END DO 825 END DO 826 827 828 ENDIF 829 830 831 !END 832 833 834 835 836 837 838 839 586 840 IF (ln_spm) THEN 587 841 DO ji = 1, jnumspm … … 1182 1436 nlogchlsets = 0 1183 1437 1438 1439 1440 1441 1442 1184 1443 IF ( ln_logchlfb ) THEN ! Feedback file format 1185 1444 … … 1212 1471 ENDIF 1213 1472 1214 ENDIF 1473 ENDIF 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 ! JOZEF ADDITION 1485 1486 1487 IF ( ln_logchlpft ) THEN 1488 1489 ! Set the number of variables for logchl to 1 1490 nlogchlpftvars = 1 ! ??????? ASK DAVID 1491 1492 ! Set the number of extra variables for logchl to 0 1493 nlogchlpftextr = 0 1494 1495 DO pft = 1, nn_logchlpftscc 1496 1497 1498 1499 IF ( ln_logchlpftfb ) THEN 1500 nlogchlpftsets = jnumlogchlpftfb(pft) 1501 ELSE 1502 nlogchlpftsets = 1 1503 ENDIF 1504 1505 1506 1507 END DO 1508 1509 ALLOCATE(logchlpftdata(nn_logchlpftscc)) 1510 ALLOCATE(logchlpftdatqc(nn_logchlpftscc)) 1511 1512 1513 1514 DO pft = 1, nn_logchlpftscc 1515 1516 logchlpftdata(pft)%nsurf=0 1517 logchlpftdatqc(pft)%nsurf=0 1518 1519 nlogchlpftsets = 0 1520 1521 WRITE(numout,*)'jnumlogchlpftfb is', jnumlogchlpftfb, ln_logchlpftfb 1522 1523 IF ( ln_logchlpftfb ) THEN ! Feedback file format 1524 1525 DO jset = 1, jnumlogchlpftfb(pft) 1526 1527 nlogchlpftsets = nlogchlpftsets + 1 1528 1529 CALL obs_rea_logchl( 0, logchlpftdata(pft), 1, & 1530 & logchlpftfbfiles(jset:jset,pft), & 1531 & nlogchlpftvars, nlogchlpftextr, nitend-nit000+2, & 1532 & dobsini, dobsend, ln_ignmis, .FALSE. ) 1533 1534 CALL obs_pre_logchl( logchlpftdata(pft), logchlpftdatqc(pft), & 1535 & ln_logchlpft, ln_nea ) 1536 1537 ENDDO 1538 1539 ELSE ! Original file format 1540 1541 nlogchlpftsets = 1 1542 1543 CALL obs_rea_logchl( 1, logchlpftdata(pft), jnumlogchlpft(pft), & 1544 & logchlpftfiles(1:jnumlogchlpft(pft),pft), & 1545 & nlogchlpftvars, nlogchlpftextr, nitend-nit000+2, & 1546 & dobsini, dobsend, ln_ignmis, .FALSE. ) 1547 1548 CALL obs_pre_logchl( logchlpftdata(pft), logchlpftdatqc(pft), & 1549 & ln_logchlpft, ln_nea ) 1550 1551 ENDIF 1552 1553 ENDDO 1554 1555 1556 1557 1558 1559 ENDIF 1560 1561 1562 nlogchlpftsets = 1 ! THIS SPECIAL CASE NEEDS TO BE GENERALIZED LATER 1563 1564 WRITE(numout,*)'Producing nlogchlpftsets', nlogchlpftsets 1565 1566 ! END 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1215 1585 1216 1586 ! - spm … … 1423 1793 & tmask, umask, vmask 1424 1794 USE phycst, ONLY : & ! Physical constants 1425 & rday, & 1426 & rt0 1795 & rday 1427 1796 USE oce, ONLY : & ! Ocean dynamics and tracers variables 1428 1797 & tsn, & … … 1456 1825 USE par_spm, ONLY: & ! ERSEM/SPM sediments 1457 1826 & jp_spm 1458 USE trc, ONLY : &1459 & trn1460 1827 #endif 1461 1828 IMPLICIT NONE … … 1481 1848 REAL(wp), DIMENSION(jpi,jpj) :: & 1482 1849 logchl ! array for log chlorophyll 1850 1851 1852 1853 1854 1855 1856 1857 ! JOZEF ADDITION 1858 1859 1860 REAL(wp), DIMENSION(jpi,jpj,nn_logchlpftscc) :: & 1861 logchlpfts 1862 1863 1864 ! END 1865 1866 1867 1868 1869 1870 1871 1872 ! array for log chlorophyll pfts 1483 1873 REAL(wp), DIMENSION(jpi,jpj) :: & 1484 1874 maskchl ! array for special chlorophyll mask … … 1496 1886 #if defined key_fabm 1497 1887 REAL(wp), DIMENSION(jpi,jpj,jpk) :: logchl_3d 1498 REAL(wp), DIMENSION(jpi,jpj,jpk) :: pco2_3d 1888 1889 1890 1891 1892 1893 1894 1895 ! JOZEF ADDITION 1896 1897 REAL(wp), DIMENSION(jpi,jpj,jpk,nn_logchlpftscc) :: logchlpfts_3d 1499 1898 #endif 1899 1900 INTEGER :: pft 1901 ! END 1902 1903 1904 1905 1906 1907 1908 1909 1910 1500 1911 CHARACTER(LEN=20) :: datestr=" ",timestr=" " 1501 1912 … … 1639 2050 ENDIF 1640 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 ! JOZEF ADDITION 2061 2062 2063 2064 IF ( ln_logchlpft ) THEN 2065 2066 #if defined key_hadocc 2067 logchl(:,:) = HADOCC_CHL(:,:,1) ! (not log) chlorophyll from HadOCC 2068 #elif defined key_medusa && defined key_foam_medusa 2069 logchl(:,:) = MEDUSA_CHL(:,:,1) ! (not log) chlorophyll from HadOCC 2070 #elif defined key_fabm 2071 logchlpfts_3d(:,:,:,1) = trn(:,:,:,jp_fabm_m1+jp_fabm_chl1) 2072 logchlpfts(:,:,1) = logchlpfts_3d(:,:,1,1) 2073 logchlpfts_3d(:,:,:,2) = trn(:,:,:,jp_fabm_m1+jp_fabm_chl2) 2074 logchlpfts(:,:,2) = logchlpfts_3d(:,:,1,2) 2075 logchlpfts_3d(:,:,:,3) = trn(:,:,:,jp_fabm_m1+jp_fabm_chl3) 2076 logchlpfts(:,:,3) = logchlpfts_3d(:,:,1,3) 2077 logchlpfts_3d(:,:,:,4) = trn(:,:,:,jp_fabm_m1+jp_fabm_chl4) 2078 logchlpfts(:,:,4) = logchlpfts_3d(:,:,1,4) 2079 #else 2080 CALL ctl_stop( ' Trying to run logchl observation operator', & 2081 & ' but no biogeochemical model appears to have been defined' ) 2082 #endif 2083 2084 ! create a special mask to exclude certain things 2085 2086 ! Take the log10 where we can, otherwise exclude 2087 tiny = 1.0e-20 2088 2089 DO pft=1,nn_logchlpftscc 2090 2091 maskchl(:,:) = tmask(:,:,1) 2092 2093 WRITE(numout,*) 'Running pft: ',pft 2094 2095 WHERE(logchlpfts(:,:,pft) > tiny .AND. logchlpfts(:,:,pft) /= obfillflt ) 2096 logchlpfts(:,:,pft) = LOG10(logchlpfts(:,:,pft)) 2097 ELSEWHERE 2098 logchlpfts(:,:,pft) = obfillflt 2099 maskchl(:,:) = 0 2100 END WHERE 2101 2102 WRITE(numout,*) 'Max value of Pft: ', MINVAL(logchlpfts(:,:,pft)) 2103 2104 DO jlogchlset = 1, nlogchlpftsets 2105 WRITE(numout,*) 'nlogchlpftsets, nn_logchlpftscc, obfillflt = ', nlogchlpftsets, nn_logchlpftscc, obfillflt 2106 WRITE(numout,*) 'kstp, jpi, jpj, nit000, n2dint = ', kstp, jpi, jpj, nit000, n2dint 2107 !WRITE(numout,*) 'ALLOCATED(logchlpftdatqc) = ', ALLOCATED(logchlpftdatqc) 2108 WRITE(numout,*) 'SHAPE(logchlpftdatqc) = ', SHAPE(logchlpftdatqc) 2109 WRITE(numout,*) 'SIZE(logchlpftdatqc) = ', SIZE(logchlpftdatqc) 2110 !WRITE(numout,*) 'ALLOCATED(logchlpfts) = ', ALLOCATED(logchlpfts) 2111 WRITE(numout,*) 'SHAPE(logchlpfts) = ', SHAPE(logchlpfts) 2112 WRITE(numout,*) 'SIZE(logchlpfts) = ', SIZE(logchlpfts) 2113 !WRITE(numout,*) 'ALLOCATED(maskchl) = ', ALLOCATED(maskchl) 2114 WRITE(numout,*) 'SHAPE(maskchl) = ', SHAPE(maskchl) 2115 WRITE(numout,*) 'SIZE(maskchl) = ', SIZE(maskchl) 2116 CALL flush(numout) 2117 2118 CALL obs_logchl_opt( logchlpftdatqc(pft), & 2119 & kstp, jpi, jpj, nit000, logchlpfts(:,:,pft), & 2120 & maskchl(:,:), n2dint ) 2121 2122 WRITE(numout,*) 'Max value of Pft: ', MINVAL(logchlpfts(:,:,pft)) 2123 END DO 2124 2125 2126 END DO 2127 2128 ENDIF 2129 2130 ! END 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 1641 2147 IF ( ln_spm ) THEN 1642 2148 #if defined key_spm … … 1787 2293 CHARACTER(LEN=20) :: datestr=" ",timestr=" " 1788 2294 CHARACTER(LEN=20) :: cdtmp 2295 INTEGER :: pft 1789 2296 !----------------------------------------------------------------------- 1790 2297 ! Depending on switches call various observation output routines … … 2058 2565 2059 2566 ENDIF 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 ! JOZEF ADDITION 2584 2585 IF ( ln_logchlpft ) THEN 2586 2587 WRITE(numout,*)'Pfts loop started' 2588 WRITE(numout,*)'nlogchlpftsets', nlogchlpftsets 2589 2590 DO pft = 1, nn_logchlpftscc 2591 2592 ! Copy data from logchldatqc to logchldata structures 2593 DO jlogchlset = 1, nlogchlpftsets 2594 2595 CALL obs_surf_decompress( logchlpftdatqc(pft), & 2596 & logchlpftdata(pft), .TRUE., numout ) 2597 2598 END DO 2599 2600 ! Mark as bad observations with no valid model counterpart due to activities in dia_obs 2601 ! Seem to need to set to fill value rather than marking as bad to be effective, so do both 2602 DO jlogchlset = 1, nlogchlpftsets 2603 WHERE ( logchlpftdata(pft)%rmod(:,1) == obfillflt ) 2604 logchlpftdata(pft)%nqc(:) = 1 2605 logchlpftdata(pft)%robs(:,1) = obfillflt 2606 END WHERE 2607 END DO 2608 2609 ! Write the logchl data 2610 DO jlogchlset = 1, nlogchlpftsets 2611 2612 WRITE(numout,*)'Code Pfts here!' 2613 2614 ! WRITE(cdtmp,'(A,I2.2)')'logchlpftfb_',jlogchlset 2615 WRITE(cdtmp,'(A,I2.2,A,I2.2)')'logchlpft',pft,'fb_',jlogchlset 2616 !CALL obs_wri_logchl( cdtmp, logchlpftdata(jlogchlset,pft) ) 2617 CALL obs_wri_logchl( cdtmp, logchlpftdata(pft), pft_num=jlogchlset ) 2618 2619 END DO 2620 2621 END DO 2622 2623 ENDIF 2624 2625 ! END 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2060 2644 2061 2645 ! - spm -
branches/UKMO/dev_r4650_general_vert_coord_obsoper_pfts/NEMOGCM/NEMO/OPA_SRC/OBS/obs_logchl.F90
r7713 r8105 22 22 PRIVATE 23 23 24 PUBLIC nlogchlvars, nlogchl extr, nlogchlsets, logchldata, logchldatqc24 PUBLIC nlogchlvars, nlogchlpftvars, nlogchlextr, nlogchlpftextr, nlogchlsets, nlogchlpftsets, logchldata, logchldatqc, logchlpftdata, logchlpftdatqc, nn_logchlpfts 25 25 26 26 !! * Shared Module variables 27 INTEGER :: nn_logchlpfts 28 27 29 INTEGER :: nlogchlvars ! Number of logchldata variables 28 30 INTEGER :: nlogchlextr ! Number of logchldata extra 29 ! variables 30 INTEGER :: nlogchlsets ! Number of logchldata sets 31 32 INTEGER :: nlogchlpftvars ! Number of logchldata variables 33 INTEGER :: nlogchlpftextr ! Number of logchldata extra 34 ! variables 35 INTEGER :: nlogchlsets 36 INTEGER :: nlogchlpftsets 37 ! Number of logchldata sets 31 38 TYPE(obs_surf), POINTER, DIMENSION(:) :: logchldata ! Initial logchl data 32 39 TYPE(obs_surf), POINTER, DIMENSION(:) :: logchldatqc ! Sea ice data after quality control 33 40 41 TYPE(obs_surf), POINTER, DIMENSION(:) :: logchlpftdata ! Initial logchl data 42 TYPE(obs_surf), POINTER, DIMENSION(:) :: logchlpftdatqc 43 34 44 END MODULE obs_logchl 35 45 -
branches/UKMO/dev_r4650_general_vert_coord_obsoper_pfts/NEMOGCM/NEMO/OPA_SRC/OBS/obs_write.F90
r7713 r8105 938 938 END SUBROUTINE obs_wri_vel 939 939 940 SUBROUTINE obs_wri_logchl( cprefix, logchldata, padd, pext ) 940 ! SUBROUTINE obs_wri_logchl( cprefix, logchldata, padd, pext ) 941 SUBROUTINE obs_wri_logchl( cprefix, logchldata, padd, pext, pft_num ) 941 942 !!----------------------------------------------------------------------- 942 943 !! … … 970 971 INTEGER :: nadd 971 972 INTEGER :: next 973 INTEGER, OPTIONAL :: pft_num 972 974 973 975 IF ( PRESENT( padd ) ) THEN … … 988 990 & 1 + nadd, next, .TRUE. ) 989 991 990 fbdata%cname(1) = 'LOGCHL' 992 !fbdata%cname(1) = 'LOGCHL' 993 IF ( PRESENT( pft_num ) ) THEN 994 WRITE(fbdata%cname(1),'(A,I2.2)')'LOGCHL',pft_num 995 ELSE 996 fbdata%cname(1) = 'LOGCHL' 997 ENDIF 998 991 999 fbdata%coblong(1) = 'logchl concentration' 992 1000 fbdata%cobunit(1) = 'mg/m3'
Note: See TracChangeset
for help on using the changeset viewer.