36 PUBLIC ::
OPERATOR(==)
53 INTERFACE OPERATOR(==)
55 END INTERFACE OPERATOR(==)
62 '$Id: PAFV_Define.f90 60152 2015-08-13 19:19:13Z paul.vandelst@noaa.gov $' 69 REAL(fp),
PARAMETER ::
zero = 0.0_fp
70 REAL(fp),
PARAMETER ::
one = 1.0_fp
72 INTEGER,
PARAMETER ::
ml = 256
88 LOGICAL :: is_allocated = .false.
93 INTEGER :: n_odps_layers = 0
94 INTEGER :: n_absorbers = 0
95 INTEGER :: n_user_layers = 0
98 INTEGER,
ALLOCATABLE :: odps2user_idx(:,:)
100 INTEGER,
ALLOCATABLE :: interp_index(:,:)
102 REAL(fp),
ALLOCATABLE :: acc_weighting(:,:)
104 REAL(fp),
ALLOCATABLE :: temperature(:)
105 REAL(fp),
ALLOCATABLE :: absorber(:,:)
106 INTEGER,
ALLOCATABLE :: idx_map(:)
107 INTEGER :: h2o_idx = 0
109 REAL(fp),
ALLOCATABLE :: ref_lnpressure(:)
110 REAL(fp),
ALLOCATABLE :: user_lnpressure(:)
112 REAL(fp),
ALLOCATABLE :: pdp(:)
113 REAL(fp),
ALLOCATABLE :: tz_ref(:)
114 REAL(fp),
ALLOCATABLE :: tz(:)
115 REAL(fp),
ALLOCATABLE :: tzp_ref(:)
116 REAL(fp),
ALLOCATABLE :: tzp(:)
118 REAL(fp),
ALLOCATABLE :: gaz_ref(:,:)
119 REAL(fp),
ALLOCATABLE :: gaz_sum(:,:)
120 REAL(fp),
ALLOCATABLE :: gaz(:,:)
121 REAL(fp),
ALLOCATABLE :: gazp_ref(:,:)
122 REAL(fp),
ALLOCATABLE :: gazp_sum(:,:)
123 REAL(fp),
ALLOCATABLE :: gazp(:,:)
124 REAL(fp),
ALLOCATABLE :: gatzp_ref(:,:)
125 REAL(fp),
ALLOCATABLE :: gatzp_sum(:,:)
126 REAL(fp),
ALLOCATABLE :: gatzp(:,:)
128 REAL(fp),
ALLOCATABLE :: dt(:)
129 REAL(fp),
ALLOCATABLE :: t(:)
130 REAL(fp),
ALLOCATABLE :: t2(:)
131 REAL(fp),
ALLOCATABLE :: dt2(:)
132 REAL(fp),
ALLOCATABLE :: h2o(:)
133 REAL(fp),
ALLOCATABLE :: h2o_a(:)
134 REAL(fp),
ALLOCATABLE :: h2o_r(:)
135 REAL(fp),
ALLOCATABLE :: h2o_s(:)
136 REAL(fp),
ALLOCATABLE :: h2o_r4(:)
137 REAL(fp),
ALLOCATABLE :: h2odh2otzp(:)
138 REAL(fp),
ALLOCATABLE :: co2(:)
139 REAL(fp),
ALLOCATABLE :: o3(:)
140 REAL(fp),
ALLOCATABLE :: o3_a(:)
141 REAL(fp),
ALLOCATABLE :: o3_r(:)
142 REAL(fp),
ALLOCATABLE :: co(:)
143 REAL(fp),
ALLOCATABLE :: co_a(:)
144 REAL(fp),
ALLOCATABLE :: co_r(:)
145 REAL(fp),
ALLOCATABLE :: co_s(:)
146 REAL(fp),
ALLOCATABLE :: co_acodcozp(:)
147 REAL(fp),
ALLOCATABLE :: n2o(:)
148 REAL(fp),
ALLOCATABLE :: n2o_a(:)
149 REAL(fp),
ALLOCATABLE :: n2o_r(:)
150 REAL(fp),
ALLOCATABLE :: n2o_s(:)
151 REAL(fp),
ALLOCATABLE :: ch4(:)
152 REAL(fp),
ALLOCATABLE :: ch4_a(:)
153 REAL(fp),
ALLOCATABLE :: ch4_r(:)
154 REAL(fp),
ALLOCATABLE :: ch4_ach4zp(:)
156 REAL(fp),
ALLOCATABLE :: od(:)
157 REAL(fp),
ALLOCATABLE :: od_path(:)
162 LOGICAL :: optran = .false.
166 REAL(fp),
ALLOCATABLE :: dpong(:)
167 REAL(fp),
ALLOCATABLE :: d_absorber(:)
168 REAL(fp),
ALLOCATABLE :: int_vapor(:)
169 REAL(fp),
ALLOCATABLE :: avea(:)
170 REAL(fp),
ALLOCATABLE :: inverse(:)
171 REAL(fp),
ALLOCATABLE :: s_t(:)
172 REAL(fp),
ALLOCATABLE :: s_p(:)
173 REAL(fp),
ALLOCATABLE :: ap1(:)
175 REAL(fp),
ALLOCATABLE :: b(:,:)
176 REAL(fp),
ALLOCATABLE :: ln_chi(:)
177 REAL(fp),
ALLOCATABLE :: chi(:)
225 status = self%Is_Allocated
254 self%Is_Allocated = .false.
326 n_ODPS_Layers, & ! Input
327 n_User_Layers, & ! Input
328 n_Absorbers , & ! Input
333 INTEGER,
INTENT(IN) :: n_odps_layers
334 INTEGER,
INTENT(IN) :: n_user_layers
335 INTEGER,
INTENT(IN) :: n_absorbers
336 LOGICAL,
OPTIONAL,
INTENT(IN) :: no_optran
338 LOGICAL :: use_optran
339 INTEGER :: alloc_stat
342 IF ( n_odps_layers < 1 .OR. &
343 n_absorbers < 1 .OR. &
344 n_user_layers < 1 )
RETURN 347 IF (
PRESENT(no_optran) ) use_optran = .NOT. no_optran
351 ALLOCATE( self%ODPS2User_Idx(2, 0:n_user_layers), &
352 self%interp_index(2, n_odps_layers), &
353 self%Acc_Weighting(n_user_layers,n_odps_layers), &
354 self%Temperature(n_odps_layers), &
355 self%Absorber(n_odps_layers, n_absorbers), &
356 self%idx_map(n_absorbers), &
358 IF ( alloc_stat /= 0 )
RETURN 360 ALLOCATE( self%Ref_LnPressure(n_odps_layers), &
361 self%User_LnPressure(n_user_layers), &
363 IF ( alloc_stat /= 0 )
RETURN 366 ALLOCATE( self%PDP(n_odps_layers), &
367 self%Tz_ref(n_odps_layers), &
368 self%Tz(n_odps_layers), &
369 self%Tzp_ref(n_odps_layers), &
370 self%Tzp(n_odps_layers), &
371 self%GAz_ref(n_odps_layers, n_absorbers), &
372 self%GAz_sum(n_odps_layers, n_absorbers), &
373 self%GAz(n_odps_layers, n_absorbers), &
374 self%GAzp_ref(n_odps_layers, n_absorbers), &
375 self%GAzp_sum(n_odps_layers, n_absorbers), &
376 self%GAzp(n_odps_layers, n_absorbers), &
377 self%GATzp_ref(n_odps_layers, n_absorbers), &
378 self%GATzp_sum(n_odps_layers, n_absorbers), &
379 self%GATzp(n_odps_layers, n_absorbers), &
381 IF ( alloc_stat /= 0 )
RETURN 383 ALLOCATE( self%DT(n_odps_layers), &
384 self%T(n_odps_layers), &
385 self%T2(n_odps_layers), &
386 self%DT2(n_odps_layers), &
387 self%H2O(n_odps_layers), &
388 self%H2O_A(n_odps_layers), &
389 self%H2O_R(n_odps_layers), &
390 self%H2O_S(n_odps_layers), &
391 self%H2O_R4(n_odps_layers), &
392 self%H2OdH2OTzp(n_odps_layers), &
393 self%CO2(n_odps_layers), &
394 self%O3(n_odps_layers), &
395 self%O3_A(n_odps_layers), &
396 self%O3_R(n_odps_layers), &
397 self%CO(n_odps_layers), &
398 self%CO_A(n_odps_layers), &
399 self%CO_R(n_odps_layers), &
400 self%CO_S(n_odps_layers), &
401 self%CO_ACOdCOzp(n_odps_layers), &
402 self%N2O(n_odps_layers), &
403 self%N2O_A(n_odps_layers), &
404 self%N2O_R(n_odps_layers), &
405 self%N2O_S(n_odps_layers), &
406 self%CH4(n_odps_layers), &
407 self%CH4_A(n_odps_layers), &
408 self%CH4_R(n_odps_layers), &
409 self%CH4_ACH4zp(n_odps_layers), &
411 IF ( alloc_stat /= 0 )
RETURN 413 ALLOCATE( self%OD(n_odps_layers), &
414 self%OD_path(0:n_odps_layers), &
416 IF ( alloc_stat /= 0 )
RETURN 419 self%n_ODPS_Layers = n_odps_layers
420 self%n_Absorbers = n_absorbers
421 self%n_User_Layers = n_user_layers
425 IF ( use_optran )
THEN 426 ALLOCATE( self%dPonG(n_odps_layers), &
427 self%d_Absorber(n_odps_layers), &
428 self%Int_vapor(n_odps_layers), &
429 self%AveA(n_odps_layers), &
430 self%Inverse(n_odps_layers), &
431 self%s_t(n_odps_layers), &
432 self%s_p(n_odps_layers), &
433 self%Ap1(n_odps_layers), &
435 self%LN_Chi(n_odps_layers), &
436 self%Chi(n_odps_layers), &
438 IF ( alloc_stat /= 0 )
RETURN 446 self%Is_Allocated = .true.
476 WRITE(*,
'(1x,"PAFV OBJECT")')
478 WRITE(*,
'(3x,"Release.Version :",1x,i0,".",i0)') self%Release, self%Version
480 WRITE(*,
'(3x,"n_ODPS_Layers :",1x,i0)') self%n_ODPS_Layers
481 WRITE(*,
'(3x,"n_User_Layers :",1x,i0)') self%n_User_Layers
482 WRITE(*,
'(3x,"n_Absorbers :",1x,i0)') self%n_Absorbers
485 WRITE(*,
'(3x,"ODPS data arrays :")')
487 WRITE(*,
'(5x,"ODPS2User_Idx :")');
WRITE(*,
'(10(1x,i3,:))') self%ODPS2User_Idx
488 WRITE(*,
'(5x,"interp_index :")');
WRITE(*,
'(10(1x,i3,:))') self%interp_index
489 WRITE(*,
'(5x,"Acc_Weighting :")');
WRITE(*,
'(5(1x,es13.6,:))') self%Acc_Weighting
490 WRITE(*,
'(5x,"Temperature :")');
WRITE(*,
'(5(1x,es13.6,:))') self%Temperature
491 WRITE(*,
'(5x,"Absorber :")');
WRITE(*,
'(5(1x,es13.6,:))') self%Absorber
492 WRITE(*,
'(5x,"idx_map :")');
WRITE(*,
'(10(1x,i3,:))') self%idx_map
493 WRITE(*,
'(5x,"H2O_idx :",1x,i0)') self%H2O_idx
495 WRITE(*,
'(5x,"Ref_LnPressure :")');
WRITE(*,
'(5(1x,es13.6,:))') self%Ref_LnPressure
496 WRITE(*,
'(5x,"User_LnPressure :")');
WRITE(*,
'(5(1x,es13.6,:))') self%User_LnPressure
498 WRITE(*,
'(5x,"PDP :")');
WRITE(*,
'(5(1x,es13.6,:))') self%PDP
499 WRITE(*,
'(5x,"Tz_ref :")');
WRITE(*,
'(5(1x,es13.6,:))') self%Tz_ref
500 WRITE(*,
'(5x,"Tz :")');
WRITE(*,
'(5(1x,es13.6,:))') self%Tz
501 WRITE(*,
'(5x,"Tzp_ref :")');
WRITE(*,
'(5(1x,es13.6,:))') self%Tzp_ref
502 WRITE(*,
'(5x,"Tzp :")');
WRITE(*,
'(5(1x,es13.6,:))') self%Tzp
503 WRITE(*,
'(5x,"GAz_ref :")');
WRITE(*,
'(5(1x,es13.6,:))') self%GAz_ref
504 WRITE(*,
'(5x,"GAz_sum :")');
WRITE(*,
'(5(1x,es13.6,:))') self%GAz_sum
505 WRITE(*,
'(5x,"GAz :")');
WRITE(*,
'(5(1x,es13.6,:))') self%GAz
506 WRITE(*,
'(5x,"GAzp_ref :")');
WRITE(*,
'(5(1x,es13.6,:))') self%GAzp_ref
507 WRITE(*,
'(5x,"GAzp_sum :")');
WRITE(*,
'(5(1x,es13.6,:))') self%GAzp_sum
508 WRITE(*,
'(5x,"GAzp :")');
WRITE(*,
'(5(1x,es13.6,:))') self%GAzp
509 WRITE(*,
'(5x,"GATzp_ref :")');
WRITE(*,
'(5(1x,es13.6,:))') self%GATzp_ref
510 WRITE(*,
'(5x,"GATzp_sum :")');
WRITE(*,
'(5(1x,es13.6,:))') self%GATzp_sum
511 WRITE(*,
'(5x,"GATzp :")');
WRITE(*,
'(5(1x,es13.6,:))') self%GATzp
512 WRITE(*,
'(5x,"DT :")');
WRITE(*,
'(5(1x,es13.6,:))') self%DT
513 WRITE(*,
'(5x,"T :")');
WRITE(*,
'(5(1x,es13.6,:))') self%T
514 WRITE(*,
'(5x,"T2 :")');
WRITE(*,
'(5(1x,es13.6,:))') self%T2
515 WRITE(*,
'(5x,"DT2 :")');
WRITE(*,
'(5(1x,es13.6,:))') self%DT2
516 WRITE(*,
'(5x,"H2O :")');
WRITE(*,
'(5(1x,es13.6,:))') self%H2O
517 WRITE(*,
'(5x,"H2O_A :")');
WRITE(*,
'(5(1x,es13.6,:))') self%H2O_A
518 WRITE(*,
'(5x,"H2O_R :")');
WRITE(*,
'(5(1x,es13.6,:))') self%H2O_R
519 WRITE(*,
'(5x,"H2O_S :")');
WRITE(*,
'(5(1x,es13.6,:))') self%H2O_S
520 WRITE(*,
'(5x,"H2O_R4 :")');
WRITE(*,
'(5(1x,es13.6,:))') self%H2O_R4
521 WRITE(*,
'(5x,"H2OdH2OTzp :")');
WRITE(*,
'(5(1x,es13.6,:))') self%H2OdH2OTzp
522 WRITE(*,
'(5x,"CO2 :")');
WRITE(*,
'(5(1x,es13.6,:))') self%CO2
523 WRITE(*,
'(5x,"O3 :")');
WRITE(*,
'(5(1x,es13.6,:))') self%O3
524 WRITE(*,
'(5x,"O3_A :")');
WRITE(*,
'(5(1x,es13.6,:))') self%O3_A
525 WRITE(*,
'(5x,"O3_R :")');
WRITE(*,
'(5(1x,es13.6,:))') self%O3_R
526 WRITE(*,
'(5x,"CO :")');
WRITE(*,
'(5(1x,es13.6,:))') self%CO
527 WRITE(*,
'(5x,"CO_A :")');
WRITE(*,
'(5(1x,es13.6,:))') self%CO_A
528 WRITE(*,
'(5x,"CO_R :")');
WRITE(*,
'(5(1x,es13.6,:))') self%CO_R
529 WRITE(*,
'(5x,"CO_S :")');
WRITE(*,
'(5(1x,es13.6,:))') self%CO_S
530 WRITE(*,
'(5x,"CO_ACOdCOzp :")');
WRITE(*,
'(5(1x,es13.6,:))') self%CO_ACOdCOzp
531 WRITE(*,
'(5x,"N2O :")');
WRITE(*,
'(5(1x,es13.6,:))') self%N2O
532 WRITE(*,
'(5x,"N2O_A :")');
WRITE(*,
'(5(1x,es13.6,:))') self%N2O_A
533 WRITE(*,
'(5x,"N2O_R :")');
WRITE(*,
'(5(1x,es13.6,:))') self%N2O_R
534 WRITE(*,
'(5x,"N2O_S :")');
WRITE(*,
'(5(1x,es13.6,:))') self%N2O_S
535 WRITE(*,
'(5x,"CH4 :")');
WRITE(*,
'(5(1x,es13.6,:))') self%CH4
536 WRITE(*,
'(5x,"CH4_A :")');
WRITE(*,
'(5(1x,es13.6,:))') self%CH4_A
537 WRITE(*,
'(5x,"CH4_R :")');
WRITE(*,
'(5(1x,es13.6,:))') self%CH4_R
538 WRITE(*,
'(5x,"CH4_ACH4zp :")');
WRITE(*,
'(5(1x,es13.6,:))') self%CH4_ACH4zp
540 WRITE(*,
'(3x,"ODPS optical depth arrays :")')
541 WRITE(*,
'(5x,"OD :")');
WRITE(*,
'(5(1x,es13.6,:))') self%OD
542 WRITE(*,
'(5x,"OD_path :")');
WRITE(*,
'(5(1x,es13.6,:))') self%OD_path
544 WRITE(*,
'(3x,"Zeeman-specific data :")')
545 WRITE(*,
'(5x,"w1, w2 :")');
WRITE(*,
'(2(1x,es13.6))') self%w1, self%w2
546 WRITE(*,
'(5x,"inode :")');
WRITE(*,
'(1x,i0)') self%inode
548 IF ( self%OPTRAN )
THEN 549 WRITE(*,
'(3x,"Compact-OPTRAN option :")')
550 WRITE(*,
'(3x,"n_OUsed_Pred :",1x,i0)') self%n_OUsed_Pred
551 WRITE(*,
'(5x,"dPonG :")');
WRITE(*,
'(5(1x,es13.6,:))') self%dPonG
552 WRITE(*,
'(5x,"d_Absorber :")');
WRITE(*,
'(5(1x,es13.6,:))') self%d_Absorber
553 WRITE(*,
'(5x,"Int_vapor :")');
WRITE(*,
'(5(1x,es13.6,:))') self%Int_vapor
554 WRITE(*,
'(5x,"AveA :")');
WRITE(*,
'(5(1x,es13.6,:))') self%AveA
555 WRITE(*,
'(5x,"Inverse :")');
WRITE(*,
'(5(1x,es13.6,:))') self%Inverse
556 WRITE(*,
'(5x,"s_t :")');
WRITE(*,
'(5(1x,es13.6,:))') self%s_t
557 WRITE(*,
'(5x,"s_p :")');
WRITE(*,
'(5(1x,es13.6,:))') self%s_p
558 WRITE(*,
'(5x,"Ap1 :")');
WRITE(*,
'(5(1x,es13.6,:))') self%Ap1
559 WRITE(*,
'(5x,"b :")');
WRITE(*,
'(5(1x,es13.6,:))') self%b
560 WRITE(*,
'(5x,"LN_Chi :")');
WRITE(*,
'(5(1x,es13.6,:))') self%LN_Chi
561 WRITE(*,
'(5x,"Chi :")');
WRITE(*,
'(5(1x,es13.6,:))') self%Chi
603 CHARACTER(*),
PARAMETER :: routine_name =
'PAFV_ValidRelease' 614 WRITE( msg,
'("An PAFV data update is needed. ", & 615 &"PAFV release is ",i0,". Valid release is ",i0,"." )' ) &
624 WRITE( msg,
'("An PAFV software update is needed. ", & 625 &"PAFV release is ",i0,". Valid release is ",i0,"." )' ) &
669 CHARACTER(*),
INTENT(OUT) :: info
671 INTEGER,
PARAMETER :: carriage_return = 13
672 INTEGER,
PARAMETER :: linefeed = 10
674 CHARACTER(1000) :: s1, s2
675 CHARACTER(2000) :: long_string
679 '(a,1x,"PAFV RELEASE.VERSION: ",i2,".",i2.2,a,3x, & 680 &"N_ODPS_LAYERS=",i0,2x,& 681 &"N_ABSORBERS =",i0,2x,& 682 &"N_USER_LAYERS=",i0,2x)' ) &
683 achar(carriage_return)//achar(linefeed), &
684 self%Release, self%Version, &
685 achar(carriage_return)//achar(linefeed), &
686 self%n_ODPS_Layers, &
690 IF ( self%OPTRAN )
THEN 692 '(a,1x,"PAFV ODAS Option",a,3x, & 693 &"N_OUSED_PRED=",i0,2x)' ) &
694 achar(carriage_return)//achar(linefeed), &
695 achar(carriage_return)//achar(linefeed), &
701 long_string = trim(s1)//trim(s2)
702 info = long_string(1:
min(len(info), len_trim(long_string)))
731 CHARACTER(*),
INTENT(OUT) :: id
819 n_ODPS_Layers, & ! Optional output
820 n_Absorbers , & ! Optional output
821 n_User_Layers, & ! Optional output
822 Release , & ! Optional output
823 Version , & ! Optional output
824 Title , & ! Optional output
825 History , & ! Optional output
829 CHARACTER(*),
INTENT(IN) :: filename
830 INTEGER ,
OPTIONAL,
INTENT(OUT) :: n_odps_layers
831 INTEGER ,
OPTIONAL,
INTENT(OUT) :: n_absorbers
832 INTEGER ,
OPTIONAL,
INTENT(OUT) :: n_user_layers
833 INTEGER ,
OPTIONAL,
INTENT(OUT) :: release
834 INTEGER ,
OPTIONAL,
INTENT(OUT) :: version
835 CHARACTER(*),
OPTIONAL,
INTENT(OUT) :: title
836 CHARACTER(*),
OPTIONAL,
INTENT(OUT) :: history
837 CHARACTER(*),
OPTIONAL,
INTENT(OUT) :: comment
841 CHARACTER(*),
PARAMETER :: routine_name =
'PAFV_InquireFile' 844 CHARACTER(ML) :: io_msg
847 INTEGER :: optran_present
855 msg =
'File '//trim(filename)//
' not found.' 862 IF ( err_stat /=
success )
THEN 863 msg =
'Error opening '//trim(filename)
869 READ( fid, iostat=io_stat, iomsg=io_msg ) &
872 IF ( io_stat /= 0 )
THEN 873 msg =
'Error reading Release/Version - '//trim(io_msg)
877 msg =
'PAFV Release check failed.' 883 READ( fid, iostat=io_stat, iomsg=io_msg ) &
884 pafv%n_ODPS_Layers, &
887 IF ( io_stat /= 0 )
THEN 888 msg =
'Error reading dimension values from '//trim(filename)//
' - '//trim(io_msg)
894 READ( fid, iostat=io_stat, iomsg=io_msg ) optran_present
895 IF ( io_stat /= 0 )
THEN 896 msg =
'Error reading Compact-OPTRAN data indicator from '//trim(filename)//
' - '//trim(io_msg)
907 IF ( err_stat /=
success )
THEN 908 msg =
'Error reading global attributes' 914 CLOSE( fid, iostat=io_stat, iomsg=io_msg )
915 IF ( io_stat /= 0 )
THEN 916 msg =
'Error closing '//trim(filename)//
' - '//trim(io_msg)
922 IF (
PRESENT(n_odps_layers) ) n_odps_layers = pafv%n_ODPS_Layers
923 IF (
PRESENT(n_absorbers ) ) n_absorbers = pafv%n_Absorbers
924 IF (
PRESENT(n_user_layers) ) n_user_layers = pafv%n_User_Layers
925 IF (
PRESENT(release ) ) release = pafv%Release
926 IF (
PRESENT(version ) ) version = pafv%Version
933 CLOSE( fid, iostat=io_stat, iomsg=io_msg )
934 IF ( io_stat /= 0 ) &
935 msg = trim(msg)//
'; Error closing input file during error cleanup - '//trim(io_msg)
1017 Filename , & ! Input
1018 No_Close , & ! Optional input
1019 Quiet , & ! Optional input
1020 Title , & ! Optional output
1021 History , & ! Optional output
1022 Comment , & ! Optional output
1027 CHARACTER(*),
INTENT(IN) :: filename
1028 LOGICAL,
OPTIONAL,
INTENT(IN) :: no_close
1029 LOGICAL,
OPTIONAL,
INTENT(IN) :: quiet
1030 CHARACTER(*),
OPTIONAL,
INTENT(OUT) :: title
1031 CHARACTER(*),
OPTIONAL,
INTENT(OUT) :: history
1032 CHARACTER(*),
OPTIONAL,
INTENT(OUT) :: comment
1033 LOGICAL,
OPTIONAL,
INTENT(IN) :: debug
1037 CHARACTER(*),
PARAMETER :: routine_name =
'PAFV_ReadFile' 1039 CHARACTER(ML) :: msg
1040 CHARACTER(ML) :: io_msg
1041 LOGICAL :: close_file
1045 INTEGER :: optran_present
1052 IF (
PRESENT(no_close) ) close_file = .NOT. no_close
1055 IF (
PRESENT(quiet) ) noisy = .NOT. quiet
1057 IF (
PRESENT(debug) )
THEN 1058 IF ( debug ) noisy = .true.
1065 INQUIRE( file=filename, number=fid )
1068 msg =
'Error inquiring '//trim(filename)//
' for its FileID' 1075 IF ( err_stat /=
success )
THEN 1076 msg =
'Error opening '//trim(filename)
1080 msg =
'File '//trim(filename)//
' not found.' 1087 READ( fid, iostat=io_stat, iomsg=io_msg ) &
1090 IF ( io_stat /= 0 )
THEN 1091 msg =
'Error reading Release/Version - '//trim(io_msg)
1095 msg =
'PAFV Release check failed.' 1101 READ( fid, iostat=io_stat, iomsg=io_msg ) &
1102 dummy%n_ODPS_Layers, &
1103 dummy%n_Absorbers , &
1105 IF ( io_stat /= 0 )
THEN 1106 msg =
'Error reading dimension values - '//trim(io_msg)
1112 READ( fid, iostat=io_stat, iomsg=io_msg ) optran_present
1113 IF ( io_stat /= 0 )
THEN 1114 msg =
'Error reading Compact-OPTRAN data indicator - '//trim(io_msg)
1122 dummy%n_ODPS_Layers, &
1123 dummy%n_Absorbers , &
1124 dummy%n_User_Layers , &
1127 msg =
'PAFV object allocation failed.' 1131 pafv%Version = dummy%Version
1138 history = history, &
1140 IF ( err_stat /=
success )
THEN 1141 msg =
'Error reading global attributes' 1147 READ( fid, iostat=io_stat, iomsg=io_msg ) &
1148 pafv%ODPS2User_Idx, &
1149 pafv%interp_index , &
1150 pafv%Acc_Weighting, &
1151 pafv%Temperature , &
1155 IF ( io_stat /= 0 )
THEN 1156 msg =
'Error reading ODPS forward variables - '//trim(io_msg)
1162 READ( fid, iostat=io_stat, iomsg=io_msg ) &
1163 pafv%Ref_LnPressure, &
1164 pafv%User_LnPressure
1165 IF ( io_stat /= 0 )
THEN 1166 msg =
'Error reading pressure profiles - '//trim(io_msg)
1172 READ( fid, iostat=io_stat, iomsg=io_msg ) &
1187 IF ( io_stat /= 0 )
THEN 1188 msg =
'Error reading predictor forward variables (set1) - '//trim(io_msg)
1191 READ( fid, iostat=io_stat, iomsg=io_msg ) &
1219 IF ( io_stat /= 0 )
THEN 1220 msg =
'Error reading predictor forward variables (set2) - '//trim(io_msg)
1226 READ( fid, iostat=io_stat, iomsg=io_msg ) &
1229 IF ( io_stat /= 0 )
THEN 1230 msg =
'Error reading optical depth variables - '//trim(io_msg)
1236 READ( fid, iostat=io_stat, iomsg=io_msg ) &
1240 IF ( io_stat /= 0 )
THEN 1241 msg =
'Error reading Zeeman specific forward variables - '//trim(io_msg)
1247 IF ( pafv%OPTRAN )
THEN 1248 READ( fid, iostat=io_stat, iomsg=io_msg ) &
1260 IF ( io_stat /= 0 )
THEN 1261 msg =
'Error reading compact-OPTRAN variables - '//trim(io_msg)
1268 IF ( close_file )
THEN 1269 CLOSE( fid, iostat=io_stat, iomsg=io_msg )
1270 IF ( io_stat /= 0 )
THEN 1271 msg =
'Error closing '//trim(filename)//
' - '//trim(io_msg)
1287 CLOSE( fid, iostat=io_stat, iomsg=io_msg )
1288 IF ( io_stat /= 0 ) &
1289 msg = trim(msg)//
'; Error closing output file '//trim(filename)//&
1290 ' during error cleanup - '//trim(io_msg)
1373 No_Close, & ! Optional input
1374 Quiet , & ! Optional input
1375 Title , & ! Optional input
1376 History , & ! Optional input
1377 Comment , & ! Optional input
1382 CHARACTER(*),
INTENT(IN) :: filename
1383 LOGICAL,
OPTIONAL,
INTENT(IN) :: no_close
1384 LOGICAL,
OPTIONAL,
INTENT(IN) :: quiet
1385 CHARACTER(*),
OPTIONAL,
INTENT(IN) :: title
1386 CHARACTER(*),
OPTIONAL,
INTENT(IN) :: history
1387 CHARACTER(*),
OPTIONAL,
INTENT(IN) :: comment
1388 LOGICAL,
OPTIONAL,
INTENT(IN) :: debug
1392 CHARACTER(*),
PARAMETER :: routine_name =
'PAFV_WriteFile' 1394 CHARACTER(ML) :: msg
1395 CHARACTER(ML) :: io_msg
1396 LOGICAL :: close_file
1400 INTEGER :: optran_present
1407 IF (
PRESENT(no_close) ) close_file = .NOT. no_close
1410 IF (
PRESENT(quiet) ) noisy = .NOT. quiet
1412 IF (
PRESENT(debug) )
THEN 1413 IF ( debug ) noisy = .true.
1417 msg =
'PAFV object is empty.' 1425 INQUIRE( file=filename, number=fid )
1428 msg =
'Error inquiring '//trim(filename)//
' for its FileID' 1434 IF ( err_stat /=
success )
THEN 1435 msg =
'Error opening '//trim(filename)
1442 WRITE( fid, iostat=io_stat, iomsg=io_msg ) &
1445 IF ( io_stat /= 0 )
THEN 1446 msg =
'Error writing Release/Version - '//trim(io_msg)
1452 WRITE( fid, iostat=io_stat, iomsg=io_msg ) &
1453 pafv%n_ODPS_Layers, &
1454 pafv%n_Absorbers , &
1456 IF ( io_stat /= 0 )
THEN 1457 msg =
'Error writing dimension values - '//trim(io_msg)
1463 IF ( pafv%OPTRAN)
THEN 1468 WRITE( fid, iostat=io_stat, iomsg=io_msg ) optran_present
1469 IF ( io_stat /= 0 )
THEN 1470 msg =
'Error writing Compact-OPTRAN data indicator - '//trim(io_msg)
1479 history = history, &
1481 IF ( err_stat /=
success )
THEN 1482 msg =
'Error writing global attributes' 1488 WRITE( fid, iostat=io_stat, iomsg=io_msg ) &
1489 pafv%ODPS2User_Idx, &
1490 pafv%interp_index , &
1491 pafv%Acc_Weighting, &
1492 pafv%Temperature , &
1496 IF ( io_stat /= 0 )
THEN 1497 msg =
'Error writing ODPS forward variables - '//trim(io_msg)
1503 WRITE( fid, iostat=io_stat, iomsg=io_msg ) &
1504 pafv%Ref_LnPressure , &
1505 pafv%User_LnPressure
1506 IF ( io_stat /= 0 )
THEN 1507 msg =
'Error writing pressure profiles - '//trim(io_msg)
1513 WRITE( fid, iostat=io_stat, iomsg=io_msg ) &
1528 IF ( io_stat /= 0 )
THEN 1529 msg =
'Error writing predictor forward variables (set1) - '//trim(io_msg)
1532 WRITE( fid, iostat=io_stat, iomsg=io_msg ) &
1560 IF ( io_stat /= 0 )
THEN 1561 msg =
'Error writing predictor forward variables (set2) - '//trim(io_msg)
1567 WRITE( fid, iostat=io_stat, iomsg=io_msg ) &
1570 IF ( io_stat /= 0 )
THEN 1571 msg =
'Error writing optical depth variables - '//trim(io_msg)
1577 WRITE( fid, iostat=io_stat, iomsg=io_msg ) &
1581 IF ( io_stat /= 0 )
THEN 1582 msg =
'Error writing Zeeman specific forward variables - '//trim(io_msg)
1588 IF ( pafv%OPTRAN )
THEN 1589 WRITE( fid, iostat=io_stat, iomsg=io_msg ) &
1601 IF ( io_stat /= 0 )
THEN 1602 msg =
'Error writing compac-OPTRAN variables - '//trim(io_msg)
1609 IF ( close_file )
THEN 1610 CLOSE( fid, iostat=io_stat, iomsg=io_msg )
1611 IF ( io_stat /= 0 )
THEN 1612 msg =
'Error closing '//trim(filename)//
' - '//trim(io_msg)
1628 CLOSE( fid, iostat=io_stat, iomsg=io_msg )
1629 IF ( io_stat /= 0 ) &
1630 msg = trim(msg)//
'; Error closing output file '//trim(filename)//&
1631 ' during error cleanup - '//trim(io_msg)
1683 ELEMENTAL FUNCTION pafv_equal( x, y )
RESULT( is_equal )
1696 IF ( (x%Release /= y%Release) .OR. &
1697 (x%Version /= y%Version) )
RETURN 1699 IF ( (x%n_ODPS_Layers /= y%n_ODPS_Layers ) .OR. &
1700 (x%n_Absorbers /= y%n_Absorbers ) .OR. &
1701 (x%n_User_Layers /= y%n_User_Layers ) )
RETURN 1703 IF ( x%OPTRAN .NEQV. y%OPTRAN )
RETURN 1705 IF ( all(x%ODPS2User_Idx == y%ODPS2User_Idx ) .AND. &
1706 all(x%interp_index == y%interp_index ) .AND. &
1707 all(x%Acc_Weighting .equalto. y%Acc_Weighting ) .AND. &
1708 all(x%Temperature .equalto. y%Temperature ) .AND. &
1709 all(x%Absorber .equalto. y%Absorber ) .AND. &
1710 all(x%idx_map == y%idx_map ) ) &
1712 IF ( all(x%Ref_LnPressure .equalto. y%Ref_LnPressure ) .AND. &
1713 all(x%User_LnPressure .equalto. y%User_LnPressure ) ) &
1714 is_equal = is_equal .EQV. .true.
1715 IF ( all(x%PDP .equalto. y%PDP ) .AND. &
1716 all(x%Tz_ref .equalto. y%Tz_ref ) .AND. &
1717 all(x%Tz .equalto. y%Tz ) .AND. &
1718 all(x%Tzp_ref .equalto. y%Tzp_ref ) .AND. &
1719 all(x%Tzp .equalto. y%Tzp ) .AND. &
1720 all(x%GAz_ref .equalto. y%GAz_ref ) .AND. &
1721 all(x%GAz_sum .equalto. y%GAz_sum ) .AND. &
1722 all(x%GAz .equalto. y%GAz ) .AND. &
1723 all(x%GAzp_ref .equalto. y%GAzp_ref ) .AND. &
1724 all(x%GAzp_sum .equalto. y%GAzp_sum ) .AND. &
1725 all(x%GAzp .equalto. y%GAzp ) .AND. &
1726 all(x%GATzp_ref .equalto. y%GATzp_ref ) .AND. &
1727 all(x%GATzp_sum .equalto. y%GATzp_sum ) .AND. &
1728 all(x%GATzp .equalto. y%GATzp ) ) &
1729 is_equal = is_equal .EQV. .true.
1730 IF ( all(x%DT .equalto. y%DT ) .AND. &
1731 all(x%T .equalto. y%T ) .AND. &
1732 all(x%T2 .equalto. y%T2 ) .AND. &
1733 all(x%DT2 .equalto. y%DT2 ) .AND. &
1734 all(x%H2O .equalto. y%H2O ) .AND. &
1735 all(x%H2O_A .equalto. y%H2O_A ) .AND. &
1736 all(x%H2O_R .equalto. y%H2O_R ) .AND. &
1737 all(x%H2O_S .equalto. y%H2O_S ) .AND. &
1738 all(x%H2O_R4 .equalto. y%H2O_R4 ) .AND. &
1739 all(x%H2OdH2OTzp .equalto. y%H2OdH2OTzp ) .AND. &
1740 all(x%CO2 .equalto. y%CO2 ) .AND. &
1741 all(x%O3 .equalto. y%O3 ) .AND. &
1742 all(x%O3_A .equalto. y%O3_A ) .AND. &
1743 all(x%O3_R .equalto. y%O3_R ) .AND. &
1744 all(x%CO .equalto. y%CO ) .AND. &
1745 all(x%CO_A .equalto. y%CO_A ) .AND. &
1746 all(x%CO_R .equalto. y%CO_R ) .AND. &
1747 all(x%CO_S .equalto. y%CO_S ) .AND. &
1748 all(x%CO_ACOdCOzp .equalto. y%CO_ACOdCOzp ) .AND. &
1749 all(x%N2O .equalto. y%N2O ) .AND. &
1750 all(x%N2O_A .equalto. y%N2O_A ) .AND. &
1751 all(x%N2O_R .equalto. y%N2O_R ) .AND. &
1752 all(x%N2O_S .equalto. y%N2O_S ) .AND. &
1753 all(x%CH4 .equalto. y%CH4 ) .AND. &
1754 all(x%CH4_A .equalto. y%CH4_A ) .AND. &
1755 all(x%CH4_R .equalto. y%CH4_R ) .AND. &
1756 all(x%CH4_ACH4zp .equalto. y%CH4_ACH4zp ) ) &
1757 is_equal = is_equal .EQV. .true.
1759 IF ( all(x%OD .equalto. y%OD ) .AND. &
1760 all(x%OD_path .equalto. y%OD_path ) ) &
1761 is_equal = is_equal .EQV. .true.
1763 IF ( (x%w1 .equalto. y%w1 ) .AND. &
1764 (x%w2 .equalto. y%w2 ) .AND. &
1765 (x%inode == y%inode ) ) &
1766 is_equal = is_equal .EQV. .true.
1768 IF ( x%OPTRAN .AND. y%OPTRAN )
THEN 1769 IF ( all(x%dPonG .equalto. y%dPonG ) .AND. &
1770 all(x%d_Absorber .equalto. y%d_Absorber ) .AND. &
1771 all(x%Int_vapor .equalto. y%Int_vapor ) .AND. &
1772 all(x%AveA .equalto. y%AveA ) .AND. &
1773 all(x%Inverse .equalto. y%Inverse ) .AND. &
1774 all(x%s_t .equalto. y%s_t ) .AND. &
1775 all(x%s_p .equalto. y%s_p ) .AND. &
1776 all(x%Ap1 .equalto. y%Ap1 ) .AND. &
1777 all(x%b .equalto. y%b ) .AND. &
1778 all(x%LN_Chi .equalto. y%LN_Chi ) .AND. &
1779 all(x%Chi .equalto. y%Chi ) ) &
1780 is_equal = is_equal .EQV. .true.
integer, parameter, public failure
integer function, public pafv_inquirefile(Filename, n_ODPS_Layers, n_Absorbers, n_User_Layers, Release, Version, Title, History, Comment)
integer function, public pafv_writefile(PAFV, Filename, No_Close, Quiet, Title, History, Comment, Debug)
real(fp), parameter, public zero
integer, parameter data_present
subroutine, public pafv_defineversion(Id)
integer, parameter, public fp
integer function, public readgatts_binary_file(fid, Write_Module, Created_On, Title, History, Comment)
integer, parameter, public max_optran_predictors
elemental subroutine, public pafv_create(self, n_ODPS_Layers, n_User_Layers, n_Absorbers, No_OPTRAN)
character(*), parameter write_error_status
logical function, public pafv_validrelease(self)
subroutine, public pafv_inspect(self)
subroutine inquire_cleanup()
character(*), parameter module_version_id
integer, parameter data_missing
integer, parameter, public max_optran_order
subroutine read_cleanup()
integer, parameter, public max_optran_used_predictors
subroutine write_cleanup()
integer function, public open_binary_file(Filename, FileID, For_Output, No_Check)
real(fp), parameter, public one
recursive subroutine, public display_message(Routine_Name, Message, Error_State, Message_Log)
elemental logical function, public pafv_associated(self)
integer function, public pafv_readfile(PAFV, Filename, No_Close, Quiet, Title, History, Comment, Debug)
integer, parameter pafv_release
subroutine, public pafv_info(self, Info)
integer function, public writegatts_binary_file(fid, Write_Module, Created_On, Title, History, Comment)
elemental subroutine, public pafv_destroy(self)
elemental logical function pafv_equal(x, y)
integer, parameter pafv_version
integer, parameter, public success
integer, parameter, public information