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

MOSART buildnml complained string element is too long #6730

Open
minxu74 opened this issue Nov 1, 2024 · 0 comments
Open

MOSART buildnml complained string element is too long #6730

minxu74 opened this issue Nov 1, 2024 · 0 comments

Comments

@minxu74
Copy link
Contributor

minxu74 commented Nov 1, 2024

During hybrid or branch runs, MOSART buildnml sometime complained the element finidat_rtm and nrevn_rtm is too long. The reason is that the finidat_rtm for hybrid and nrevsn_rtm for branch are specified with their absolute paths, thus in some cases, the lengths of the paths are longer than 256 causing the error.

The quick fix is to use "os.path.basename" to get the relative paths as follows:

            if run_type == "hybrid": infile_text += "finidat_rtm = '{}'\n".format(os.path.basename(fncheck))
            if run_type == "branch": infile_text += "nrevsn_rtm  = '{}'\n".format(os.path.basename(fncheck))

The original code:

                fncheck = "{}/{}.mosart{}.r.{}-{}.nc".format(rundir, run_refcase, inst_string, run_refdate, run_reftod)
                if not os.path.exists(fncheck):
                    fncheck = "{}/{}.mosart.r.{}-{}.nc".format(rundir, run_refcase, run_refdate, run_reftod)
                    if not os.path.exists(fncheck):
                        fncheck = "{}/{}.clm2{}.r.{}-{}.nc".format(rundir, run_refcase, inst_string, run_refdate, run_reftod)
                        if not os.path.exists(fncheck):
                            fncheck = "{}/{}.clm2.r.{}-{}.nc".format(rundir, run_refcase, run_refdate, run_reftod)
                            expect(os.path.exists(fncheck), "ERROR mosart.buildnml: could not find restart file for branch or hybrid start")

            if run_type == "hybrid": infile_text += "finidat_rtm = '{}'\n".format(fncheck)
            if run_type == "branch": infile_text += "nrevsn_rtm  = '{}'\n".format(fncheck)

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

No branches or pull requests

1 participant