Particle Cross Section Regression Line
Particle Cross Section Regression Line
How is the location of the red regression line shown in the particle cross section plot determined?

 Posts: 362
 Joined: November 7th, 2012, 1:39 pm
 Registered HYSPLIT User: Yes
 Contact:
Re: Particle Cross Section Regression Line
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 crosssection
IF(CNTR.GE.2.0)THEN
SLOPE(N)=(CNTR*SUMXYSUMX*SUMY)/(CNTR*SUMX2SUMX*SUMX)
YNODE(N)=SUMY/CNTRSLOPE(N)*SUMX/CNTR
ELSE
SLOPE(N)=1.0
YNODE(N)=0.0
END IF
END DO
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 crosssection
IF(CNTR.GE.2.0)THEN
SLOPE(N)=(CNTR*SUMXYSUMX*SUMY)/(CNTR*SUMX2SUMX*SUMX)
YNODE(N)=SUMY/CNTRSLOPE(N)*SUMX/CNTR
ELSE
SLOPE(N)=1.0
YNODE(N)=0.0
END IF
END DO