FV3 Bundle
CRTM_MWwaterCoeff.f90
Go to the documentation of this file.
1 !
2 ! CRTM_MWwaterCoeff
3 !
4 ! Module containing the shared CRTM microwave water surface emissivity
5 ! data and their load/destruction routines.
6 !
7 ! PUBLIC DATA:
8 ! MWwaterC: Data structure containing the microwave water surface
9 ! emissivity data.
10 !
11 ! SIDE EFFECTS:
12 ! Routines in this module modify the contents of the public
13 ! data structure MWwaterC.
14 !
15 ! RESTRICTIONS:
16 ! Routines in this module should only be called during the
17 ! CRTM initialisation.
18 !
19 ! CREATION HISTORY:
20 ! Written by: Paul van Delst, 12-Nov-2011
21 ! paul.vandelst@noaa.gov
22 !
23 
25 
26  ! -----------------
27  ! Environment setup
28  ! -----------------
29  ! Module use
35  ! Disable all implicit typing
36  IMPLICIT NONE
37 
38 
39  ! ------------
40  ! Visibilities
41  ! ------------
42  ! Everything private by default
43  PRIVATE
44  ! The shared data
45  PUBLIC :: mwwaterc
46  ! Procedures
47  PUBLIC :: crtm_mwwatercoeff_load
50 
51 
52  ! -----------------
53  ! Module parameters
54  ! -----------------
55  CHARACTER(*), PARAMETER :: module_version_id = &
56  '$Id: CRTM_MWwaterCoeff.f90 60152 2015-08-13 19:19:13Z paul.vandelst@noaa.gov $'
57  ! Message string length
58  INTEGER, PARAMETER :: ml = 512
59 
60 
61  ! --------------------------------------------------
62  ! The shared microwave water surface emissivity data
63  ! --------------------------------------------------
64  TYPE(mwwatercoeff_type), TARGET, SAVE :: mwwaterc
65 
66 
67 CONTAINS
68 
69 
70 !------------------------------------------------------------------------------
71 !:sdoc+:
72 !
73 ! NAME:
74 ! CRTM_MWwaterCoeff_Load
75 !
76 ! PURPOSE:
77 ! Function to load the microwave water surface emissivity data into
78 ! the public data structure MWwaterC
79 !
80 ! CALLING SEQUENCE:
81 ! Error_Status = CRTM_MWwaterCoeff_Load( &
82 ! Filename, &
83 ! File_Path = File_Path , &
84 ! Quiet = Quiet , &
85 ! Process_ID = Process_ID , &
86 ! Output_Process_ID = Output_Process_ID )
87 !
88 ! INPUT ARGUMENTS:
89 ! Filename: Name of the MWwaterCoeff file.
90 ! UNITS: N/A
91 ! TYPE: CHARACTER(*)
92 ! DIMENSION: Scalar
93 ! ATTRIBUTES: INTENT(IN)
94 !
95 !
96 ! OPTIONAL INPUT ARGUMENTS:
97 ! File_Path: Character string specifying a file path for the
98 ! input data file. If not specified, the current
99 ! directory is the default.
100 ! UNITS: N/A
101 ! TYPE: CHARACTER(*)
102 ! DIMENSION: Scalar
103 ! ATTRIBUTES: INTENT(IN), OPTIONAL
104 !
105 ! Quiet: Set this logical argument to suppress INFORMATION
106 ! messages being printed to stdout
107 ! If == .FALSE., INFORMATION messages are OUTPUT [DEFAULT].
108 ! == .TRUE., INFORMATION messages are SUPPRESSED.
109 ! If not specified, default is .FALSE.
110 ! UNITS: N/A
111 ! TYPE: LOGICAL
112 ! DIMENSION: Scalar
113 ! ATTRIBUTES: INTENT(IN), OPTIONAL
114 !
115 ! Process_ID: Set this argument to the MPI process ID that this
116 ! function call is running under. This value is used
117 ! solely for controlling INFORMATIOn message output.
118 ! If MPI is not being used, ignore this argument.
119 ! This argument is ignored if the Quiet argument is set.
120 ! UNITS: N/A
121 ! TYPE: INTEGER
122 ! DIMENSION: Scalar
123 ! ATTRIBUTES: INTENT(IN), OPTIONAL
124 !
125 ! Output_Process_ID: Set this argument to the MPI process ID in which
126 ! all INFORMATION messages are to be output. If
127 ! the passed Process_ID value agrees with this value
128 ! the INFORMATION messages are output.
129 ! This argument is ignored if the Quiet argument
130 ! is set.
131 ! UNITS: N/A
132 ! TYPE: INTEGER
133 ! DIMENSION: Scalar
134 ! ATTRIBUTES: INTENT(IN), OPTIONAL
135 !
136 ! FUNCTION RESULT:
137 ! Error_Status: The return value is an integer defining the error
138 ! status. The error codes are defined in the
139 ! Message_Handler module.
140 ! If == SUCCESS the data load was successful
141 ! == FAILURE an unrecoverable error occurred.
142 ! UNITS: N/A
143 ! TYPE: INTEGER
144 ! DIMENSION: Scalar
145 !
146 ! SIDE EFFECTS:
147 ! This function modifies the contents of the public data
148 ! structure MWwaterC.
149 !
150 !:sdoc-:
151 !------------------------------------------------------------------------------
152 
153  FUNCTION crtm_mwwatercoeff_load( &
154  Filename , & ! Input
155  File_Path , & ! Optional input
156  Quiet , & ! Optional input
157  Process_ID , & ! Optional input
158  Output_Process_ID) & ! Optional input
159  result( err_stat )
160  ! Arguments
161  CHARACTER(*), INTENT(IN) :: filename
162  CHARACTER(*), OPTIONAL, INTENT(IN) :: file_path
163  LOGICAL , OPTIONAL, INTENT(IN) :: quiet
164  INTEGER , OPTIONAL, INTENT(IN) :: process_id
165  INTEGER , OPTIONAL, INTENT(IN) :: output_process_id
166  ! Function result
167  INTEGER :: err_stat
168  ! Local parameters
169  CHARACTER(*), PARAMETER :: routine_name = 'CRTM_MWwaterCoeff_Load'
170  ! Local variables
171  CHARACTER(ML) :: msg, pid_msg
172  CHARACTER(ML) :: mwwatercoeff_file
173  LOGICAL :: noisy
174 
175  ! Setup
176  err_stat = success
177  ! ...Assign the filename to local variable
178  mwwatercoeff_file = adjustl(filename)
179  ! ...Add the file path
180  IF ( PRESENT(file_path) ) mwwatercoeff_file = trim(adjustl(file_path))//trim(mwwatercoeff_file)
181  ! ...Check Quiet argument
182  noisy = .true.
183  IF ( PRESENT(quiet) ) noisy = .NOT. quiet
184  ! ...Check the MPI Process Ids
185  IF ( noisy .AND. PRESENT(process_id) .AND. PRESENT(output_process_id) ) THEN
186  IF ( process_id /= output_process_id ) noisy = .false.
187  END IF
188  ! ...Create a process ID message tag for error messages
189  IF ( PRESENT(process_id) ) THEN
190  WRITE( pid_msg,'("; Process ID: ",i0)' ) process_id
191  ELSE
192  pid_msg = ''
193  END IF
194 
195 
196  ! Read the MWwaterCoeff data file
197  err_stat = mwwatercoeff_readfile( &
198  mwwaterc, &
199  mwwatercoeff_file, &
200  quiet = .NOT. noisy )
201  IF ( err_stat /= success ) THEN
202  msg = 'Error reading MWwaterCoeff file '//trim(mwwatercoeff_file)//trim(pid_msg)
203  CALL display_message( routine_name, msg, err_stat )
204  RETURN
205  END IF
206 
207  END FUNCTION crtm_mwwatercoeff_load
208 
209 
210 !------------------------------------------------------------------------------
211 !:sdoc+:
212 !
213 ! NAME:
214 ! CRTM_MWwaterCoeff_Destroy
215 !
216 ! PURPOSE:
217 ! Function to deallocate the public data structure MWwaterC containing
218 ! the CRTM microwave water surface emissivity data.
219 !
220 ! CALLING SEQUENCE:
221 ! Error_Status = CRTM_MWwaterCoeff_Destroy( Process_ID = Process_ID )
222 !
223 ! OPTIONAL INPUTS:
224 ! Process_ID: Set this argument to the MPI process ID that this
225 ! function call is running under. This value is used
226 ! solely for controlling message output. If MPI is not
227 ! being used, ignore this argument.
228 ! UNITS: N/A
229 ! TYPE: INTEGER
230 ! DIMENSION: Scalar
231 ! ATTRIBUTES: INTENT(IN), OPTIONAL
232 !
233 ! FUNCTION RESULT:
234 ! Error_Status: The return value is an integer defining the error
235 ! status. The error codes are defined in the
236 ! Message_Handler module.
237 ! If == SUCCESS the deallocation of the public data
238 ! structure was successful
239 ! == FAILURE an unrecoverable error occurred.
240 ! UNITS: N/A
241 ! TYPE: INTEGER
242 ! DIMENSION: Scalar
243 !
244 ! SIDE EFFECTS:
245 ! This function modifies the contents of the public data
246 ! structure MWwaterC.
247 !
248 !:sdoc-:
249 !------------------------------------------------------------------------------
250 
251  FUNCTION crtm_mwwatercoeff_destroy( Process_ID ) RESULT( err_stat )
252  ! Arguments
253  INTEGER, OPTIONAL, INTENT(IN) :: process_id
254  ! Function result
255  INTEGER :: err_stat
256  ! Local parameters
257  CHARACTER(*), PARAMETER :: routine_name = 'CRTM_MWwaterCoeff_Destroy'
258  ! Local variables
259  CHARACTER(ML) :: msg, pid_msg
260 
261  ! Setup
262  err_stat = success
263  ! ...Create a process ID message tag for error messages
264  IF ( PRESENT(process_id) ) THEN
265  WRITE( pid_msg,'("; Process ID: ",i0)' ) process_id
266  ELSE
267  pid_msg = ''
268  END IF
269 
270  ! Destroy the structure
272  IF ( mwwatercoeff_associated( mwwaterc ) ) THEN
273  err_stat = failure
274  msg = 'Error deallocating MWwaterCoeff shared data structure'//trim(pid_msg)
275  CALL display_message( routine_name, msg, err_stat ); RETURN
276  END IF
277 
278  END FUNCTION crtm_mwwatercoeff_destroy
279 
280 
281 !------------------------------------------------------------------------------
282 !:sdoc+:
283 !
284 ! NAME:
285 ! CRTM_MWwaterCoeff_IsLoaded
286 !
287 ! PURPOSE:
288 ! Function to test if microwave water surface emissivity data has
289 ! been loaded into the public data structure MWwaterC.
290 !
291 ! CALLING SEQUENCE:
292 ! status = CRTM_MWwaterCoeff_IsLoaded()
293 !
294 !:sdoc-:
295 !------------------------------------------------------------------------------
296 
297  FUNCTION crtm_mwwatercoeff_isloaded() RESULT( IsLoaded )
298  LOGICAL :: isloaded
299  isloaded = mwwatercoeff_associated( mwwaterc )
300  END FUNCTION crtm_mwwatercoeff_isloaded
301 
302 END MODULE crtm_mwwatercoeff
logical function, public crtm_mwwatercoeff_isloaded()
integer function, public crtm_mwwatercoeff_load(Filename, File_Path, Quiet, Process_ID, Output_Process_ID)
integer, parameter, public failure
character(*), parameter module_version_id
type(mwwatercoeff_type), target, save, public mwwaterc
pure logical function, public mwwatercoeff_associated(self)
pure subroutine, public mwwatercoeff_destroy(self)
recursive subroutine, public display_message(Routine_Name, Message, Error_State, Message_Log)
integer function, public mwwatercoeff_readfile(MWwaterCoeff, Filename, No_Close, Quiet, Title, History, Comment, Debug)
integer, parameter ml
integer function, public crtm_mwwatercoeff_destroy(Process_ID)
integer, parameter, public success