Skip to content

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

@ekluzek

Description

@ekluzek

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:

    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:

     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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bfbbit-for-bitenhancementnew capability or improved behavior of existing capabilitypriority: lowBackground task that doesn't need to be done right away.usabilityImprove or clarify user-facing options

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions