我正在使用Fortran代码来简化从许多输出文件中提取所需数据的过程。首先,我构建了一个代码来与名为“ output.sub”的特定文件一起使用,并且可以很好地提取所需的各种变量。现在,我尝试将代码与另一个文件“ output.rch”一起使用,该文件的结构与上一个类似。更改了需要更改以解决新输出文件的内容,但是现在我收到文件结束错误。我正在Visual Studios Professional 2017上使用固定格式的Fortran文件。
这是旧代码:
PROGRAM WATER_BALANCE
IMPLICIT NONE
INTEGER I,J,K
INTEGER FLAGP(516),FLAGS(516),FLAGPET(516),FLAGET(516),
$ FLAGSW(516),FLAGPER(516),FLAGSUR(516),FLAGGW(516),FLAGWYLD(516)
REAL A,B,C,D,E,F,G,H,L
REAL PRECIP(516),SNOMELT(516),PET(516),ET(516),SW(516),PERC(516),
$SURQ(516),GW_Q(516),WYLD(516)
REAL PETB(14,516) !1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012
DO I=1,516
PRECIP(I)=0.0
SNOMELT(I)=0.0
PET(I)=0.0
ET(I)=0.0
SW(I)=0.0
PERC(I)=0.0
SURQ(I)=0.0
GW_Q(I)=0.0
WYLD(I)=0.0
END DO
OPEN(1,FILE='output.sub',STATUS='OLD')
DO I=1,9
READ(1,*)
END DO
DO I=1,365 !1999Äê
DO J=1,516
READ(1,"(41X,9E10.3)") A,B,C,D,E,F,G,H,L
PRECIP(J)=PRECIP(J)+A
SNOMELT(J)=SNOMELT(J)+B
PET(J)=PET(J)+C
ET(J)=ET(J)+D
SW(J)=SW(J)+E
PERC(J)=PERC(J)+F
SURQ(J)=SURQ(J)+G
GW_Q(J)=GW_Q(J)+H
WYLD(J)=WYLD(J)+L
END DO
END DO
DO K=1,516
PETB(1,K)=PET(K)/365
PET(K)=0.0
END DO
DO I=366,731 !2000
DO J=1,516
READ(1,"(41X,9E10.3)") A,B,C,D,E,F,G,H,L
PRECIP(J)=PRECIP(J)+A
SNOMELT(J)=SNOMELT(J)+B
PET(J)=PET(J)+C
ET(J)=ET(J)+D
SW(J)=SW(J)+E
PERC(J)=PERC(J)+F
SURQ(J)=SURQ(J)+G
GW_Q(J)=GW_Q(J)+H
WYLD(J)=WYLD(J)+L
END DO
END DO
DO K=1,516
PETB(2,K)=PET(K)/366
PET(K)=0.0
END DO
DO I=732,1096 !2001
DO J=1,516
READ(1,"(41X,9E10.3)") A,B,C,D,E,F,G,H,L
PRECIP(J)=PRECIP(J)+A
SNOMELT(J)=SNOMELT(J)+B
PET(J)=PET(J)+C
ET(J)=ET(J)+D
SW(J)=SW(J)+E
PERC(J)=PERC(J)+F
SURQ(J)=SURQ(J)+G
GW_Q(J)=GW_Q(J)+H
WYLD(J)=WYLD(J)+L
END DO
END DO
DO K=1,516
PETB(3,K)=PET(K)/366
PET(K)=0.0
END DO
DO I=1097,1461 !2002
DO J=1,516
READ(1,"(41X,9E10.3)") A,B,C,D,E,F,G,H,L
PRECIP(J)=PRECIP(J)+A
SNOMELT(J)=SNOMELT(J)+B
PET(J)=PET(J)+C
ET(J)=ET(J)+D
SW(J)=SW(J)+E
PERC(J)=PERC(J)+F
SURQ(J)=SURQ(J)+G
GW_Q(J)=GW_Q(J)+H
WYLD(J)=WYLD(J)+L
END DO
END DO
DO K=1,516
PETB(4,K)=PET(K)/366
PET(K)=0.0
END DO
DO I=1462,1826 !2003
DO J=1,516
READ(1,"(41X,9E10.3)") A,B,C,D,E,F,G,H,L
PRECIP(J)=PRECIP(J)+A
SNOMELT(J)=SNOMELT(J)+B
PET(J)=PET(J)+C
ET(J)=ET(J)+D
SW(J)=SW(J)+E
PERC(J)=PERC(J)+F
SURQ(J)=SURQ(J)+G
GW_Q(J)=GW_Q(J)+H
WYLD(J)=WYLD(J)+L
END DO
END DO
DO K=1,516
PETB(5,K)=PET(K)/366
PET(K)=0.0
END DO
DO I=1827,2191 !2004
DO J=1,516
READ(1,"(41X,9E10.3)") A,B,C,D,E,F,G,H,L
PRECIP(J)=PRECIP(J)+A
SNOMELT(J)=SNOMELT(J)+B
PET(J)=PET(J)+C
ET(J)=ET(J)+D
SW(J)=SW(J)+E
PERC(J)=PERC(J)+F
SURQ(J)=SURQ(J)+G
GW_Q(J)=GW_Q(J)+H
WYLD(J)=WYLD(J)+L
END DO
END DO
DO K=1,516
PETB(6,K)=PET(K)/366
PET(K)=0.0
END DO
DO I=2192,2556 !2005
DO J=1,516
READ(1,"(41X,9E10.3)") A,B,C,D,E,F,G,H,L
PRECIP(J)=PRECIP(J)+A
SNOMELT(J)=SNOMELT(J)+B
PET(J)=PET(J)+C
ET(J)=ET(J)+D
SW(J)=SW(J)+E
PERC(J)=PERC(J)+F
SURQ(J)=SURQ(J)+G
GW_Q(J)=GW_Q(J)+H
WYLD(J)=WYLD(J)+L
END DO
END DO
DO K=1,516
PETB(7,K)=PET(K)/366
PET(K)=0.0
END DO
DO I=2557,2921 !2006
DO J=1,516
READ(1,"(41X,9E10.3)") A,B,C,D,E,F,G,H,L
PRECIP(J)=PRECIP(J)+A
SNOMELT(J)=SNOMELT(J)+B
PET(J)=PET(J)+C
ET(J)=ET(J)+D
SW(J)=SW(J)+E
PERC(J)=PERC(J)+F
SURQ(J)=SURQ(J)+G
GW_Q(J)=GW_Q(J)+H
WYLD(J)=WYLD(J)+L
END DO
END DO
DO K=1,516
PETB(8,K)=PET(K)/366
PET(K)=0.0
END DO
DO I=2922,3287 !2007
DO J=1,516
READ(1,"(41X,9E10.3)") A,B,C,D,E,F,G,H,L
PRECIP(J)=PRECIP(J)+A
SNOMELT(J)=SNOMELT(J)+B
PET(J)=PET(J)+C
ET(J)=ET(J)+D
SW(J)=SW(J)+E
PERC(J)=PERC(J)+F
SURQ(J)=SURQ(J)+G
GW_Q(J)=GW_Q(J)+H
WYLD(J)=WYLD(J)+L
END DO
END DO
DO K=1,516
PETB(9,K)=PET(K)/366
PET(K)=0.0
END DO
DO I=3288,3653 !2008
DO J=1,516
READ(1,"(41X,9E10.3)") A,B,C,D,E,F,G,H,L
PRECIP(J)=PRECIP(J)+A
SNOMELT(J)=SNOMELT(J)+B
PET(J)=PET(J)+C
ET(J)=ET(J)+D
SW(J)=SW(J)+E
PERC(J)=PERC(J)+F
SURQ(J)=SURQ(J)+G
GW_Q(J)=GW_Q(J)+H
WYLD(J)=WYLD(J)+L
END DO
END DO
DO K=1,516
PETB(10,K)=PET(K)/366
PET(K)=0.0
END DO
DO I=3654,4018 !2009
DO J=1,516
READ(1,"(41X,9E10.3)") A,B,C,D,E,F,G,H,L
PRECIP(J)=PRECIP(J)+A
SNOMELT(J)=SNOMELT(J)+B
PET(J)=PET(J)+C
ET(J)=ET(J)+D
SW(J)=SW(J)+E
PERC(J)=PERC(J)+F
SURQ(J)=SURQ(J)+G
GW_Q(J)=GW_Q(J)+H
WYLD(J)=WYLD(J)+L
END DO
END DO
DO K=1,516
PETB(11,K)=PET(K)/366
PET(K)=0.0
END DO
DO I=4019,4383 !2010
DO J=1,516
READ(1,"(41X,9E10.3)") A,B,C,D,E,F,G,H,L
PRECIP(J)=PRECIP(J)+A
SNOMELT(J)=SNOMELT(J)+B
PET(J)=PET(J)+C
ET(J)=ET(J)+D
SW(J)=SW(J)+E
PERC(J)=PERC(J)+F
SURQ(J)=SURQ(J)+G
GW_Q(J)=GW_Q(J)+H
WYLD(J)=WYLD(J)+L
END DO
END DO
DO K=1,516
PETB(12,K)=PET(K)/366
PET(K)=0.0
END DO
DO I=4384,4748 !2011
DO J=1,516
READ(1,"(41X,9E10.3)") A,B,C,D,E,F,G,H,L
PRECIP(J)=PRECIP(J)+A
SNOMELT(J)=SNOMELT(J)+B
PET(J)=PET(J)+C
ET(J)=ET(J)+D
SW(J)=SW(J)+E
PERC(J)=PERC(J)+F
SURQ(J)=SURQ(J)+G
GW_Q(J)=GW_Q(J)+H
WYLD(J)=WYLD(J)+L
END DO
END DO
DO K=1,516
PETB(13,K)=PET(K)/366
PET(K)=0.0
END DO
DO I=4749,5114 !2012
DO J=1,516
READ(1,"(41X,9E10.3)") A,B,C,D,E,F,G,H,L
PRECIP(J)=PRECIP(J)+A
SNOMELT(J)=SNOMELT(J)+B
PET(J)=PET(J)+C
ET(J)=ET(J)+D
SW(J)=SW(J)+E
PERC(J)=PERC(J)+F
SURQ(J)=SURQ(J)+G
GW_Q(J)=GW_Q(J)+H
WYLD(J)=WYLD(J)+L
END DO
END DO
DO K=1,516
PETB(14,K)=PET(K)/366
PET(K)=0.0
END DO
OPEN(2,FILE='OUT',STATUS='UNKNOWN')
DO K=1,516
WRITE(2,"(14(E10.3,5X))") PETB(1,K),PETB(2,K),PETB(3,K),PETB(4,K),
$ PETB(5,K),PETB(6,K),PETB(7,K),PETB(8,K),PETB(9,K),
$ PETB(10,K),PETB(11,K),PETB(12,K),PETB(13,K),PETB(14,K)
END DO
CLOSE(1)
CLOSE(2)
END
已更新:这是与“ output.rch”文件一起使用的修改后的代码:
PROGRAM WATER_QUALITY
IMPLICIT NONE
INTEGER X,Y,Z
INTEGER FLAGFIN(516),FLAGFOUT(516),FLAGEVAP(516),FLAGTLOSS(516),
$ FLAGSIN(516),FLAGSOUT(516),FLAGSED(516),FLAGONIN(516),
$ FLAGONOUT(516), FLAGPIN(516),FLAGPOUT(516),FLAGNO3IN(516),
$ FLAGNO3OUT(516), FLAGNH4IN(516),FLAGNH4OUT(516),FLAGNO2IN(516),
$ FLAGNO2OUT(516)
REAL A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q
REAL FLOW_IN(516),FLOW_OUT(516),EVAP(516),TLOSS(516),SED_IN(516),
$SED_OUT(516),SEDCONC(516),ORGN_IN(516),ORGN_OUT(516),ORGP_IN(516),
$ORGP_OUT(516),NO3_IN(516),NO3_OUT(516),NH4_IN(516),NH4_OUT(516),
$NO2_IN(516),NO2_OUT(516)
REAL NO3_INB(15,516) !1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013
DO X=1,516
FLOW_IN(X)=0.0
FLOW_OUT(X)=0.0
EVAP(X)=0.0
TLOSS(X)=0.0
SED_IN(X)=0.0
SED_OUT(X)=0.0
SEDCONC(X)=0.0
ORGN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Y)=EVAP(Y)+C
TLOSS(Y)=TLOSS(Y)+D
SED_IN(Y)=SED_IN(Y)+E
SED_OUT(Y)=SED_OUT(Y)+F
SEDCONC(Y)=SEDCONC(Y)+G
ORGN_IN(Y)=ORGN_IN(Y)+H
ORGN_OUT(Y)=ORGN_OUT(Y)+I
ORGP_IN(Y)=ORGP_IN(Y)+J
ORGP_OUT(Y)=ORGP_OUT(Y)+K
NO3_IN(Y)=NO3_IN(Y)+L
NO3_OUT(Y)=NO3_OUT(Y)+M
NH4_IN(Y)=NH4_IN(Y)+N
NH4_OUT(Y)=NH4_OUT(Y)+O
NO2_IN(Y)=NO2_IN(Y)+P
NO2_OUT(Y)=NO2_OUT(Y)+Q
END DO
END DO
DO Z=1,516
NO3_INB(15,Z)=NO3_IN(Z)/366
NO3_IN(Z)=0.0
END DO
OPEN(11,FILE='OUT',STATUS='UNKNOWN')
DO Z=1,516
WRITE(11,"(15(E10.3,6X))") NO3_INB(1,Z),NO3_INB(2,Z),NO3_INB(3,Z),
$ NO3_INB(4,Z),NO3_INB(5,Z),NO3_INB(6,Z),NO3_INB(7,Z),
$ NO3_INB(8,Z),NO3_INB(9,Z),NO3_INB(10,Z),NO3_INB(11,Z),
$ NO3_INB(12,Z),NO3_INB(13,Z),NO3_INB(14,Z),NO3_INB(15,Z)
END DO
CLOSE(10)
CLOSE(11)
END
这是“ output.sub”(工作文件)外观的一部分:
1
SWAT Dec 23 2016 VER 2016/Rev 664 0/ 0/ 0 0: 0: 0
General Input/Output section (file.cio):
12/3/2018 12:00:00 AM ARCGIS-SWAT interface AV
SUB GIS MO DA YR AREAkm2 PRECIPmm SNOMELTmm PETmm ETmm SWmm PERCmm SURQmm GW_Qmm WYLDmm SYLDt/ha ORGNkg/ha ORGPkg/haNSURQkg/ha SOLPkg/ha SEDPkg/ha LAT Q(mm)LATNO3kg/hGWNO3kg/haCHOLAmic/LCBODU mg/L DOXQ mg/L TNO3kg/ha QTILEmm TVAPkg/ha
BIGSUB 1 0 1 1 1999 .11443E+03 0.200E+00 0.000E+00 0.000E+00 0.000E+00 0.201E+03 0.000E+00 0.506E-02 0.409E-01 0.844E-01 0.714E-05 0.281E-03 0.365E-04 0.246E-03 0.232E-05 0.424E-04 0.471E-02 0.368E-03 0.180E-05 .79489E-06 0.000E+00 0.123E-01 0.000E+00 0.000E+00 0.000E+00
BIGSUB 2 0 1 1 1999 .13345E+03 0.200E+00 0.000E+00 0.000E+00 0.000E+00 0.214E+03 0.000E+00 0.466E-02 0.418E-01 0.866E-01 0.543E-05 0.247E-03 0.322E-04 0.233E-03 0.226E-05 0.370E-04 0.588E-02 0.484E-03 0.208E-05 .55263E-06 0.000E+00 0.126E-01 0.000E+00 0.000E+00 0.000E+00
BIGSUB 3 0 1 1 1999 .64204E+02 0.000E+00 0.000E+00 0.341E+00 0.169E+00 0.440E+03 0.000E+00 0.627E-03 0.150E+00 0.275E+00 0.164E-07 0.159E-04 0.209E-05 0.178E-04 0.451E-06 0.233E-05 0.952E-03 0.793E-04 0.175E-04 .45972E-10 0.000E+00 0.401E-01 0.000E+00 0.000E+00 0.000E+00
BIGSUB 4 0 1 1 1999 .43200E+00 0.000E+00 0.000E+00 0.342E+00 0.163E+00 0.550E+03 0.000E+00 0.517E-06 0.197E+00 0.348E+00 0.237E-10 0.517E-09 0.517E-09 0.517E-09 0.517E-09 0.103E-08 0.000E+00 0.000E+00 0.872E-04 .16009E-21 0.000E+00 0.507E-01 0.000E+00 0.000E+00 0.000E+00
这是“ output.rch”文件的外观:
1
SWAT Dec 23 2016 VER 2016/Rev 664 0/ 0/ 0 0: 0: 0
General Input/Output section (file.cio):
12/3/2018 12:00:00 AM ARCGIS-SWAT interface AV
RCH GIS MO DA YR AREAkm2 FLOW_INcms FLOW_OUTcms EVAPcms TLOSScms SED_INtons SED_OUTtons SEDCONCmg/L ORGN_INkg ORGN_OUTkg ORGP_INkg ORGP_OUTkg NO3_INkg NO3_OUTkg NH4_INkg NH4_OUTkg NO2_INkg NO2_OUTkg MINP_INkg MINP_OUTkg CHLA_INkg CHLA_OUTkg CBOD_INkg CBOD_OUTkg DISOX_INkg DISOX_OUTkg SOLPST_INmgSOLPST_OUTmg SORPST_INmgSORPST_OUTmg REACTPSTmg VOLPSTmg SETTLPSTmgRESUSP_PSTmgDIFFUSEPSTmgREACBEDPSTmg BURYPSTmg BED_PSTmg BACTP_OUTctBACTLP_OUTct CMETAL#1kg CMETAL#2kg CMETAL#3kg TOT Nkg TOT Pkg NO3ConcMg/l WTMPdegc
REACH 1 0 1 1 1999 0.1144E+03 0.1118E+00 0.1139E+00 0.0000E+00 0.1118E+00 0.8167E-01 0.8167E-01 0.8301E+01 0.3215E+01 0.2903E+01 0.9024E+00 0.7628E+00 0.7042E+01 0.7173E+01 0.0000E+00 0.2906E+00 0.0000E+00 0.0000E+00 0.2660E-01 0.8129E-01 0.9096E-02 0.0000E+00 0.0000E+00 0.0000E+00 0.1408E+03 0.1425E+03 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.1037E+02 0.8441E+00 0.7291E+00 -0.2837E+01
REACH 2 0 1 1 1999 0.1335E+03 0.1338E+00 0.1366E+00 0.0000E+00 0.1338E+00 0.7249E-01 0.7249E-01 0.6140E+01 0.3292E+01 0.2978E+01 0.9225E+00 0.7812E+00 0.9594E+01 0.9795E+01 0.0000E+00 0.2949E+00 0.0000E+00 0.0000E+00 0.3013E-01 0.9229E-01 0.7375E-02 0.0000E+00 0.0000E+00 0.0000E+00 0.1686E+03 0.1710E+03 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.1307E+02 0.8735E+00 0.8297E+00 -0.2837E+01
REACH 3 0 1 1 1999 0.3121E+03 0.4549E+00 0.4618E+00 0.0000E+00 0.4549E+00 0.1543E+00 0.3399E+00 0.8519E+01 0.5983E+01 0.5373E+01 0.1572E+01 0.1322E+01 0.1770E+02 0.1797E+02 0.5855E+00 0.1071E+01 0.0000E+00 0.6687E-01 0.1765E+00 0.4064E+00 0.2952E-06 0.0000E+00 0.0000E+00 0.0000E+00 0.5710E+03 0.5779E+03 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.2448E+02 0.1729E+01 0.4505E+00 -0.2837E+01
REACH 4 0 1 1 1999 0.4225E+03 0.6049E+00 0.6164E+00 0.0000E+00 0.6049E+00 0.3417E+00 0.5355E+00 0.1005E+02 0.5860E+01 0.5890E+01 0.1472E+01 0.1470E+01 0.2393E+02 0.2439E+02 0.1134E+01 0.1205E+01 0.6687E-01 0.7998E-01 0.4412E+00 0.4751E+00 0.6916E-20 0.0000E+00 0.0000E+00 0.0000E+00 0.7570E+03 0.7712E+03 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.3156E+02 0.1945E+01 0.4579E+00 -0.2837E+01
更新:这是我得到的错误:
forrtl: severe (64): input conversion error, unit 10, file C:\Users\etern\OneDrive\Documents\Indiana University\PhD Research\PhD Dissertation Writing\WabashProject\VisualStudioProjects\OutPutRCH\OutPutRCH\output.rch
Image PC Routine Line Source
libifcoremdd.dll 54013BA5 Unknown Unknown Unknown
libifcoremdd.dll 54059BDA Unknown Unknown Unknown
OutPutRCH.exe 00BD1E6E _MAIN__ 51 RCH.for
OutPutRCH.exe 00BF00D3 Unknown Unknown Unknown
OutPutRCH.exe 00BF24DE Unknown Unknown Unknown
OutPutRCH.exe 00BF23C7 Unknown Unknown Unknown
OutPutRCH.exe 00BF226D Unknown Unknown Unknown
OutPutRCH.exe 00BF2548 Unknown Unknown Unknown
KERNEL32.DLL 766A8484 Unknown Unknown Unknown
ntdll.dll 77173AB8 Unknown Unknown Unknown
ntdll.dll 77173A88 Unknown Unknown Unknown
**更新时间:**第51行是这样:
READ(10,"(44X,17E10.3)")A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q
行的旧格式为:
READ(1,"(41X,9E10.3)") A,B,C,D,E,F,G,H,L
以下是对代码所做的更改:
1-更改了FLAG,以创建新的标题以匹配新的输出文件。
2-在第一个Do功能下更改了每个标志的初始值。
3-更改了打开功能以打开新的输出文件。
4-更改了用于标识变量的字母,因为新文件使用17个变量,而旧文件使用9个变量。
5-代表每年输出文件的Do函数已更改为与17个变量匹配。
6-更改了每年的“读取”功能以匹配新文件。旧文件中的数据从文本文件的第41列开始,新文件中的数据从45开始。而且,旧文件中的数据为9个字符宽,新文件中的数据为10个字符。
7-更改了写入功能,以创建6个字符宽的列(与旧文件中的5个字符相比)。
答案 0 :(得分:1)
使用Fortran Edit Descriptors
时出错。在原始代码SUB
中,read命令被假定为41X,E10.3
,因为分析所需的数据在41个空格后开始,并且field
的长度包括下一个field
值之前的空格。在这一行中,每个field
之间都有一个单个空间。
新代码RCH
被正确确定为从44X
开始,但仍被标记为从E10.4
开始读取数据,这是不正确的,因为field
的长度实际上是12;在下一个field
之前十个数字和两个空格。正确的代码在这里发布以供参考:
PROGRAM WATER_QUALITY
IMPLICIT NONE
INTEGER X,Y,Z
INTEGER FLAGFIN(516),FLAGFOUT(516),FLAGEVAP(516),FLAGTLOSS(516),
$ FLAGSIN(516),FLAGSOUT(516),FLAGSED(516),FLAGONIN(516),
$ FLAGONOUT(516), FLAGPIN(516),FLAGPOUT(516),FLAGNO3IN(516),
$ FLAGNO3OUT(516), FLAGNH4IN(516),FLAGNH4OUT(516),FLAGNO2IN(516),
$ FLAGNO2OUT(516)
REAL A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q
REAL FLOW_IN(516),FLOW_OUT(516),EVAP(516),TLOSS(516),SED_IN(516),
$SED_OUT(516),SEDCONC(516),ORGN_IN(516),ORGN_OUT(516),ORGP_IN(516),
$ORGP_OUT(516),NO3_IN(516),NO3_OUT(516),NH4_IN(516),NH4_OUT(516),
$NO2_IN(516),NO2_OUT(516)
REAL NO3_INB(14,516) !1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012
DO X=1,516
FLOW_IN(X)=0.0
FLOW_OUT(X)=0.0
EVAP(X)=0.0
TLOSS(X)=0.0
SED_IN(X)=0.0
SED_OUT(X)=0.0
SEDCONC(X)=0.0
ORGN_IN(X)=0.0
ORGN_OUT(X)=0.0
ORGP_IN(X)=0.0
ORGP_OUT(X)=0.0
NO3_IN(X)=0.0
NO3_OUT(X)=0.0
NH4_IN(X)=0.0
NH4_OUT(X)=0.0
NO2_IN(X)=0.0
NO2_OUT(X)=0.0
END DO
OPEN(10,FILE='output.rch',STATUS='OLD')
DO X=1,9
READ(10,*)
END DO
DO X=1,365 !1999
DO Y=1,516
READ(10,"(44X,17E12.3)") A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q
FLOW_IN(Y)=FLOW_IN(Y)+A
FLOW_OUT(Y)=FLOW_OUT(Y)+B
EVAP(Y)=EVAP(Y)+C
TLOSS(Y)=TLOSS(Y)+D
SED_IN(Y)=SED_IN(Y)+E
SED_OUT(Y)=SED_OUT(Y)+F
SEDCONC(Y)=SEDCONC(Y)+G
ORGN_IN(Y)=ORGN_IN(Y)+H
ORGN_OUT(Y)=ORGN_OUT(Y)+I
ORGP_IN(Y)=ORGP_IN(Y)+J
ORGP_OUT(Y)=ORGP_OUT(Y)+K
NO3_IN(Y)=NO3_IN(Y)+L
NO3_OUT(Y)=NO3_OUT(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