Skip to content

Commit

Permalink
Tyler Green - 12/13/23
Browse files Browse the repository at this point in the history
Two main changes are:
 1: Made the time window for routine 'query_ob' in 'ob_access_module.F90' configurable through the namelist. This variable is called 'time_window' in namelist group wrf-model#7. All scripts relevant to make this namelist change were editted.
 2: Changed the 'time_equal_tolerance_seconds' variable in the subroutine 'time_eq' in the file 'obs_sort_module.F90' from 1800 seconds to 60 seconsd. This was ausing observations at the same location within 15minutes of eachoter to be considered the same and discarded.
  • Loading branch information
greent12 committed Dec 13, 2023
1 parent 6109dfc commit a66f717
Show file tree
Hide file tree
Showing 14 changed files with 104 additions and 60 deletions.
27 changes: 20 additions & 7 deletions src/driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,9 @@ SUBROUTINE driver ( filename , filename_out , &
nml%record_4%max_p_extend_t , nml%record_4%max_p_extend_w , &
h , iew_alloc , jns_alloc , map_projection , fdda_date_8 , fdda_time_6 , fdda_loop )
END IF

! Run the quality control (QC) procedures on the observations.

IF ( ( .NOT. nml%record_7%f4d ) .OR. &
( ( nml%record_7%f4d ) .AND. ( fdda_loop .EQ. 1 ) ) ) THEN
CALL proc_qc ( iew_alloc , jns_alloc , kbu_alloc , number_of_obs , &
Expand Down Expand Up @@ -456,7 +456,10 @@ SUBROUTINE driver ( filename , filename_out , &
pressure , pres , current_date_8 , current_time_6 , dxd , 1. , &
!BPR END
obs , index , nml%record_3%max_number_of_obs , &
t , u , v , h , rh , slp_x , sst , tobbox , odis )
t , u , v , h , rh , slp_x , sst , tobbox , odis ,&
!Tyler BEGIN
nml%record_7%time_window )
!Tyler END
ELSE
CALL proc_qc ( iew_alloc , jns_alloc , kbu_alloc , number_of_obs , &
total_dups , map_projection , &
Expand Down Expand Up @@ -489,9 +492,12 @@ SUBROUTINE driver ( filename , filename_out , &
pressure , pres , fdda_date_8 , fdda_time_6 , dxd , 1. , &
!BPR END
obs , index , nml%record_3%max_number_of_obs , &
t , u , v , h , rh , slp_x , sst , tobbox , odis )
t , u , v , h , rh , slp_x , sst , tobbox , odis, &
!Tyler BEGIN
nml%record_7%time_window)
!Tyler END
END IF

! After the QC process, the observations are available for output
! in a similar fashion to the non-QC'ed data. The differences
! between this file, "qc_out", and "useful_out" are the QC flags
Expand Down Expand Up @@ -551,8 +557,11 @@ SUBROUTINE driver ( filename , filename_out , &
!nml%record_2%grid_id )
nml%record_2%grid_id , terrain, h, nml%record_9%scale_cressman_rh_decreases , &
nml%record_9%radius_influence_sfc_mult, nml%record_9%oa_psfc , &
nml%record_9%max_p_tolerance_one_lev_oa )
nml%record_9%max_p_tolerance_one_lev_oa , &
!BPR END
!Tyler BEGIN
nml%record_7%time_window)
!Tyler END

! Store the final analysis back into the all_3d and all_2d arrays if we are doing
! SFC FDDA. Why? So that when we do the LAGTEM or temporal interpolation, we are
Expand Down Expand Up @@ -591,8 +600,11 @@ SUBROUTINE driver ( filename , filename_out , &
!nml%record_2%grid_id )
nml%record_2%grid_id , terrain, h, nml%record_9%scale_cressman_rh_decreases , &
nml%record_9%radius_influence_sfc_mult, nml%record_9%oa_psfc , &
nml%record_9%max_p_tolerance_one_lev_oa )
nml%record_9%max_p_tolerance_one_lev_oa , &
!BPR END
!Tyler BEGIN
nml%record_7%time_window)
!Tyler END
END IF

