Page 1 of 1

Particle Cross Section Regression Line

Posted: July 11th, 2013, 11:15 am
by kdgeorge
How is the location of the red regression line shown in the particle cross section plot determined?

Re: Particle Cross Section Regression Line

Posted: October 23rd, 2013, 7:29 am
by glenn.rolph
The computation of the regression line through the particle positions is determined using the following fortran routine....


DO N=1,NUMTIM
! time period index record
READ(32)NUMPAR,NUMPOL,IYR,IMO,IDA,IHR
CNTR=0.0
SUMX=0.0
SUMY=0.0
SUMXY=0.0
SUMX2=0.0
SUMY2=0.0

DO J=1,NUMPAR
READ(32)(MASS(I),I=1,NUMPOL)
READ(32)TLAT,TLON,ZLVL,SIGH,SIGV,SIGX
READ(32)PAGE,HDWP,PTYP,PGRD,NSORT
IF(SUM(MASS).GT.0.0)THEN
CALL CLL2XY(PARMAP,TLAT,TLON,X1,Y1)

! regression sums
CNTR=CNTR+1.0
SUMX=SUMX+X1
SUMY=SUMY+Y1
SUMXY=SUMXY+X1*Y1
SUMX2=SUMX2+X1*X1
SUMY2=SUMY2+Y1*Y1
END IF
END DO

! regression line to determine cross-section
IF(CNTR.GE.2.0)THEN
SLOPE(N)=(CNTR*SUMXY-SUMX*SUMY)/(CNTR*SUMX2-SUMX*SUMX)
YNODE(N)=SUMY/CNTR-SLOPE(N)*SUMX/CNTR
ELSE
SLOPE(N)=1.0
YNODE(N)=0.0
END IF
END DO