[2128] | 1 | MODULE diaobs |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE diaobs *** |
---|
| 4 | !! Observation diagnostics: Computation of the misfit between data and |
---|
| 5 | !! their model equivalent |
---|
| 6 | !!====================================================================== |
---|
[9168] | 7 | !! History : 1.0 ! 2006-03 (K. Mogensen) Original code |
---|
| 8 | !! - ! 2006-05 (K. Mogensen, A. Weaver) Reformatted |
---|
| 9 | !! - ! 2006-10 (A. Weaver) Cleaning and add controls |
---|
| 10 | !! - ! 2007-03 (K. Mogensen) General handling of profiles |
---|
| 11 | !! - ! 2007-04 (G. Smith) Generalized surface operators |
---|
| 12 | !! 2.0 ! 2008-10 (M. Valdivieso) obs operator for velocity profiles |
---|
| 13 | !! 3.4 ! 2014-08 (J. While) observation operator for profiles in all vertical coordinates |
---|
| 14 | !! - ! Incorporated SST bias correction |
---|
| 15 | !! 3.6 ! 2015-02 (M. Martin) Simplification of namelist and code |
---|
| 16 | !! - ! 2015-08 (M. Martin) Combined surface/profile routines. |
---|
| 17 | !! 4.0 ! 2017-11 (G. Madec) style only |
---|
| 18 | !!---------------------------------------------------------------------- |
---|
[2128] | 19 | |
---|
| 20 | !!---------------------------------------------------------------------- |
---|
[9168] | 21 | !! dia_obs_init : Reading and prepare observations |
---|
| 22 | !! dia_obs : Compute model equivalent to observations |
---|
| 23 | !! dia_obs_wri : Write observational diagnostics |
---|
| 24 | !! calc_date : Compute the date of timestep in YYYYMMDD.HHMMSS format |
---|
| 25 | !! ini_date : Compute the initial date YYYYMMDD.HHMMSS |
---|
| 26 | !! fin_date : Compute the final date YYYYMMDD.HHMMSS |
---|
[2128] | 27 | !!---------------------------------------------------------------------- |
---|
[9168] | 28 | USE par_kind ! Precision variables |
---|
| 29 | USE in_out_manager ! I/O manager |
---|
| 30 | USE par_oce ! ocean parameter |
---|
| 31 | USE dom_oce ! Ocean space and time domain variables |
---|
| 32 | USE sbc_oce ! Sea-ice fraction |
---|
| 33 | ! |
---|
| 34 | USE obs_read_prof ! Reading and allocation of profile obs |
---|
| 35 | USE obs_read_surf ! Reading and allocation of surface obs |
---|
| 36 | USE obs_sstbias ! Bias correction routine for SST |
---|
| 37 | USE obs_readmdt ! Reading and allocation of MDT for SLA. |
---|
| 38 | USE obs_prep ! Preparation of obs. (grid search etc). |
---|
| 39 | USE obs_oper ! Observation operators |
---|
| 40 | USE obs_write ! Writing of observation related diagnostics |
---|
| 41 | USE obs_grid ! Grid searching |
---|
| 42 | USE obs_read_altbias ! Bias treatment for altimeter |
---|
| 43 | USE obs_profiles_def ! Profile data definitions |
---|
| 44 | USE obs_surf_def ! Surface data definitions |
---|
| 45 | USE obs_types ! Definitions for observation types |
---|
| 46 | ! |
---|
| 47 | USE mpp_map ! MPP mapping |
---|
| 48 | USE lib_mpp ! For ctl_warn/stop |
---|
[2128] | 49 | |
---|
| 50 | IMPLICIT NONE |
---|
| 51 | PRIVATE |
---|
| 52 | |
---|
[9019] | 53 | PUBLIC dia_obs_init ! Initialize and read observations |
---|
| 54 | PUBLIC dia_obs ! Compute model equivalent to observations |
---|
| 55 | PUBLIC dia_obs_wri ! Write model equivalent to observations |
---|
| 56 | PUBLIC dia_obs_dealloc ! Deallocate dia_obs data |
---|
| 57 | PUBLIC calc_date ! Compute the date of a timestep |
---|
| 58 | |
---|
[14056] | 59 | LOGICAL, PUBLIC :: ln_diaobs !: Logical switch for the obs operator |
---|
| 60 | LOGICAL :: ln_sstnight ! Logical switch for night mean SST obs |
---|
| 61 | LOGICAL :: ln_default_fp_indegs ! T=> Default obs footprint size specified in degrees, F=> in metres |
---|
| 62 | LOGICAL :: ln_sla_fp_indegs ! T=> SLA obs footprint size specified in degrees, F=> in metres |
---|
| 63 | LOGICAL :: ln_sst_fp_indegs ! T=> SST obs footprint size specified in degrees, F=> in metres |
---|
| 64 | LOGICAL :: ln_sss_fp_indegs ! T=> SSS obs footprint size specified in degrees, F=> in metres |
---|
| 65 | LOGICAL :: ln_sic_fp_indegs ! T=> sea-ice obs footprint size specified in degrees, F=> in metres |
---|
[9023] | 66 | |
---|
[14056] | 67 | REAL(wp) :: rn_default_avglamscl ! E/W diameter of SLA observation footprint (metres) |
---|
| 68 | REAL(wp) :: rn_default_avgphiscl ! N/S diameter of SLA observation footprint (metre |
---|
| 69 | REAL(wp) :: rn_sla_avglamscl ! E/W diameter of SLA observation footprint (metres) |
---|
| 70 | REAL(wp) :: rn_sla_avgphiscl ! N/S diameter of SLA observation footprint (metres) |
---|
| 71 | REAL(wp) :: rn_sst_avglamscl ! E/W diameter of SST observation footprint (metres) |
---|
| 72 | REAL(wp) :: rn_sst_avgphiscl ! N/S diameter of SST observation footprint (metres) |
---|
| 73 | REAL(wp) :: rn_sss_avglamscl ! E/W diameter of SSS observation footprint (metres) |
---|
| 74 | REAL(wp) :: rn_sss_avgphiscl ! N/S diameter of SSS observation footprint (metres) |
---|
| 75 | REAL(wp) :: rn_sic_avglamscl ! E/W diameter of sea-ice observation footprint (metres) |
---|
| 76 | REAL(wp) :: rn_sic_avgphiscl ! N/S diameter of sea-ice observation footprint (metres) |
---|
[9023] | 77 | |
---|
[14056] | 78 | INTEGER :: nn_1dint ! Vertical interpolation method |
---|
| 79 | INTEGER :: nn_2dint_default ! Default horizontal interpolation method |
---|
| 80 | INTEGER :: nn_2dint_sla ! SLA horizontal interpolation method |
---|
| 81 | INTEGER :: nn_2dint_sst ! SST horizontal interpolation method |
---|
| 82 | INTEGER :: nn_2dint_sss ! SSS horizontal interpolation method |
---|
| 83 | INTEGER :: nn_2dint_sic ! Seaice horizontal interpolation method |
---|
[9168] | 84 | INTEGER, DIMENSION(imaxavtypes) :: nn_profdavtypes ! Profile data types representing a daily average |
---|
| 85 | INTEGER :: nproftypes ! Number of profile obs types |
---|
| 86 | INTEGER :: nsurftypes ! Number of surface obs types |
---|
| 87 | INTEGER , DIMENSION(:), ALLOCATABLE :: nvarsprof, nvarssurf ! Number of profile & surface variables |
---|
| 88 | INTEGER , DIMENSION(:), ALLOCATABLE :: nextrprof, nextrsurf ! Number of profile & surface extra variables |
---|
| 89 | INTEGER , DIMENSION(:), ALLOCATABLE :: n2dintsurf ! Interpolation option for surface variables |
---|
| 90 | REAL(wp), DIMENSION(:), ALLOCATABLE :: zavglamscl, zavgphiscl ! E/W & N/S diameter of averaging footprint for surface variables |
---|
| 91 | LOGICAL , DIMENSION(:), ALLOCATABLE :: lfpindegs ! T=> surface obs footprint size specified in degrees, F=> in metres |
---|
| 92 | LOGICAL , DIMENSION(:), ALLOCATABLE :: llnightav ! Logical for calculating night-time averages |
---|
[2128] | 93 | |
---|
[9168] | 94 | TYPE(obs_surf), PUBLIC, POINTER, DIMENSION(:) :: surfdata !: Initial surface data |
---|
| 95 | TYPE(obs_surf), PUBLIC, POINTER, DIMENSION(:) :: surfdataqc !: Surface data after quality control |
---|
| 96 | TYPE(obs_prof), PUBLIC, POINTER, DIMENSION(:) :: profdata !: Initial profile data |
---|
| 97 | TYPE(obs_prof), PUBLIC, POINTER, DIMENSION(:) :: profdataqc !: Profile data after quality control |
---|
[9023] | 98 | |
---|
[15077] | 99 | CHARACTER(len=lca), PUBLIC, DIMENSION(:), ALLOCATABLE :: cobstypesprof, cobstypessurf !: Profile & surface obs types |
---|
[2128] | 100 | |
---|
[14982] | 101 | # include "domzgr_substitute.h90" |
---|
[2287] | 102 | !!---------------------------------------------------------------------- |
---|
[9598] | 103 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
[2287] | 104 | !! $Id$ |
---|
[10068] | 105 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
[2287] | 106 | !!---------------------------------------------------------------------- |
---|
[2128] | 107 | CONTAINS |
---|
| 108 | |
---|
[12377] | 109 | SUBROUTINE dia_obs_init( Kmm ) |
---|
[2128] | 110 | !!---------------------------------------------------------------------- |
---|
| 111 | !! *** ROUTINE dia_obs_init *** |
---|
| 112 | !! |
---|
| 113 | !! ** Purpose : Initialize and read observations |
---|
| 114 | !! |
---|
| 115 | !! ** Method : Read the namelist and call reading routines |
---|
| 116 | !! |
---|
| 117 | !! ** Action : Read the namelist and call reading routines |
---|
| 118 | !! |
---|
| 119 | !!---------------------------------------------------------------------- |
---|
[12377] | 120 | INTEGER, INTENT(in) :: Kmm ! ocean time level indices |
---|
| 121 | INTEGER, PARAMETER :: jpmaxnfiles = 1000 ! Maximum number of files for each obs type |
---|
[9019] | 122 | INTEGER, DIMENSION(:), ALLOCATABLE :: ifilesprof, ifilessurf ! Number of profile & surface files |
---|
[6140] | 123 | INTEGER :: ios ! Local integer output status for namelist read |
---|
| 124 | INTEGER :: jtype ! Counter for obs types |
---|
| 125 | INTEGER :: jvar ! Counter for variables |
---|
| 126 | INTEGER :: jfile ! Counter for files |
---|
[14056] | 127 | INTEGER :: jnumsstbias ! Number of SST bias files to read and apply |
---|
| 128 | INTEGER :: n2dint_type ! Local version of nn_2dint* |
---|
[9168] | 129 | ! |
---|
[6140] | 130 | CHARACTER(len=128), DIMENSION(jpmaxnfiles) :: & |
---|
| 131 | & cn_profbfiles, & ! T/S profile input filenames |
---|
| 132 | & cn_sstfbfiles, & ! Sea surface temperature input filenames |
---|
[9023] | 133 | & cn_sssfbfiles, & ! Sea surface salinity input filenames |
---|
[6140] | 134 | & cn_slafbfiles, & ! Sea level anomaly input filenames |
---|
| 135 | & cn_sicfbfiles, & ! Seaice concentration input filenames |
---|
| 136 | & cn_velfbfiles, & ! Velocity profile input filenames |
---|
[14056] | 137 | & cn_sstbiasfiles ! SST bias input filenames |
---|
[6140] | 138 | CHARACTER(LEN=128) :: & |
---|
| 139 | & cn_altbiasfile ! Altimeter bias input filename |
---|
| 140 | CHARACTER(len=128), DIMENSION(:,:), ALLOCATABLE :: & |
---|
| 141 | & clproffiles, & ! Profile filenames |
---|
| 142 | & clsurffiles ! Surface filenames |
---|
[14056] | 143 | CHARACTER(len=8), DIMENSION(:), ALLOCATABLE :: & |
---|
| 144 | & clvars ! Expected variable names |
---|
[9168] | 145 | ! |
---|
[6140] | 146 | LOGICAL :: ln_t3d ! Logical switch for temperature profiles |
---|
| 147 | LOGICAL :: ln_s3d ! Logical switch for salinity profiles |
---|
| 148 | LOGICAL :: ln_sla ! Logical switch for sea level anomalies |
---|
| 149 | LOGICAL :: ln_sst ! Logical switch for sea surface temperature |
---|
[9023] | 150 | LOGICAL :: ln_sss ! Logical switch for sea surface salinity |
---|
[6140] | 151 | LOGICAL :: ln_sic ! Logical switch for sea ice concentration |
---|
| 152 | LOGICAL :: ln_vel3d ! Logical switch for velocity (u,v) obs |
---|
| 153 | LOGICAL :: ln_nea ! Logical switch to remove obs near land |
---|
| 154 | LOGICAL :: ln_altbias ! Logical switch for altimeter bias |
---|
[9019] | 155 | LOGICAL :: ln_sstbias ! Logical switch for bias corection of SST |
---|
[6140] | 156 | LOGICAL :: ln_ignmis ! Logical switch for ignoring missing files |
---|
| 157 | LOGICAL :: ln_s_at_t ! Logical switch to compute model S at T obs |
---|
[9023] | 158 | LOGICAL :: ln_bound_reject ! Logical to remove obs near boundaries in LAMs. |
---|
[14056] | 159 | LOGICAL :: ltype_fp_indegs ! Local version of ln_*_fp_indegs |
---|
| 160 | LOGICAL :: ltype_night ! Local version of ln_sstnight (false for other variables) |
---|
| 161 | LOGICAL, DIMENSION(:), ALLOCATABLE :: llvar ! Logical for profile variable read |
---|
[6140] | 162 | LOGICAL, DIMENSION(jpmaxnfiles) :: lmask ! Used for finding number of sstbias files |
---|
[9168] | 163 | ! |
---|
[14056] | 164 | REAL(dp) :: rn_dobsini ! Obs window start date YYYYMMDD.HHMMSS |
---|
| 165 | REAL(dp) :: rn_dobsend ! Obs window end date YYYYMMDD.HHMMSS |
---|
| 166 | REAL(wp) :: ztype_avglamscl ! Local version of rn_*_avglamscl |
---|
| 167 | REAL(wp) :: ztype_avgphiscl ! Local version of rn_*_avgphiscl |
---|
| 168 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: zglam ! Model longitudes for profile variables |
---|
| 169 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: zgphi ! Model latitudes for profile variables |
---|
| 170 | REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE :: zmask ! Model land/sea mask associated with variables |
---|
[9168] | 171 | !! |
---|
[6140] | 172 | NAMELIST/namobs/ln_diaobs, ln_t3d, ln_s3d, ln_sla, & |
---|
[9023] | 173 | & ln_sst, ln_sic, ln_sss, ln_vel3d, & |
---|
| 174 | & ln_altbias, ln_sstbias, ln_nea, & |
---|
| 175 | & ln_grid_global, ln_grid_search_lookup, & |
---|
| 176 | & ln_ignmis, ln_s_at_t, ln_bound_reject, & |
---|
[14056] | 177 | & ln_sstnight, ln_default_fp_indegs, & |
---|
[9023] | 178 | & ln_sla_fp_indegs, ln_sst_fp_indegs, & |
---|
| 179 | & ln_sss_fp_indegs, ln_sic_fp_indegs, & |
---|
[6140] | 180 | & cn_profbfiles, cn_slafbfiles, & |
---|
| 181 | & cn_sstfbfiles, cn_sicfbfiles, & |
---|
[9023] | 182 | & cn_velfbfiles, cn_sssfbfiles, & |
---|
| 183 | & cn_sstbiasfiles, cn_altbiasfile, & |
---|
[6140] | 184 | & cn_gridsearchfile, rn_gridsearchres, & |
---|
[9023] | 185 | & rn_dobsini, rn_dobsend, & |
---|
[14056] | 186 | & rn_default_avglamscl, rn_default_avgphiscl, & |
---|
[9023] | 187 | & rn_sla_avglamscl, rn_sla_avgphiscl, & |
---|
| 188 | & rn_sst_avglamscl, rn_sst_avgphiscl, & |
---|
| 189 | & rn_sss_avglamscl, rn_sss_avgphiscl, & |
---|
| 190 | & rn_sic_avglamscl, rn_sic_avgphiscl, & |
---|
[14056] | 191 | & nn_1dint, nn_2dint_default, & |
---|
[9023] | 192 | & nn_2dint_sla, nn_2dint_sst, & |
---|
| 193 | & nn_2dint_sss, nn_2dint_sic, & |
---|
[6140] | 194 | & nn_msshc, rn_mdtcorr, rn_mdtcutoff, & |
---|
[9023] | 195 | & nn_profdavtypes |
---|
[9168] | 196 | !----------------------------------------------------------------------- |
---|
[2128] | 197 | |
---|
| 198 | !----------------------------------------------------------------------- |
---|
| 199 | ! Read namelist parameters |
---|
| 200 | !----------------------------------------------------------------------- |
---|
[6140] | 201 | ! Some namelist arrays need initialising |
---|
[9168] | 202 | cn_profbfiles (:) = '' |
---|
| 203 | cn_slafbfiles (:) = '' |
---|
| 204 | cn_sstfbfiles (:) = '' |
---|
| 205 | cn_sicfbfiles (:) = '' |
---|
| 206 | cn_velfbfiles (:) = '' |
---|
| 207 | cn_sssfbfiles (:) = '' |
---|
[9023] | 208 | cn_sstbiasfiles(:) = '' |
---|
[6140] | 209 | nn_profdavtypes(:) = -1 |
---|
[2128] | 210 | |
---|
[6140] | 211 | CALL ini_date( rn_dobsini ) |
---|
| 212 | CALL fin_date( rn_dobsend ) |
---|
| 213 | |
---|
| 214 | ! Read namelist namobs : control observation diagnostics |
---|
[4147] | 215 | READ ( numnam_ref, namobs, IOSTAT = ios, ERR = 901) |
---|
[11536] | 216 | 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namobs in reference namelist' ) |
---|
[4147] | 217 | READ ( numnam_cfg, namobs, IOSTAT = ios, ERR = 902 ) |
---|
[11536] | 218 | 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'namobs in configuration namelist' ) |
---|
[4624] | 219 | IF(lwm) WRITE ( numond, namobs ) |
---|
[4147] | 220 | |
---|
[9168] | 221 | IF( .NOT.ln_diaobs ) THEN |
---|
| 222 | IF(lwp) WRITE(numout,*) |
---|
| 223 | IF(lwp) WRITE(numout,*) 'dia_obs_init : NO Observation diagnostic used' |
---|
| 224 | IF(lwp) WRITE(numout,*) '~~~~~~~~~~~~' |
---|
[2128] | 225 | RETURN |
---|
| 226 | ENDIF |
---|
[9023] | 227 | |
---|
| 228 | IF(lwp) THEN |
---|
| 229 | WRITE(numout,*) |
---|
| 230 | WRITE(numout,*) 'dia_obs_init : Observation diagnostic initialization' |
---|
| 231 | WRITE(numout,*) '~~~~~~~~~~~~' |
---|
[9168] | 232 | WRITE(numout,*) ' Namelist namobs : set observation diagnostic parameters' |
---|
| 233 | WRITE(numout,*) ' Logical switch for T profile observations ln_t3d = ', ln_t3d |
---|
| 234 | WRITE(numout,*) ' Logical switch for S profile observations ln_s3d = ', ln_s3d |
---|
| 235 | WRITE(numout,*) ' Logical switch for SLA observations ln_sla = ', ln_sla |
---|
| 236 | WRITE(numout,*) ' Logical switch for SST observations ln_sst = ', ln_sst |
---|
| 237 | WRITE(numout,*) ' Logical switch for Sea Ice observations ln_sic = ', ln_sic |
---|
| 238 | WRITE(numout,*) ' Logical switch for velocity observations ln_vel3d = ', ln_vel3d |
---|
| 239 | WRITE(numout,*) ' Logical switch for SSS observations ln_sss = ', ln_sss |
---|
| 240 | WRITE(numout,*) ' Global distribution of observations ln_grid_global = ', ln_grid_global |
---|
| 241 | WRITE(numout,*) ' Logical switch for obs grid search lookup ln_grid_search_lookup = ', ln_grid_search_lookup |
---|
[9023] | 242 | IF (ln_grid_search_lookup) & |
---|
[9168] | 243 | WRITE(numout,*) ' Grid search lookup file header cn_gridsearchfile = ', cn_gridsearchfile |
---|
| 244 | WRITE(numout,*) ' Initial date in window YYYYMMDD.HHMMSS rn_dobsini = ', rn_dobsini |
---|
| 245 | WRITE(numout,*) ' Final date in window YYYYMMDD.HHMMSS rn_dobsend = ', rn_dobsend |
---|
| 246 | WRITE(numout,*) ' Type of vertical interpolation method nn_1dint = ', nn_1dint |
---|
[14056] | 247 | WRITE(numout,*) ' Default horizontal interpolation method nn_2dint_default = ', nn_2dint_default |
---|
| 248 | WRITE(numout,*) ' Type of horizontal interpolation method for SLA nn_2dint_sla = ', nn_2dint_sla |
---|
| 249 | WRITE(numout,*) ' Type of horizontal interpolation method for SST nn_2dint_sst = ', nn_2dint_sst |
---|
| 250 | WRITE(numout,*) ' Type of horizontal interpolation method for SSS nn_2dint_sss = ', nn_2dint_sss |
---|
| 251 | WRITE(numout,*) ' Type of horizontal interpolation method for SIC nn_2dint_sic = ', nn_2dint_sic |
---|
| 252 | WRITE(numout,*) ' Default E/W diameter of obs footprint rn_default_avglamscl = ', rn_default_avglamscl |
---|
| 253 | WRITE(numout,*) ' Default N/S diameter of obs footprint rn_default_avgphiscl = ', rn_default_avgphiscl |
---|
| 254 | WRITE(numout,*) ' Default obs footprint in deg [T] or m [F] ln_default_fp_indegs = ', ln_default_fp_indegs |
---|
| 255 | WRITE(numout,*) ' SLA E/W diameter of obs footprint rn_sla_avglamscl = ', rn_sla_avglamscl |
---|
| 256 | WRITE(numout,*) ' SLA N/S diameter of obs footprint rn_sla_avgphiscl = ', rn_sla_avgphiscl |
---|
| 257 | WRITE(numout,*) ' SLA obs footprint in deg [T] or m [F] ln_sla_fp_indegs = ', ln_sla_fp_indegs |
---|
| 258 | WRITE(numout,*) ' SST E/W diameter of obs footprint rn_sst_avglamscl = ', rn_sst_avglamscl |
---|
| 259 | WRITE(numout,*) ' SST N/S diameter of obs footprint rn_sst_avgphiscl = ', rn_sst_avgphiscl |
---|
| 260 | WRITE(numout,*) ' SST obs footprint in deg [T] or m [F] ln_sst_fp_indegs = ', ln_sst_fp_indegs |
---|
| 261 | WRITE(numout,*) ' SIC E/W diameter of obs footprint rn_sic_avglamscl = ', rn_sic_avglamscl |
---|
| 262 | WRITE(numout,*) ' SIC N/S diameter of obs footprint rn_sic_avgphiscl = ', rn_sic_avgphiscl |
---|
| 263 | WRITE(numout,*) ' SIC obs footprint in deg [T] or m [F] ln_sic_fp_indegs = ', ln_sic_fp_indegs |
---|
[9168] | 264 | WRITE(numout,*) ' Rejection of observations near land switch ln_nea = ', ln_nea |
---|
| 265 | WRITE(numout,*) ' Rejection of obs near open bdys ln_bound_reject = ', ln_bound_reject |
---|
| 266 | WRITE(numout,*) ' MSSH correction scheme nn_msshc = ', nn_msshc |
---|
| 267 | WRITE(numout,*) ' MDT correction rn_mdtcorr = ', rn_mdtcorr |
---|
| 268 | WRITE(numout,*) ' MDT cutoff for computed correction rn_mdtcutoff = ', rn_mdtcutoff |
---|
| 269 | WRITE(numout,*) ' Logical switch for alt bias ln_altbias = ', ln_altbias |
---|
| 270 | WRITE(numout,*) ' Logical switch for sst bias ln_sstbias = ', ln_sstbias |
---|
| 271 | WRITE(numout,*) ' Logical switch for ignoring missing files ln_ignmis = ', ln_ignmis |
---|
| 272 | WRITE(numout,*) ' Daily average types nn_profdavtypes = ', nn_profdavtypes |
---|
| 273 | WRITE(numout,*) ' Logical switch for night-time SST obs ln_sstnight = ', ln_sstnight |
---|
[9023] | 274 | ENDIF |
---|
[2128] | 275 | !----------------------------------------------------------------------- |
---|
[6140] | 276 | ! Set up list of observation types to be used |
---|
| 277 | ! and the files associated with each type |
---|
[2128] | 278 | !----------------------------------------------------------------------- |
---|
| 279 | |
---|
[6140] | 280 | nproftypes = COUNT( (/ln_t3d .OR. ln_s3d, ln_vel3d /) ) |
---|
[9023] | 281 | nsurftypes = COUNT( (/ln_sla, ln_sst, ln_sic, ln_sss /) ) |
---|
[2128] | 282 | |
---|
[9168] | 283 | IF( ln_sstbias ) THEN |
---|
[6140] | 284 | lmask(:) = .FALSE. |
---|
[9168] | 285 | WHERE( cn_sstbiasfiles(:) /= '' ) lmask(:) = .TRUE. |
---|
[6140] | 286 | jnumsstbias = COUNT(lmask) |
---|
| 287 | lmask(:) = .FALSE. |
---|
| 288 | ENDIF |
---|
[2128] | 289 | |
---|
[9168] | 290 | IF( nproftypes == 0 .AND. nsurftypes == 0 ) THEN |
---|
| 291 | CALL ctl_warn( 'dia_obs_init: ln_diaobs is set to true, but all obs operator logical flags', & |
---|
| 292 | & ' (ln_t3d, ln_s3d, ln_sla, ln_sst, ln_sic, ln_vel3d)', & |
---|
| 293 | & ' are set to .FALSE. so turning off calls to dia_obs' ) |
---|
[6140] | 294 | ln_diaobs = .FALSE. |
---|
| 295 | RETURN |
---|
| 296 | ENDIF |
---|
[2128] | 297 | |
---|
[9168] | 298 | IF( nproftypes > 0 ) THEN |
---|
| 299 | ! |
---|
| 300 | ALLOCATE( cobstypesprof(nproftypes) ) |
---|
| 301 | ALLOCATE( ifilesprof (nproftypes) ) |
---|
| 302 | ALLOCATE( clproffiles (nproftypes,jpmaxnfiles) ) |
---|
| 303 | ! |
---|
[6140] | 304 | jtype = 0 |
---|
[9168] | 305 | IF( ln_t3d .OR. ln_s3d ) THEN |
---|
[6140] | 306 | jtype = jtype + 1 |
---|
[14056] | 307 | cobstypesprof(jtype) = 'prof' |
---|
| 308 | clproffiles(jtype,:) = cn_profbfiles |
---|
[2128] | 309 | ENDIF |
---|
[9168] | 310 | IF( ln_vel3d ) THEN |
---|
[6140] | 311 | jtype = jtype + 1 |
---|
[14056] | 312 | cobstypesprof(jtype) = 'vel' |
---|
| 313 | clproffiles(jtype,:) = cn_velfbfiles |
---|
[6140] | 314 | ENDIF |
---|
[9168] | 315 | ! |
---|
[14056] | 316 | CALL obs_settypefiles( nproftypes, jpmaxnfiles, ifilesprof, cobstypesprof, clproffiles ) |
---|
| 317 | ! |
---|
[6140] | 318 | ENDIF |
---|
[2128] | 319 | |
---|
[9168] | 320 | IF( nsurftypes > 0 ) THEN |
---|
| 321 | ! |
---|
| 322 | ALLOCATE( cobstypessurf(nsurftypes) ) |
---|
| 323 | ALLOCATE( ifilessurf (nsurftypes) ) |
---|
| 324 | ALLOCATE( clsurffiles (nsurftypes,jpmaxnfiles) ) |
---|
| 325 | ALLOCATE( n2dintsurf (nsurftypes) ) |
---|
| 326 | ALLOCATE( zavglamscl (nsurftypes) ) |
---|
| 327 | ALLOCATE( zavgphiscl (nsurftypes) ) |
---|
| 328 | ALLOCATE( lfpindegs (nsurftypes) ) |
---|
| 329 | ALLOCATE( llnightav (nsurftypes) ) |
---|
| 330 | ! |
---|
[6140] | 331 | jtype = 0 |
---|
[9168] | 332 | IF( ln_sla ) THEN |
---|
[6140] | 333 | jtype = jtype + 1 |
---|
[14056] | 334 | cobstypessurf(jtype) = 'sla' |
---|
| 335 | clsurffiles(jtype,:) = cn_slafbfiles |
---|
[2128] | 336 | ENDIF |
---|
[9168] | 337 | IF( ln_sst ) THEN |
---|
[6140] | 338 | jtype = jtype + 1 |
---|
[14056] | 339 | cobstypessurf(jtype) = 'sst' |
---|
| 340 | clsurffiles(jtype,:) = cn_sstfbfiles |
---|
[2128] | 341 | ENDIF |
---|
[9570] | 342 | #if defined key_si3 || defined key_cice |
---|
[9168] | 343 | IF( ln_sic ) THEN |
---|
[6140] | 344 | jtype = jtype + 1 |
---|
[14056] | 345 | cobstypessurf(jtype) = 'sic' |
---|
| 346 | clsurffiles(jtype,:) = cn_sicfbfiles |
---|
[6140] | 347 | ENDIF |
---|
| 348 | #endif |
---|
[9168] | 349 | IF( ln_sss ) THEN |
---|
[9023] | 350 | jtype = jtype + 1 |
---|
[14056] | 351 | cobstypessurf(jtype) = 'sss' |
---|
| 352 | clsurffiles(jtype,:) = cn_sssfbfiles |
---|
[9023] | 353 | ENDIF |
---|
[9168] | 354 | ! |
---|
[14056] | 355 | CALL obs_settypefiles( nsurftypes, jpmaxnfiles, ifilessurf, cobstypessurf, clsurffiles ) |
---|
| 356 | |
---|
| 357 | DO jtype = 1, nsurftypes |
---|
| 358 | |
---|
| 359 | IF ( TRIM(cobstypessurf(jtype)) == 'sla' ) THEN |
---|
| 360 | IF ( nn_2dint_sla == -1 ) THEN |
---|
| 361 | n2dint_type = nn_2dint_default |
---|
| 362 | ELSE |
---|
| 363 | n2dint_type = nn_2dint_sla |
---|
| 364 | ENDIF |
---|
| 365 | ztype_avglamscl = rn_sla_avglamscl |
---|
| 366 | ztype_avgphiscl = rn_sla_avgphiscl |
---|
| 367 | ltype_fp_indegs = ln_sla_fp_indegs |
---|
| 368 | ltype_night = .FALSE. |
---|
| 369 | ELSE IF ( TRIM(cobstypessurf(jtype)) == 'sst' ) THEN |
---|
| 370 | IF ( nn_2dint_sst == -1 ) THEN |
---|
| 371 | n2dint_type = nn_2dint_default |
---|
| 372 | ELSE |
---|
| 373 | n2dint_type = nn_2dint_sst |
---|
| 374 | ENDIF |
---|
| 375 | ztype_avglamscl = rn_sst_avglamscl |
---|
| 376 | ztype_avgphiscl = rn_sst_avgphiscl |
---|
| 377 | ltype_fp_indegs = ln_sst_fp_indegs |
---|
| 378 | ltype_night = ln_sstnight |
---|
| 379 | ELSE IF ( TRIM(cobstypessurf(jtype)) == 'sic' ) THEN |
---|
| 380 | IF ( nn_2dint_sic == -1 ) THEN |
---|
| 381 | n2dint_type = nn_2dint_default |
---|
| 382 | ELSE |
---|
| 383 | n2dint_type = nn_2dint_sic |
---|
| 384 | ENDIF |
---|
| 385 | ztype_avglamscl = rn_sic_avglamscl |
---|
| 386 | ztype_avgphiscl = rn_sic_avgphiscl |
---|
| 387 | ltype_fp_indegs = ln_sic_fp_indegs |
---|
| 388 | ltype_night = .FALSE. |
---|
| 389 | ELSE IF ( TRIM(cobstypessurf(jtype)) == 'sss' ) THEN |
---|
| 390 | IF ( nn_2dint_sss == -1 ) THEN |
---|
| 391 | n2dint_type = nn_2dint_default |
---|
| 392 | ELSE |
---|
| 393 | n2dint_type = nn_2dint_sss |
---|
| 394 | ENDIF |
---|
| 395 | ztype_avglamscl = rn_sss_avglamscl |
---|
| 396 | ztype_avgphiscl = rn_sss_avgphiscl |
---|
| 397 | ltype_fp_indegs = ln_sss_fp_indegs |
---|
| 398 | ltype_night = .FALSE. |
---|
| 399 | ELSE |
---|
| 400 | n2dint_type = nn_2dint_default |
---|
| 401 | ztype_avglamscl = rn_default_avglamscl |
---|
| 402 | ztype_avgphiscl = rn_default_avgphiscl |
---|
| 403 | ltype_fp_indegs = ln_default_fp_indegs |
---|
| 404 | ltype_night = .FALSE. |
---|
| 405 | ENDIF |
---|
| 406 | |
---|
| 407 | CALL obs_setinterpopts( nsurftypes, jtype, TRIM(cobstypessurf(jtype)), & |
---|
| 408 | & nn_2dint_default, n2dint_type, & |
---|
| 409 | & ztype_avglamscl, ztype_avgphiscl, & |
---|
| 410 | & ltype_fp_indegs, ltype_night, & |
---|
| 411 | & n2dintsurf, zavglamscl, zavgphiscl, & |
---|
| 412 | & lfpindegs, llnightav ) |
---|
| 413 | |
---|
| 414 | END DO |
---|
| 415 | ! |
---|
[2128] | 416 | ENDIF |
---|
| 417 | |
---|
| 418 | |
---|
[6140] | 419 | !----------------------------------------------------------------------- |
---|
| 420 | ! Obs operator parameter checking and initialisations |
---|
| 421 | !----------------------------------------------------------------------- |
---|
[9168] | 422 | ! |
---|
| 423 | IF( ln_vel3d .AND. .NOT.ln_grid_global ) THEN |
---|
[6140] | 424 | CALL ctl_stop( 'Velocity data only works with ln_grid_global=.true.' ) |
---|
| 425 | RETURN |
---|
| 426 | ENDIF |
---|
[9168] | 427 | ! |
---|
| 428 | IF( ln_grid_global ) THEN |
---|
| 429 | CALL ctl_warn( 'dia_obs_init: ln_grid_global=T may cause memory issues when used with a large number of processors' ) |
---|
[2128] | 430 | ENDIF |
---|
[9168] | 431 | ! |
---|
| 432 | IF( nn_1dint < 0 .OR. nn_1dint > 1 ) THEN |
---|
| 433 | CALL ctl_stop('dia_obs_init: Choice of vertical (1D) interpolation method is not available') |
---|
[2128] | 434 | ENDIF |
---|
[9168] | 435 | ! |
---|
[14056] | 436 | IF( nn_2dint_default < 0 .OR. nn_2dint_default > 6 ) THEN |
---|
| 437 | CALL ctl_stop('dia_obs_init: Choice of default horizontal (2D) interpolation method is not available') |
---|
[6140] | 438 | ENDIF |
---|
[9168] | 439 | ! |
---|
[6140] | 440 | CALL obs_typ_init |
---|
[9168] | 441 | IF( ln_grid_global ) CALL mppmap_init |
---|
| 442 | ! |
---|
[6140] | 443 | CALL obs_grid_setup( ) |
---|
[2128] | 444 | |
---|
[6140] | 445 | !----------------------------------------------------------------------- |
---|
| 446 | ! Depending on switches read the various observation types |
---|
| 447 | !----------------------------------------------------------------------- |
---|
[9168] | 448 | ! |
---|
| 449 | IF( nproftypes > 0 ) THEN |
---|
| 450 | ! |
---|
| 451 | ALLOCATE( profdata (nproftypes) , nvarsprof (nproftypes) ) |
---|
| 452 | ALLOCATE( profdataqc(nproftypes) , nextrprof (nproftypes) ) |
---|
| 453 | ! |
---|
[6140] | 454 | DO jtype = 1, nproftypes |
---|
[9168] | 455 | ! |
---|
[6140] | 456 | IF ( TRIM(cobstypesprof(jtype)) == 'prof' ) THEN |
---|
[14056] | 457 | nvarsprof(jtype) = 2 |
---|
| 458 | nextrprof(jtype) = 1 |
---|
| 459 | ALLOCATE( llvar (nvarsprof(jtype)) ) |
---|
| 460 | ALLOCATE( clvars(nvarsprof(jtype)) ) |
---|
| 461 | ALLOCATE( zglam(jpi, jpj, nvarsprof(jtype)) ) |
---|
| 462 | ALLOCATE( zgphi(jpi, jpj, nvarsprof(jtype)) ) |
---|
| 463 | ALLOCATE( zmask(jpi, jpj, jpk, nvarsprof(jtype)) ) |
---|
| 464 | llvar(1) = ln_t3d |
---|
| 465 | llvar(2) = ln_s3d |
---|
| 466 | clvars(1) = 'POTM' |
---|
| 467 | clvars(2) = 'PSAL' |
---|
| 468 | zglam(:,:,1) = glamt(:,:) |
---|
| 469 | zglam(:,:,2) = glamt(:,:) |
---|
| 470 | zgphi(:,:,1) = gphit(:,:) |
---|
| 471 | zgphi(:,:,2) = gphit(:,:) |
---|
| 472 | zmask(:,:,:,1) = tmask(:,:,:) |
---|
| 473 | zmask(:,:,:,2) = tmask(:,:,:) |
---|
| 474 | ELSE IF ( TRIM(cobstypesprof(jtype)) == 'vel' ) THEN |
---|
| 475 | nvarsprof(jtype) = 2 |
---|
[6140] | 476 | nextrprof(jtype) = 2 |
---|
[14056] | 477 | ALLOCATE( llvar (nvarsprof(jtype)) ) |
---|
| 478 | ALLOCATE( clvars(nvarsprof(jtype)) ) |
---|
| 479 | ALLOCATE( zglam(jpi, jpj, nvarsprof(jtype)) ) |
---|
| 480 | ALLOCATE( zgphi(jpi, jpj, nvarsprof(jtype)) ) |
---|
| 481 | ALLOCATE( zmask(jpi, jpj, jpk, nvarsprof(jtype)) ) |
---|
| 482 | llvar(1) = ln_vel3d |
---|
| 483 | llvar(2) = ln_vel3d |
---|
| 484 | clvars(1) = 'UVEL' |
---|
| 485 | clvars(2) = 'VVEL' |
---|
| 486 | zglam(:,:,1) = glamu(:,:) |
---|
| 487 | zglam(:,:,2) = glamv(:,:) |
---|
| 488 | zgphi(:,:,1) = gphiu(:,:) |
---|
| 489 | zgphi(:,:,2) = gphiv(:,:) |
---|
| 490 | zmask(:,:,:,1) = umask(:,:,:) |
---|
| 491 | zmask(:,:,:,2) = vmask(:,:,:) |
---|
| 492 | ELSE |
---|
| 493 | nvarsprof(jtype) = 1 |
---|
| 494 | nextrprof(jtype) = 0 |
---|
| 495 | ALLOCATE( llvar (nvarsprof(jtype)) ) |
---|
| 496 | ALLOCATE( clvars(nvarsprof(jtype)) ) |
---|
| 497 | ALLOCATE( zglam(jpi, jpj, nvarsprof(jtype)) ) |
---|
| 498 | ALLOCATE( zgphi(jpi, jpj, nvarsprof(jtype)) ) |
---|
| 499 | ALLOCATE( zmask(jpi, jpj, jpk, nvarsprof(jtype)) ) |
---|
| 500 | llvar(1) = .TRUE. |
---|
| 501 | zglam(:,:,1) = glamt(:,:) |
---|
| 502 | zgphi(:,:,1) = gphit(:,:) |
---|
| 503 | zmask(:,:,:,1) = tmask(:,:,:) |
---|
[6140] | 504 | ENDIF |
---|
[9168] | 505 | ! |
---|
| 506 | ! Read in profile or profile obs types |
---|
[6140] | 507 | CALL obs_rea_prof( profdata(jtype), ifilesprof(jtype), & |
---|
| 508 | & clproffiles(jtype,1:ifilesprof(jtype)), & |
---|
| 509 | & nvarsprof(jtype), nextrprof(jtype), nitend-nit000+2, & |
---|
[14056] | 510 | & rn_dobsini, rn_dobsend, llvar, & |
---|
| 511 | & ln_ignmis, ln_s_at_t, .FALSE., clvars, & |
---|
[6140] | 512 | & kdailyavtypes = nn_profdavtypes ) |
---|
[9168] | 513 | ! |
---|
[6140] | 514 | DO jvar = 1, nvarsprof(jtype) |
---|
| 515 | CALL obs_prof_staend( profdata(jtype), jvar ) |
---|
| 516 | END DO |
---|
[9168] | 517 | ! |
---|
[6140] | 518 | CALL obs_pre_prof( profdata(jtype), profdataqc(jtype), & |
---|
[14056] | 519 | & llvar, & |
---|
[6140] | 520 | & jpi, jpj, jpk, & |
---|
[14056] | 521 | & zmask, zglam, zgphi, & |
---|
[12377] | 522 | & ln_nea, ln_bound_reject, Kmm, & |
---|
[9023] | 523 | & kdailyavtypes = nn_profdavtypes ) |
---|
[14056] | 524 | ! |
---|
| 525 | DEALLOCATE( llvar, clvars, zglam, zgphi, zmask ) |
---|
| 526 | ! |
---|
[6140] | 527 | END DO |
---|
[9168] | 528 | ! |
---|
[6140] | 529 | DEALLOCATE( ifilesprof, clproffiles ) |
---|
[9168] | 530 | ! |
---|
[2128] | 531 | ENDIF |
---|
[9168] | 532 | ! |
---|
| 533 | IF( nsurftypes > 0 ) THEN |
---|
| 534 | ! |
---|
| 535 | ALLOCATE( surfdata (nsurftypes) , nvarssurf(nsurftypes) ) |
---|
| 536 | ALLOCATE( surfdataqc(nsurftypes) , nextrsurf(nsurftypes) ) |
---|
| 537 | ! |
---|
[6140] | 538 | DO jtype = 1, nsurftypes |
---|
[9168] | 539 | ! |
---|
[6140] | 540 | nvarssurf(jtype) = 1 |
---|
| 541 | nextrsurf(jtype) = 0 |
---|
[9023] | 542 | llnightav(jtype) = .FALSE. |
---|
[9168] | 543 | IF( TRIM(cobstypessurf(jtype)) == 'sla' ) nextrsurf(jtype) = 2 |
---|
| 544 | IF( TRIM(cobstypessurf(jtype)) == 'sst' ) llnightav(jtype) = ln_sstnight |
---|
| 545 | ! |
---|
[14056] | 546 | ALLOCATE( clvars( nvarssurf(jtype) ) ) |
---|
| 547 | IF ( TRIM(cobstypessurf(jtype)) == 'sla' ) THEN |
---|
| 548 | clvars(1) = 'SLA' |
---|
| 549 | ELSE IF ( TRIM(cobstypessurf(jtype)) == 'sst' ) THEN |
---|
| 550 | clvars(1) = 'SST' |
---|
| 551 | ELSE IF ( TRIM(cobstypessurf(jtype)) == 'sic' ) THEN |
---|
| 552 | clvars(1) = 'ICECONC' |
---|
| 553 | ELSE IF ( TRIM(cobstypessurf(jtype)) == 'sss' ) THEN |
---|
| 554 | clvars(1) = 'SSS' |
---|
| 555 | ENDIF |
---|
| 556 | ! |
---|
[9168] | 557 | ! Read in surface obs types |
---|
[6140] | 558 | CALL obs_rea_surf( surfdata(jtype), ifilessurf(jtype), & |
---|
| 559 | & clsurffiles(jtype,1:ifilessurf(jtype)), & |
---|
| 560 | & nvarssurf(jtype), nextrsurf(jtype), nitend-nit000+2, & |
---|
[14056] | 561 | & rn_dobsini, rn_dobsend, ln_ignmis, .FALSE., llnightav(jtype), & |
---|
| 562 | & clvars ) |
---|
[9168] | 563 | ! |
---|
[9023] | 564 | CALL obs_pre_surf( surfdata(jtype), surfdataqc(jtype), ln_nea, ln_bound_reject ) |
---|
[9168] | 565 | ! |
---|
| 566 | IF( TRIM(cobstypessurf(jtype)) == 'sla' ) THEN |
---|
[12377] | 567 | CALL obs_rea_mdt( surfdataqc(jtype), n2dintsurf(jtype), Kmm ) |
---|
[9168] | 568 | IF( ln_altbias ) & |
---|
[9023] | 569 | & CALL obs_rea_altbias ( surfdataqc(jtype), n2dintsurf(jtype), cn_altbiasfile ) |
---|
[6140] | 570 | ENDIF |
---|
[9168] | 571 | ! |
---|
| 572 | IF( TRIM(cobstypessurf(jtype)) == 'sst' .AND. ln_sstbias ) THEN |
---|
[9023] | 573 | jnumsstbias = 0 |
---|
| 574 | DO jfile = 1, jpmaxnfiles |
---|
[9168] | 575 | IF( TRIM(cn_sstbiasfiles(jfile)) /= '' ) jnumsstbias = jnumsstbias + 1 |
---|
[9023] | 576 | END DO |
---|
[9168] | 577 | IF( jnumsstbias == 0 ) CALL ctl_stop("ln_sstbias set but no bias files to read in") |
---|
| 578 | ! |
---|
| 579 | CALL obs_app_sstbias( surfdataqc(jtype), n2dintsurf(jtype) , & |
---|
| 580 | & jnumsstbias , cn_sstbiasfiles(1:jnumsstbias) ) |
---|
[6140] | 581 | ENDIF |
---|
[14056] | 582 | ! |
---|
| 583 | DEALLOCATE( clvars ) |
---|
[6140] | 584 | END DO |
---|
[9168] | 585 | ! |
---|
[6140] | 586 | DEALLOCATE( ifilessurf, clsurffiles ) |
---|
[9168] | 587 | ! |
---|
[6140] | 588 | ENDIF |
---|
[9168] | 589 | ! |
---|
[2128] | 590 | END SUBROUTINE dia_obs_init |
---|
| 591 | |
---|
[9019] | 592 | |
---|
[12377] | 593 | SUBROUTINE dia_obs( kstp, Kmm ) |
---|
[2128] | 594 | !!---------------------------------------------------------------------- |
---|
| 595 | !! *** ROUTINE dia_obs *** |
---|
| 596 | !! |
---|
| 597 | !! ** Purpose : Call the observation operators on each time step |
---|
| 598 | !! |
---|
| 599 | !! ** Method : Call the observation operators on each time step to |
---|
[6140] | 600 | !! compute the model equivalent of the following data: |
---|
| 601 | !! - Profile data, currently T/S or U/V |
---|
| 602 | !! - Surface data, currently SST, SLA or sea-ice concentration. |
---|
[2128] | 603 | !! |
---|
[6140] | 604 | !! ** Action : |
---|
[2128] | 605 | !!---------------------------------------------------------------------- |
---|
[9019] | 606 | USE phycst , ONLY : rday ! Physical constants |
---|
[12377] | 607 | USE oce , ONLY : ts, uu, vv, ssh ! Ocean dynamics and tracers variables (Kmm time-level only) |
---|
[9019] | 608 | USE phycst , ONLY : rday ! Physical constants |
---|
[9570] | 609 | #if defined key_si3 |
---|
[9656] | 610 | USE ice , ONLY : at_i ! SI3 Ice model variables |
---|
[2128] | 611 | #endif |
---|
[9023] | 612 | #if defined key_cice |
---|
| 613 | USE sbc_oce, ONLY : fr_i ! ice fraction |
---|
| 614 | #endif |
---|
| 615 | |
---|
[2128] | 616 | IMPLICIT NONE |
---|
| 617 | |
---|
| 618 | !! * Arguments |
---|
[6140] | 619 | INTEGER, INTENT(IN) :: kstp ! Current timestep |
---|
[12377] | 620 | INTEGER, INTENT(in) :: Kmm ! ocean time level indices |
---|
[2128] | 621 | !! * Local declarations |
---|
[6140] | 622 | INTEGER :: idaystp ! Number of timesteps per day |
---|
| 623 | INTEGER :: jtype ! Data loop variable |
---|
| 624 | INTEGER :: jvar ! Variable number |
---|
[14982] | 625 | INTEGER :: ji, jj, jk ! Loop counters |
---|
[14056] | 626 | REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE :: & |
---|
| 627 | & zprofvar ! Model values for variables in a prof ob |
---|
| 628 | REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE :: & |
---|
| 629 | & zprofmask ! Mask associated with zprofvar |
---|
[9125] | 630 | REAL(wp), DIMENSION(jpi,jpj) :: & |
---|
[9023] | 631 | & zsurfvar, & ! Model values equivalent to surface ob. |
---|
| 632 | & zsurfmask ! Mask associated with surface variable |
---|
[14056] | 633 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: & |
---|
| 634 | & zglam, & ! Model longitudes for prof variables |
---|
| 635 | & zgphi ! Model latitudes for prof variables |
---|
[14982] | 636 | REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: zdept, zdepw |
---|
[6140] | 637 | |
---|
[9019] | 638 | !----------------------------------------------------------------------- |
---|
[2715] | 639 | |
---|
[2128] | 640 | IF(lwp) THEN |
---|
| 641 | WRITE(numout,*) |
---|
| 642 | WRITE(numout,*) 'dia_obs : Call the observation operators', kstp |
---|
| 643 | WRITE(numout,*) '~~~~~~~' |
---|
| 644 | ENDIF |
---|
| 645 | |
---|
[12489] | 646 | idaystp = NINT( rday / rn_Dt ) |
---|
[2128] | 647 | |
---|
| 648 | !----------------------------------------------------------------------- |
---|
[6140] | 649 | ! Call the profile and surface observation operators |
---|
[2128] | 650 | !----------------------------------------------------------------------- |
---|
| 651 | |
---|
[6140] | 652 | IF ( nproftypes > 0 ) THEN |
---|
| 653 | |
---|
[14982] | 654 | ALLOCATE( zdept(jpi,jpj,jpk), zdepw(jpi,jpj,jpk) ) |
---|
| 655 | DO jk = 1, jpk |
---|
| 656 | zdept(:,:,jk) = gdept(:,:,jk,Kmm) |
---|
| 657 | zdepw(:,:,jk) = gdepw(:,:,jk,Kmm) |
---|
| 658 | END DO |
---|
| 659 | |
---|
[6140] | 660 | DO jtype = 1, nproftypes |
---|
| 661 | |
---|
[14056] | 662 | ! Allocate local work arrays |
---|
| 663 | ALLOCATE( zprofvar (jpi, jpj, jpk, profdataqc(jtype)%nvar) ) |
---|
| 664 | ALLOCATE( zprofmask(jpi, jpj, jpk, profdataqc(jtype)%nvar) ) |
---|
| 665 | ALLOCATE( zglam (jpi, jpj, profdataqc(jtype)%nvar) ) |
---|
| 666 | ALLOCATE( zgphi (jpi, jpj, profdataqc(jtype)%nvar) ) |
---|
| 667 | |
---|
| 668 | ! Defaults which might change |
---|
| 669 | DO jvar = 1, profdataqc(jtype)%nvar |
---|
| 670 | zprofmask(:,:,:,jvar) = tmask(:,:,:) |
---|
| 671 | zglam(:,:,jvar) = glamt(:,:) |
---|
| 672 | zgphi(:,:,jvar) = gphit(:,:) |
---|
| 673 | END DO |
---|
| 674 | |
---|
[6140] | 675 | SELECT CASE ( TRIM(cobstypesprof(jtype)) ) |
---|
| 676 | CASE('prof') |
---|
[14056] | 677 | zprofvar(:,:,:,1) = ts(:,:,:,jp_tem,Kmm) |
---|
| 678 | zprofvar(:,:,:,2) = ts(:,:,:,jp_sal,Kmm) |
---|
[6140] | 679 | CASE('vel') |
---|
[14056] | 680 | zprofvar(:,:,:,1) = uu(:,:,:,Kmm) |
---|
| 681 | zprofvar(:,:,:,2) = vv(:,:,:,Kmm) |
---|
| 682 | zprofmask(:,:,:,1) = umask(:,:,:) |
---|
| 683 | zprofmask(:,:,:,2) = vmask(:,:,:) |
---|
| 684 | zglam(:,:,1) = glamu(:,:) |
---|
| 685 | zglam(:,:,2) = glamv(:,:) |
---|
| 686 | zgphi(:,:,1) = gphiu(:,:) |
---|
| 687 | zgphi(:,:,2) = gphiv(:,:) |
---|
[9023] | 688 | CASE DEFAULT |
---|
| 689 | CALL ctl_stop( 'Unknown profile observation type '//TRIM(cobstypesprof(jtype))//' in dia_obs' ) |
---|
[6140] | 690 | END SELECT |
---|
| 691 | |
---|
[14056] | 692 | DO jvar = 1, profdataqc(jtype)%nvar |
---|
| 693 | CALL obs_prof_opt( profdataqc(jtype), kstp, jpi, jpj, jpk, & |
---|
| 694 | & nit000, idaystp, jvar, & |
---|
| 695 | & zprofvar(:,:,:,jvar), & |
---|
[14982] | 696 | & zdept(:,:,:), zdepw(:,:,:), & |
---|
[14056] | 697 | & zprofmask(:,:,:,jvar), & |
---|
| 698 | & zglam(:,:,jvar), zgphi(:,:,jvar), & |
---|
| 699 | & nn_1dint, nn_2dint_default, & |
---|
| 700 | & kdailyavtypes = nn_profdavtypes ) |
---|
| 701 | END DO |
---|
| 702 | |
---|
| 703 | DEALLOCATE( zprofvar, zprofmask, zglam, zgphi ) |
---|
[6140] | 704 | |
---|
[2128] | 705 | END DO |
---|
| 706 | |
---|
[14982] | 707 | DEALLOCATE( zdept, zdepw ) |
---|
| 708 | |
---|
[2128] | 709 | ENDIF |
---|
| 710 | |
---|
[6140] | 711 | IF ( nsurftypes > 0 ) THEN |
---|
[2128] | 712 | |
---|
[6140] | 713 | DO jtype = 1, nsurftypes |
---|
[2128] | 714 | |
---|
[9023] | 715 | !Defaults which might be changed |
---|
| 716 | zsurfmask(:,:) = tmask(:,:,1) |
---|
| 717 | |
---|
[6140] | 718 | SELECT CASE ( TRIM(cobstypessurf(jtype)) ) |
---|
| 719 | CASE('sst') |
---|
[12377] | 720 | zsurfvar(:,:) = ts(:,:,1,jp_tem,Kmm) |
---|
[6140] | 721 | CASE('sla') |
---|
[12377] | 722 | zsurfvar(:,:) = ssh(:,:,Kmm) |
---|
[9023] | 723 | CASE('sss') |
---|
[12377] | 724 | zsurfvar(:,:) = ts(:,:,1,jp_sal,Kmm) |
---|
[6140] | 725 | CASE('sic') |
---|
| 726 | IF ( kstp == 0 ) THEN |
---|
| 727 | IF ( lwp .AND. surfdataqc(jtype)%nsstpmpp(1) > 0 ) THEN |
---|
| 728 | CALL ctl_warn( 'Sea-ice not initialised on zeroth '// & |
---|
| 729 | & 'time-step but some obs are valid then.' ) |
---|
| 730 | WRITE(numout,*)surfdataqc(jtype)%nsstpmpp(1), & |
---|
| 731 | & ' sea-ice obs will be missed' |
---|
| 732 | ENDIF |
---|
| 733 | surfdataqc(jtype)%nsurfup = surfdataqc(jtype)%nsurfup + & |
---|
| 734 | & surfdataqc(jtype)%nsstp(1) |
---|
| 735 | CYCLE |
---|
| 736 | ELSE |
---|
[9570] | 737 | #if defined key_cice || defined key_si3 |
---|
[9023] | 738 | zsurfvar(:,:) = fr_i(:,:) |
---|
[9354] | 739 | #else |
---|
[9040] | 740 | CALL ctl_stop( ' Trying to run sea-ice observation operator', & |
---|
| 741 | & ' but no sea-ice model appears to have been defined' ) |
---|
[9023] | 742 | #endif |
---|
[6140] | 743 | ENDIF |
---|
| 744 | |
---|
| 745 | END SELECT |
---|
[2128] | 746 | |
---|
[6140] | 747 | CALL obs_surf_opt( surfdataqc(jtype), kstp, jpi, jpj, & |
---|
[9023] | 748 | & nit000, idaystp, zsurfvar, zsurfmask, & |
---|
| 749 | & n2dintsurf(jtype), llnightav(jtype), & |
---|
| 750 | & zavglamscl(jtype), zavgphiscl(jtype), & |
---|
| 751 | & lfpindegs(jtype) ) |
---|
[6140] | 752 | |
---|
[2128] | 753 | END DO |
---|
[6140] | 754 | |
---|
[2128] | 755 | ENDIF |
---|
| 756 | |
---|
| 757 | END SUBROUTINE dia_obs |
---|
[6140] | 758 | |
---|
| 759 | SUBROUTINE dia_obs_wri |
---|
[2128] | 760 | !!---------------------------------------------------------------------- |
---|
| 761 | !! *** ROUTINE dia_obs_wri *** |
---|
| 762 | !! |
---|
| 763 | !! ** Purpose : Call observation diagnostic output routines |
---|
| 764 | !! |
---|
| 765 | !! ** Method : Call observation diagnostic output routines |
---|
| 766 | !! |
---|
[6140] | 767 | !! ** Action : |
---|
[2128] | 768 | !! |
---|
| 769 | !! History : |
---|
| 770 | !! ! 06-03 (K. Mogensen) Original code |
---|
| 771 | !! ! 06-05 (K. Mogensen) Reformatted |
---|
| 772 | !! ! 06-10 (A. Weaver) Cleaning |
---|
| 773 | !! ! 07-03 (K. Mogensen) General handling of profiles |
---|
| 774 | !! ! 08-09 (M. Valdivieso) Velocity component (U,V) profiles |
---|
[6140] | 775 | !! ! 15-08 (M. Martin) Combined writing for prof and surf types |
---|
[2128] | 776 | !!---------------------------------------------------------------------- |
---|
[6140] | 777 | !! * Modules used |
---|
| 778 | USE obs_rot_vel ! Rotation of velocities |
---|
| 779 | |
---|
[2128] | 780 | IMPLICIT NONE |
---|
| 781 | |
---|
| 782 | !! * Local declarations |
---|
[6140] | 783 | INTEGER :: jtype ! Data set loop variable |
---|
| 784 | INTEGER :: jo, jvar, jk |
---|
| 785 | REAL(wp), DIMENSION(:), ALLOCATABLE :: & |
---|
| 786 | & zu, & |
---|
| 787 | & zv |
---|
[2128] | 788 | |
---|
| 789 | !----------------------------------------------------------------------- |
---|
| 790 | ! Depending on switches call various observation output routines |
---|
| 791 | !----------------------------------------------------------------------- |
---|
| 792 | |
---|
[6140] | 793 | IF ( nproftypes > 0 ) THEN |
---|
[2128] | 794 | |
---|
[6140] | 795 | DO jtype = 1, nproftypes |
---|
[2128] | 796 | |
---|
[6140] | 797 | IF ( TRIM(cobstypesprof(jtype)) == 'vel' ) THEN |
---|
[2128] | 798 | |
---|
[6140] | 799 | ! For velocity data, rotate the model velocities to N/S, E/W |
---|
| 800 | ! using the compressed data structure. |
---|
| 801 | ALLOCATE( & |
---|
| 802 | & zu(profdataqc(jtype)%nvprot(1)), & |
---|
| 803 | & zv(profdataqc(jtype)%nvprot(2)) & |
---|
| 804 | & ) |
---|
[2128] | 805 | |
---|
[14056] | 806 | CALL obs_rotvel( profdataqc(jtype), nn_2dint_default, zu, zv ) |
---|
[2128] | 807 | |
---|
[6140] | 808 | DO jo = 1, profdataqc(jtype)%nprof |
---|
| 809 | DO jvar = 1, 2 |
---|
| 810 | DO jk = profdataqc(jtype)%npvsta(jo,jvar), profdataqc(jtype)%npvend(jo,jvar) |
---|
[2128] | 811 | |
---|
[6140] | 812 | IF ( jvar == 1 ) THEN |
---|
| 813 | profdataqc(jtype)%var(jvar)%vmod(jk) = zu(jk) |
---|
| 814 | ELSE |
---|
| 815 | profdataqc(jtype)%var(jvar)%vmod(jk) = zv(jk) |
---|
| 816 | ENDIF |
---|
[2128] | 817 | |
---|
[6140] | 818 | END DO |
---|
| 819 | END DO |
---|
| 820 | END DO |
---|
[2128] | 821 | |
---|
[6140] | 822 | DEALLOCATE( zu ) |
---|
| 823 | DEALLOCATE( zv ) |
---|
[2128] | 824 | |
---|
[6140] | 825 | END IF |
---|
[2128] | 826 | |
---|
[6140] | 827 | CALL obs_prof_decompress( profdataqc(jtype), & |
---|
| 828 | & profdata(jtype), .TRUE., numout ) |
---|
[2128] | 829 | |
---|
[6140] | 830 | CALL obs_wri_prof( profdata(jtype) ) |
---|
[2128] | 831 | |
---|
| 832 | END DO |
---|
| 833 | |
---|
| 834 | ENDIF |
---|
| 835 | |
---|
[6140] | 836 | IF ( nsurftypes > 0 ) THEN |
---|
[2128] | 837 | |
---|
[6140] | 838 | DO jtype = 1, nsurftypes |
---|
[2128] | 839 | |
---|
[6140] | 840 | CALL obs_surf_decompress( surfdataqc(jtype), & |
---|
| 841 | & surfdata(jtype), .TRUE., numout ) |
---|
[2128] | 842 | |
---|
[6140] | 843 | CALL obs_wri_surf( surfdata(jtype) ) |
---|
[2128] | 844 | |
---|
| 845 | END DO |
---|
| 846 | |
---|
| 847 | ENDIF |
---|
| 848 | |
---|
| 849 | END SUBROUTINE dia_obs_wri |
---|
| 850 | |
---|
[4245] | 851 | SUBROUTINE dia_obs_dealloc |
---|
| 852 | IMPLICIT NONE |
---|
| 853 | !!---------------------------------------------------------------------- |
---|
| 854 | !! *** ROUTINE dia_obs_dealloc *** |
---|
| 855 | !! |
---|
| 856 | !! ** Purpose : To deallocate data to enable the obs_oper online loop. |
---|
| 857 | !! Specifically: dia_obs_init --> dia_obs --> dia_obs_wri |
---|
| 858 | !! |
---|
| 859 | !! ** Method : Clean up various arrays left behind by the obs_oper. |
---|
| 860 | !! |
---|
| 861 | !! ** Action : |
---|
| 862 | !! |
---|
| 863 | !!---------------------------------------------------------------------- |
---|
[6140] | 864 | ! obs_grid deallocation |
---|
[4245] | 865 | CALL obs_grid_deallocate |
---|
| 866 | |
---|
[6140] | 867 | ! diaobs deallocation |
---|
| 868 | IF ( nproftypes > 0 ) & |
---|
| 869 | & DEALLOCATE( cobstypesprof, profdata, profdataqc, nvarsprof, nextrprof ) |
---|
| 870 | |
---|
| 871 | IF ( nsurftypes > 0 ) & |
---|
[9023] | 872 | & DEALLOCATE( cobstypessurf, surfdata, surfdataqc, nvarssurf, nextrsurf, & |
---|
| 873 | & n2dintsurf, zavglamscl, zavgphiscl, lfpindegs, llnightav ) |
---|
[6140] | 874 | |
---|
[4245] | 875 | END SUBROUTINE dia_obs_dealloc |
---|
| 876 | |
---|
[6140] | 877 | SUBROUTINE calc_date( kstp, ddobs ) |
---|
[2128] | 878 | !!---------------------------------------------------------------------- |
---|
[6140] | 879 | !! *** ROUTINE calc_date *** |
---|
[2128] | 880 | !! |
---|
[6140] | 881 | !! ** Purpose : Get date in double precision YYYYMMDD.HHMMSS format |
---|
[2128] | 882 | !! |
---|
[6140] | 883 | !! ** Method : Get date in double precision YYYYMMDD.HHMMSS format |
---|
[2128] | 884 | !! |
---|
[6140] | 885 | !! ** Action : Get date in double precision YYYYMMDD.HHMMSS format |
---|
[2128] | 886 | !! |
---|
[6140] | 887 | !! ** Action : Get initial date in double precision YYYYMMDD.HHMMSS format |
---|
| 888 | !! |
---|
[2128] | 889 | !! History : |
---|
| 890 | !! ! 06-03 (K. Mogensen) Original code |
---|
| 891 | !! ! 06-05 (K. Mogensen) Reformatted |
---|
| 892 | !! ! 06-10 (A. Weaver) Cleaning |
---|
| 893 | !! ! 06-10 (G. Smith) Calculates initial date the same as method for final date |
---|
| 894 | !! ! 10-05 (D. Lea) Update to month length calculation for NEMO vn3.2 |
---|
[6140] | 895 | !! ! 2014-09 (D. Lea) New generic routine now deals with arbitrary initial time of day |
---|
[2128] | 896 | !!---------------------------------------------------------------------- |
---|
| 897 | USE phycst, ONLY : & ! Physical constants |
---|
| 898 | & rday |
---|
| 899 | USE dom_oce, ONLY : & ! Ocean space and time domain variables |
---|
[12489] | 900 | & rn_Dt |
---|
[2128] | 901 | |
---|
| 902 | IMPLICIT NONE |
---|
| 903 | |
---|
| 904 | !! * Arguments |
---|
[6140] | 905 | REAL(KIND=dp), INTENT(OUT) :: ddobs ! Date in YYYYMMDD.HHMMSS |
---|
| 906 | INTEGER :: kstp |
---|
[2128] | 907 | |
---|
| 908 | !! * Local declarations |
---|
| 909 | INTEGER :: iyea ! date - (year, month, day, hour, minute) |
---|
| 910 | INTEGER :: imon |
---|
| 911 | INTEGER :: iday |
---|
| 912 | INTEGER :: ihou |
---|
| 913 | INTEGER :: imin |
---|
[6140] | 914 | INTEGER :: imday ! Number of days in month. |
---|
| 915 | REAL(wp) :: zdayfrc ! Fraction of day |
---|
[2128] | 916 | |
---|
| 917 | INTEGER, DIMENSION(12) :: imonth_len !: length in days of the months of the current year |
---|
| 918 | |
---|
| 919 | !!---------------------------------------------------------------------- |
---|
| 920 | !! Initial date initialization (year, month, day, hour, minute) |
---|
| 921 | !!---------------------------------------------------------------------- |
---|
| 922 | iyea = ndate0 / 10000 |
---|
| 923 | imon = ( ndate0 - iyea * 10000 ) / 100 |
---|
| 924 | iday = ndate0 - iyea * 10000 - imon * 100 |
---|
[6140] | 925 | ihou = nn_time0 / 100 |
---|
| 926 | imin = ( nn_time0 - ihou * 100 ) |
---|
[2128] | 927 | |
---|
| 928 | !!---------------------------------------------------------------------- |
---|
| 929 | !! Compute number of days + number of hours + min since initial time |
---|
| 930 | !!---------------------------------------------------------------------- |
---|
[12489] | 931 | zdayfrc = kstp * rn_Dt / rday |
---|
[2128] | 932 | zdayfrc = zdayfrc - aint(zdayfrc) |
---|
[6140] | 933 | imin = imin + int( zdayfrc * 24 * 60 ) |
---|
| 934 | DO WHILE (imin >= 60) |
---|
| 935 | imin=imin-60 |
---|
| 936 | ihou=ihou+1 |
---|
| 937 | END DO |
---|
| 938 | DO WHILE (ihou >= 24) |
---|
| 939 | ihou=ihou-24 |
---|
| 940 | iday=iday+1 |
---|
| 941 | END DO |
---|
[12489] | 942 | iday = iday + kstp * rn_Dt / rday |
---|
[2128] | 943 | |
---|
[6140] | 944 | !----------------------------------------------------------------------- |
---|
| 945 | ! Convert number of days (iday) into a real date |
---|
| 946 | !---------------------------------------------------------------------- |
---|
[2128] | 947 | |
---|
| 948 | CALL calc_month_len( iyea, imonth_len ) |
---|
[6140] | 949 | |
---|
[2128] | 950 | DO WHILE ( iday > imonth_len(imon) ) |
---|
| 951 | iday = iday - imonth_len(imon) |
---|
| 952 | imon = imon + 1 |
---|
| 953 | IF ( imon > 12 ) THEN |
---|
| 954 | imon = 1 |
---|
| 955 | iyea = iyea + 1 |
---|
| 956 | CALL calc_month_len( iyea, imonth_len ) ! update month lengths |
---|
| 957 | ENDIF |
---|
| 958 | END DO |
---|
| 959 | |
---|
[6140] | 960 | !---------------------------------------------------------------------- |
---|
| 961 | ! Convert it into YYYYMMDD.HHMMSS format. |
---|
| 962 | !---------------------------------------------------------------------- |
---|
| 963 | ddobs = iyea * 10000_dp + imon * 100_dp + & |
---|
| 964 | & iday + ihou * 0.01_dp + imin * 0.0001_dp |
---|
| 965 | |
---|
| 966 | END SUBROUTINE calc_date |
---|
| 967 | |
---|
| 968 | SUBROUTINE ini_date( ddobsini ) |
---|
[2128] | 969 | !!---------------------------------------------------------------------- |
---|
[6140] | 970 | !! *** ROUTINE ini_date *** |
---|
| 971 | !! |
---|
| 972 | !! ** Purpose : Get initial date in double precision YYYYMMDD.HHMMSS format |
---|
| 973 | !! |
---|
| 974 | !! ** Method : |
---|
| 975 | !! |
---|
| 976 | !! ** Action : |
---|
| 977 | !! |
---|
| 978 | !! History : |
---|
| 979 | !! ! 06-03 (K. Mogensen) Original code |
---|
| 980 | !! ! 06-05 (K. Mogensen) Reformatted |
---|
| 981 | !! ! 06-10 (A. Weaver) Cleaning |
---|
| 982 | !! ! 10-05 (D. Lea) Update to month length calculation for NEMO vn3.2 |
---|
| 983 | !! ! 2014-09 (D. Lea) Change to call generic routine calc_date |
---|
[2128] | 984 | !!---------------------------------------------------------------------- |
---|
| 985 | |
---|
[6140] | 986 | IMPLICIT NONE |
---|
[2128] | 987 | |
---|
[6140] | 988 | !! * Arguments |
---|
| 989 | REAL(KIND=dp), INTENT(OUT) :: ddobsini ! Initial date in YYYYMMDD.HHMMSS |
---|
| 990 | |
---|
| 991 | CALL calc_date( nit000 - 1, ddobsini ) |
---|
| 992 | |
---|
[2128] | 993 | END SUBROUTINE ini_date |
---|
| 994 | |
---|
| 995 | SUBROUTINE fin_date( ddobsfin ) |
---|
| 996 | !!---------------------------------------------------------------------- |
---|
| 997 | !! *** ROUTINE fin_date *** |
---|
| 998 | !! |
---|
[6140] | 999 | !! ** Purpose : Get final date in double precision YYYYMMDD.HHMMSS format |
---|
[2128] | 1000 | !! |
---|
[6140] | 1001 | !! ** Method : |
---|
[2128] | 1002 | !! |
---|
[6140] | 1003 | !! ** Action : |
---|
[2128] | 1004 | !! |
---|
| 1005 | !! History : |
---|
| 1006 | !! ! 06-03 (K. Mogensen) Original code |
---|
| 1007 | !! ! 06-05 (K. Mogensen) Reformatted |
---|
| 1008 | !! ! 06-10 (A. Weaver) Cleaning |
---|
| 1009 | !! ! 10-05 (D. Lea) Update to month length calculation for NEMO vn3.2 |
---|
[6140] | 1010 | !! ! 2014-09 (D. Lea) Change to call generic routine calc_date |
---|
[2128] | 1011 | !!---------------------------------------------------------------------- |
---|
| 1012 | |
---|
| 1013 | IMPLICIT NONE |
---|
| 1014 | |
---|
| 1015 | !! * Arguments |
---|
[6140] | 1016 | REAL(dp), INTENT(OUT) :: ddobsfin ! Final date in YYYYMMDD.HHMMSS |
---|
[2128] | 1017 | |
---|
[6140] | 1018 | CALL calc_date( nitend, ddobsfin ) |
---|
[2128] | 1019 | |
---|
[6140] | 1020 | END SUBROUTINE fin_date |
---|
| 1021 | |
---|
[14056] | 1022 | SUBROUTINE obs_settypefiles( ntypes, jpmaxnfiles, ifiles, cobstypes, cfiles ) |
---|
[9023] | 1023 | |
---|
[14056] | 1024 | INTEGER, INTENT(IN) :: ntypes ! Total number of obs types |
---|
| 1025 | INTEGER, INTENT(IN) :: jpmaxnfiles ! Maximum number of files allowed for each type |
---|
| 1026 | INTEGER, DIMENSION(ntypes), INTENT(OUT) :: & |
---|
| 1027 | & ifiles ! Out number of files for each type |
---|
[15077] | 1028 | CHARACTER(len=lca), DIMENSION(ntypes), INTENT(IN) :: & |
---|
[14056] | 1029 | & cobstypes ! List of obs types |
---|
| 1030 | CHARACTER(len=128), DIMENSION(ntypes, jpmaxnfiles), INTENT(IN) :: & |
---|
| 1031 | & cfiles ! List of files for all types |
---|
[9023] | 1032 | |
---|
[14056] | 1033 | !Local variables |
---|
| 1034 | INTEGER :: jfile |
---|
| 1035 | INTEGER :: jtype |
---|
[9023] | 1036 | |
---|
[14056] | 1037 | DO jtype = 1, ntypes |
---|
[9023] | 1038 | |
---|
[14056] | 1039 | ifiles(jtype) = 0 |
---|
| 1040 | DO jfile = 1, jpmaxnfiles |
---|
| 1041 | IF ( trim(cfiles(jtype,jfile)) /= '' ) & |
---|
| 1042 | ifiles(jtype) = ifiles(jtype) + 1 |
---|
| 1043 | END DO |
---|
[9023] | 1044 | |
---|
[14056] | 1045 | IF ( ifiles(jtype) == 0 ) THEN |
---|
| 1046 | CALL ctl_stop( 'Logical for observation type '//TRIM(cobstypes(jtype))// & |
---|
| 1047 | & ' set to true but no files available to read' ) |
---|
| 1048 | ENDIF |
---|
[9023] | 1049 | |
---|
[14056] | 1050 | IF(lwp) THEN |
---|
| 1051 | WRITE(numout,*) ' '//cobstypes(jtype)//' input observation file names:' |
---|
| 1052 | DO jfile = 1, ifiles(jtype) |
---|
| 1053 | WRITE(numout,*) ' '//TRIM(cfiles(jtype,jfile)) |
---|
| 1054 | END DO |
---|
| 1055 | ENDIF |
---|
[9023] | 1056 | |
---|
[14056] | 1057 | END DO |
---|
[9023] | 1058 | |
---|
[14056] | 1059 | END SUBROUTINE obs_settypefiles |
---|
[9023] | 1060 | |
---|
[14056] | 1061 | SUBROUTINE obs_setinterpopts( ntypes, jtype, ctypein, & |
---|
| 1062 | & n2dint_default, n2dint_type, & |
---|
| 1063 | & ravglamscl_type, ravgphiscl_type, & |
---|
| 1064 | & lfp_indegs_type, lavnight_type, & |
---|
| 1065 | & n2dint, ravglamscl, ravgphiscl, & |
---|
| 1066 | & lfpindegs, lavnight ) |
---|
[9023] | 1067 | |
---|
[14056] | 1068 | INTEGER, INTENT(IN) :: ntypes ! Total number of obs types |
---|
| 1069 | INTEGER, INTENT(IN) :: jtype ! Index of the current type of obs |
---|
| 1070 | INTEGER, INTENT(IN) :: n2dint_default ! Default option for interpolation type |
---|
| 1071 | INTEGER, INTENT(IN) :: n2dint_type ! Option for interpolation type |
---|
| 1072 | REAL(wp), INTENT(IN) :: & |
---|
| 1073 | & ravglamscl_type, & !E/W diameter of obs footprint for this type |
---|
| 1074 | & ravgphiscl_type !N/S diameter of obs footprint for this type |
---|
| 1075 | LOGICAL, INTENT(IN) :: lfp_indegs_type !T=> footprint in degrees, F=> in metres |
---|
| 1076 | LOGICAL, INTENT(IN) :: lavnight_type !T=> obs represent night time average |
---|
| 1077 | CHARACTER(len=8), INTENT(IN) :: ctypein |
---|
[9023] | 1078 | |
---|
[14056] | 1079 | INTEGER, DIMENSION(ntypes), INTENT(INOUT) :: & |
---|
| 1080 | & n2dint |
---|
| 1081 | REAL(wp), DIMENSION(ntypes), INTENT(INOUT) :: & |
---|
| 1082 | & ravglamscl, ravgphiscl |
---|
| 1083 | LOGICAL, DIMENSION(ntypes), INTENT(INOUT) :: & |
---|
| 1084 | & lfpindegs, lavnight |
---|
[9023] | 1085 | |
---|
[14056] | 1086 | lavnight(jtype) = lavnight_type |
---|
[9023] | 1087 | |
---|
[14056] | 1088 | IF ( (n2dint_type >= 0) .AND. (n2dint_type <= 6) ) THEN |
---|
| 1089 | n2dint(jtype) = n2dint_type |
---|
| 1090 | ELSE IF ( n2dint_type == -1 ) THEN |
---|
| 1091 | n2dint(jtype) = n2dint_default |
---|
| 1092 | ELSE |
---|
| 1093 | CALL ctl_stop(' Choice of '//TRIM(ctypein)//' horizontal (2D) interpolation method', & |
---|
| 1094 | & ' is not available') |
---|
| 1095 | ENDIF |
---|
[9023] | 1096 | |
---|
[14056] | 1097 | ! For averaging observation footprints set options for size of footprint |
---|
| 1098 | IF ( (n2dint(jtype) > 4) .AND. (n2dint(jtype) <= 6) ) THEN |
---|
| 1099 | IF ( ravglamscl_type > 0._wp ) THEN |
---|
| 1100 | ravglamscl(jtype) = ravglamscl_type |
---|
| 1101 | ELSE |
---|
| 1102 | CALL ctl_stop( 'Incorrect value set for averaging footprint '// & |
---|
| 1103 | 'scale (ravglamscl) for observation type '//TRIM(ctypein) ) |
---|
| 1104 | ENDIF |
---|
[9023] | 1105 | |
---|
[14056] | 1106 | IF ( ravgphiscl_type > 0._wp ) THEN |
---|
| 1107 | ravgphiscl(jtype) = ravgphiscl_type |
---|
| 1108 | ELSE |
---|
| 1109 | CALL ctl_stop( 'Incorrect value set for averaging footprint '// & |
---|
| 1110 | 'scale (ravgphiscl) for observation type '//TRIM(ctypein) ) |
---|
| 1111 | ENDIF |
---|
[9023] | 1112 | |
---|
[14056] | 1113 | lfpindegs(jtype) = lfp_indegs_type |
---|
[9023] | 1114 | |
---|
[14056] | 1115 | ENDIF |
---|
[9023] | 1116 | |
---|
[14056] | 1117 | ! Write out info |
---|
| 1118 | IF(lwp) THEN |
---|
| 1119 | IF ( n2dint(jtype) <= 4 ) THEN |
---|
| 1120 | WRITE(numout,*) ' '//TRIM(ctypein)// & |
---|
| 1121 | & ' model counterparts will be interpolated horizontally' |
---|
| 1122 | ELSE IF ( n2dint(jtype) <= 6 ) THEN |
---|
| 1123 | WRITE(numout,*) ' '//TRIM(ctypein)// & |
---|
| 1124 | & ' model counterparts will be averaged horizontally' |
---|
| 1125 | WRITE(numout,*) ' '//' with E/W scale: ',ravglamscl(jtype) |
---|
| 1126 | WRITE(numout,*) ' '//' with N/S scale: ',ravgphiscl(jtype) |
---|
| 1127 | IF ( lfpindegs(jtype) ) THEN |
---|
| 1128 | WRITE(numout,*) ' '//' (in degrees)' |
---|
| 1129 | ELSE |
---|
| 1130 | WRITE(numout,*) ' '//' (in metres)' |
---|
| 1131 | ENDIF |
---|
| 1132 | ENDIF |
---|
| 1133 | ENDIF |
---|
[9023] | 1134 | |
---|
[14056] | 1135 | END SUBROUTINE obs_setinterpopts |
---|
| 1136 | |
---|
[2128] | 1137 | END MODULE diaobs |
---|