program fill_missing_EMX_realtime !----------------------------------------------------------------! !--- ---! !--- Fortran program to approximate the EMX del-P for DTOPS ---! !--- in cases when this information is not available. This ---! !--- will happen for the first advisory cycle or two for a ---! !--- new TC and potentially in other situations. This ---! !--- program expects 6 command line arguments: ---! !--- ---! !--- 1) efile : file containing the linear regression ---! !--- coefficients for approximating EMX del-P ---! !--- using DSHP, LGEM, HWFI, and AVNI ---! !--- 2) dt : number of hours over which del-V occurs ---! !--- 3) dshp_delv : del-V from DSHP ---! !--- 4) lgem_delv : del-V from LGEM ---! !--- 5) hwfi_delv : del-V from HWFI ---! !--- 6) avni_delv : del-V from AVNI ---! !--- ---! !--- Usage: ./fill_missing_EMX_realtime.exe ${efile} ${dt} \ ---! !--- ${dshp_delv} ${lgem_delv} ${hwfi_delv} ${avni_delv} ---! !--- ---! !--- Compile statement: ---! !--- ---! !--- gfortran -O2 -o fill_missing_EMX_realtime.exe \ ---! !--- fill_missing_EMX_realtime.f ---! !--- ---! !--- Edit history: ---! !--- Matt Onderlinde - May 2017 - wrote original code ---! !--- ---! !----------------------------------------------------------------! implicit none !--- Declare variables ------------------------------------------! !--- Declare input arguments character*900 :: efile, dtin, dshp_delvin, lgem_delvin character*900 :: hwfi_delvin, avni_delvin real :: dt, dshp_delv, lgem_delv, hwfi_delv, avni_delv !--- Declare RI time period and threshold variables to be read from !--- each line of the coefficient file real :: curdt, curthresh !--- Declare multiple linear regression coefficient array real :: coef(5) !--- Declare output EMX del-P approximation real :: delp !--- Declare other variables integer :: i character*15 :: dum !--- Done declaring variables -----------------------------------! !--- Get command line arguments ---------------------------------! call get_command_argument(1,efile) call get_command_argument(2,dtin) call get_command_argument(3,dshp_delvin) call get_command_argument(4,lgem_delvin) call get_command_argument(5,hwfi_delvin) call get_command_argument(6,avni_delvin) read(dtin,*) dt read(dshp_delvin,*) dshp_delv read(lgem_delvin,*) lgem_delv read(hwfi_delvin,*) hwfi_delv read(avni_delvin,*) avni_delv !--- Done getting arguments -------------------------------------! !--- Read in current coefficients from file ---------------------! open(10, file=trim(efile), status='old') read(10,*) dum do i = 1, 8 read(10,*) curdt, curthresh, coef(:) if ( curdt .eq. dt ) then exit end if end do close(10) !--- Done reading coefficients ----------------------------------! !--- Compute approximated EMX del-P and report ------------------! delp = coef(1) + coef(2)*dshp_delv + coef(3)*lgem_delv + & coef(4)*hwfi_delv + coef(5)*avni_delv write(*,'(f5.1)') delp !--- Done computing RI percentage -------------------------------! end program