Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instability in NWHEAT reading ecotype parameters #401

Closed
palderman opened this issue Mar 6, 2024 · 0 comments · Fixed by #402
Closed

Instability in NWHEAT reading ecotype parameters #401

palderman opened this issue Mar 6, 2024 · 0 comments · Fixed by #402

Comments

@palderman
Copy link
Contributor

The NWHEAT model reads ecotype parameters with formatted input with specific number of decimal places ("F5.2"):

READ(C255,3100,IOSTAT=ERRNUM) ECOTYP,ECONAM,TBASE,TOPT,
& ROPT,TTOP, P2O,VREQ,GDDE,DSGFT,RUE1,RUE2,KVAL1,KVAL2,
& SLAP2,TC1P1,TC1P2,DTNP1,PLGP1,PLGP2,P2AF,P3AF,P4AF,
& P5AF,P6AF,ADLAI,ADTIL,ADPHO,STEMN,MXNUP,MXNCR,WFNU,
& PNUPR,EXNO3,MNNO3,EXNH4,MNNH4,INGWT,INGNC,FREAR,
& MNNCR,GPPSS,GPPES,MXGWT,MNRTN,NOMOB,RTDP1,RTDP2,
& FOZ1,SFOZ1
3100 FORMAT (A6,1X,A16,1X,10(1X,F5.1),2(1X,F5.2),3(1X,F5.1),
& 1(1X,F5.3),1(1x,F5.0),11(1X,F5.2),1(1X,F5.3),
& 1(1X,F5.2),1(1X,F5.3),5(1X,F5.2),3(1X,F5.3),
& 2(1X,F5.2),1(1X,F5.1),1(1X,F5.2),1(1X,F5.3),
& 2(1X,F5.0),2(1X,F5.2))

This leads to unstable results when a parameter value is written in the ecotype file using a different number of decimal places (e.g. using 24 instead of 24.0). If the format is specified as "F6.1" and the parameter value is written as 24.0 it will be read as 24.0, but if the parameter value is written as 24 the parameter value will be interpreted as 2.4. I've detected the issue with both gfortran and Intel compilers so I don't think it is compiler-dependent.

The issue can be easily resolved by changing the format specification for all parameters to "F6.0". With that modification, the parameter values are consistently interpreted correctly (e.g. both 24 and 24.0 are interpreted as 24.0). I'll submit a corresponding pull request shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant