ESCOMP / CISM-wrapper

Community Ice Sheet Model wrapper for CESM
http://www.cesm.ucar.edu/models/cesm2.0/land-ice/
Other
3 stars 16 forks source link

iyear0 blank with RUN_STARTDATE set to year 0 #24

Open billsacks opened 5 years ago

billsacks commented 5 years ago

This tripped up a user: On cheyenne, if you set:

./xmlchange RUN_STARTDATE=0000-01-01

Then cism_in has iyear0 blank (instead of 0). This causes a runtime crash when CISM tries to read time_manager_nml.

I was able to reproduce this problem on cheyenne (which uses perl v5.18.2), but on my mac (which uses perl v5.28.0), iyear0 is correctly set to 0 in this case. (I'm not positive the difference is due to the perl versions, but my guess is that that's the cause.)

billsacks commented 5 years ago

I'm closing this as a wontfix because it will presumably be dealt with in the upcoming conversion of build-namelist to python.

billsacks commented 5 years ago

@cacraig ran into this issue, and wonders if @fischer-ncar might run into it once he converts some more of the CAM test suite. So this seems worth fixing.

The problem seems to be in these lines on the release-cesm2.0 branch:

https://github.com/ESCOMP/cism-wrapper/blob/1afd0996a5dd400a86ad4b0a9dad0d4370a58c4e/bld/build-namelist#L379-L380

If the year in startdate is 0000, then the sed command gives you a blank string rather than 0. A simple fix would be to put in a conditional to check if the result is blank, and if so set it to 0. Alternatively, we could put in place @ekluzek 's more robust fix from cism2_1_64 (either just the fix for build-namelist or all of the changes in that tag).

@Katetc do you think you could pick one of these options and fix this on the release branch?