@@ -17,10 +17,10 @@ def make_target(out: Path) -> None:
1717 ds .to_netcdf (out )
1818
1919def prepare (
20+ * ,
2021 var : str ,
2122 in_files : list [Path ],
2223 realm : str ,
23- mapping_yaml : Path ,
2424 cmor_tables : Path ,
2525 dataset_json : Path ,
2626 outdir : Path ,
@@ -36,23 +36,28 @@ def prepare(
3636 cm .write_variable (ds_out , var , vdef , outdir = outdir )
3737
3838def main (argv : list [str ] | None = None ) -> int :
39+ """Entry point for the cmip7_prep command-line interface."""
3940 p = argparse .ArgumentParser (prog = "cmip7-prep" )
4041 sub = p .add_subparsers (dest = "cmd" , required = True )
4142
42- p_make = sub .add_parser ("make-target" )
43- p_make .add_argument ("out" , type = Path )
43+ p_make = sub .add_parser ("make-target" , help = "Write a simple 1° lat/lon grid file." )
44+ p_make .add_argument ("out" , type = Path , help = "Output NetCDF path for the target grid." )
4445 p_make .set_defaults (func = lambda a : make_target (a .out ))
4546
46- p_prep = sub .add_parser ("prepare" )
47- p_prep .add_argument ("--var" , required = True )
48- p_prep .add_argument ("--in-file" , "-i" , action = "append" , required = True , type = Path )
49- p_prep .add_argument ("--realm" , required = True )
50- p_prep .add_argument ("--mapping-yaml" , required = True , type = Path )
51- p_prep .add_argument ("--cmor-tables" , required = True , type = Path )
52- p_prep .add_argument ("--dataset-json" , required = True , type = Path )
53- p_prep .add_argument ("--outdir" , default = Path ("out" ), type = Path )
47+ p_prep = sub .add_parser ("prepare" , help = "Regrid one variable and write CMOR output." )
48+ p_prep .add_argument ("--var" , required = True , help = "Variable name in input files." )
49+ p_prep .add_argument ("--in-file" , "-i" , action = "append" , required = True , type = Path , help = "Input files (repeatable)." )
50+ p_prep .add_argument ("--realm" , required = True , help = "CMOR realm/table, e.g., Amon." )
51+ p_prep .add_argument ("--cmor-tables" , required = True , type = Path , help = "Path to CMOR Tables directory." )
52+ p_prep .add_argument ("--dataset-json" , required = True , type = Path , help = "Path to cmor_dataset.json." )
53+ p_prep .add_argument ("--outdir" , default = Path ("out" ), type = Path , help = "Output directory for CMORized files." )
5454 p_prep .set_defaults (func = lambda a : prepare (
55- a .var , a .in_file , a .realm , a .mapping_yaml , a .cmor_tables , a .dataset_json , a .outdir
55+ var = a .var ,
56+ in_files = a .in_file ,
57+ realm = a .realm ,
58+ cmor_tables = a .cmor_tables ,
59+ dataset_json = a .dataset_json ,
60+ outdir = a .outdir ,
5661 ))
5762
5863 args = p .parse_args (argv )
0 commit comments