2 posts
• Page **1** of **1**

How is the location of the red regression line shown in the particle cross section plot determined?

- kdgeorge
**Posts:**3**Joined:**May 20th, 2013, 12:26 pm

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

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

- glenn.rolph
**Posts:**102**Joined:**November 7th, 2012, 1:39 pm

2 posts
• Page **1** of **1**

Users browsing this forum: No registered users and 1 guest