MODFLOW-USGS / mt3d-usgs

MT3D-USGS Repository
23 stars 12 forks source link

missing exponent in ascii sft output #52

Closed jtwhite79 closed 5 years ago

jtwhite79 commented 5 years ago

hey guys - I just ran into a situation where this number was reported for a sw concen: 0.5771964-104 (missing the e since the exponent is 3 digits and negative). I realize this is allowed in Fortran (barf!) but modern languages (haha) do not like this. Also, for single precision, this would be an underflow. Would it be ok to cast down really small numbers (< e-38) to zero prior to writing to the sft ascii output file? I can probably make this change and submit a pull request but was just checking if this was acceptable.

h2osteff commented 5 years ago

Perhaps changing the edit descriptor to include at least 3 digits on the exponent might be the easiest fix? (Ew.dE3)

jtwhite79 commented 5 years ago

@h2osteff - would that format accommodate a three-digit signed exponent (essentially 4 digits devoted to the exponent) and also report the E? I'm almost entirely ignorant of fortran and some prelim googling didn't answer this question...

h2osteff commented 5 years ago

My understanding is that it forces at least 3 digits to be used in the exponent. The "E" and the sign "+/-" are not counted as part of those 3, so you need to leave enough width for them (w). e.g. the number 1234*10^(123) with and edit descriptor E11.4E3 would print: .1234E+123

emorway-usgs commented 5 years ago

Hello, thanks @h2osteff for the suggestion. @JDub, we'll try to get back to you with a response next week.

vivekbedekar commented 5 years ago

This issue was resolved with a format change. As suggested above, G15.7 was replaced by G15.7E3. see commit bdf0c5a.

jtwhite79 commented 5 years ago

Thanks guys! Great code you got here!