Changeset 4048
- Timestamp:
- 2013-10-02T18:32:18+02:00 (11 years ago)
- Location:
- branches/2013/dev_r3987_UKMO4_OBS/NEMOGCM/NEMO
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2013/dev_r3987_UKMO4_OBS/NEMOGCM/NEMO/OOO_SRC/off_data.F90
r4030 r4048 3 3 IMPLICIT NONE 4 4 INTEGER, PARAMETER :: MaxNumFiles = 1000 5 5 6 !! Class 4 file settings 6 7 INTEGER :: & 7 & cl4_fclen, & !: number of forecast days8 & jimatch, & !: current match9 & n_match !: number of matches8 & cl4_fcst_idx(MaxNumFiles), & !: forecast indices 9 & cl4_match_len, & !: number of match types 10 & cl4_fcst_len !: number of forecast days 10 11 CHARACTER(len=lc) :: & 11 & cl4_vars(MaxNumFiles), & !: class 4 variables12 & cl4_sys, & !: class 4 system13 & cl4_cfg, & !: class 4 configuration14 & cl4_date, & !: class 4 date15 & cl4_vn, & !: class 4 version16 & cl4_prefix, & !: class 4 prefix17 & cl4_contact, & !: class 4 contact18 & cl4_inst !: class 4 institute19 REAL :: cl4_modjuld !: model Julian day12 & cl4_vars(MaxNumFiles), & !: class 4 variables 13 & cl4_sys, & !: class 4 system 14 & cl4_cfg, & !: class 4 configuration 15 & cl4_date, & !: class 4 date 16 & cl4_vn, & !: class 4 version 17 & cl4_prefix, & !: class 4 prefix 18 & cl4_contact, & !: class 4 contact 19 & cl4_inst !: class 4 institute 20 REAL :: cl4_modjuld !: model Julian day 20 21 REAL :: & 21 & cl4_leadtime(MaxNumFiles) !: Lead time data 22 & cl4_leadtime(MaxNumFiles) !: Lead time data 23 22 24 !! Offline obs_oper settings 23 25 CHARACTER(len=lc) :: & 24 & model_files(MaxNumFiles)!: model files26 & off_files(MaxNumFiles) !: model files 25 27 INTEGER :: & 26 & nn_modindex(MaxNumFiles), & !: model file indices 27 & nn_forecast(MaxNumFiles) !: forecast indices 28 & jifile, & !: current file list index 29 & n_files, & !: number of files 30 & jimatch, & !: current match 31 & nn_off_idx(MaxNumFiles), & !: time_counter indices 32 & nn_off_freq !: read frequency in time steps 28 33 CHARACTER(len=128) :: & 29 & alt_file !: altimeter file34 & alt_file !: altimeter file 30 35 CONTAINS 31 36 SUBROUTINE off_data_init( ld_cl4 ) … … 44 49 45 50 ! Standard offline obs_oper information 46 NAMELIST/namoff/ model_files, nn_modindex, nn_forecast51 NAMELIST/namoff/off_files, nn_off_idx, nn_off_freq 47 52 48 53 ! Class 4 file specifiers 49 54 NAMELIST/namcl4/cl4_vars, cl4_sys, cl4_cfg, cl4_date, cl4_vn, & 50 55 & cl4_prefix, cl4_contact, cl4_inst, cl4_leadtime, & 51 & cl4_fc len56 & cl4_fcst_idx, cl4_fcst_len, cl4_match_len 52 57 53 58 ! Standard offline obs_oper initialisation 54 jimatch = 0 !: match iteration variable 55 n_match = 0 !: number of matches to perform 56 model_files(:) = '' !: list of files to read in 57 nn_modindex(:) = 0 !: list of indices inside each file 59 jimatch = 0 !: match-up iteration variable 60 jifile = 1 !: input file iteration variable 61 n_files = 0 !: number of files to cycle through 62 off_files(:) = '' !: list of files to read in 63 nn_off_idx(:) = 0 !: list of indices inside each file 64 nn_off_freq = -1 !: input frequency in time steps 58 65 59 66 ! Class 4 initialisation 60 67 cl4_leadtime(:) = 0 !: Lead time axis value for each file 61 cl4_fclen = 0 !: Length of the forecast dimension 68 cl4_fcst_len = 0 !: Length of the forecast dimension 69 cl4_match_len = 1 !: Number of match types 70 cl4_fcst_idx(:) = 0 !: output file forecast index 62 71 cl4_vars(:) = '' !: output file variable names 63 72 cl4_sys = '' !: output file system … … 77 86 ENDIF 78 87 79 ! count forecast/persistencefiles88 ! count input files 80 89 lmask(:) = .FALSE. 81 WHERE ( model_files(:) /= '') lmask(:) = .TRUE.82 n_ match= COUNT(lmask)90 WHERE (off_files(:) /= '') lmask(:) = .TRUE. 91 n_files = COUNT(lmask) 83 92 93 !! Initialise sub obs window frequency 94 IF (nn_off_freq == -1) THEN 95 !! Run length 96 nn_off_freq = nitend - nit000 + 1 97 ENDIF 98 99 !! Print summary of settings 84 100 IF(lwp) THEN 85 101 WRITE(numout,*) … … 87 103 WRITE(numout,*) '~~~~~~~~~~~~~~~~~' 88 104 WRITE(numout,*) ' Namelist namoff : set offline obs_oper parameters' 89 DO jf = 1, n_ match105 DO jf = 1, n_files 90 106 WRITE(numout,'(1X,2A)') ' Input forecast file name forecastfile = ', & 91 TRIM( model_files(jf))107 TRIM(off_files(jf)) 92 108 WRITE(numout,*) ' Input forecast file index forecastindex = ', & 93 nn_ modindex(jf)94 WRITE(numout,*) ' Input forecast leadtime indexleadtimeindex = ', &95 nn_forecast(jf)96 WRITE(numout,*) ' Input forecast leadtime valueleadtimevalue = ', &109 nn_off_idx(jf) 110 WRITE(numout,*) ' Output forecast leadtime index leadtimeindex = ', & 111 cl4_fcst_idx(jf) 112 WRITE(numout,*) ' Output forecast leadtime value leadtimevalue = ', & 97 113 cl4_leadtime(jf) 98 114 WRITE(numout,'(1X,2A)') ' Input class 4 variable class 4 parameter = ', & -
branches/2013/dev_r3987_UKMO4_OBS/NEMOGCM/NEMO/OOO_SRC/off_oper.F90
r4031 r4048 40 40 CALL off_oper_init 41 41 !! Loop over various model counterparts 42 DO jimatch = 1, n_match42 DO jimatch = 1, cl4_match_len 43 43 IF (jimatch .GT. 1) THEN 44 44 !! Initialise obs_oper 45 45 CALL dia_obs_init 46 46 END IF 47 !! Read next model counterpart48 CALL off_rea_dri49 47 !! Interpolate to observation space 50 48 CALL off_oper_interp … … 64 62 !! ** Purpose : To interpolate the model as if it were running online. 65 63 !! 64 !! ** Method : 1. Populate model counterparts 65 !! 2. Call dia_obs at appropriate time steps 66 66 !!---------------------------------------------------------------------- 67 67 IMPLICIT NONE 68 68 INTEGER :: istp ! time step index 69 !! Loop over entire run 69 70 istp = nit000 70 71 nstop = 0 71 72 DO WHILE ( istp <= nitend .AND. nstop == 0 ) 72 CALL dia_obs(istp) 73 IF (jifile <= n_files + 1) THEN 74 IF ( MOD(istp, nn_off_freq) == nit000 ) THEN 75 !! Read next model counterpart 76 CALL off_rea_dri(jifile) 77 jifile = jifile + 1 78 ENDIF 79 !! Interpolate single time step 80 CALL dia_obs(istp) 81 ENDIF 82 !! Increment model step 73 83 istp = istp + 1 74 84 END DO -
branches/2013/dev_r3987_UKMO4_OBS/NEMOGCM/NEMO/OOO_SRC/off_read.F90
r4031 r4048 23 23 24 24 CONTAINS 25 SUBROUTINE off_rea_dri 25 SUBROUTINE off_rea_dri(kfile) 26 26 IMPLICIT NONE 27 INTEGER, INTENT(IN) :: & 28 & kfile !: File number 27 29 CHARACTER(len=lc) :: & 28 30 & cdfilename, & !: File name … … 30 32 INTEGER :: & 31 33 & kindex !: File index to read 32 cdfilename = TRIM(model_files(jimatch)) 33 cmatchname = TRIM(cl4_vars(jimatch)) 34 kindex = nn_modindex(jimatch) 35 IF (TRIM(cmatchname) == 'forecast') THEN 36 CALL off_read_dailymean(TRIM(cdfilename), kindex) 37 CALL off_read_juld(TRIM(cdfilename), kindex, cl4_modjuld) 38 ELSE IF (TRIM(cmatchname) == 'persistence') THEN 39 CALL off_read_dailymean(TRIM(cdfilename), kindex) 34 35 !! Filename, index and match-up kind 36 cdfilename = TRIM(off_files(kfile)) 37 cmatchname = TRIM(cl4_vars(kfile)) 38 kindex = nn_off_idx(kfile) 39 40 !! Update model fields 41 !! Class 4 variables: forecast, persistence, 42 !! nrt_analysis, best_estimate 43 !! Feedback variables: empty string 44 IF ( (TRIM(cmatchname) == 'forecast') .OR. & 45 & (TRIM(cmatchname) == 'persistence') .OR. & 46 & (TRIM(cmatchname) == 'nrt_analysis') .OR. & 47 & (TRIM(cmatchname) == 'best_estimate').OR. & 48 & (TRIM(cmatchname) == '') ) THEN 49 CALL off_read_file(TRIM(cdfilename), kindex) 40 50 CALL off_read_juld(TRIM(cdfilename), kindex, cl4_modjuld) 41 51 ELSE IF (TRIM(cmatchname) == 'climatology') THEN … … 44 54 CALL off_read_altbias(TRIM(cdfilename)) 45 55 CALL off_read_juld(TRIM(cdfilename), kindex, cl4_modjuld) 46 ELSE IF (TRIM(cmatchname) == '') THEN47 ! Feedback file settings48 CALL off_read_dailymean(TRIM(cdfilename), kindex)49 CALL off_read_juld(TRIM(cdfilename), kindex, cl4_modjuld)50 56 END IF 57 51 58 END SUBROUTINE off_rea_dri 52 59 … … 83 90 ELSE 84 91 ! Open Netcdf file to find dimension id 85 istat = nf90_open(trim(filename),nf90_no clobber,ncid)92 istat = nf90_open(trim(filename),nf90_nowrite,ncid) 86 93 istat = nf90_inq_dimid(ncid,'x',xdim) 87 94 istat = nf90_inq_dimid(ncid,'y',ydim) … … 127 134 END SUBROUTINE off_read_altbias 128 135 129 SUBROUTINE off_read_ dailymean(filename, ifcst)136 SUBROUTINE off_read_file(filename, ifcst) 130 137 IMPLICIT NONE 131 138 !------------------------------------------------------------------------ 132 139 ! 133 ! ** off_read_ dailymean**140 ! ** off_read_file ** 134 141 ! 135 142 ! Purpose : To fill tn and sn with dailymean field from netcdf files … … 255 262 istat = nf90_close(ncid) 256 263 END IF 257 END SUBROUTINE off_read_ dailymean264 END SUBROUTINE off_read_file 258 265 259 266 SUBROUTINE off_read_juld(filename, ifcst, julian) … … 291 298 time_str='' 292 299 !! Read in time_counter and remainder seconds 293 istat = nf90_open(trim(filename),nf90_no clobber,ncid)300 istat = nf90_open(trim(filename),nf90_nowrite,ncid) 294 301 istat = nf90_inq_dimid(ncid,'time_counter',dimid) 295 302 IF (istat /= nf90_noerr) THEN -
branches/2013/dev_r3987_UKMO4_OBS/NEMOGCM/NEMO/OOO_SRC/off_write.F90
r4031 r4048 23 23 24 24 INTERFACE off_wri_extra 25 MODULE PROCEDURE off_wri_extra_3d , off_wri_extra_4d, off_wri_extra_4d_index25 MODULE PROCEDURE off_wri_extra_3d_index, off_wri_extra_4d, off_wri_extra_4d_index 26 26 END INTERFACE 27 27 28 28 CONTAINS 29 29 30 SUBROUTINE off_wri_extra_3d (cdfilename, cdvarname, ndeps, nvars, &31 & nobs, pdata)30 SUBROUTINE off_wri_extra_3d_index(cdfilename, cdvarname, ndeps, nvars, & 31 & nobs, kstart, kcount, pdata) 32 32 !!---------------------------------------------------------------------- 33 33 !! *** ROUTINE off_wri_extra_3d *** … … 43 43 & cdfilename, & !: netcdf file name 44 44 & cdvarname !: netcdf variable name 45 INTEGER, DIMENSION(3), INTENT(IN) :: & 46 & kstart, & !: start indices 47 & kcount !: count indices 45 48 REAL(KIND=cldp), DIMENSION(ndeps, nvars, nobs), INTENT(IN) :: & 46 49 & pdata !: 3d data … … 54 57 ! Write data 55 58 CALL chkerr(nf90_inq_varid(ncid,TRIM(cdvarname), varid),cpname, __LINE__ ) 56 CALL chkerr(nf90_put_var(ncid, varid, pdata ),cpname, __LINE__ )59 CALL chkerr(nf90_put_var(ncid, varid, pdata, kstart, kcount),cpname, __LINE__ ) 57 60 ! Close netcdf file 58 61 CALL chkerr(nf90_close(ncid), cpname, __LINE__ ) 59 END SUBROUTINE off_wri_extra_3d 62 END SUBROUTINE off_wri_extra_3d_index 60 63 61 64 SUBROUTINE off_wri_extra_4d_index(cdfilename, cdvarname, ndeps, nfcst, & … … 249 252 END SUBROUTINE off_wri_default 250 253 251 SUBROUTINE off_wri_init(cconf, csys, ckind, cversion, c date, &252 & nproc, nobs, nvars, ndeps, nfcst, &253 & cdfilename)254 SUBROUTINE off_wri_init(cconf, csys, ckind, cversion, ccont, & 255 & cinst, cdate, nproc, nobs, nvars, & 256 & ndeps, nfcst, cdfilename) 254 257 !!---------------------------------------------------------------------- 255 258 !! *** ROUTINE off_wri_init *** … … 265 268 & ckind, & !: observation kind e.g. profile 266 269 & cversion, & !: model version e.g. 12.0 270 & ccont, & !: contact email 271 & cinst, & !: institution description 267 272 & cdate !: e.g. yyyymmdd 268 273 INTEGER, INTENT(IN) :: & … … 358 363 & TRIM(ref_date) ), cpname, __LINE__ ) 359 364 CALL chkerr( nf90_put_att(ncid, nf90_global, 'contact', & 360 & 'andrew.ryan@metoffice.gov.uk'), cpname, __LINE__ )365 & TRIM(ccont) ), cpname, __LINE__ ) 361 366 CALL chkerr( nf90_put_att(ncid, nf90_global, 'obs_type', & 362 367 & TRIM(ckind) ), cpname, __LINE__ ) … … 365 370 CALL chkerr( nf90_put_att(ncid, nf90_global, 'configuration', & 366 371 & TRIM(cconf) ), cpname, __LINE__ ) 367 CALL chkerr( nf90_put_att(ncid, nf90_global, 'institution', &368 & 'UK Met Office'), cpname, __LINE__ )372 CALL chkerr( nf90_put_att(ncid, nf90_global, 'institution', & 373 & TRIM(cinst) ), cpname, __LINE__ ) 369 374 370 375 !! Define Dimensions -
branches/2013/dev_r3987_UKMO4_OBS/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90
r4030 r4048 82 82 LOGICAL, PUBLIC :: ln_ssh !: Logical switch for sea surface height 83 83 LOGICAL, PUBLIC :: ln_sss !: Logical switch for sea surface salinity 84 LOGICAL, PUBLIC :: ln_sstnight !: Logical switch for night mean SST observations 84 85 LOGICAL, PUBLIC :: ln_nea !: Remove observations near land 85 86 LOGICAL, PUBLIC :: ln_altbias !: Logical switch for altimeter bias … … 169 170 & nmsshc, mdtcorr, mdtcutoff, & 170 171 & ln_reysst, ln_ghrsst, reysstname, reysstfmt, & 172 & ln_sstnight, & 171 173 & ln_grid_search_lookup, & 172 174 & grid_search_file, grid_search_res, & … … 228 230 ln_velhradcp = .FALSE. 229 231 ln_velfb = .FALSE. 232 ln_sstnight = .FALSE. 230 233 ln_nea = .FALSE. 231 234 ln_grid_search_lookup = .FALSE. … … 360 363 WRITE(numout,*) ' Logical switch for GHRSST observations ln_ghrsst = ', ln_ghrsst 361 364 WRITE(numout,*) ' Logical switch for feedback SST data ln_sstfb = ', ln_sstfb 365 WRITE(numout,*) ' Logical switch for night-time SST obs ln_sstnight = ', ln_sstnight 362 366 WRITE(numout,*) ' Logical switch for SSS observations ln_sss = ', ln_sss 363 367 WRITE(numout,*) ' Logical switch for Sea Ice observations ln_seaice = ', ln_seaice … … 753 757 nsstsets = nsstsets + 1 754 758 755 ld_sstnight(nsstsets) = .TRUE.759 ld_sstnight(nsstsets) = ln_sstnight 756 760 757 761 CALL obs_rea_sst_rey( reysstname, reysstfmt, sstdata(nsstsets), & … … 767 771 nsstsets = nsstsets + 1 768 772 769 ld_sstnight(nsstsets) = .TRUE.773 ld_sstnight(nsstsets) = ln_sstnight 770 774 771 775 CALL obs_rea_sst( 1, sstdata(nsstsets), jnumsst, & … … 786 790 nsstsets = nsstsets + 1 787 791 788 ld_sstnight(nsstsets) = .TRUE.792 ld_sstnight(nsstsets) = ln_sstnight 789 793 790 794 CALL obs_rea_sst( 0, sstdata(nsstsets), 1, & -
branches/2013/dev_r3987_UKMO4_OBS/NEMOGCM/NEMO/OPA_SRC/OBS/obs_fbm.F90
r4030 r4048 1044 1044 TYPE(obfbdata) :: fbdata ! obsfbdata structure 1045 1045 IF (ln_cl4) THEN 1046 WRITE(*,*) "DEBUG: Writing class 4 file outputs"1047 1046 ! Class 4 file output stream 1048 1047 CALL write_obfbdata_cl( cdfilename, fbdata ) 1049 1048 ELSE 1050 WRITE(*,*) "DEBUG: Writing feedback file outputs"1051 1049 ! Standard feedback file output stream 1052 1050 CALL write_obfbdata_fb( cdfilename, fbdata ) … … 1579 1577 & cconf, & !: model configuration 1580 1578 & csys, & !: model system 1579 & ccont, & !: contact email 1580 & cinst, & !: institution 1581 1581 & cversion !: model version 1582 1582 CHARACTER(len=8) :: & … … 1611 1611 CHARACTER(len=128), DIMENSION(:), ALLOCATABLE :: & 1612 1612 & ctype !: Instrument type 1613 CHARACTER(len=nf90_max_name) :: & 1614 & cdtmp !: NetCDF variable name 1613 1615 CHARACTER(len=8), DIMENSION(:), ALLOCATABLE :: & 1614 1616 & cwmo, & !: Instrument WMO ID … … 1626 1628 csys = TRIM(cl4_sys) 1627 1629 cversion = TRIM(cl4_vn) 1630 ccont = TRIM(cl4_contact) 1631 cinst = TRIM(cl4_inst) 1628 1632 cdate = TRIM(cl4_date) 1629 1633 CALL locate_kind(cdfilename, ckind) 1630 1634 kproc = narea 1631 kfcst = cl4_fc len1635 kfcst = cl4_fcst_len 1632 1636 kobs = fbdata%nobs 1633 1637 kdeps = fbdata%nlev … … 1663 1667 DO ivar = 1, kvars 1664 1668 DO iobs = 1, kobs 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1669 ! 1 symbolises good for fbdata 1670 ! fbimdi symbolises that qc has not been set 1671 ! Essentially, if any fbdata flag is not an element of {1, fbimdi} 1672 ! then set the class 4 flag to bad. 1673 ! Note: fbdata%ioqc is marked good if zero. 1674 IF (((fbdata%ioqc(iobs) /= 0) .AND. & 1675 & (fbdata%ioqc(iobs) /= fbimdi)) .OR. & 1676 & ((fbdata%ipqc(iobs) /= 1) .AND. & 1677 & (fbdata%ipqc(iobs) /= fbimdi)) .OR. & 1678 & ((fbdata%idqc(idep,iobs) /= 1) .AND. & 1679 & (fbdata%idqc(idep,iobs) /= fbimdi)) .OR. & 1680 & ((fbdata%ivqc(iobs,ivar) /= 1) .AND. & 1681 & (fbdata%ivqc(iobs,ivar) /= fbimdi)) .OR. & 1682 & ((fbdata%ivlqc(idep,iobs,ivar) /= 1) .AND. & 1683 & (fbdata%ivlqc(idep,iobs,ivar) /= fbimdi)) .OR. & 1684 & ((fbdata%itqc(iobs) /= 1) .AND. & 1685 & (fbdata%itqc(iobs) /= fbimdi))) THEN 1686 ! 1 symbolises bad for class 4 file 1687 k2qc(idep, ivar, iobs) = 1 1688 ELSE 1689 ! 0 symbolises good for class 4 file 1690 k2qc(idep, ivar, iobs) = 0 1691 END IF 1688 1692 END DO 1689 1693 END DO … … 1697 1701 ! 1,2,3,4 --> 1,4,2,3 1698 1702 pmod(:,:,:) = fbrmdi 1699 ij = nn_forecast(jimatch)1703 ij = cl4_fcst_idx(jimatch) 1700 1704 DO ii = 1,kdeps 1701 1705 DO ik = 1, kvars … … 1710 1714 1711 1715 ! Lead time of class 4 file is a global parameter 1712 plead = cl4_leadtime(1:cl4_fc len)1716 plead = cl4_leadtime(1:cl4_fcst_len) 1713 1717 1714 1718 ! Model Julian day … … 1725 1729 1726 1730 ! Initialise class 4 file 1727 CALL off_wri_init(cconf, csys, ckind, cversion, c date, &1731 CALL off_wri_init(cconf, csys, ckind, cversion, ccont, cinst, cdate, & 1728 1732 & kproc, kobs, kvars, kdeps, kfcst, & 1729 1733 & clfilename) … … 1734 1738 & plam, pphi, pdep, ptim, pob, plead, & 1735 1739 & k2qc, pmodjuld) 1736 1737 1740 !! Write to optional variables 1738 CALL off_wri_extra(clfilename, TRIM(cl4_vars(jimatch)), kdeps, kfcst, & 1739 & kvars, kobs, (/ 1,ij,1,1 /), (/ kdeps,1,kvars,kobs /), pmod) 1741 cdtmp = cl4_vars(jimatch) 1742 IF ( (TRIM(cdtmp) == "forecast") .OR. & 1743 (TRIM(cdtmp) == "persistence") ) THEN 1744 !! 4D variables 1745 CALL off_wri_extra(clfilename, TRIM(cdtmp), kdeps, kfcst, & 1746 & kvars, kobs, (/ 1,ij,1,1 /), (/ kdeps,1,kvars,kobs /), pmod) 1747 ELSE 1748 !! 3D variables 1749 CALL off_wri_extra(clfilename, TRIM(cdtmp), kdeps, & 1750 & kvars, kobs, (/ 1,1,1 /), (/ kdeps,kvars,kobs /), pmod) 1751 ENDIF 1740 1752 1741 1753 DEALLOCATE(plam, pphi, ptim, pdep, plead, kqc, k2qc, & -
branches/2013/dev_r3987_UKMO4_OBS/NEMOGCM/NEMO/OPA_SRC/OBS/obs_oper.F90
r3651 r4048 861 861 862 862 ENDIF 863 864 863 sstdatqc%rmod(jobs,1) = zext(1) 865 864
Note: See TracChangeset
for help on using the changeset viewer.