File indexing completed on 2019-12-08 06:11:40 UTC
view on githubraw file Latest commit 331566cb on 2019-11-26 21:45:22 UTC
331566cbeb Jean*0001 #include "PROFILES_OPTIONS.h"
0002
0003 subroutine profiles_readparms( myThid )
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 implicit none
0017
0018
0019
0020 #include "EEPARAMS.h"
0021 #include "SIZE.h"
0022 #include "GRID.h"
0023 #include "PARAMS.h"
0024
0025 #include "PROFILES_SIZE.h"
0026 #include "profiles.h"
0027
0028
0029
0030 integer myThid
0031
0032
0033
0034
0035 CHARACTER*(MAX_LEN_MBUF) msgBuf
0036 INTEGER iUnit, num_file, num_var, IL
0037 LOGICAL exst, specifiedNames
0038 character*(128) fname
0039
0040
0041 INTEGER ILNBLNK
0042 EXTERNAL ILNBLNK
0043
0044
0045
0046
0047 namelist /profiles_nml/
0048 & profilesDir,
0049 & profilesfiles,
0050 & mult_profiles,
0051 & mult_profiles_mean,
0052 #ifdef ALLOW_PROFILES_SAMPLESPLIT_COST
0053
0054 & profiles_mean_indsamples,
0055 #endif
0056 & prof_facmod,
0057 & prof_names,
0058 & prof_namesmod,
0059 #ifdef ALLOW_PROFILES_CLIMMASK
0060 & prof_namesclim,
0061 #endif
0062 & prof_itracer,
0063 & profilesDoNcOutput,
0064 & profilesDoGenGrid
0065
0066 IF ( .NOT.usePROFILES ) THEN
0067
0068 _BEGIN_MASTER(myThid)
0069
0070
0071 CALL PACKAGES_UNUSED_MSG( 'usePROFILES', ' ', ' ' )
0072 _END_MASTER(myThid)
0073 RETURN
0074 ENDIF
0075
0076 _BEGIN_MASTER( myThid )
0077
0078
0079 profilesDir=' '
0080
0081 do num_file=1,NFILESPROFMAX
0082 profilesfiles(num_file) = ' '
0083 enddo
0084
0085 do num_file=1,NFILESPROFMAX
0086 do num_var=1,NVARMAX
0087 mult_profiles(num_file,num_var) = 1. _d 0
0088 prof_facmod(num_file,num_var) = 1. _d 0
0089 prof_names(num_file,num_var)='empty'
0090 prof_itracer(num_file,num_var)=1
0091 prof_namesmod(num_file,num_var)='empty'
0092 #ifdef ALLOW_PROFILES_CLIMMASK
0093 prof_namesclim(num_file,num_var)='empty'
0094 #endif
0095 enddo
0096 enddo
0097 do num_var=1,NVARMAX
0098 mult_profiles_mean(num_var) = 1. _d 0
0099 #ifdef ALLOW_PROFILES_SAMPLESPLIT_COST
0100 profiles_mean_indsamples(num_var) = 1
0101 #endif
0102 enddo
0103
0104 profilesDoNcOutput=.false.
0105
0106 IF ( (.NOT.usingSphericalPolarGrid .OR. rotateGrid) ) THEN
0107 profilesDoGenGrid=.true.
0108 ELSE
0109 profilesDoGenGrid=.false.
0110 ENDIF
0111
0112
0113 WRITE(msgBuf,'(A)') 'PROFILES_READPARMS: opening data.profiles'
0114 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
0115 & SQUEEZE_RIGHT , 1)
0116
0117 CALL OPEN_COPY_DATA_FILE(
0118 I 'data.profiles', 'PROFILES_READPARMS',
0119 O iUnit,
0120 I myThid )
0121
0122 READ( iUnit, nml = profiles_nml )
0123
0124 WRITE(msgBuf,'(2A)') 'PROFILES_READPARMS: ',
0125 & 'finished reading data.profiles'
0126 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
0127 & SQUEEZE_RIGHT , 1)
0128
0129 #ifdef SINGLE_DISK_IO
0130 CLOSE(iUnit)
0131 #else
0132 CLOSE(iUnit,STATUS='DELETE')
0133 #endif /* SINGLE_DISK_IO */
0134
0135 do num_file=1,NFILESPROFMAX
0136
0137 specifiedNames=.FALSE.
0138 do num_var=1,NVARMAX
0139 if (prof_names(num_file,num_var).NE.'empty')
0140 & specifiedNames=.TRUE.
0141 enddo
0142
0143 if (.NOT.specifiedNames) then
0144 prof_names(num_file,1)='prof_T'
0145 prof_names(num_file,2)='prof_S'
0146
0147 prof_names(num_file,3)='prof_U'
0148 prof_names(num_file,4)='prof_V'
0149 prof_names(num_file,5)='prof_ptr'
0150 prof_names(num_file,6)='prof_ssh'
0151 prof_names(num_file,7)='prof_DIC'
0152 prof_names(num_file,8)='prof_ALK'
0153 prof_names(num_file,9)='prof_O2'
0154 prof_names(num_file,10)='prof_NO3'
0155 prof_names(num_file,11)='prof_PO4'
0156 prof_names(num_file,12)='prof_FE'
0157 prof_names(num_file,13)='prof_PCO'
0158 prof_names(num_file,14)='prof_PH'
0159 prof_names(num_file,15)='prof_CHL'
0160 prof_names(num_file,16)='prof_POC'
0161
0162 prof_itracer(num_file,1)=1
0163 prof_itracer(num_file,2)=1
0164 prof_itracer(num_file,3)=1
0165 prof_itracer(num_file,4)=1
0166 prof_itracer(num_file,5)=1
0167 prof_itracer(num_file,6)=1
0168 prof_itracer(num_file,7)=1
0169 prof_itracer(num_file,8)=2
0170 prof_itracer(num_file,9)=3
0171 prof_itracer(num_file,10)=4
0172 prof_itracer(num_file,11)=5
0173 prof_itracer(num_file,12)=6
0174 prof_itracer(num_file,13)=1
0175 prof_itracer(num_file,14)=1
0176 prof_itracer(num_file,15)=1
0177 prof_itracer(num_file,16)=1
0178
0179 prof_namesmod(num_file,1)='theta'
0180 prof_namesmod(num_file,2)='salt'
0181
0182 prof_namesmod(num_file,3)='uVel'
0183 prof_namesmod(num_file,4)='vVel'
0184 prof_namesmod(num_file,5)='pTracer'
0185 prof_namesmod(num_file,6)='etaN'
0186 prof_namesmod(num_file,7)='pTracer'
0187 prof_namesmod(num_file,8)='pTracer'
0188 prof_namesmod(num_file,9)='pTracer'
0189 prof_namesmod(num_file,10)='pTracer'
0190 prof_namesmod(num_file,11)='pTracer'
0191 prof_namesmod(num_file,12)='pTracer'
0192 prof_namesmod(num_file,13)='PCO'
0193 prof_namesmod(num_file,14)='PH'
0194 prof_namesmod(num_file,15)='CHL'
0195 prof_namesmod(num_file,16)='POC'
0196
0197 #ifdef ALLOW_PROFILES_CLIMMASK
0198 prof_namesclim(num_file,1)='prof_Tclim'
0199 prof_namesclim(num_file,2)='prof_Sclim'
0200 #endif
0201 endif
0202
0203 do num_var=1,NVARMAX
0204 if (((prof_names(num_file,num_var).NE.'empty').AND.
0205 & (prof_namesmod(num_file,num_var).EQ.'empty')).OR.
0206 & ((prof_names(num_file,num_var).EQ.'empty').AND.
0207 & (prof_namesmod(num_file,num_var).NE.'empty'))) then
0208 print*,'prof_names=',prof_names(num_file,num_var),' ',
0209 & prof_namesmod(num_file,num_var),' ',num_file,num_var
0210 WRITE(errorMessageUnit,'(2A)')
0211 & 'ERROR in PROFILES_READPARMS: inconsistent ',
0212 & 'prof_names and prof_namesmod'
0213 CALL ALL_PROC_DIE( myThid )
0214 STOP 'ABNORMAL END: S/R PROFILES_READPARMS'
0215 endif
0216 enddo
0217
0218 do num_var=1,NVARMAX
0219 IL = ILNBLNK( prof_names(num_file,num_var) )
0220 WRITE(prof_namesmask(num_file,num_var),'(2A)')
0221 & prof_names(num_file,num_var)(1:IL),'mask'
0222 WRITE(prof_namesweight(num_file,num_var),'(2A)')
0223 & prof_names(num_file,num_var)(1:IL),'weight'
0224 #ifdef ALLOW_PROFILES_CLIMMASK
0225 WRITE(prof_namesclim(num_file,num_var),'(2A)')
0226 & prof_names(num_file,num_var)(1:IL),'clim'
0227 #endif
0228 enddo
0229
0230 if ( profilesfiles(num_file) .NE. ' ' ) then
0231 IL = ILNBLNK( profilesfiles(num_file) )
0232 fname = profilesfiles(num_file)(1:IL)//'.nc'
0233 inquire( file=fname, exist=exst )
0234 if (.NOT.exst) then
0235
0236 WRITE(msgBuf,'(3A)')
0237 & '** WARNING ** PROFILES_READPARMS: missing file: ',
0238 & profilesfiles(num_file)(1:IL),' gets switched off'
0239 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
0240 & SQUEEZE_RIGHT , myThid)
0241
0242 profilesfiles(num_file) = ' '
0243 endif
0244 endif
0245 enddo
0246
0247 _END_MASTER( myThid )
0248
0249 _BARRIER
0250
0251 RETURN
0252 END