Page 1 Source Listing STATS 2013-01-11 18:32 stats.f90 1 SUBROUTINE STATS(FLD,NPTS,FMIN,FMAX,FAVG,FMAD,FSDV,RMISS,NMISS) 2 3 !$$$ subprogram documentation block 4 ! 5 ! SUBPROGRAM: STATS COMPUTE STATS FOR PASSED ARRAY 6 ! PRGMMR: TREADON ORG: NP20 DATE: 1995-08-06 7 ! 8 ! Abstract: Compute mean and standard deviation of data in passed array. Also 9 ! identify min and max data values in passed array. 10 ! 11 ! Program history log: 12 ! 1995-08-06 Treadon 13 ! 14 ! Input argument list: 15 ! fld - data array 16 ! npts - number of points in data array 17 ! 18 ! Output argument list: 19 ! fmin - minimum value in data array 20 ! fmax - maximum valud in data array 21 ! favg - average of values in data array 22 ! fsdv - standard deviation of values in array 23 ! fmad - mean absolute deviation of values in array 24 ! 25 ! Attributes: 26 ! Language: FORTRAN 90 (free format) 27 ! Machine: NCEP WCOSS 28 ! 29 !$$$ 30 ! 31 ! 32 ! Declare parameters 33 parameter (eps=1) 34 ! 35 ! Declare variables 36 real fld(npts),work(npts) 37 real fmin,fmax,favg,fmad,fsdv,rmiss 38 real sum,sums,suma 39 ! 40 !************************************************************ 41 ! Start stats here. 42 ! 43 ! 44 ! Initialize output variables. 45 fmin = +9.99e33 46 fmax = -9.99e33 47 favg = -9.99e33 48 fsdv = -9.99e33 49 fmad = -9.99e33 50 if (npts.lt.1) then 51 write(6,*)' STATS: ERROR npts<1. npts=',npts 52 return 53 endif 54 ! 55 ! Load array into work array. Remove missing data points 56 ! as we load work array. 57 kk = 0 Page 2 Source Listing STATS 2013-01-11 18:32 stats.f90 58 ll = 0 59 do k = 1,npts 60 if (abs(fld(k)-rmiss).gt.eps) then 61 kk = kk + 1 62 work(kk) = fld(k) 63 else 64 ll = ll + 1 65 endif 66 end do 67 ngood = kk 68 nmiss = ll 69 ! 70 ! 71 ! Identify min and max values. Compute mean. 72 sum = 0.0 73 do k = 1,ngood 74 fmin = min(fmin,work(k)) 75 fmax = max(fmax,work(k)) 76 sum = sum + work(k) 77 end do 78 if (ngood.gt.0) favg = sum/ngood 79 ! 80 ! 81 ! If min and max are equal, no further computations 82 ! are needed. Set favg=fmin(=fmax), fsdv=0=fmad. 83 if (abs(fmax-fmin).lt.eps) then 84 favg = fmin 85 fsdv = 0.0 86 fmad = 0.0 87 return 88 endif 89 ! 90 ! 91 ! Compute standard and mean absolute deviation. 92 sums = 0.0 93 suma = 0.0 94 do k = 1,ngood 95 sums = sums + (work(k)-favg)*(work(k)-favg) 96 suma = suma + abs(work(k)-favg) 97 end do 98 if ((ngood-1).gt.0) fsdv = sqrt(sums/(ngood-1)) 99 if (ngood.gt.0) fmad = suma/ngood 100 ! 101 ! 102 ! End of routine 103 return 104 end Page 3 Source Listing STATS 2013-01-11 18:32 Entry Points stats.f90 ENTRY POINTS Name stats_ SYMBOL CROSS REFERENCE Name Object Declared Type Bytes Dimen Elements Attributes References ABS Func 60 scalar 60,83,96 EPS Param 33 R(4) 4 scalar 60,83 FAVG Dummy 1 R(4) 4 scalar ARG,INOUT 47,78,84,95,96 FLD Dummy 1 R(4) 4 1 0 ARG,INOUT 60,62 FMAD Dummy 1 R(4) 4 scalar ARG,INOUT 49,86,99 FMAX Dummy 1 R(4) 4 scalar ARG,INOUT 46,75,83 FMIN Dummy 1 R(4) 4 scalar ARG,INOUT 45,74,83,84 FSDV Dummy 1 R(4) 4 scalar ARG,INOUT 48,85,98 K Local 59 I(4) 4 scalar 59,60,62,73,74,75,76,94,95,96 KK Local 57 I(4) 4 scalar 57,61,62,67 LL Local 58 I(4) 4 scalar 58,64,68 MAX Func 75 scalar 75 MIN Func 74 scalar 74 NGOOD Local 67 I(4) 4 scalar 67,73,78,94,98,99 NMISS Dummy 1 I(4) 4 scalar ARG,INOUT 68 NPTS Dummy 1 I(4) 4 scalar ARG,INOUT 36,50,51,59 RMISS Dummy 1 R(4) 4 scalar ARG,INOUT 60 SQRT Func 98 scalar 98 STATS Subr 1 SUM Local 38 R(4) 4 scalar 72,76,78 SUMA Local 38 R(4) 4 scalar 93,96,99 SUMS Local 38 R(4) 4 scalar 92,95,98 WORK Local 36 R(4) 4 1 0 62,74,75,76,95,96 Page 4 Source Listing STATS 2013-01-11 18:32 Subprograms/Common Blocks stats.f90 SUBPROGRAMS/COMMON BLOCKS Name Object Declared Type Bytes Dimen Elements Attributes References STATS Subr 1 COMPILER OPTIONS BEING USED -align nocommons -align nodcommons -align noqcommons -align records -align nosequence -align norec1byte -align norec2byte -align norec4byte -align norec8byte -align norec16byte -altparam -assume accuracy_sensitive -assume nobscc -assume nobuffered_io -assume nobyterecl -assume nocc_omp -assume nocstring -assume nodummy_aliases -assume nofpe_summary -assume noieee_fpe_flags -assume nominus0 -assume noold_boz -assume old_unit_star -assume noold_ldout_format -assume noold_logical_ldio -assume old_maxminloc -assume old_xor -assume protect_constants -assume noprotect_parens -assume split_common -assume source_include -assume nostd_intent_in -assume nostd_mod_proc_name -assume norealloc_lhs -assume underscore -assume no2underscores no -auto -auto_scalar no -bintext -ccdefault default -check noargs -check noarg_temp_created -check nobounds -check noformat -check nooutput_conversion -check nooverflow -check nopointers -check power -check noshape -check nounderflow -check nouninitialized -coarray-num-procs 0 no -coarray-config-file -convert big_endian -cross_reference -D __INTEL_COMPILER=1210 -D __unix__ -D __unix -D __linux__ -D __linux -D __gnu_linux__ -D unix -D linux -D __ELF__ -D __x86_64 -D __x86_64__ -D _MT -D __INTEL_COMPILER_BUILD_DATE=20120612 -D __i686 -D __i686__ -D __pentiumpro -D __pentiumpro__ -D __pentium4 -D __pentium4__ -D __tune_pentium4__ -D __SSE2__ -D __SSE__ -D __MMX__ -double_size 64 no -d_lines no -Qdyncom -error_limit 30 no -f66 no -f77rtl no -fast -fpscomp nofilesfromcmd -fpscomp nogeneral -fpscomp noioformat -fpscomp noldio_spacing -fpscomp nologicals no -fpconstant -fpe3 -fprm nearest no -ftz Page 5 Source Listing STATS 2013-01-11 18:32 stats.f90 -fp_model noprecise -fp_model fast -fp_model nostrict -fp_model nosource -fp_model nodouble -fp_model noextended -fp_model novery_fast -fp_model noexcept -fp_model nono_except -heap_arrays 0 no -threadprivate_compat -free -g0 -iface nomixed_str_len_arg -iface nono_mixed_str_len_arg no -intconstant -integer_size 32 no -mixed_str_len_arg no -module -names lowercase no -noinclude -O2 no -pad_source -real_size 32 no -recursive -reentrancy none no -sharable_localsaves -vec=simd -show noinclude -show map -show options no -syntax_only no -threadcom no -U no -vms -w noall -w nonone -w alignments -w noargument_checking -w nodeclarations -w general -w noignore_bounds -w noignore_loc -w nointerfaces -w notruncated_source -w uncalled -w uninitialized -w nounused -w usage -includepath : /gpfs/tp2/usrx/local/intel/composer_xe_2011_sp1.11.339/compiler/include/,.f,./.f,/usrx/local/intel/composerxe/mkl/include/.f, /usrx/local/intel/composerxe/tbb/include/.f,/gpfs/tp2/usrx/local/intel/composer_xe_2011_sp1.11.339/compiler/include/intel64/.f, /gpfs/tp2/usrx/local/intel/composer_xe_2011_sp1.11.339/compiler/include/.f,/usr/local/include/.f,/usr/lib/gcc/x86_64-redhat-linux/4.4.6/include/.f, /usr/include/.f,/usr/include/.f -list filename : stats.lst -o filename : none COMPILER: Intel(R) Fortran 12.1-2100