FV3 Bundle
MWwaterCoeff_Define.f90
Go to the documentation of this file.
1 !
2 ! MWwaterCoeff_Define
3 !
4 ! Module defining the MWwaterCoeff object.
5 !
6 !
7 ! CREATION HISTORY:
8 ! Written by: Paul van Delst, 10-Nov-2011
9 ! paul.vandelst@noaa.gov
10 
12 
13  ! -----------------
14  ! Environment setup
15  ! -----------------
16  ! Module use
17  USE type_kinds , ONLY: fp, long, double
19  USE compare_float_numbers, ONLY: OPERATOR(.equalto.)
24  USE fitcoeff_define
26  ! Disable implicit typing
27  IMPLICIT NONE
28 
29 
30  ! ------------
31  ! Visibilities
32  ! ------------
33  ! Everything private by default
34  PRIVATE
35  ! Datatypes
36  PUBLIC :: mwwatercoeff_type
37  ! Operators
38  PUBLIC :: OPERATOR(==)
39  ! Procedures
40  PUBLIC :: mwwatercoeff_associated
41  PUBLIC :: mwwatercoeff_destroy
42  PUBLIC :: mwwatercoeff_create
43  PUBLIC :: mwwatercoeff_inspect
45  PUBLIC :: mwwatercoeff_info
47  PUBLIC :: mwwatercoeff_readfile
48  PUBLIC :: mwwatercoeff_writefile
49 
50 
51  ! ---------------------
52  ! Procedure overloading
53  ! ---------------------
54  INTERFACE OPERATOR(==)
55  MODULE PROCEDURE mwwatercoeff_equal
56  END INTERFACE OPERATOR(==)
57 
58 
59  ! -----------------
60  ! Module parameters
61  ! -----------------
62  CHARACTER(*), PARAMETER :: module_version_id = &
63  '$Id: MWwaterCoeff_Define.f90 60152 2015-08-13 19:19:13Z paul.vandelst@noaa.gov $'
64  ! Release and version
65  INTEGER, PARAMETER :: mwwatercoeff_release = 1 ! This determines structure and file formats.
66  INTEGER, PARAMETER :: mwwatercoeff_version = 1 ! This is just the default data version.
67  ! Close status for write errors
68  CHARACTER(*), PARAMETER :: write_error_status = 'DELETE'
69  ! Data indicators
70  INTEGER, PARAMETER :: data_missing = 0
71  INTEGER, PARAMETER :: data_present = 1
72  ! String lengths
73  INTEGER, PARAMETER :: ml = 256 ! Message length
74  INTEGER, PARAMETER :: sl = 80 ! String length
75 
76 
77  ! ---------------------------------
78  ! MWwaterCoeff data type definition
79  ! ---------------------------------
80  !:tdoc+:
82  ! Allocation indicator
83  LOGICAL :: is_allocated = .false.
84  ! Release and version information
85  INTEGER(Long) :: release = mwwatercoeff_release
86  INTEGER(Long) :: version = mwwatercoeff_version
87  ! Derived type components
88  TYPE(fitcoeff_1d_type) :: fccoeff ! Foam coverage fitting coefficients
89  TYPE(fitcoeff_1d_type) :: frcoeff ! Foam reflectivity fitting coefficients
90  TYPE(fitcoeff_3d_type) :: rccoeff ! Reflection correction fitting coefficients
91  TYPE(fitcoeff_3d_type) :: azcoeff ! Azimuth emissivity fitting coefficients
92  TYPE(fitcoeff_1d_type) :: ssccoeff ! Small-scale correction fitting coefficients
93  TYPE(fitcoeff_3d_type) :: lsccoeff ! Large-scale correction fitting coefficients
94  TYPE(mwwaterlut_type) :: lut ! Emissivity look-up table
95  END TYPE mwwatercoeff_type
96  !:tdoc-:
97 
98 
99 CONTAINS
100 
101 
102 !################################################################################
103 !################################################################################
104 !## ##
105 !## ## PUBLIC PROCEDURES ## ##
106 !## ##
107 !################################################################################
108 !################################################################################
109 
110 !--------------------------------------------------------------------------------
111 !:sdoc+:
112 !
113 ! NAME:
114 ! MWwaterCoeff_Associated
115 !
116 ! PURPOSE:
117 ! Pure function to test the status of the allocatable components
118 ! of the MWwaterCoeff structure.
119 !
120 ! CALLING SEQUENCE:
121 ! Status = MWwaterCoeff_Associated( MWwaterCoeff )
122 !
123 ! OBJECTS:
124 ! MWwaterCoeff: Structure which is to have its member's
125 ! status tested.
126 ! UNITS: N/A
127 ! TYPE: MWwaterCoeff_type
128 ! DIMENSION: Scalar
129 ! ATTRIBUTES: INTENT(IN)
130 !
131 ! FUNCTION RESULT:
132 ! Status: The return value is a logical value indicating the
133 ! status of the components.
134 ! .TRUE. - if ALL of the MWwaterCoeff allocatable members
135 ! are in use.
136 ! .FALSE. - if ANY of the MWwaterCoeff allocatable members
137 ! are not in use.
138 ! UNITS: N/A
139 ! TYPE: LOGICAL
140 ! DIMENSION: Scalar
141 !
142 !:sdoc-:
143 !--------------------------------------------------------------------------------
144 
145  PURE FUNCTION mwwatercoeff_associated( self ) RESULT( Status )
146  TYPE(mwwatercoeff_type), INTENT(IN) :: self
147  LOGICAL :: status
148  status = self%Is_Allocated
149  END FUNCTION mwwatercoeff_associated
150 
151 
152 !--------------------------------------------------------------------------------
153 !:sdoc+:
154 !
155 ! NAME:
156 ! MWwaterCoeff_Destroy
157 !
158 ! PURPOSE:
159 ! Pure subroutine to re-initialize MWwaterCoeff objects.
160 !
161 ! CALLING SEQUENCE:
162 ! CALL MWwaterCoeff_Destroy( MWwaterCoeff )
163 !
164 ! OBJECTS:
165 ! MWwaterCoeff: Re-initialized MWwaterCoeff structure.
166 ! UNITS: N/A
167 ! TYPE: MWwaterCoeff_type
168 ! DIMENSION: Scalar
169 ! ATTRIBUTES: INTENT(OUT)
170 !
171 !:sdoc-:
172 !--------------------------------------------------------------------------------
173 
174  PURE SUBROUTINE mwwatercoeff_destroy( self )
175  TYPE(mwwatercoeff_type), INTENT(OUT) :: self
176  self%Is_Allocated = .false.
177  END SUBROUTINE mwwatercoeff_destroy
178 
179 
180 !--------------------------------------------------------------------------------
181 !:sdoc+:
182 !
183 ! NAME:
184 ! MWwaterCoeff_Create
185 !
186 ! PURPOSE:
187 ! Pure subroutine to create a valid instance of an MWwaterCoeff object.
188 !
189 ! CALLING SEQUENCE:
190 ! CALL MWwaterCoeff_Create( MWwaterCoeff )
191 !
192 ! OBJECTS:
193 ! MWwaterCoeff: MWwaterCoeff object structure.
194 ! UNITS: N/A
195 ! TYPE: MWwaterCoeff_type
196 ! DIMENSION: Scalar
197 ! ATTRIBUTES: INTENT(IN OUT)
198 !
199 !:sdoc-:
200 !--------------------------------------------------------------------------------
201 
202  PURE SUBROUTINE mwwatercoeff_create( &
203  self ) ! Output
204  ! Arguments
205  TYPE(mwwatercoeff_type), INTENT(IN OUT) :: self
206  ! Set allocation indicator
207  self%Is_Allocated = .true.
208  END SUBROUTINE mwwatercoeff_create
209 
210 
211 !--------------------------------------------------------------------------------
212 !:sdoc+:
213 !
214 ! NAME:
215 ! MWwaterCoeff_Inspect
216 !
217 ! PURPOSE:
218 ! Subroutine to print the contents of a MWwaterCoeff object to stdout.
219 !
220 ! CALLING SEQUENCE:
221 ! CALL MWwaterCoeff_Inspect( MWwaterCoeff )
222 !
223 ! OBJECTS:
224 ! MWwaterCoeff: MWwaterCoeff object to display.
225 ! UNITS: N/A
226 ! TYPE: MWwaterCoeff_type
227 ! DIMENSION: Scalar
228 ! ATTRIBUTES: INTENT(IN)
229 !
230 !:sdoc-:
231 !--------------------------------------------------------------------------------
232 
233  SUBROUTINE mwwatercoeff_inspect( self, pause )
234  TYPE(mwwatercoeff_type), INTENT(IN) :: self
235  LOGICAL, OPTIONAL, INTENT(IN) :: pause
236  LOGICAL :: wait
237 
238  wait = .false.
239  IF ( PRESENT(pause) ) wait = pause
240 
241  WRITE(*,'(1x,"MWwaterCoeff OBJECT")')
242  ! Release/version info
243  WRITE(*,'(3x,"Release.Version : ",i0,".",i0)') self%Release, self%Version
244  IF ( .NOT. mwwatercoeff_associated(self) ) RETURN
245  ! Derived types
246  IF ( fitcoeff_associated(self%FCCoeff ) ) THEN
247  WRITE(*,'(1x,"Foam coverage cofficients, ")',advance='NO')
248  CALL fitcoeff_inspect(self%FCCoeff )
249  END IF
250  IF ( fitcoeff_associated(self%FRCoeff ) ) THEN
251  WRITE(*,'(1x,"Foam reflectivity cofficients, ")',advance='NO')
252  CALL fitcoeff_inspect(self%FRCoeff )
253  END IF
254  IF ( fitcoeff_associated(self%RCCoeff) ) THEN
255  WRITE(*,'(1x,"Reflection correction cofficients, ")',advance='NO')
256  CALL fitcoeff_inspect(self%RCCoeff)
257  END IF
258  IF ( fitcoeff_associated(self%AZCoeff) ) THEN
259  WRITE(*,'(1x,"Azimuth emissivity coefficients, ")',advance='NO')
260  CALL fitcoeff_inspect(self%AZCoeff)
261  END IF
262  IF ( fitcoeff_associated(self%SSCCoeff) ) THEN
263  WRITE(*,'(1x,"Small-scale correction coefficients, ")',advance='NO')
264  CALL fitcoeff_inspect(self%SSCCoeff)
265  END IF
266  IF ( fitcoeff_associated(self%LSCCoeff) ) THEN
267  WRITE(*,'(1x,"Large-scale correction coefficients, ")',advance='NO')
268  CALL fitcoeff_inspect(self%LSCCoeff)
269  END IF
270  IF ( mwwaterlut_associated(self%LUT) ) THEN
271  WRITE(*,'(1x,"Emissivity look-up table, ")',advance='NO')
272  CALL mwwaterlut_inspect(self%LUT,pause=pause)
273  END IF
274  END SUBROUTINE mwwatercoeff_inspect
275 
276 
277 
278 !----------------------------------------------------------------------------------
279 !:sdoc+:
280 !
281 ! NAME:
282 ! MWwaterCoeff_ValidRelease
283 !
284 ! PURPOSE:
285 ! Function to check the MWwaterCoeff Release value.
286 !
287 ! CALLING SEQUENCE:
288 ! IsValid = MWwaterCoeff_ValidRelease( MWwaterCoeff )
289 !
290 ! INPUTS:
291 ! MWwaterCoeff: MWwaterCoeff object for which the Release component
292 ! is to be checked.
293 ! UNITS: N/A
294 ! TYPE: MWwaterCoeff_type
295 ! DIMENSION: Scalar
296 ! ATTRIBUTES: INTENT(IN)
297 !
298 ! FUNCTION RESULT:
299 ! IsValid: Logical value defining the release validity.
300 ! UNITS: N/A
301 ! TYPE: LOGICAL
302 ! DIMENSION: Scalar
303 !
304 !:sdoc-:
305 !----------------------------------------------------------------------------------
306 
307  FUNCTION mwwatercoeff_validrelease( self ) RESULT( IsValid )
308  ! Arguments
309  TYPE(mwwatercoeff_type), INTENT(IN) :: self
310  ! Function result
311  LOGICAL :: isvalid
312  ! Local parameters
313  CHARACTER(*), PARAMETER :: routine_name = 'MWwaterCoeff_ValidRelease'
314  ! Local variables
315  CHARACTER(ML) :: msg
316 
317  ! Set up
318  isvalid = .true.
319 
320 
321  ! Check release is not too old
322  IF ( self%Release < mwwatercoeff_release ) THEN
323  isvalid = .false.
324  WRITE( msg,'("An MWwaterCoeff data update is needed. ", &
325  &"MWwaterCoeff release is ",i0,". Valid release is ",i0,"." )' ) &
326  self%Release, mwwatercoeff_release
327  CALL display_message( routine_name, msg, information ); RETURN
328  END IF
329 
330 
331  ! Check release is not too new
332  IF ( self%Release > mwwatercoeff_release ) THEN
333  isvalid = .false.
334  WRITE( msg,'("An MWwaterCoeff software update is needed. ", &
335  &"MWwaterCoeff release is ",i0,". Valid release is ",i0,"." )' ) &
336  self%Release, mwwatercoeff_release
337  CALL display_message( routine_name, msg, information ); RETURN
338  END IF
339 
340  END FUNCTION mwwatercoeff_validrelease
341 
342 
343 !--------------------------------------------------------------------------------
344 !:sdoc+:
345 !
346 ! NAME:
347 ! MWwaterCoeff_Info
348 !
349 ! PURPOSE:
350 ! Subroutine to return a string containing version and dimension
351 ! information about a MWwaterCoeff object.
352 !
353 ! CALLING SEQUENCE:
354 ! CALL MWwaterCoeff_Info( MWwaterCoeff, Info )
355 !
356 ! OBJECTS:
357 ! MWwaterCoeff: MWwaterCoeff object about which info is required.
358 ! UNITS: N/A
359 ! TYPE: MWwaterCoeff_type
360 ! DIMENSION: Scalar
361 ! ATTRIBUTES: INTENT(IN)
362 !
363 ! OUTPUTS:
364 ! Info: String containing version and dimension information
365 ! about the MWwaterCoeff object.
366 ! UNITS: N/A
367 ! TYPE: CHARACTER(*)
368 ! DIMENSION: Scalar
369 ! ATTRIBUTES: INTENT(OUT)
370 !
371 !:sdoc-:
372 !--------------------------------------------------------------------------------
373 
374  SUBROUTINE mwwatercoeff_info( self, Info )
375  ! Arguments
376  TYPE(mwwatercoeff_type), INTENT(IN) :: self
377  CHARACTER(*), INTENT(OUT) :: info
378  ! Parameters
379  INTEGER, PARAMETER :: carriage_return = 13
380  INTEGER, PARAMETER :: linefeed = 10
381  ! Local variables
382  CHARACTER(2000) :: long_string
383 
384  ! Write the required data to the local string
385  WRITE( long_string, &
386  '(a,1x,"MWwaterCoeff RELEASE.VERSION: ",i0,".",i0 )' ) &
387  achar(carriage_return)//achar(linefeed), &
388  self%Release, self%Version
389 
390  ! Trim the output based on the
391  ! dummy argument string length
392  info = long_string(1:min(len(info), len_trim(long_string)))
393 
394  END SUBROUTINE mwwatercoeff_info
395 
396 
397 !--------------------------------------------------------------------------------
398 !:sdoc+:
399 !
400 ! NAME:
401 ! MWwaterCoeff_DefineVersion
402 !
403 ! PURPOSE:
404 ! Subroutine to return the module version information.
405 !
406 ! CALLING SEQUENCE:
407 ! CALL MWwaterCoeff_DefineVersion( Id )
408 !
409 ! OUTPUTS:
410 ! Id: Character string containing the version Id information
411 ! for the module.
412 ! UNITS: N/A
413 ! TYPE: CHARACTER(*)
414 ! DIMENSION: Scalar
415 ! ATTRIBUTES: INTENT(OUT)
416 !
417 !:sdoc-:
418 !--------------------------------------------------------------------------------
419 
420  SUBROUTINE mwwatercoeff_defineversion( Id )
421  CHARACTER(*), INTENT(OUT) :: id
422  id = module_version_id
423  END SUBROUTINE mwwatercoeff_defineversion
424 
425 
426 !--------------------------------------------------------------------------------
427 !:sdoc+:
428 !
429 ! NAME:
430 ! MWwaterCoeff_SetValue
431 !
432 ! PURPOSE:
433 ! Subroutine to set the contents of a valid MWwaterCoeff object.
434 !
435 ! CALLING SEQUENCE:
436 ! CALL MWwaterCoeff_SetValue( MWwaterCoeff, &
437 ! FCCoeff = FCCoeff , &
438 ! FRCoeff = FRCoeff , &
439 ! RCCoeff = RCCoeff , &
440 ! AZCoeff = AZCoeff , &
441 ! SSCCoeff = SSCCoeff , &
442 ! LSCCoeff = LSCCoeff , &
443 ! MWwaterLUT = MWwaterLUT )
444 ! OBJECTS:
445 ! MWwaterCoeff: Valid, allocated MWwaterCoeff object for which
446 ! values are to be set.
447 ! UNITS: N/A
448 ! TYPE: MWwaterCoeff_type
449 ! DIMENSION: Scalar
450 ! ATTRIBUTES: INTENT(IN OUT)
451 !
452 ! OPTIONAL INPUTS:
453 ! FCCoeff: Object containing the foam coverage fitting coefficients.
454 ! UNITS: N/A
455 ! TYPE: FitCoeff_1D_type
456 ! DIMENSION: Scalar
457 ! ATTRIBUTES: INTENT(IN), OPTIONAL
458 !
459 ! FRCoeff: Object containing the foam reflectivity fitting
460 ! coefficients.
461 ! UNITS: N/A
462 ! TYPE: FitCoeff_1D_type
463 ! DIMENSION: Scalar
464 ! ATTRIBUTES: INTENT(IN), OPTIONAL
465 !
466 ! RCCoeff: Object containing the reflection correction fitting
467 ! coefficients.
468 ! UNITS: N/A
469 ! TYPE: FitCoeff_3D_type
470 ! DIMENSION: Scalar
471 ! ATTRIBUTES: INTENT(IN), OPTIONAL
472 !
473 ! AZCoeff: Object containing the azimuth emissivity fitting
474 ! coefficients.
475 ! UNITS: N/A
476 ! TYPE: FitCoeff_3D_type
477 ! DIMENSION: Scalar
478 ! ATTRIBUTES: INTENT(IN), OPTIONAL
479 !
480 ! SSCCoeff: Object containing the small-scale correction fitting
481 ! coefficients.
482 ! UNITS: N/A
483 ! TYPE: FitCoeff_1D_type
484 ! DIMENSION: Scalar
485 ! ATTRIBUTES: INTENT(IN), OPTIONAL
486 !
487 ! LSCCoeff: Object containing the large-scale correction fitting
488 ! coefficients.
489 ! UNITS: N/A
490 ! TYPE: FitCoeff_3D_type
491 ! DIMENSION: Scalar
492 ! ATTRIBUTES: INTENT(IN), OPTIONAL
493 !
494 ! MWwaterLUT: Object containing the emissivity look-up table.
495 ! UNITS: N/A
496 ! TYPE: MWwaterLUT_type
497 ! DIMENSION: Scalar
498 ! ATTRIBUTES: INTENT(IN), OPTIONAL
499 !
500 !:sdoc-:
501 !--------------------------------------------------------------------------------
502 
503  SUBROUTINE mwwatercoeff_setvalue( &
504  self , & ! In/Output
505  FCCoeff , & ! Optional input
506  FRCoeff , & ! Optional input
507  RCCoeff , & ! Optional input
508  AZCoeff , & ! Optional input
509  SSCCoeff , & ! Optional input
510  LSCCoeff , & ! Optional input
511  MWwaterLUT ) ! Optional input
512  ! Arguments
513  TYPE(MWwaterCoeff_type) , INTENT(IN OUT) :: self
514  TYPE(FitCoeff_1D_type), OPTIONAL, INTENT(IN) :: FCCoeff
515  TYPE(FitCoeff_1D_type), OPTIONAL, INTENT(IN) :: FRCoeff
516  TYPE(FitCoeff_3D_type), OPTIONAL, INTENT(IN) :: RCCoeff
517  TYPE(FitCoeff_3D_type), OPTIONAL, INTENT(IN) :: AZCoeff
518  TYPE(FitCoeff_1D_type), OPTIONAL, INTENT(IN) :: SSCCoeff
519  TYPE(FitCoeff_3D_type), OPTIONAL, INTENT(IN) :: LSCCoeff
520  TYPE(MWwaterLUT_type) , OPTIONAL, INTENT(IN) :: MWwaterLUT
521 
522  IF ( PRESENT(fccoeff ) ) self%FCCoeff = fccoeff
523  IF ( PRESENT(frcoeff ) ) self%FRCoeff = frcoeff
524  IF ( PRESENT(rccoeff ) ) self%RCCoeff = rccoeff
525  IF ( PRESENT(azcoeff ) ) self%AZCoeff = azcoeff
526  IF ( PRESENT(ssccoeff ) ) self%SSCCoeff = ssccoeff
527  IF ( PRESENT(lsccoeff ) ) self%LSCCoeff = lsccoeff
528  IF ( PRESENT(mwwaterlut) ) self%LUT = mwwaterlut
529 
530  END SUBROUTINE mwwatercoeff_setvalue
531 
532 
533 !--------------------------------------------------------------------------------
534 !:sdoc+:
535 !
536 ! NAME:
537 ! MWwaterCoeff_GetValue
538 !
539 ! PURPOSE:
540 ! Subroutine to get the contents of a valid MWwaterCoeff object.
541 !
542 ! CALLING SEQUENCE:
543 ! CALL MWwaterCoeff_GetValue( MWwaterCoeff, &
544 ! FCCoeff = FCCoeff , &
545 ! FRCoeff = FRCoeff , &
546 ! RCCoeff = RCCoeff , &
547 ! AZCoeff = AZCoeff , &
548 ! SSCCoeff = SSCCoeff , &
549 ! LSCCoeff = LSCCoeff , &
550 ! MWwaterLUT = MWwaterLUT )
551 !
552 ! OBJECTS:
553 ! MWwaterCoeff: Valid, allocated MWwaterCoeff object from which
554 ! values are to be retrieved.
555 ! UNITS: N/A
556 ! TYPE: MWwaterCoeff_type
557 ! DIMENSION: Scalar
558 ! ATTRIBUTES: INTENT(IN OUT)
559 !
560 ! OPTIONAL OUTPUTS:
561 ! FCCoeff: Object containing the foam coverage fitting coefficients.
562 ! UNITS: N/A
563 ! TYPE: FitCoeff_1D_type
564 ! DIMENSION: Scalar
565 ! ATTRIBUTES: INTENT(OUT), OPTIONAL
566 !
567 ! FRCoeff: Object containing the foam reflectivity fitting
568 ! coefficients.
569 ! UNITS: N/A
570 ! TYPE: FitCoeff_1D_type
571 ! DIMENSION: Scalar
572 ! ATTRIBUTES: INTENT(OUT), OPTIONAL
573 !
574 ! RCCoeff: Object containing the reflection correction fitting
575 ! coefficients.
576 ! UNITS: N/A
577 ! TYPE: FitCoeff_3D_type
578 ! DIMENSION: Scalar
579 ! ATTRIBUTES: INTENT(OUT), OPTIONAL
580 !
581 ! AZCoeff: Object containing the azimuth emissivity fitting
582 ! coefficients.
583 ! UNITS: N/A
584 ! TYPE: FitCoeff_3D_type
585 ! DIMENSION: Scalar
586 ! ATTRIBUTES: INTENT(OUT), OPTIONAL
587 !
588 ! SSCCoeff: Object containing the small-scale correction fitting
589 ! coefficients.
590 ! UNITS: N/A
591 ! TYPE: FitCoeff_1D_type
592 ! DIMENSION: Scalar
593 ! ATTRIBUTES: INTENT(OUT), OPTIONAL
594 !
595 ! LSCCoeff: Object containing the large-scale correction fitting
596 ! coefficients.
597 ! UNITS: N/A
598 ! TYPE: FitCoeff_3D_type
599 ! DIMENSION: Scalar
600 ! ATTRIBUTES: INTENT(OUT), OPTIONAL
601 !
602 ! MWwaterLUT: Object containing the emissivity look-up table.
603 ! UNITS: N/A
604 ! TYPE: MWwaterLUT_type
605 ! DIMENSION: Scalar
606 ! ATTRIBUTES: INTENT(OUT), OPTIONAL
607 !
608 !:sdoc-:
609 !--------------------------------------------------------------------------------
610 
611  SUBROUTINE mwwatercoeff_getvalue( &
612  self , & ! Input
613  FCCoeff , & ! Optional output
614  FRCoeff , & ! Optional output
615  RCCoeff , & ! Optional output
616  AZCoeff , & ! Optional output
617  SSCCoeff , & ! Optional output
618  LSCCoeff , & ! Optional output
619  MWwaterLUT ) ! Optional output
620  ! Arguments
621  TYPE(MWwaterCoeff_type) , INTENT(IN) :: self
622  TYPE(FitCoeff_1D_type), OPTIONAL, INTENT(OUT) :: FCCoeff
623  TYPE(FitCoeff_1D_type), OPTIONAL, INTENT(OUT) :: FRCoeff
624  TYPE(FitCoeff_3D_type), OPTIONAL, INTENT(OUT) :: RCCoeff
625  TYPE(FitCoeff_3D_type), OPTIONAL, INTENT(OUT) :: AZCoeff
626  TYPE(FitCoeff_1D_type), OPTIONAL, INTENT(OUT) :: SSCCoeff
627  TYPE(FitCoeff_3D_type), OPTIONAL, INTENT(OUT) :: LSCCoeff
628  TYPE(MWwaterLUT_type) , OPTIONAL, INTENT(OUT) :: MWwaterLUT
629 
630  IF ( PRESENT(fccoeff ) ) fccoeff = self%FCCoeff
631  IF ( PRESENT(frcoeff ) ) frcoeff = self%FRCoeff
632  IF ( PRESENT(rccoeff ) ) rccoeff = self%RCCoeff
633  IF ( PRESENT(azcoeff ) ) azcoeff = self%AZCoeff
634  IF ( PRESENT(ssccoeff ) ) ssccoeff = self%SSCCoeff
635  IF ( PRESENT(lsccoeff ) ) lsccoeff = self%LSCCoeff
636  IF ( PRESENT(mwwaterlut) ) mwwaterlut = self%LUT
637 
638  END SUBROUTINE mwwatercoeff_getvalue
639 
640 
641 !--------------------------------------------------------------------------------
642 !:sdoc+:
643 !
644 ! NAME:
645 ! MWwaterCoeff_ReadFile
646 !
647 ! PURPOSE:
648 ! Function to read MWwaterCoeff object files.
649 !
650 ! CALLING SEQUENCE:
651 ! Error_Status = MWwaterCoeff_ReadFile( &
652 ! MWwaterCoeff , &
653 ! Filename , &
654 ! No_Close = No_Close, &
655 ! Quiet = Quiet , &
656 ! Title = Title , &
657 ! History = History , &
658 ! Comment = Comment )
659 !
660 ! OBJECTS:
661 ! MWwaterCoeff: MWwaterCoeff object containing the data read from file.
662 ! UNITS: N/A
663 ! TYPE: MWwaterCoeff_type
664 ! DIMENSION: Scalar
665 ! ATTRIBUTES: INTENT(OUT)
666 !
667 ! INPUTS:
668 ! Filename: Character string specifying the name of a
669 ! MWwaterCoeff data file to read.
670 ! UNITS: N/A
671 ! TYPE: CHARACTER(*)
672 ! DIMENSION: Scalar
673 ! ATTRIBUTES: INTENT(IN)
674 !
675 ! OPTIONAL INPUTS:
676 ! No_Close: Set this logical argument to *NOT* close the datafile
677 ! upon exiting this routine. This option is required if
678 ! the MWwaterCoeff data is embedded within another file.
679 ! If == .FALSE., File is closed upon function exit [DEFAULT].
680 ! == .TRUE., File is NOT closed upon function exit
681 ! If not specified, default is .FALSE.
682 ! UNITS: N/A
683 ! TYPE: LOGICAL
684 ! DIMENSION: Scalar
685 ! ATTRIBUTES: INTENT(IN), OPTIONAL
686 !
687 ! Quiet: Set this logical argument to suppress INFORMATION
688 ! messages being printed to stdout
689 ! If == .FALSE., INFORMATION messages are OUTPUT [DEFAULT].
690 ! == .TRUE., INFORMATION messages are SUPPRESSED.
691 ! If not specified, default is .FALSE.
692 ! UNITS: N/A
693 ! TYPE: LOGICAL
694 ! DIMENSION: Scalar
695 ! ATTRIBUTES: INTENT(IN), OPTIONAL
696 !
697 ! OPTIONAL OUTPUTS:
698 ! Title: Character string containing a succinct description
699 ! of what is in the dataset.
700 ! UNITS: N/A
701 ! TYPE: CHARACTER(*)
702 ! DIMENSION: Scalar
703 ! ATTRIBUTES: INTENT(OUT), OPTIONAL
704 !
705 ! History: Character string containing dataset creation
706 ! history.
707 ! UNITS: N/A
708 ! TYPE: CHARACTER(*)
709 ! DIMENSION: Scalar
710 ! ATTRIBUTES: INTENT(OUT), OPTIONAL
711 !
712 ! Comment: Character string containing any comments about
713 ! the dataset.
714 ! UNITS: N/A
715 ! TYPE: CHARACTER(*)
716 ! DIMENSION: Scalar
717 ! ATTRIBUTES: INTENT(OUT), OPTIONAL
718 !
719 ! FUNCTION RESULT:
720 ! Error_Status: The return value is an integer defining the error status.
721 ! The error codes are defined in the Message_Handler module.
722 ! If == SUCCESS, the file read was successful
723 ! == FAILURE, an unrecoverable error occurred.
724 ! UNITS: N/A
725 ! TYPE: INTEGER
726 ! DIMENSION: Scalar
727 !
728 !:sdoc-:
729 !------------------------------------------------------------------------------
730 
731  FUNCTION mwwatercoeff_readfile( &
732  MWwaterCoeff, & ! Output
733  Filename , & ! Input
734  No_Close , & ! Optional input
735  Quiet , & ! Optional input
736  Title , & ! Optional output
737  History , & ! Optional output
738  Comment , & ! Optional output
739  Debug ) & ! Optional input (Debug output control)
740  result( err_stat )
741  ! Arguments
742  TYPE(mwwatercoeff_type), INTENT(OUT) :: mwwatercoeff
743  CHARACTER(*), INTENT(IN) :: filename
744  LOGICAL , OPTIONAL, INTENT(IN) :: no_close
745  LOGICAL , OPTIONAL, INTENT(IN) :: quiet
746  CHARACTER(*), OPTIONAL, INTENT(OUT) :: title
747  CHARACTER(*), OPTIONAL, INTENT(OUT) :: history
748  CHARACTER(*), OPTIONAL, INTENT(OUT) :: comment
749  LOGICAL , OPTIONAL, INTENT(IN) :: debug
750  ! Function result
751  INTEGER :: err_stat
752  ! Function parameters
753  CHARACTER(*), PARAMETER :: routine_name = 'MWwaterCoeff_ReadFile'
754  ! Function variables
755  CHARACTER(ML) :: msg
756  CHARACTER(ML) :: io_msg
757  LOGICAL :: close_file
758  LOGICAL :: noisy
759  INTEGER :: io_stat
760  INTEGER :: fid
761  INTEGER(Long) :: lut_present
762  TYPE(mwwatercoeff_type) :: dummy
763 
764  ! Setup
765  err_stat = success
766  ! ...Check No_Close argument
767  close_file = .true.
768  IF ( PRESENT(no_close) ) close_file = .NOT. no_close
769  ! ...Check Quiet argument
770  noisy = .true.
771  IF ( PRESENT(quiet) ) noisy = .NOT. quiet
772  ! ...Override Quiet settings if debug set.
773  IF ( PRESENT(debug) ) THEN
774  IF ( debug ) noisy = .true.
775  END IF
776 
777 
778  ! Check if the file is open.
779  IF ( file_open( filename ) ) THEN
780  ! ...Inquire for the logical unit number
781  INQUIRE( file=filename, number=fid )
782  ! ...Ensure it's valid
783  IF ( fid < 0 ) THEN
784  msg = 'Error inquiring '//trim(filename)//' for its FileID'
785  CALL read_cleanup(); RETURN
786  END IF
787  ELSE
788  ! ...Open the file if it exists
789  IF ( file_exists( filename ) ) THEN
790  err_stat = open_binary_file( filename, fid )
791  IF ( err_stat /= success ) THEN
792  msg = 'Error opening '//trim(filename)
793  CALL read_cleanup(); RETURN
794  END IF
795  ELSE
796  msg = 'File '//trim(filename)//' not found.'
797  CALL read_cleanup(); RETURN
798  END IF
799  END IF
800 
801 
802  ! Read and check the release and version
803  READ( fid, iostat=io_stat, iomsg=io_msg ) &
804  dummy%Release, &
805  dummy%Version
806  IF ( io_stat /= 0 ) THEN
807  msg = 'Error reading Release/Version - '//trim(io_msg)
808  CALL read_cleanup(); RETURN
809  END IF
810  IF ( .NOT. mwwatercoeff_validrelease( dummy ) ) THEN
811  msg = 'MWwaterCoeff Release check failed.'
812  CALL read_cleanup(); RETURN
813  END IF
814 
815 
816  ! Create instance of the structure
817  CALL mwwatercoeff_create(mwwatercoeff)
818  ! ...Explicitly set the version
819  mwwatercoeff%Version = dummy%Version
820 
821 
822  ! Read the global attributes
823  err_stat = readgatts_binary_file( &
824  fid, &
825  title = title , &
826  history = history, &
827  comment = comment )
828  IF ( err_stat /= success ) THEN
829  msg = 'Error reading global attributes'
830  CALL read_cleanup(); RETURN
831  END IF
832 
833 
834  ! Read the coefficient data
835  ! ...Read the foam coverage coefficients
836  err_stat = fitcoeff_readfile( &
837  mwwatercoeff%FCCoeff, &
838  filename, &
839  no_close = .true., &
840  quiet = quiet , &
841  debug = debug )
842  IF ( err_stat /= success ) THEN
843  msg = 'Error reading foam coverage coefficient data.'
844  CALL read_cleanup(); RETURN
845  END IF
846  ! ...Read the foam reflectivity coefficients
847  err_stat = fitcoeff_readfile( &
848  mwwatercoeff%FRCoeff, &
849  filename, &
850  no_close = .true., &
851  quiet = quiet , &
852  debug = debug )
853  IF ( err_stat /= success ) THEN
854  msg = 'Error reading foam reflectivity coefficient data.'
855  CALL read_cleanup(); RETURN
856  END IF
857  ! ...Read the reflection correction coefficients
858  err_stat = fitcoeff_readfile( &
859  mwwatercoeff%RCCoeff, &
860  filename, &
861  no_close = .true., &
862  quiet = quiet , &
863  debug = debug )
864  IF ( err_stat /= success ) THEN
865  msg = 'Error reading reflection correction coefficient data'
866  CALL read_cleanup(); RETURN
867  END IF
868  ! ...Read the azimuth emissivity coefficients
869  err_stat = fitcoeff_readfile( &
870  mwwatercoeff%AZCoeff, &
871  filename, &
872  no_close = .true., &
873  quiet = quiet , &
874  debug = debug )
875  IF ( err_stat /= success ) THEN
876  msg = 'Error reading azimuth emissivity coefficient data.'
877  CALL read_cleanup(); RETURN
878  END IF
879  ! ...Read the small-scale correction coefficients
880  err_stat = fitcoeff_readfile( &
881  mwwatercoeff%SSCCoeff, &
882  filename, &
883  no_close = .true., &
884  quiet = quiet , &
885  debug = debug )
886  IF ( err_stat /= success ) THEN
887  msg = 'Error reading small-scale correction coefficient data.'
888  CALL read_cleanup(); RETURN
889  END IF
890  ! ...Read the large-scale correction coefficients
891  err_stat = fitcoeff_readfile( &
892  mwwatercoeff%LSCCoeff, &
893  filename, &
894  no_close = .true., &
895  quiet = quiet , &
896  debug = debug )
897  IF ( err_stat /= success ) THEN
898  msg = 'Error reading large-scale correction coefficient data.'
899  CALL read_cleanup(); RETURN
900  END IF
901 
902 
903  ! Read the emissivity look-up table if it's present
904  ! ...Read the data indicator
905  READ( fid, iostat=io_stat, iomsg=io_msg ) lut_present
906  IF ( io_stat /= 0 ) THEN
907  msg = 'Error reading emissivity look-up table data indicator - '//trim(io_msg)
908  CALL read_cleanup(); RETURN
909  END IF
910  ! ...Read the LUT data
911  IF ( lut_present == data_present ) THEN
912  err_stat = mwwaterlut_readfile( &
913  mwwatercoeff%LUT, &
914  filename, &
915  no_close = .true., &
916  quiet = quiet , &
917  debug = debug )
918  IF ( err_stat /= success ) THEN
919  msg = 'Error reading emissivity look-up table data.'
920  CALL read_cleanup(); RETURN
921  END IF
922  END IF
923 
924 
925  ! Close the file
926  IF ( close_file ) THEN
927  CLOSE( fid, iostat=io_stat, iomsg=io_msg )
928  IF ( io_stat /= 0 ) THEN
929  msg = 'Error closing '//trim(filename)//' - '//trim(io_msg)
930  CALL read_cleanup(); RETURN
931  END IF
932  END IF
933 
934 
935  ! Output an info message
936  IF ( noisy ) THEN
937  CALL mwwatercoeff_info( mwwatercoeff, msg )
938  CALL display_message( routine_name, 'FILE: '//trim(filename)//'; '//trim(msg), information )
939  END IF
940 
941  CONTAINS
942 
943  SUBROUTINE read_cleanup()
944  IF ( file_open(filename) ) THEN
945  CLOSE( fid, iostat=io_stat, iomsg=io_msg )
946  IF ( io_stat /= 0 ) &
947  msg = trim(msg)//'; Error closing input file during error cleanup - '//trim(io_msg)
948  END IF
949  CALL mwwatercoeff_destroy( mwwatercoeff )
950  err_stat = failure
951  CALL display_message( routine_name, msg, err_stat )
952  END SUBROUTINE read_cleanup
953 
954  END FUNCTION mwwatercoeff_readfile
955 
956 
957 !--------------------------------------------------------------------------------
958 !:sdoc+:
959 !
960 ! NAME:
961 ! MWwaterCoeff_WriteFile
962 !
963 ! PURPOSE:
964 ! Function to write MWwaterCoeff object files.
965 !
966 ! CALLING SEQUENCE:
967 ! Error_Status = MWwaterCoeff_WriteFile( &
968 ! MWwaterCoeff , &
969 ! Filename , &
970 ! No_Close = No_Close, &
971 ! Quiet = Quiet , &
972 ! Title = Title , &
973 ! History = History , &
974 ! Comment = Comment )
975 !
976 ! OBJECTS:
977 ! MWwaterCoeff: MWwaterCoeff object containing the data to write to file.
978 ! UNITS: N/A
979 ! TYPE: MWwaterCoeff_type
980 ! DIMENSION: Scalar
981 ! ATTRIBUTES: INTENT(IN)
982 !
983 ! INPUTS:
984 ! Filename: Character string specifying the name of a
985 ! MWwaterCoeff format data file to write.
986 ! UNITS: N/A
987 ! TYPE: CHARACTER(*)
988 ! DIMENSION: Scalar
989 ! ATTRIBUTES: INTENT(IN)
990 !
991 ! OPTIONAL INPUTS:
992 ! No_Close: Set this logical argument to *NOT* close the datafile
993 ! upon exiting this routine. This option is required if
994 ! the MWwaterCoeff data is to be embedded within another file.
995 ! If == .FALSE., File is closed upon function exit [DEFAULT].
996 ! == .TRUE., File is NOT closed upon function exit
997 ! If not specified, default is .FALSE.
998 ! UNITS: N/A
999 ! TYPE: LOGICAL
1000 ! DIMENSION: Scalar
1001 ! ATTRIBUTES: INTENT(IN), OPTIONAL
1002 !
1003 ! Quiet: Set this logical argument to suppress INFORMATION
1004 ! messages being printed to stdout
1005 ! If == .FALSE., INFORMATION messages are OUTPUT [DEFAULT].
1006 ! == .TRUE., INFORMATION messages are SUPPRESSED.
1007 ! If not specified, default is .FALSE.
1008 ! UNITS: N/A
1009 ! TYPE: LOGICAL
1010 ! DIMENSION: Scalar
1011 ! ATTRIBUTES: INTENT(IN), OPTIONAL
1012 !
1013 ! Title: Character string containing a succinct description
1014 ! of what is in the dataset.
1015 ! UNITS: N/A
1016 ! TYPE: CHARACTER(*)
1017 ! DIMENSION: Scalar
1018 ! ATTRIBUTES: INTENT(IN), OPTIONAL
1019 !
1020 ! History: Character string containing dataset creation
1021 ! history.
1022 ! UNITS: N/A
1023 ! TYPE: CHARACTER(*)
1024 ! DIMENSION: Scalar
1025 ! ATTRIBUTES: INTENT(IN), OPTIONAL
1026 !
1027 ! Comment: Character string containing any comments about
1028 ! the dataset.
1029 ! UNITS: N/A
1030 ! TYPE: CHARACTER(*)
1031 ! DIMENSION: Scalar
1032 ! ATTRIBUTES: INTENT(IN), OPTIONAL
1033 !
1034 ! FUNCTION RESULT:
1035 ! Error_Status: The return value is an integer defining the error status.
1036 ! The error codes are defined in the Message_Handler module.
1037 ! If == SUCCESS, the file write was successful
1038 ! == FAILURE, an unrecoverable error occurred.
1039 ! UNITS: N/A
1040 ! TYPE: INTEGER
1041 ! DIMENSION: Scalar
1042 !
1043 !:sdoc-:
1044 !------------------------------------------------------------------------------
1045 
1046  FUNCTION mwwatercoeff_writefile( &
1047  MWwaterCoeff, & ! Input
1048  Filename , & ! Input
1049  No_Close , & ! Optional input
1050  Quiet , & ! Optional input
1051  Title , & ! Optional input
1052  History , & ! Optional input
1053  Comment , & ! Optional input
1054  Debug ) & ! Optional input (Debug output control)
1055  result( err_stat )
1056  ! Arguments
1057  TYPE(mwwatercoeff_type), INTENT(IN) :: mwwatercoeff
1058  CHARACTER(*), INTENT(IN) :: filename
1059  LOGICAL , OPTIONAL, INTENT(IN) :: no_close
1060  LOGICAL , OPTIONAL, INTENT(IN) :: quiet
1061  CHARACTER(*), OPTIONAL, INTENT(IN) :: title
1062  CHARACTER(*), OPTIONAL, INTENT(IN) :: history
1063  CHARACTER(*), OPTIONAL, INTENT(IN) :: comment
1064  LOGICAL , OPTIONAL, INTENT(IN) :: debug
1065  ! Function result
1066  INTEGER :: err_stat
1067  ! Function parameters
1068  CHARACTER(*), PARAMETER :: routine_name = 'MWwaterCoeff_WriteFile'
1069  ! Function variables
1070  CHARACTER(ML) :: msg
1071  CHARACTER(ML) :: io_msg
1072  LOGICAL :: close_file
1073  LOGICAL :: noisy
1074  INTEGER :: io_stat
1075  INTEGER :: fid
1076  INTEGER(Long) :: lut_present
1077 
1078 
1079  ! Setup
1080  err_stat = success
1081  ! ...Check No_Close argument
1082  close_file = .true.
1083  IF ( PRESENT(no_close) ) close_file = .NOT. no_close
1084  ! ...Check Quiet argument
1085  noisy = .true.
1086  IF ( PRESENT(quiet) ) noisy = .NOT. quiet
1087  ! ...Override Quiet settings if debug set.
1088  IF ( PRESENT(debug) ) THEN
1089  IF ( debug ) noisy = .true.
1090  END IF
1091  ! ...Check there is data to write
1092  IF ( .NOT. mwwatercoeff_associated( mwwatercoeff ) ) THEN
1093  msg = 'MWwaterCoeff object is empty.'
1094  CALL write_cleanup(); RETURN
1095  END IF
1096 
1097 
1098  ! Check if the file is open.
1099  IF ( file_open( filename ) ) THEN
1100  ! ...Inquire for the logical unit number
1101  INQUIRE( file=filename, number=fid )
1102  ! ...Ensure it's valid
1103  IF ( fid < 0 ) THEN
1104  msg = 'Error inquiring '//trim(filename)//' for its FileID'
1105  CALL write_cleanup(); RETURN
1106  END IF
1107  ELSE
1108  ! ...Open the file for output
1109  err_stat = open_binary_file( filename, fid, for_output=.true. )
1110  IF ( err_stat /= success ) THEN
1111  msg = 'Error opening '//trim(filename)
1112  CALL write_cleanup(); RETURN
1113  END IF
1114  END IF
1115 
1116 
1117  ! Write the release and version
1118  WRITE( fid, iostat=io_stat, iomsg=io_msg ) &
1119  mwwatercoeff%Release, &
1120  mwwatercoeff%Version
1121  IF ( io_stat /= 0 ) THEN
1122  msg = 'Error writing Release/Version - '//trim(io_msg)
1123  CALL write_cleanup(); RETURN
1124  END IF
1125 
1126 
1127  ! Write the global attributes
1128  err_stat = writegatts_binary_file( &
1129  fid, &
1130  write_module = module_version_id, &
1131  title = title , &
1132  history = history, &
1133  comment = comment )
1134  IF ( err_stat /= success ) THEN
1135  msg = 'Error writing global attributes'
1136  CALL write_cleanup(); RETURN
1137  END IF
1138 
1139 
1140  ! Write the coefficient data
1141  ! ...Write the foam coverage coefficients
1142  err_stat = fitcoeff_writefile( &
1143  mwwatercoeff%FCCoeff, &
1144  filename, &
1145  no_close = .true., &
1146  quiet = quiet , &
1147  debug = debug )
1148  IF ( err_stat /= success ) THEN
1149  msg = 'Error writing foam coverage coefficient data.'
1150  CALL write_cleanup(); RETURN
1151  END IF
1152  ! ...Write the foam reflectivity coefficients
1153  err_stat = fitcoeff_writefile( &
1154  mwwatercoeff%FRCoeff, &
1155  filename, &
1156  no_close = .true., &
1157  quiet = quiet , &
1158  debug = debug )
1159  IF ( err_stat /= success ) THEN
1160  msg = 'Error writing foam reflectivity coefficient data.'
1161  CALL write_cleanup(); RETURN
1162  END IF
1163  ! ...Write the reflection correction coefficients
1164  err_stat = fitcoeff_writefile( &
1165  mwwatercoeff%RCCoeff, &
1166  filename, &
1167  no_close = .true., &
1168  quiet = quiet , &
1169  debug = debug )
1170  IF ( err_stat /= success ) THEN
1171  msg = 'Error writing reflection correction coefficient data'
1172  CALL write_cleanup(); RETURN
1173  END IF
1174  ! ...Write the azimuth emissivity coefficients
1175  err_stat = fitcoeff_writefile( &
1176  mwwatercoeff%AZCoeff, &
1177  filename, &
1178  no_close = .true., &
1179  quiet = quiet , &
1180  debug = debug )
1181  IF ( err_stat /= success ) THEN
1182  msg = 'Error writing azimuth emissivity coefficient data.'
1183  CALL write_cleanup(); RETURN
1184  END IF
1185  ! ...Write the small-scale correction coefficients
1186  err_stat = fitcoeff_writefile( &
1187  mwwatercoeff%SSCCoeff, &
1188  filename, &
1189  no_close = .true., &
1190  quiet = quiet , &
1191  debug = debug )
1192  IF ( err_stat /= success ) THEN
1193  msg = 'Error writing small-scale correction coefficient data.'
1194  CALL write_cleanup(); RETURN
1195  END IF
1196  ! ...Write the large-scale correction coefficients
1197  err_stat = fitcoeff_writefile( &
1198  mwwatercoeff%LSCCoeff, &
1199  filename, &
1200  no_close = .true., &
1201  quiet = quiet , &
1202  debug = debug )
1203  IF ( err_stat /= success ) THEN
1204  msg = 'Error writing large-scale correction coefficient data.'
1205  CALL write_cleanup(); RETURN
1206  END IF
1207 
1208 
1209  ! Write the emissivity look-up table if it's present
1210  IF ( mwwaterlut_associated( mwwatercoeff%LUT ) ) THEN
1211  lut_present = data_present
1212  ELSE
1213  lut_present = data_missing
1214  END IF
1215  ! ...Write the data indicator
1216  WRITE( fid, iostat=io_stat, iomsg=io_msg ) lut_present
1217  IF ( io_stat /= 0 ) THEN
1218  msg = 'Error writing emissivity look-up table data indicator - '//trim(io_msg)
1219  CALL write_cleanup(); RETURN
1220  END IF
1221  ! ...Write the LUT data
1222  IF ( lut_present == data_present ) THEN
1223  err_stat = mwwaterlut_writefile( &
1224  mwwatercoeff%LUT, &
1225  filename, &
1226  no_close = .true., &
1227  quiet = quiet , &
1228  debug = debug )
1229  IF ( err_stat /= success ) THEN
1230  msg = 'Error writing emissivity look-up table data.'
1231  CALL write_cleanup(); RETURN
1232  END IF
1233  END IF
1234 
1235 
1236  ! Close the file
1237  IF ( close_file ) THEN
1238  CLOSE( fid, iostat=io_stat, iomsg=io_msg )
1239  IF ( io_stat /= 0 ) THEN
1240  msg = 'Error closing '//trim(filename)//' - '//trim(io_msg)
1241  CALL write_cleanup(); RETURN
1242  END IF
1243  END IF
1244 
1245 
1246  ! Output an info message
1247  IF ( noisy ) THEN
1248  CALL mwwatercoeff_info( mwwatercoeff, msg )
1249  CALL display_message( routine_name, 'FILE: '//trim(filename)//'; '//trim(msg), information )
1250  END IF
1251 
1252  CONTAINS
1253 
1254  SUBROUTINE write_cleanup()
1255  IF ( file_open(filename) ) THEN
1256  CLOSE( fid, status=write_error_status, iostat=io_stat, iomsg=io_msg )
1257  IF ( io_stat /= 0 ) &
1258  msg = trim(msg)//'; Error closing output file during error cleanup - '//trim(io_msg)
1259  END IF
1260  err_stat = failure
1261  CALL display_message( routine_name, msg, err_stat )
1262  END SUBROUTINE write_cleanup
1263 
1264  END FUNCTION mwwatercoeff_writefile
1265 
1266 
1267 !################################################################################
1268 !################################################################################
1269 !## ##
1270 !## ## PRIVATE PROCEDURES ## ##
1271 !## ##
1272 !################################################################################
1273 !################################################################################
1274 
1275 !--------------------------------------------------------------------------------
1276 !
1277 ! NAME:
1278 ! MWwaterCoeff_Equal
1279 !
1280 ! PURPOSE:
1281 ! Pure function to test the equality of two MWwaterCoeff objects.
1282 ! Used in OPERATOR(==) interface block.
1283 !
1284 ! CALLING SEQUENCE:
1285 ! is_equal = MWwaterCoeff_Equal( x, y )
1286 !
1287 ! or
1288 !
1289 ! IF ( x == y ) THEN
1290 ! ...
1291 ! END IF
1292 !
1293 ! OBJECTS:
1294 ! x, y: Two MWwaterCoeff objects to be compared.
1295 ! UNITS: N/A
1296 ! TYPE: MWwaterCoeff_type
1297 ! DIMENSION: Scalar
1298 ! ATTRIBUTES: INTENT(IN)
1299 !
1300 ! FUNCTION RESULT:
1301 ! is_equal: Logical value indicating whether the inputs are equal.
1302 ! UNITS: N/A
1303 ! TYPE: LOGICAL
1304 ! DIMENSION: Scalar
1305 !
1306 !--------------------------------------------------------------------------------
1307 
1308  PURE FUNCTION mwwatercoeff_equal( x, y ) RESULT( is_equal )
1309  TYPE(mwwatercoeff_type), INTENT(IN) :: x, y
1310  LOGICAL :: is_equal
1311 
1312  ! Set up
1313  is_equal = .false.
1314 
1315  ! Check the object association status
1316  IF ( (.NOT. mwwatercoeff_associated(x)) .OR. &
1317  (.NOT. mwwatercoeff_associated(y)) ) RETURN
1318 
1319  ! Check contents
1320  ! ...Release/version info
1321  IF ( (x%Release /= y%Release) .OR. &
1322  (x%Version /= y%Version) ) RETURN
1323  ! ...Structures
1324  IF ( fitcoeff_associated( x%FCCoeff ) .NEQV. fitcoeff_associated( x%FCCoeff ) ) RETURN
1325  IF ( fitcoeff_associated( x%FCCoeff ) .AND. fitcoeff_associated( x%FCCoeff ) ) THEN
1326  IF ( .NOT. (x%FCCoeff == y%FCCoeff) ) RETURN
1327  END IF
1328  IF ( fitcoeff_associated( x%FRCoeff ) .NEQV. fitcoeff_associated( x%FRCoeff ) ) RETURN
1329  IF ( fitcoeff_associated( x%FRCoeff ) .AND. fitcoeff_associated( x%FRCoeff ) ) THEN
1330  IF ( .NOT. (x%FRCoeff == y%FRCoeff) ) RETURN
1331  END IF
1332  IF ( fitcoeff_associated( x%RCCoeff ) .NEQV. fitcoeff_associated( x%RCCoeff ) ) RETURN
1333  IF ( fitcoeff_associated( x%RCCoeff ) .AND. fitcoeff_associated( x%RCCoeff ) ) THEN
1334  IF ( .NOT. (x%RCCoeff == y%RCCoeff) ) RETURN
1335  END IF
1336  IF ( fitcoeff_associated( x%AZCoeff ) .NEQV. fitcoeff_associated( x%AZCoeff ) ) RETURN
1337  IF ( fitcoeff_associated( x%AZCoeff ) .AND. fitcoeff_associated( x%AZCoeff ) ) THEN
1338  IF ( .NOT. (x%AZCoeff == y%AZCoeff) ) RETURN
1339  END IF
1340  IF ( fitcoeff_associated( x%SSCCoeff ) .NEQV. fitcoeff_associated( x%SSCCoeff ) ) RETURN
1341  IF ( fitcoeff_associated( x%SSCCoeff ) .AND. fitcoeff_associated( x%SSCCoeff ) ) THEN
1342  IF ( .NOT. (x%SSCCoeff == y%SSCCoeff) ) RETURN
1343  END IF
1344  IF ( fitcoeff_associated( x%LSCCoeff ) .NEQV. fitcoeff_associated( x%LSCCoeff ) ) RETURN
1345  IF ( fitcoeff_associated( x%LSCCoeff ) .AND. fitcoeff_associated( x%LSCCoeff ) ) THEN
1346  IF ( .NOT. (x%LSCCoeff == y%LSCCoeff) ) RETURN
1347  END IF
1348  IF ( mwwaterlut_associated( x%LUT ) .NEQV. mwwaterlut_associated( x%LUT ) ) RETURN
1349  IF ( mwwaterlut_associated( x%LUT ) .AND. mwwaterlut_associated( x%LUT ) ) THEN
1350  IF ( .NOT. (x%LUT == y%LUT) ) RETURN
1351  END IF
1352 
1353  ! If we get here everything is equal
1354  is_equal = .true.
1355 
1356  END FUNCTION mwwatercoeff_equal
1357 
1358 END MODULE mwwatercoeff_define
pure logical function mwwatercoeff_equal(x, y)
integer, parameter, public failure
integer, parameter data_present
integer, parameter sl
pure logical function, public mwwaterlut_associated(self)
subroutine mwwatercoeff_getvalue(self, FCCoeff, FRCoeff, RCCoeff, AZCoeff, SSCCoeff, LSCCoeff, MWwaterLUT)
integer, parameter, public long
Definition: Type_Kinds.f90:76
integer, parameter, public fp
Definition: Type_Kinds.f90:124
integer, parameter ml
subroutine, public mwwaterlut_inspect(self, pause)
integer function, public readgatts_binary_file(fid, Write_Module, Created_On, Title, History, Comment)
integer, parameter mwwatercoeff_version
subroutine, public mwwatercoeff_defineversion(Id)
integer, parameter, public double
Definition: Type_Kinds.f90:106
pure logical function, public mwwatercoeff_associated(self)
character(*), parameter write_error_status
subroutine, public mwwatercoeff_inspect(self, pause)
pure subroutine, public mwwatercoeff_destroy(self)
subroutine read_cleanup()
subroutine write_cleanup()
pure subroutine, public mwwatercoeff_create(self)
integer function, public open_binary_file(Filename, FileID, For_Output, No_Check)
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)
logical function, public mwwatercoeff_validrelease(self)
integer, parameter mwwatercoeff_release
integer function, public writegatts_binary_file(fid, Write_Module, Created_On, Title, History, Comment)
subroutine mwwatercoeff_setvalue(self, FCCoeff, FRCoeff, RCCoeff, AZCoeff, SSCCoeff, LSCCoeff, MWwaterLUT)
integer function, public mwwaterlut_writefile(MWwaterLUT, Filename, No_Close, Quiet, Title, History, Comment, Debug)
integer, parameter data_missing
subroutine, public mwwatercoeff_info(self, Info)
#define min(a, b)
Definition: mosaic_util.h:32
integer function, public mwwaterlut_readfile(MWwaterLUT, Filename, No_Close, Quiet, Title, History, Comment, Debug)
character(*), parameter module_version_id
integer function, public mwwatercoeff_writefile(MWwaterCoeff, Filename, No_Close, Quiet, Title, History, Comment, Debug)
integer, parameter, public success
integer, parameter, public information