END IF
Expand Down Expand Up @@ -779,6 +791,7 @@ SUBROUTINE driver ( filename , filename_out , &

ENDIF


IF ( fdda_loop.EQ.1) THEN
obs_file_count = (icount-1)*2 + 1
IF ( .NOT. nml%record_7%f4d ) obs_file_count = icount
Expand Down
3 changes: 2 additions & 1 deletion src/namelist.common
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@
f4d , &
lagtem

COMMON /record7_nmli/ intf4d
COMMON /record7_nmli/ intf4d , &
time_window

! Record 8 NAMELIST variables.

Expand Down
3 changes: 2 additions & 1 deletion src/namelist.inc
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@
f4d , &
lagtem

INTEGER :: intf4d
INTEGER :: intf4d , &
time_window

! Record 8 NAMELIST variables.

Expand Down
3 changes: 2 additions & 1 deletion src/namelist.nml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@
NAMELIST /record7/ use_first_guess , &
f4d , &
intf4d , &
lagtem
lagtem , &
time_window

! Record 8 NAMELIST variables.

Expand Down
2 changes: 2 additions & 0 deletions src/namelist_module.F90
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ MODULE namelist
lagtem ! T/F use lagged time for off-time first guess

INTEGER :: intf4d ! time (s) between sfc FDDA time periods
INTEGER :: time_window !Time window for sfc FDDA
END TYPE nml_record_7

TYPE nml_record_8
Expand Down Expand Up @@ -983,6 +984,7 @@ SUBROUTINE store_namelist ( nml )
nml%record_7%f4d = f4d
nml%record_7%intf4d = intf4d
nml%record_7%lagtem = lagtem
nml%record_7%time_window = time_window

! Record 8 NAMELIST values:

Expand Down
54 changes: 30 additions & 24 deletions src/ob_access_module.F90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ MODULE ob_access
CONTAINS

!------------------------------------------------------------------------------
SUBROUTINE query_ob ( obs , date , time , &
SUBROUTINE query_ob ( obs , date , time , ds, &
request_variable , request_level , request_qc_max , request_p_diff , &
!BPR BEGIN
!value , qc )
Expand Down Expand Up @@ -39,7 +39,7 @@ SUBROUTINE query_ob ( obs , date , time , &

REAL :: r
LOGICAL :: not_missing
INTEGER :: ds , time_error
INTEGER :: time_error
CHARACTER (LEN=19) :: obs_date , analysis_date , analysis_p1_date , analysis_m1_date
LOGICAL :: close

Expand All @@ -57,6 +57,10 @@ SUBROUTINE query_ob ( obs , date , time , &
INCLUDE 'constants.inc'
!BPR END

!Tyler BEGIN - Make the time widndow a variable, not hardcoded
INTEGER, INTENT(IN) :: ds
!Tyler END

INCLUDE 'error.inc'
INCLUDE 'missing.inc'
INTERFACE
Expand Down Expand Up @@ -87,28 +91,30 @@ SUBROUTINE query_ob ( obs , date , time , &
( time - ( time / 10000 ) * 10000 ) / 100, &
time - ( time / 100 ) * 100

IF ( obs%info%platform(36:39) .EQ. ' ' ) THEN
IF ( ( obs%info%platform( 1:11) .EQ. 'FM-97 AIREP' ) .OR. &
( obs%info%platform( 1:15) .EQ. 'FM-36 TEMP SHIP' ) .OR. &
( obs%info%platform( 1:10) .EQ. 'FM-35 TEMP' ) .OR. &
( obs%info%platform( 1:11) .EQ. 'FM-88 SATOB' ) ) THEN
ds = 3600
ELSE
ds = 1800
END IF
ELSE
READ (obs%info%platform(36:39),IOSTAT=time_error,FMT='(I4)') ds
IF ( time_error .NE. 0 ) THEN
IF ( ( obs%info%platform( 1:11) .EQ. 'FM-97 AIREP' ) .OR. &
( obs%info%platform( 1:15) .EQ. 'FM-36 TEMP SHIP' ) .OR. &
( obs%info%platform( 1:10) .EQ. 'FM-35 TEMP' ) .OR. &
( obs%info%platform( 1:11) .EQ. 'FM-88 SATOB' ) ) THEN
ds = 3600
ELSE
ds = 1800
END IF
END IF
END IF
!Tyler - commenting this decision out for time window, it is now passed into
!routine
! IF ( obs%info%platform(36:39) .EQ. ' ' ) THEN
! IF ( ( obs%info%platform( 1:11) .EQ. 'FM-97 AIREP' ) .OR. &
! ( obs%info%platform( 1:15) .EQ. 'FM-36 TEMP SHIP' ) .OR. &
! ( obs%info%platform( 1:10) .EQ. 'FM-35 TEMP' ) .OR. &
! ( obs%info%platform( 1:11) .EQ. 'FM-88 SATOB' ) ) THEN
! ds = 3600
! ELSE
! ds = 1800
! END IF
! ELSE
! READ (obs%info%platform(36:39),IOSTAT=time_error,FMT='(I4)') ds
! IF ( time_error .NE. 0 ) THEN
! IF ( ( obs%info%platform( 1:11) .EQ. 'FM-97 AIREP' ) .OR. &
! ( obs%info%platform( 1:15) .EQ. 'FM-36 TEMP SHIP' ) .OR. &
! ( obs%info%platform( 1:10) .EQ. 'FM-35 TEMP' ) .OR. &
! ( obs%info%platform( 1:11) .EQ. 'FM-88 SATOB' ) ) THEN
! ds = 3600
! ELSE
! ds = 1800
! END IF
! END IF
! END IF

CALL geth_newdate ( analysis_p1_date , analysis_date , ds )
CALL geth_newdate ( analysis_m1_date , analysis_date , -1*ds )
Expand Down
4 changes: 0 additions & 4 deletions src/obs_sort_module.F90
Original file line number Diff line number Diff line change
Expand Up @@ -645,16 +645,12 @@ SUBROUTINE check_duplicate_ob ( obs , index , num_obs , total_dups , date , time
! foo
! IF ( .NOT. ( obs(first)%location .EQ. obs(second)%location ) ) THEN
IF ( .NOT. loc_eq ( obs(first)%location , obs(second)%location ) ) THEN
WRITE(*,*) "Tyler: obs_sort_module.F90, observation locations are &
not equal...cycling obsloop"
CYCLE obsloop
END IF

! If this obs has been merged with another obs or discarded, skip it.

IF ( obs(second)%info%discard ) THEN
WRITE(*,*) "Tyler: obs_sort_module.F90, observation has discard &
flag set to True, cycling compare"
CYCLE compare
END IF

Expand Down
18 changes: 16 additions & 2 deletions src/proc_oa.F90
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ SUBROUTINE proc_oa ( t , u , v , rh , slp_x , &
!BPR BEGIN
!grid_id )
grid_id, terrain, h, scale_cressman_rh_decreases, radius_influence_sfc_mult, &
oa_psfc, max_p_tolerance_one_lev_oa )
oa_psfc, max_p_tolerance_one_lev_oa, &
!BPR END

!Tyler BEGIN
ds )
!Tyler END
! This routine is a driver routine for objective analysis.

USE obj_analysis
Expand Down Expand Up @@ -157,6 +159,9 @@ SUBROUTINE proc_oa ( t , u , v , rh , slp_x , &
!Default is 1
INTEGER :: request_p_diff

!Tyler
INTEGER, INTENT(IN) :: ds

!If the user wants to allow a tolerance between an obs pressure and the
!pressure level it can be used for an objective anlysis on, then use the user-specified tolerance.
!If not, then use a tolerance of 1 Pa, which is effectively no tolerance.
Expand Down Expand Up @@ -283,6 +288,9 @@ SUBROUTINE proc_oa ( t , u , v , rh , slp_x , &
num_obs_found , num_obs_pass , obs , &
iew_alloc , jns_alloc , kbu_alloc , &
total_dups , map_projection , &
!Tyler BEGIN
ds,&
!Tyler END
get_value=obs_value , get_x_location=xob , get_y_location=yob , &
get_id=station_id , get_array_index = array_index , get_qc_info = qc_flag )
IF ( num_obs_pass .LT. mqd_minimum_num_obs ) THEN
Expand Down Expand Up @@ -430,6 +438,9 @@ SUBROUTINE proc_oa ( t , u , v , rh , slp_x , &
num_obs_found , num_obs_pass , obs , &
iew_alloc , jns_alloc , kbu_alloc , &
total_dups , map_projection , &
!Tyler BEGIN
ds,&
!Tyler END
get_value=obs_value , get_x_location=xob , get_y_location=yob , &
get_id=station_id , get_array_index = array_index , get_qc_info = qc_flag )

Expand Down Expand Up @@ -463,6 +474,9 @@ SUBROUTINE proc_oa ( t , u , v , rh , slp_x , &
num_obs_found , num_obs_pass , obs , &
iew_alloc , jns_alloc , kbu_alloc , &
total_dups , map_projection , &
!Tyler BEGIN
ds,&
!Tyler END
get_value=obs_value , get_x_location=xob , get_y_location=yob , &
get_id=station_id , get_array_index = array_index , get_qc_info = qc_flag )

Expand Down
4 changes: 2 additions & 2 deletions src/proc_oa.int
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ oa_min_switch , oa_3D_option , &
!BPR BEGIN
!grid_id )
grid_id, terrain, h, scale_cressman_rh_decreases, radius_influence_sfc_mult, &
oa_psfc, max_p_tolerance_one_lev_oa )
oa_psfc, max_p_tolerance_one_lev_oa , ds)
!BPR END

USE observation
Expand Down Expand Up @@ -79,5 +79,5 @@ oa_psfc, max_p_tolerance_one_lev_oa )
TYPE (report) , DIMENSION ( total_numobs ) :: obs
REAL , INTENT(IN) :: dxd , &
lat_center

INTEGER, INTENT(IN) :: ds
END SUBROUTINE proc_oa
16 changes: 11 additions & 5 deletions src/proc_ob_access.F90
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ SUBROUTINE proc_ob_access ( request_type , request_variable , print_found_obs ,
request_numobs , obs , &
iew_alloc , jns_alloc , kbu_alloc , &
total_dups , map_projection , &
!Tyler BEGIN
ds,&
!Tyler END
get_value , get_x_location , get_y_location , get_longitude , &
get_array_index , get_over_water , get_id , get_qc_info , &
!BPR BEGIN
Expand Down Expand Up @@ -47,6 +50,9 @@ SUBROUTINE proc_ob_access ( request_type , request_variable , print_found_obs ,
kbu_alloc , &
total_dups , &
map_projection
!Tyler BEGIN
INTEGER,INTENT(IN) :: ds
!Tyler END

! Optional arguments for retrieving data.

Expand Down Expand Up @@ -187,13 +193,13 @@ SUBROUTINE proc_ob_access ( request_type , request_variable , print_found_obs ,

! See if the next report in the array satifies the requested
! criteria.

CALL query_ob ( obs(loop_index) , date , time , &
!Tyler - added in 'ds' as an argument
CALL query_ob ( obs(loop_index) , date , time , ds, &
request_variable , request_level , request_qc_max , request_p_diff , &
!BPR BEGIN
! value , qc )
value , qc , fg_3d_h = get_fg_3d_h, fg_3d_t = get_fg_3d_t )
!BPR END
!BPR EN

! If qc is returned .NE. to missing, then this routine found a
! valid observation.
Expand Down Expand Up @@ -304,8 +310,8 @@ SUBROUTINE proc_ob_access ( request_type , request_variable , print_found_obs ,

! See if the next report in the array satifies the requested
! criteria.

CALL query_ob ( obs(loop_index) , date , time , &
!Tyler - added in 'ds' as an argument
CALL query_ob ( obs(loop_index) , date , time , ds, &
request_variable , request_level , request_qc_max , request_p_diff , &
value , qc )

Expand Down
4 changes: 2 additions & 2 deletions src/proc_ob_access.int
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ SUBROUTINE proc_ob_access ( request_type , request_variable , print_found_obs ,
request_level , date , time , request_p_diff , request_qc_max , total_numobs , &
request_numobs , obs , &
iew_alloc , jns_alloc , kbu_alloc , &
total_dups , map_projection , &
total_dups , map_projection , ds, &
get_value , get_x_location , get_y_location , get_longitude , &
get_array_index , get_over_water , get_id , get_qc_info , &
!BPR BEGIN
Expand Down Expand Up @@ -43,5 +43,5 @@ put_value , put_array_index , put_qc_info )
REAL , OPTIONAL , DIMENSION (:) :: put_value
INTEGER , OPTIONAL , DIMENSION (:) :: put_array_index , &
put_qc_info

INTEGER, INTENT(IN) :: ds
END SUBROUTINE proc_ob_access
9 changes: 0 additions & 9 deletions src/proc_obs_sort.F90
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,18 @@ SUBROUTINE proc_obs_sort ( obs_filename , unit , &

INTEGER :: i

WRITE(*,*) "Tyler: proc_obs_sort.F90, Top of subroutine."

! Ingest the observations. On return, we get the number of observations
! in the data set, as well as the observation data structure all filled
! filled up. All data types are ingested at the same time, so the
! upper air, surface, ship, aircraft, satellite, and bogus data are
! all read at this point. The data is vertically sorted with this
! call.

WRITE(*,*) "Tyler: proc_obs_sort.F90, Calling 'read_observations'."
CALL read_observations ( obs_filename , unit , obs , number_of_obs , &
total_number_of_obs , fatal_if_exceed_max_obs , print_out_obs_found , &
!BPR BEGIN
! height , pressure , iew , jns , levels , map_projection )
height , pressure , slp_x , temperature , iew , jns , levels , map_projection )
WRITE(*,*) "Tyler: proc_obs_sort.F90, Returing from 'read_observations'."
!BPR END

! There should be at least a single observation to make the rest of
Expand All @@ -75,16 +71,12 @@ SUBROUTINE proc_obs_sort ( obs_filename , unit , &
! (except for observations that are from the same "place"). This
! puts duplicate location observations next to each other.

WRITE(*,*) "Tyler: proc_obs_sort.F90, Calling 'sort_obs'."
CALL sort_obs ( obs , number_of_obs , index1 )
WRITE(*,*) "Tyler: proc_obs_sort.F90, Returing from 'sort_obs'."

! Merge the observations to (try to) remove all duplicates and
! build composite data.

WRITE(*,*) "Tyler: proc_obs_sort.F90, Calling 'check_duplicate_ob'."
CALL check_duplicate_ob ( obs , index1 , number_of_obs , total_dups , date , time )
WRITE(*,*) "Tyler: proc_obs_sort.F90, Returing from 'check_duplicate_ob'."

! The final stage of this procedure is to vertically interpolate
! any missing levels that the analysis would like to have available
Expand Down Expand Up @@ -180,5 +172,4 @@ SUBROUTINE proc_obs_sort ( obs_filename , unit , &
CALL error_handler ( error_number , error_message , fatal , listing )
END IF

WRITE(*,*) "Tyler: proc_obs_sort.F90, Bottom of subroutine."
END SUBROUTINE proc_obs_sort
Loading

0 comments on commit a66f717

Please sign in to comment.