ESCOMP / ESCOMP/CTSM

Change gen_surfdata_namelist --namelist option to --prefix to specify the filenames for the namelist, surfdata, land-use data, and log files

Open
#3,462 2 comments 0 reactions 0 assignees View on GitHub
b4b enhancement priority: low usability
Dominant language
Fortran
Stars
352
Forks
361
Avg merge
6d 6h
Merged PRs (30d)
8

Description

The gen_surfdata_namelist script should have the --namelist option changed to be more general so that it sets more of the filenames in order to make sure they are all consistent, and that you can specify them for testing rather than getting a hardcoded one that includes a creation date.

This came up in the following comment to #3453
> It looks like the problem is that you can specify the namelist filename -- but NOT the surface dataset or log file name.
>
> gen_mksurfdata_namelist.py: has this code:
>
> ``` python
> prefix = f"surfdata_{res}_{ssp_rcp_name}_{start_year}_{num_pft}pfts_c{time_stamp}."
>
> if args.namelist_fname is None:
> nlfname = f"{prefix}namelist"
> else:
> nlfname = args.namelist_fname
>
> fsurdat = f"{prefix}nc"
> fsurlog = f"{prefix}log"
> ```
>
> One way to handle it would be to have "prefix" be the thing that's entered in the command line. And then you'd have something like this:
>
> ``` python
> if args.namelist_prefix is None:
> prefix = args.namelist_prefix
> else:
> prefix = f"surfdata_{res}_{ssp_rcp_name}_{start_year}_{num_pft}pfts_c{time_stamp}."
>
> nlfname = f"{prefix}namelist"
> fsurdat = f"{prefix}nc"
> fsurlog = f"{prefix}log"
> ```
>
> And then the same prefix would be used for all three files. It does mean that the namelist file will have an assumed ".namelist" ending on it -- but I think that would be OK.
>
> I think this approach for the prefix would be the best, but I can image other options as well....

_Originally posted by @ekluzek in [#3453](https://github.com/ESCOMP/CTSM/issues/3453#issuecomment-3238427505)_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.