subroutine n_dML_c( n_eq , n_SNCL , n_ML , n_dML , n_dML_se , 1 n_do, c_ns , c_ML , ans ) c c ...... calculate dML for a new CISN SNCL c c Input: c n_eq = number of earthquakes recorded by new SNCL within the c appropriate WA amplitude range c n_SNCL = new SNCL identifier c n_ML = new SNCL ML estimate for each earthquake c c_ns = number of CISN SNCLs with known dML which recorded c each earthquake within the appropriate WA amplitude c range c c_ML = CISN ML estimate for each at each of the CISN SNCLs c ( c_ML(i,j), i = n_eq index and j = c_ns index ) c c Returns: c n_dML = new SNCL dML adjustment c n_dML_se = uncertainty estimate for new SNCL dML c n_do = number of differential observations c ans = 0 if minimum data requirements are met c = 1 otherwise c c NOTE: for robustness, it is highly recommended that n_eq c be at least 30 and n_do be at least 200. This c subroutine returns ans == 1 if these requirements c are not met. c implicit none integer*4 c_ns(100), n_eq, i, j, k, nk, lnb, lnblnk, n_do integer*4 ans real*8 c_ML(100,2000), n_ML(100), diff_ML(200000), dMLt real*8 n_dML, n_dML_se real*8 iq1, median, iq3, iqr character*15 n_SNCL c c ..... check that minimum data requirements are met c if( n_eq .lt. 30 ) ans = 1 k = 0 do i = 1 , n_eq do j = 1 , c_ns( i ) k = k + 1 end do end do n_do = k if( n_do .lt. 200 ) ans = 1 if( ans .eq. 1 ) then write( * , * ) 1 'WARNING: minimum data requirements are not met' write( * , '(a,i5)' ) ' n_eq = ',n_eq write( * , '(a,i5)' ) ' n_do = ',n_do return endif c k = 0 do i = 1 , n_eq do j = 1 , c_ns( i ) k = k + 1 diff_ML( k ) = n_ML( i ) - c_ML( i , j ) end do end do nk = k n_do = nk c c ...... rank diff_ML data c do i = 1 , nk - 1 do j = i + 1 , nk if( diff_ML( j ) .lt. diff_ML( i ) ) then dMLt = diff_ML( i ) diff_ML( i ) = diff_ML( j ) diff_ML( j ) = dMLt endif end do end do c c ...... find median and inter-quartile range c k = nk - 2 * ( nk / 2 ) if( k .ne. 0 ) then median = diff_ML( ( nk / 2 ) + 1 ) else median = ( diff_ML( nk / 2 ) + 1 diff_ML( ( nk / 2 ) + 1 ) ) / 2.d0 endif c c ...... new dML is minus the median differential value c n_dML = -median c iq1 = diff_ML( nk / 4 ) iq3 = diff_ML( ( 3 * nk ) / 4 ) iqr = iq3 - iq1 n_dML_se = iqr / dsqrt( dble( nk - 1 ) ) c c ...... output results c lnb = lnblnk( n_SNCL ) write( * , '(a,2f8.3,i8)' ) n_SNCL( 1 : lnb ), 1 n_dML, n_dML_se, n_do c return end