我想将此Fortran转换为C#。我不了解Fortran。
代码:
DIMENSION JDAY(15000),DATE(15000),TMAX(15000),TM`enter code here`IN(15000),
1 RH1(15000),RH2(15000),WS(15000),RF(15000),SS(15000),EVP(15000),
2 ED(15000),WSI(15000),AN(15000),
3 DD(15000),TC(15000),W(15000),F(15000),DD1(15000),DD2(15000),
4 DR(15000),RA(15000),RS(15000),RNS(15000),TO(15000),RNL(15000),
9 RN(15000),PET(15000),D(15000),DDD(15000),
5 AA(15000),BB(15000),BCM(15000),TOA(20000),SLO(20000),
5 EAA(20000),EAI(20000),EAV(20000),EDD(20000),VP(20000),
5 GE(20000),PEN(20000),DE(20000),ESA(20000),TMK(20000),
5TMN(20000),TA(20000),TX(20000),TN(20000),RS0(20000),
5 EO(20000),EM(20000),CO(20000),CZ(20000),TXS(20000),TNS(20000),
5ES(20000),EA(20000),SL(20000),SLTX(20000),SLTN(20000),DTR(20000),
5SQDTR(20000),AHRS(20000),RFCO(20000),RFC(20000),RFPET(20000),
5RFRO(20000),DRO(20000),SS0(20000),AR(20000),FR(20000),SD(20000),
5TBASE(20000),ID(25000),IM(25000),IY(25000),IDS(300)
5,IMS(9000),IYYY(9000),CF(25000),FF(25000),GF(25000),
1IDSS(9000),IMSS(9000),IYSS(9000),
1VAR(9000),DS(9000),SSD(9000),SSM1(9000),SSD1(900),SSY1(900),
1SSD2(900),SSY2(900),SSM3(900),SSD3(900),SSY3(900),SSM4(900),
1SSD4(900),SSY4(900),SSM5(900),SSD5(900),SSY5(900),SSM6(900),
1SSD6(900),SSY6(900),SSM2(900),SSM7(900),SSD7(900),SSY7(900),
1SSM8(900),SSD8(900),SSY8(900),SSM9(900),SSD9(900),SSY9(900),
1SSM10(900),SSD10(900),SSY10(900),SSM11(900),SSD11(900),
1SSY11(900),GDD6(900),GDD7(900),GDD8(900),GDD9(900),
1GDD1(900),GDD2(900),GDD3(900),GDD4(900),GDD5(900),GDD10(900)
1,AVGDD1(900),AVGDD2(900),AVGDD3(900),AVGDD4(900),AVGDD5(900)
1,AVGDD6(900),AVGDD7(900),AVGDD8(900),AVGDD9(900),AVGDD10(900)
1,AKC(15000),AMF(15000),ALF(15000),AHF(15000),AJF(15000),AET(15000)
1,ANF(15000),DSS(900),SSDS(900),AVGDD1S(900),AVGDD2S(900),
1AVGDD3S(900),AVGDD4S(900),AVGDD5S(900),JDAYO(10000),TFBS(10000)
1,IMT(10000),IDT(10000),IYT(10000),TXX(10000),TNN(10000),RFL(10000)
1,AVGDD6S(900),AVGDD7S(900),CRWT(25000),
1AVGDD8S(900),AVGDD9S(900),AVGDD10S(900),CR1(900),CR2(900),CR3(900)
1,CR4(900),CR5(900),CR6(900),CR7(900),CR8(900),CR9(900),CR10(900),
1AVCR1(900),AVCR2(900),AVCR3(900),AVCR4(900),AVCR5(900),AVCR6(900),
1AVCR7(900),AVCR8(900),AVCR9(900),AVCR10(900),AVCR6S(900),
1AVCR1S(900),AVCR2S(900),AVCR3S(900),AVCR4S(900),AVCR5S(900),
1AVCR7S(900),AVCR8S(900),AVCR9S(900),AVCR10S(900)
CHARACTER DATE*15,FILE1*60,FILE2*15,IDOS*20,VAR*20,DS*5,AAV*15,
1DSS*5
INTEGER SSM1,SSD1,SSY1,SSM2,SSD2,SSY2,SSM3,SSD3,SSY3,SSM4,SSD4,
1SSY4,SSM5,SSD5,SSY5,SSM6,SSD6,SSY6,ST1,ST2,ST3,ST4,ESO1,ESO2,MSO1,
1MSO2,LSO1,LSO2,SSM7,SSD7,SSY7,SSM8,SSD8,SSY8,SSM9,SSD9,SSY9,SSM10,
1SSD10,SSY10,SSM11,SSD11,SSY11
WRITE(*,*)'***************************************************
1************************'
WRITE(*,*)'*
1 *'
WRITE(*,*)'*
1 *'
WRITE(*,*)'* - DYNAMIC CROP WEATHER CALENDAR v1.
10 - *'
WRITE(*,*)'* AICRPAM
1 *'
WRITE(*,*)'* CRIDA, HYDERABAD
1 *'
WRITE(*,*)'*
1 *'
WRITE(*,*)'*
1 *'
WRITE(*,*)'**************************************************
1************************'
OPEN(29,FILE="INPUT.CSV")
READ(29,*)
READ(29,*)FILE1
READ(29,*)
READ(29,*)FILE2
OPEN(10,FILE=FILE1)
OPEN(30,FILE=FILE2)
OPEN(20,FILE="R_H_WB FOR SOWING.CSV")
OPEN(32,FILE="ACCUMULATED GDD.CSV")
C OPEN(91,FILE="CROP WATER REQUIREMENT.CSV")
OPEN(33,FILE="CROP WATER REQUIREMENT.CSV")
OPEN(23,FILE="PREDICTED DATE OF SOWING.CSV")
OPEN(92,FILE="PREDICTED PHENOLOGY.CSV")
OPEN(15,FILE="DOS.CSV")
WRITE(92,*)"STAGE,DATE"
C WRITE(91,*)'DATE,JULIAN DAY,RF(MM),PET(MM),RFCO,NO OF DAYS SINCE
C 1LAST RF,Kc,AET(MM),SOIL MOISTURE,RUNOFF,DRAINAGE,IRRIGATION'
WRITE(20,*)'DATE,JULIAN DAY,RF(MM),PET(MM),RFCO,NO OF DAYS SINCE
1LAST RF,AET(MM),RUNOFF,DRAINAGE,SOIL MOISTURE,SOWING DATE'
WRITE(32,*)'DURATION,SOWING,STAGE-1,STAGE-2,STAGE-3,
1STAGE-4,STAGE-5,STAGE-6,STAGE-7,STAGE-8,STAGE-9,STAGE-10'
WRITE(33,*)'DURATION,SOWING,STAGE-1,STAGE-2,STAGE-3,
1STAGE-4,STAGE-5,STAGE-6,STAGE-7,STAGE-8,STAGE-9,STAGE-10'
READ(29,*)
READ(29,*)ALA,ALON,ELEV
ALAT=ALA*(3.14/180)
READ(29,*)
READ(29,*)
READ(29,*)
READ(29,*)
READ(29,*)IIDW,IIMW,IIYW
READ(29,*)
READ(29,*)AWHC,FRAC
READ(29,*)
READ(29,*)JDAYMIN,JDAYMAX
READ(29,*)
READ(29,*)THRESHOLD
READ(29,*)
READ(29,*)FCAP,PWP
READ(29,*)
READ(29,*)RTR
READ(29,*)
READ(29,*)TBSE
READ(29,*)
READ(29,*)
READ(29,*)ST1,ST2,ST3,ST4
READ(29,*)
READ(29,*)
READ(29,*)CKC1,CKC2,CKC3
READ(29,*)
READ(29,*)
READ(29,*)ESO1,ESO2
READ(29,*)
READ(29,*)MSO1,MSO2
READ(29,*)
READ(29,*)LSO1,LSO2
READ(29,*)
READ(29,*)JSTART
AKC1=CKC1
AKC3=CKC2
AKC5=CKC3
CROPWAT=0
READ(30,*)
READ(30,*)
JDAYO(1)=1
MI=1
39 READ(30,*,END=38,ERR=38)IMT(MI),IDT(MI),IYT(MI),TXX(MI),TNN(MI),
1RFL(MI)
IF(IDT(MI).EQ.1.AND.IMT(MI).EQ.1)THEN
JDAYO(MI)=1
ELSE
JDAYO(MI)=JDAYO(MI-1)+1
TFBS(MI)=((TXX(MI)+TNN(MI))/2)-TBSE
ENDIF
C 47 FORMAT(I2,1X,I2,1X,I4)
C WRITE(83,*)IMT(MI),IDT(MI),IYT(MI),TXX(MI),TNN(MI),RFL(MI)
MI=MI+1
GOTO 39
38 CLOSE(39)
READ(15,*)
READ(15,*)
IN=1
52 READ(15,*,END=51,ERR=51)VAR(IN),DS(IN),SSD(IN),SSM1(IN),
1SSD1(IN),SSY1(IN),SSM2(IN),
1SSD2(IN),SSY2(IN),SSM3(IN),SSD3(IN),SSY3(IN),SSM4(IN),
1SSD4(IN),SSY4(IN),SSM5(IN),SSD5(IN),SSY5(IN),SSM6(IN),SSD6(IN),
1SSY6(IN),SSM7(IN),SSD7(IN),SSY7(IN),SSM8(IN),SSD8(IN),SSY8(IN),
1SSM9(IN),SSD9(IN),SSY9(IN),SSM10(IN),SSD10(IN),SSY10(IN),SSM11(IN)
1,SSD11(IN),SSY11(IN)
IN=IN+1
GOTO 52
51 CLOSE(52)
READ(10,*)
I=1
N=0
45 READ(10,*,END=35)IM(I),ID(I),IY(I),TMAX(I),TMIN(I),
5 RH1(I),RH2(I),WS(I),SS(I),RF(I),AR(I)
C 14 FORMAT(I2,1X,I2,1X,I4,1X,F6.0,1X,F6.2,1X,F6.2,1X,F6.2,1X,F6.2,
C 51X,F6.2,1X,F6.2,1X,F6.2)
C WRITE(84,*)IM(I),ID(I),IY(I),TMAX(I),TMIN(I),
C 5 RH1(I),RH2(I),WS(I),SS(I),RF(I),AR(I)
I=I+1
N=N+1
GOTO 45
35 CLOSE(45)
C WRITE(*,*)'THE ET IS WRITTEN IN THE FILE OUT.CSV'
C FF(0)=0
DO IL=1,IN-1
DO I=1,N-1
IF(SSM1(IL).EQ.IM(I).AND.SSD1(IL).EQ.ID(I).AND.SSY1(IL).EQ.
1IY(I))THEN
IST=I
DO IS=IST,IST+ST1
AKC(IS)=CKC1
ENDDO
L1=1
DO IS=IST+ST1+1,IST+ST1+ST2
AKC(IS)=CKC1+(((CKC2-CKC1)/ST2)*L1)
L1=L1+1
ENDDO DO IS=IST+ST1+ST2+1,IST+ST1+ST2+ST3
AKC(IS)=CKC2
ENDDO L2=1
DO IS=IST+ST1+ST2+ST3+1,IST+ST1+ST2+ST3+ST4
AKC(IS)=CKC2-(((CKC2-CKC3)/ST4)*L2)
L2=L2+1
ENDDO ENDIF ENDDO
C DO I=1,N
C WRITE(73,*)ID(I),IM(I),IY(I),AKC(I)
C ENDDO ENDDO
JDAY(1)=1
DO I=1,N
IF(ID(I).EQ.1.AND.IM(I).EQ.1)THEN
JDAY(I)=1
ELSE
JDAY(I)=JDAY(I-1)+1
ENDIF
DR(I)=1+(0.033*(COS(6.28*(JDAY(I))/365)))
D(I)=0.4093*SIN(6.28*JDAY(I)/365-1.39)
WSI(I)=ACOS((-TAN(ALAT))*TAN(D(I)))
WS(I)=((WS(I)*5)/18)*((4.87)/LOG((67.8*3.048006)-5.42))
RA(I)=((24*60)/3.14)*(0.082*DR(I))*((WSI(I)*SIN(ALAT)
7 *SIN(D(I))+(COS(ALAT)*COS(D(I))*SIN(WSI(I)))))
C AVERAGE TEMPERATURE IN A DAY IN KELVIN
TBASE(I)=((TMAX(I)+TMIN(I))/2)-TBSE
TO(I)=((TMAX(I)+TMIN(I))/2)+273
C AVERAGE TEMPERATURE IN A DAY IN KELVIN
TOA(I)=(TMAX(I)+TMIN(I))/2
TXS(I)=0.6108*EXP((TMAX(I)*17.27)/(TMAX(I)+237.3))
TNS(I)=0.6108*EXP((TMIN(I)*17.27)/(TMIN(I)+237.3))
ES(I)=(TXS(I)+TNS(I))/2
EA(I)=ES(I)*(((RH1(I)+RH2(I))/2)/100)
SLTX(I)=4098*(0.6108*EXP((17.27*TMAX(I))/(TMAX(I)+237.3)))/(
1((TMAX(I)+237.3)*(TMAX(I)+237.3)))
SLTN(I)=4098*(0.6108*EXP((17.27*TMIN(I))/(TMIN(I)+237.3)))/(
1((TMIN(I)+237.3)*(TMIN(I)+237.3)))
SL(I)=4098*(0.6108*EXP((17.27*TOA(I))/(TOA(I)+237.3)))/(
1((TOA(I)+237.3)*(TOA(I)+237.3)))
DTR(I)=TMAX(I)-TMIN(I)
SQDTR(I)=SQRT(DTR(I))
AHRS(I)=SQDTR(I)*RA(I)*0.16
AN(I)=(24/3.14)*ACOS((-TAN(ALAT))*TAN(D(I)))
RS(I)=(0.32+((SS(I)*0.46)/AN(I)))*RA(I)
RNS(I)=(1-0.23)*RS(I)
RS0(I)=(0.75+((2*ELEV)/100000))*RA(I)
EO(I)=0.34-(0.14*SQRT(EA(I)))
EM(I)=(1.35*(RS(I)/RS0(I)))-0.35
TX(I)=TMAX(I)+273.16
TN(I)=TMIN(I)+273.16
TMK(I)=((TX(I)*TX(I)*TX(I)*TX(I)))
TMN(I)=((TN(I)*TN(I)*TN(I)*TN(I)))
TA(I)=(TMK(I)+TMN(I))/2
GE(I)=0.38*(TOA(I)-TOA(I-1))
RNL(I)=(((TMK(I)+TMN(I))/2)*EO(I)*EM(I)*4.903)/1000000000
RN(I)=(RNS(I)-RNL(I))
CO(I)=(0.408*RN(I)*SL(I))+(0.060217*WS(I)*(ES(I)-EA(I))*900/(273+
1 TOA(I)))
CZ(I)=SL(I)+0.060217*(1+0.34*WS(I))
PET(I)=((0.408*SL(I)*RN(I))+(0.065584*(900/(TOA(I)+273)))*(WS
1(I)*(ES(I)-EA(I))))/(SL(I)+(0.065584*(1+0.34*WS(I))))
C POTENTIAL EVAPOTRANSPIRATION
PEN(I)=CO(I)/CZ(I)
C SOLAR INCLINATION
C WRITE(20,*)JDAY(I),',',DATE(I),',',PEN(I),',',PET(I)
ENDDO
RFC(1)=1
R0=0
DO I=1,N
IF(RF(I).GT.0.0)THEN
RFCO(I)=0
ELSE
RFCO(I)=1
ENDIF
IF(RFCO(I).EQ.1)THEN
RFC(I)=RFC(I-1)+RFCO(I)
ELSE
RFC(I)=0 ENDIF
IF(RFCO(I).EQ.0)THEN
RFPET(I)=PET(I)
ELSE
RFPET(I)=PET(I)*SQRT((1/RFC(I)))
ENDIF
IF(RF(I).GE.RTR)THEN
RFRO(I)=RF(I)-RTR ELSE
RFRO(I)=0 ENDIF
IF(SS0(I-1).GT.AWHC)THEN
DRO(I)=SS0(I-1)-AWHC ELSE
DRO(I)=0 ENDIF
IF((SS0(I-1)+RF(I)+AR(I)-RFPET(I)-RFRO(I)-DRO(I)).LT.PWP)THEN
SS0(I)=PWP ELSE
SS0(I)=SS0(I-1)+RF(I)+AR(I)-RFPET(I)-RFRO(I)-DRO(I) ENDIF
IF(SS0(I).GT.FCAP)THEN
SS0(I)=FCAP ELSE
SS0(I)=SS0(I)
ENDIF
IF(((SS0(I-1))/AWHC).GT.FRAC)THEN
FR(I)=1 ELSE
FR(I)=(SS0(I-1)/(AWHC*FRAC)) ENDIF
IF(JDAY(I).GE.JDAYMIN.AND.JDAY(I).LE.JDAYMAX.AND.SS0(I).GE.
1(AWHC*THRESHOLD))THEN
SD(I)=1 ELSE
SD(I)=0 ENDIF
C WRITE(83,*)JDAYMIN,JDAYMAX,AWHC*THRESHOLD,AWHC,THRESHOLD
CRWT(I)=AKC(I)*RFPET(I)
WRITE(20,29)IM(I),ID(I),IY(I),JDAY(I),RF(I),PET(I),RFCO(I),RFC(I)
1,RFPET(I),RFRO(I),DRO(I),SS0(I),SD(I)
29 FORMAT (I2,'/',I2,'/',I4,',',I3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',F7.2,',',F7.2,',',F7.2,',',F7.2,',',F7.2,',',F7.2)
IG=IG+1 ENDIF ENDDO
C DO IG=1,IN-1
C ENDDO
DO I=1,N-1
IF(AKC(I).GT.0)THEN
AKC(I)=AKC(I) ELSE
AKC(I)=0 ENDIF
C WRITE(81,*)AKC(I),ID(I),IM(I),IY(I)
IF(RF(I).GT.0)THEN
CF(I)=0
ELSE
CF(I)=1 ENDIF
IF(CF(I).EQ.1)THEN
FF(I)=FF(I-1)+CF(I) ELSE
FF(I)=0 ENDIF
IF(CF(I).EQ.0)THEN
GF(I)=PET(I) ELSE
GF(I)=PET(I)*SQRT(1/FF(I)) IF IF(RF(I).GE.RTR)THEN
AMF(I)=RF(I)-RTR ELSE
AMF(I)=0 ENDIF
IF(ALF(I-1).GE.AWHC)THEN
ANF(I)=ALF(I-1)-AWHC ELSE
ANF(I)=0 ENDIF
IF(JDAY(I).LE.JSTART)THEN
ALF(I)=0
ELSEIF((ALF(I-1)+RF(I)+AR(I)-AET(I)-AMF(I)-ANF(I)).LT.PWP)THEN
ALF(I)=PWP ELSE
ALF(I)=ALF(I-1)+RF(I)+AR(I)-AET(I)-AMF(I)-ANF(I) ENDIF
IF(ALF(I).GT.FCAP)THEN
ALF(I)=140 ELSE
ALF(I)=ALF(I) ENDIF
IF((ALF(I-1)/AWHC).GE.FRAC)THEN
AHF(I)=1 ELSE
AHF(I)=ALF(I-1)/(AWHC*FRAC) ENDIF
AJF(I)=AHF(I)*AKC(I)*(PET(I)-GF(I))
AET(I)=GF(I)+AJF(I)
C WRITE(91,49)IM(I),ID(I),IY(I),JDAY(I),RF(I),PET(I),CF(I),FF(I),
C 1AKC(I),AET(I),ALF(I),AMF(I),ANF(I),AR(I)
C 49 FORMAT (I2,'/',I2,'/',I4,',',I3,',',F6.2,',',F6.2,',',
C 1F6.2,',',F6.2,',',F6.2,',',F6.2,',',F6.2,',',F6.2,',',F6.2,',',
C 1F6.2) ENDDO
DO IO=1,MI-1
IF(IDT(IO).EQ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