43 PUBLIC ::
OPERATOR(==)
60 INTERFACE OPERATOR(==)
62 END INTERFACE OPERATOR(==)
70 '$Id: NLTECoeff_Define.f90 60152 2015-08-13 19:19:13Z paul.vandelst@noaa.gov $' 72 REAL(Double),
PARAMETER ::
zero = 0.0_double
73 REAL(Double),
PARAMETER ::
one = 1.0_double
75 INTEGER,
PARAMETER ::
ml = 512
77 INTEGER,
PARAMETER ::
sl = 20
85 INTEGER,
PARAMETER ::
true = 1
93 LOGICAL :: is_allocated = .
false.
98 INTEGER(Long) :: n_predictors = 0
99 INTEGER(Long) :: n_sensor_angles = 0
100 INTEGER(Long) :: n_solar_angles = 0
101 INTEGER(Long) :: n_nlte_channels = 0
102 INTEGER(Long) :: n_channels = 0
106 CHARACTER(SL) :: sensor_id =
'' 109 INTEGER(Long),
ALLOCATABLE :: sensor_channel(:)
118 REAL(Double) ,
ALLOCATABLE :: secant_sensor_zenith(:)
119 REAL(Double) ,
ALLOCATABLE :: secant_solar_zenith(:)
120 INTEGER(Long),
ALLOCATABLE :: nlte_channel(:)
121 LOGICAL ,
ALLOCATABLE :: is_nlte_channel(:)
123 INTEGER(Long),
ALLOCATABLE :: c_index(:)
124 REAL(Double) ,
ALLOCATABLE :: c(:,:,:,:)
176 status = nltecoeff%Is_Allocated
204 nltecoeff%Is_Allocated = .
false.
205 nltecoeff%n_Predictors = 0
206 nltecoeff%n_Sensor_Angles = 0
207 nltecoeff%n_Solar_Angles = 0
208 nltecoeff%n_NLTE_Channels = 0
209 nltecoeff%n_Channels = 0
210 nltecoeff%Sensor_Id =
'' 280 NLTECoeff , & ! Output
281 n_Predictors , & ! Input
282 n_Sensor_Angles , & ! Input
283 n_Solar_Angles , & ! Input
284 n_NLTE_Channels , & ! Input
288 INTEGER ,
INTENT(IN) :: n_predictors
289 INTEGER ,
INTENT(IN) :: n_sensor_angles
290 INTEGER ,
INTENT(IN) :: n_solar_angles
291 INTEGER ,
INTENT(IN) :: n_nlte_channels
292 INTEGER ,
INTENT(IN) :: n_channels
294 INTEGER :: alloc_stat
297 IF ( n_predictors < 1 .OR. &
298 n_sensor_angles < 1 .OR. &
299 n_solar_angles < 1 .OR. &
300 n_nlte_channels < 1 .OR. &
301 n_channels < n_nlte_channels )
RETURN 304 ALLOCATE( nltecoeff%Sensor_Channel( n_channels ), &
305 nltecoeff%Secant_Sensor_Zenith( n_sensor_angles ), &
306 nltecoeff%Secant_Solar_Zenith( n_solar_angles ), &
307 nltecoeff%NLTE_Channel( n_nlte_channels ), &
308 nltecoeff%Is_NLTE_Channel( n_channels ), &
309 nltecoeff%C_Index( n_channels ), &
310 nltecoeff%C( n_predictors, n_sensor_angles, n_solar_angles, n_nlte_channels ), &
312 IF ( alloc_stat /= 0 )
RETURN 317 nltecoeff%n_Predictors = n_predictors
318 nltecoeff%n_Sensor_Angles = n_sensor_angles
319 nltecoeff%n_Solar_Angles = n_solar_angles
320 nltecoeff%n_NLTE_Channels = n_nlte_channels
321 nltecoeff%n_Channels = n_channels
323 nltecoeff%Sensor_Channel = 0
324 nltecoeff%Secant_Sensor_Zenith =
zero 325 nltecoeff%Secant_Solar_Zenith =
zero 326 nltecoeff%NLTE_Channel = 0
327 nltecoeff%Is_NLTE_Channel = .
false.
328 nltecoeff%C_Index = 0
332 nltecoeff%Is_Allocated = .
true.
362 CHARACTER(3) :: maybe
363 WRITE(*,
'(1x,"NLTECoeff OBJECT")')
365 WRITE(*,
'(3x,"Release.Version :",1x,i0,".",i0)') nltecoeff%Release, nltecoeff%Version
367 WRITE(*,
'(3x,"n_Predictors :",1x,i0)') nltecoeff%n_Predictors
368 WRITE(*,
'(3x,"n_Sensor_Angles :",1x,i0)') nltecoeff%n_Sensor_Angles
369 WRITE(*,
'(3x,"n_Solar_Angles :",1x,i0)') nltecoeff%n_Solar_Angles
370 WRITE(*,
'(3x,"n_NLTE_Channels :",1x,i0)') nltecoeff%n_NLTE_Channels
371 WRITE(*,
'(3x,"n_Channels :",1x,i0)') nltecoeff%n_Channels
374 WRITE(*,
'(3x,"Sensor_Id :",1x,a )') trim(nltecoeff%Sensor_Id)
375 WRITE(*,
'(3x,"WMO_Satellite_ID :",1x,i0)') nltecoeff%WMO_Satellite_ID
376 WRITE(*,
'(3x,"WMO_Sensor_ID :",1x,i0)') nltecoeff%WMO_Sensor_ID
377 WRITE(*,
'(3x,"Sensor_Channel :")')
378 WRITE(*,
'(10(1x,i5,:))') nltecoeff%Sensor_Channel
380 WRITE(*,
'(3x,"Upper_Plevel :")')
381 WRITE(*,
'(5(1x,es13.6,:))') nltecoeff%Upper_Plevel
382 WRITE(*,
'(3x,"Lower_Plevel :")')
383 WRITE(*,
'(5(1x,es13.6,:))') nltecoeff%Lower_Plevel
385 WRITE(*,
'(3x,"Min_Tm :")')
386 WRITE(*,
'(5(1x,es13.6,:))') nltecoeff%Min_Tm
387 WRITE(*,
'(3x,"Max_Tm :")')
388 WRITE(*,
'(5(1x,es13.6,:))') nltecoeff%Max_Tm
389 WRITE(*,
'(3x,"Mean_Tm :")')
390 WRITE(*,
'(5(1x,es13.6,:))') nltecoeff%Mean_Tm
392 WRITE(*,
'(3x,"Secant_Sensor_Zenith :")')
393 WRITE(*,
'(5(1x,es13.6,:))') nltecoeff%Secant_Sensor_Zenith
394 WRITE(*,
'(3x,"Secant_Solar_Zenith :")')
395 WRITE(*,
'(5(1x,es13.6,:))') nltecoeff%Secant_Solar_Zenith
396 WRITE(*,
'(3x,"NLTE_Channel :")')
397 WRITE(*,
'(10(1x,i5,:))') nltecoeff%NLTE_Channel
399 WRITE(*,
'(3x,"NLTE_Channel_Flag :")')
400 DO i = 1, nltecoeff%n_Channels
401 IF ( mod(i,5) == 0 .OR. i == nltecoeff%n_Channels )
THEN 406 WRITE(*,fmt=
'(1x,i5,":",l1,", c-index: ",i0)',advance=maybe) nltecoeff%Sensor_Channel(i), &
407 nltecoeff%Is_NLTE_Channel(i), &
411 WRITE(*,
'(3x,"NLTE correction coefficients :")')
412 WRITE(*,
'(5(1x,es13.6,:))') nltecoeff%C
451 CHARACTER(*),
PARAMETER :: routine_name =
'NLTECoeff_ValidRelease' 462 WRITE( msg,
'("A NLTECoeff data update is needed. ", & 463 &"NLTECoeff release is ",i0,". Valid release is ",i0,"." )' ) &
473 WRITE( msg,
'("A NLTECoeff software update is needed. ", & 474 &"NLTECoeff release is ",i0,". Valid release is ",i0,"." )' ) &
517 CHARACTER(*),
INTENT(OUT) :: info
519 INTEGER,
PARAMETER :: carriage_return = 13
520 INTEGER,
PARAMETER :: linefeed = 10
522 CHARACTER(2000) :: long_string
525 WRITE( long_string, &
526 '(a,1x,"NLTECoeff RELEASE.VERSION: ",i2,".",i2.2,a,3x, & 527 &"N_PREDICTORS=",i0,2x,& 528 &"N_SENSOR_ANGLES=",i0,2x,& 529 &"N_SOLAR_ANGLES=",i0,2x,& 530 &"N_NLTE_CHANNELS=",i0,2x,& 531 &"N_CHANNELS=",i0 )' ) &
532 achar(carriage_return)//achar(linefeed), &
533 nltecoeff%Release, nltecoeff%Version, &
534 achar(carriage_return)//achar(linefeed), &
535 nltecoeff%n_Predictors , &
536 nltecoeff%n_Sensor_Angles , &
537 nltecoeff%n_Solar_Angles , &
538 nltecoeff%n_NLTE_Channels , &
543 info = long_string(1:
min(len(info), len_trim(long_string)))
572 CHARACTER(*),
INTENT(OUT) :: id
616 NLTECoeff , & ! Input
617 Sensor_Channel, & ! Input
621 INTEGER ,
INTENT(IN) :: sensor_channel(:)
625 INTEGER :: n_subset_channels, n_nlte_subset_channels
626 INTEGER,
ALLOCATABLE :: idx(:), nlte_idx(:)
635 nltecoeff%Sensor_Channel, &
642 nltecoeff%NLTE_Channel, &
648 CALL subset_getvalue( subset , n_values = n_subset_channels , index = idx )
649 CALL subset_getvalue( nlte_subset, n_values = n_nlte_subset_channels, index = nlte_idx )
652 nltecoeff%n_Predictors , &
653 nltecoeff%n_Sensor_Angles, &
654 nltecoeff%n_Solar_Angles , &
655 n_nlte_subset_channels , &
662 nc_subset%Version = nltecoeff%Version
663 nc_subset%Sensor_Id = nltecoeff%Sensor_Id
664 nc_subset%WMO_Satellite_ID = nltecoeff%WMO_Satellite_ID
665 nc_subset%WMO_Sensor_ID = nltecoeff%WMO_Sensor_ID
666 nc_subset%Upper_Plevel = nltecoeff%Upper_Plevel
667 nc_subset%Lower_Plevel = nltecoeff%Lower_Plevel
668 nc_subset%Min_Tm = nltecoeff%Min_Tm
669 nc_subset%Max_Tm = nltecoeff%Max_Tm
670 nc_subset%Mean_Tm = nltecoeff%Mean_Tm
671 nc_subset%Secant_Sensor_Zenith = nltecoeff%Secant_Sensor_Zenith
672 nc_subset%Secant_Solar_Zenith = nltecoeff%Secant_Solar_Zenith
674 nc_subset%Sensor_Channel = nltecoeff%Sensor_Channel(idx)
675 nc_subset%NLTE_Channel = nltecoeff%NLTE_Channel(nlte_idx)
676 nc_subset%Is_NLTE_Channel = nltecoeff%Is_NLTE_Channel(idx)
677 nc_subset%C_Index = nltecoeff%C_Index(idx)
678 nc_subset%C = nltecoeff%C(:,:,:,nlte_idx)
725 NLTECoeff, & ! Output
731 CHARACTER(*),
OPTIONAL,
INTENT(IN) :: sensor_id
733 INTEGER,
ALLOCATABLE :: valid_index(:)
734 INTEGER :: i, j, n_nc, n_valid, n_channels, n_nlte_channels
735 INTEGER :: ch1, ch2, nlte_ch1, nlte_ch2
739 n_nc =
SIZE(nc_array)
740 IF ( n_nc < 1 )
RETURN 743 IF ( n_valid == 0 )
RETURN 745 ALLOCATE( valid_index(n_valid) )
750 IF ( nc_array(i)%n_Predictors /= nc_array(valid_index(1))%n_Predictors .OR. &
751 nc_array(i)%n_Sensor_Angles /= nc_array(valid_index(1))%n_Sensor_Angles .OR. &
752 nc_array(i)%n_Solar_Angles /= nc_array(valid_index(1))%n_Solar_Angles .OR. &
753 nc_array(i)%WMO_Satellite_ID /= nc_array(valid_index(1))%WMO_Satellite_ID .OR. &
754 nc_array(i)%WMO_Sensor_ID /= nc_array(valid_index(1))%WMO_Sensor_ID )
THEN 761 n_nlte_channels = sum(nc_array(valid_index)%n_NLTE_Channels)
762 n_channels = sum(nc_array(valid_index)%n_Channels)
768 nc_array(valid_index(1))%n_Predictors , &
769 nc_array(valid_index(1))%n_Sensor_Angles, &
770 nc_array(valid_index(1))%n_Solar_Angles , &
778 nltecoeff%Version = nc_array(valid_index(1))%Version
779 IF (
PRESENT(sensor_id) )
THEN 780 nltecoeff%Sensor_Id = adjustl(sensor_id)
782 nltecoeff%Sensor_Id = nc_array(valid_index(1))%Sensor_Id
784 nltecoeff%WMO_Satellite_ID = nc_array(valid_index(1))%WMO_Satellite_ID
785 nltecoeff%WMO_Sensor_ID = nc_array(valid_index(1))%WMO_Sensor_ID
786 nltecoeff%Upper_Plevel = nc_array(valid_index(1))%Upper_Plevel
787 nltecoeff%Lower_Plevel = nc_array(valid_index(1))%Lower_Plevel
788 nltecoeff%Min_Tm = nc_array(valid_index(1))%Min_Tm
789 nltecoeff%Max_Tm = nc_array(valid_index(1))%Max_Tm
790 nltecoeff%Mean_Tm = nc_array(valid_index(1))%Mean_Tm
791 nltecoeff%Secant_Sensor_Zenith = nc_array(valid_index(1))%Secant_Sensor_Zenith
792 nltecoeff%Secant_Solar_Zenith = nc_array(valid_index(1))%Secant_Solar_Zenith
799 nlte_ch2 = nlte_ch1 + nc_array(i)%n_NLTE_Channels - 1
800 ch2 = ch1 + nc_array(i)%n_Channels - 1
802 nltecoeff%Sensor_Channel(ch1:ch2) = nc_array(i)%Sensor_Channel
803 nltecoeff%NLTE_Channel(nlte_ch1:nlte_ch2) = nc_array(i)%NLTE_Channel
804 nltecoeff%Is_NLTE_Channel(ch1:ch2) = nc_array(i)%Is_NLTE_Channel
805 nltecoeff%C_Index(ch1:ch2) = nc_array(i)%C_Index
806 nltecoeff%C(:,:,:,nlte_ch1:nlte_ch2) = nc_array(i)%C
808 nlte_ch1 = nlte_ch2 + 1
816 DEALLOCATE( valid_index )
861 INTEGER ,
INTENT(IN) :: sensor_channel(:)
865 INTEGER :: n_channels, n_nlte_channels
869 n_channels =
SIZE(sensor_channel)
870 IF ( n_channels < 1 )
RETURN 871 IF ( n_channels < nltecoeff%n_NLTE_Channels )
RETURN 881 nc_copy%n_Predictors , &
882 nc_copy%n_Sensor_Angles, &
883 nc_copy%n_Solar_Angles , &
884 nc_copy%n_NLTE_Channels, &
891 nltecoeff%Version = nc_copy%Version
892 nltecoeff%Sensor_Id = nc_copy%Sensor_Id
893 nltecoeff%WMO_Satellite_ID = nc_copy%WMO_Satellite_ID
894 nltecoeff%WMO_Sensor_ID = nc_copy%WMO_Sensor_ID
895 nltecoeff%Upper_Plevel = nc_copy%Upper_Plevel
896 nltecoeff%Lower_Plevel = nc_copy%Lower_Plevel
897 nltecoeff%Min_Tm = nc_copy%Min_Tm
898 nltecoeff%Max_Tm = nc_copy%Max_Tm
899 nltecoeff%Mean_Tm = nc_copy%Mean_Tm
900 nltecoeff%Secant_Sensor_Zenith = nc_copy%Secant_Sensor_Zenith
901 nltecoeff%Secant_Solar_Zenith = nc_copy%Secant_Solar_Zenith
903 nltecoeff%NLTE_Channel = nc_copy%NLTE_Channel
904 nltecoeff%C = nc_copy%C
906 nltecoeff%Sensor_Channel = sensor_channel
911 reindex_loop:
DO i = 1, n_channels
912 IF ( nltecoeff%Sensor_Channel(i) == nltecoeff%NLTE_Channel(i_nlte) )
THEN 913 nltecoeff%Is_NLTE_Channel(i) = .
true.
914 nltecoeff%C_Index(i) = i_nlte
916 IF (i_nlte > nltecoeff%n_NLTE_Channels)
EXIT reindex_loop
920 n_nlte_channels = i_nlte - 1
921 IF ( n_nlte_channels /= nltecoeff%n_NLTE_Channels ) nltecoeff = nc_copy
985 IF ( (x%Release /= y%Release) .OR. &
986 (x%Version /= y%Version) )
RETURN 988 IF ( (x%n_Predictors /= y%n_Predictors ) .OR. &
989 (x%n_Sensor_Angles /= y%n_Sensor_Angles ) .OR. &
990 (x%n_Solar_Angles /= y%n_Solar_Angles ) .OR. &
991 (x%n_NLTE_Channels /= y%n_NLTE_Channels ) .OR. &
992 (x%n_Channels /= y%n_Channels ) )
RETURN 994 IF ( (x%Sensor_Id /= y%Sensor_Id ) .OR. &
995 (x%WMO_Satellite_ID /= y%WMO_Satellite_ID) .OR. &
996 (x%WMO_Sensor_ID /= y%WMO_Sensor_ID ) )
RETURN 998 IF ( all(x%Sensor_Channel == y%Sensor_Channel ) .AND. &
999 all(x%Upper_Plevel .equalto. y%Upper_Plevel ) .AND. &
1000 all(x%Lower_Plevel .equalto. y%Lower_Plevel ) .AND. &
1001 all(x%Min_Tm .equalto. y%Min_Tm ) .AND. &
1002 all(x%Max_Tm .equalto. y%Max_Tm ) .AND. &
1003 all(x%Mean_Tm .equalto. y%Mean_Tm ) .AND. &
1004 all(x%Secant_Sensor_Zenith .equalto. y%Secant_Sensor_Zenith) .AND. &
1005 all(x%Secant_Solar_Zenith .equalto. y%Secant_Solar_Zenith ) .AND. &
1006 all(x%NLTE_Channel == y%NLTE_Channel ) .AND. &
1007 all(x%Is_NLTE_Channel .EQV. y%Is_NLTE_Channel ) .AND. &
1008 all(x%C_Index == y%C_Index ) .AND. &
1009 all(x%C .equalto. y%C ) ) &
1038 TYPE(NLTECoeff_type),
INTENT(IN OUT) :: NLTECoeff
1041 DO i = 1, nltecoeff%n_Channels
1042 IF ( nltecoeff%C_Index(i) > 0 )
THEN 1043 nltecoeff%C_Index(i) = j
integer, parameter, public failure
integer, parameter, public invalid_wmo_sensor_id
elemental subroutine, public nltecoeff_create(NLTECoeff, n_Predictors, n_Sensor_Angles, n_Solar_Angles, n_NLTE_Channels, n_Channels)
integer, parameter nltecoeff_release
real(fp), parameter, public zero
integer, parameter, public long
elemental logical function nltecoeff_equal(x, y)
integer, parameter, public double
logical function, public nltecoeff_validrelease(NLTECoeff)
integer, parameter, public invalid_wmo_satellite_id
elemental logical function, public subset_associated(Subset)
integer, parameter nltecoeff_version
subroutine, public nltecoeff_subset(NLTECoeff, Sensor_Channel, NC_Subset)
real(fp), parameter, public one
recursive subroutine, public display_message(Routine_Name, Message, Error_State, Message_Log)
subroutine, public nltecoeff_channelreindex(NLTECoeff, Sensor_Channel)
subroutine nltecoeff_reindex(NLTECoeff)
subroutine, public nltecoeff_inspect(NLTECoeff)
subroutine, public subset_getvalue(Subset, n_Values, Number, Index)
subroutine, public nltecoeff_info(NLTECoeff, Info)
subroutine, public nltecoeff_defineversion(Id)
elemental subroutine, public nltecoeff_destroy(NLTECoeff)
subroutine, public subset_generate(Subset, List, Subset_List)
character(*), parameter module_version_id
integer, parameter, public success
subroutine, public nltecoeff_concat(NLTECoeff, NC_Array, Sensor_Id)
integer, parameter n_layers
integer, parameter, public information
elemental logical function, public nltecoeff_associated(NLTECoeff)