From 96717fbd632b90d598607a347d21188dd4ff45e9 Mon Sep 17 00:00:00 2001 From: Adrianna Foster Date: Wed, 5 Jan 2022 15:56:25 -0700 Subject: [PATCH 1/2] updates to argparse for clarity --- .../site_and_regional/single_point_case.py | 12 +++---- python/ctsm/subset_data.py | 35 ++++++++----------- 2 files changed, 20 insertions(+), 27 deletions(-) diff --git a/python/ctsm/site_and_regional/single_point_case.py b/python/ctsm/site_and_regional/single_point_case.py index 695cc56404..a733795990 100644 --- a/python/ctsm/site_and_regional/single_point_case.py +++ b/python/ctsm/site_and_regional/single_point_case.py @@ -93,9 +93,9 @@ def __init__( create_user_mods, overwrite_single_pft, dominant_pft, - zero_nonveg_landunits, + include_nonveg, uniform_snowpack, - saturation_excess, + cap_saturation, output_dir, ): super().__init__(create_domain, create_surfdata, create_landuse, create_datm, @@ -105,9 +105,9 @@ def __init__( self.site_name = site_name self.overwrite_single_pft = overwrite_single_pft self.dominant_pft = dominant_pft - self.zero_nonveg_landunits = zero_nonveg_landunits + self.include_nonveg = include_nonveg self.uniform_snowpack = uniform_snowpack - self.saturation_excess = saturation_excess + self.cap_saturation = cap_saturation self.output_dir = output_dir self.tag = None @@ -238,7 +238,7 @@ def create_surfdata_at_point(self, indir, file, user_mods_dir): f_out["PCT_NAT_PFT"][:, :, :] = 0 if self.dominant_pft < 16: f_out['PCT_NAT_PFT'][:, :, self.dominant_pft] = 100 - if self.zero_nonveg_landunits: + if not self.include_nonveg: f_out["PCT_NATVEG"][:, :] = 100 f_out["PCT_CROP"][:, :] = 0 f_out["PCT_LAKE"][:, :] = 0.0 @@ -247,7 +247,7 @@ def create_surfdata_at_point(self, indir, file, user_mods_dir): f_out["PCT_GLACIER"][:, :] = 0.0 if self.uniform_snowpack: f_out["STD_ELEV"][:, :] = 20.0 - if not self.saturation_excess: + if self.cap_saturation: f_out["FMAX"][:, :] = 0.0 # specify dimension order diff --git a/python/ctsm/subset_data.py b/python/ctsm/subset_data.py index e40ea6e3b4..f66b2d52a6 100644 --- a/python/ctsm/subset_data.py +++ b/python/ctsm/subset_data.py @@ -132,39 +132,32 @@ def get_parser(): default="", ) pt_parser.add_argument( - "--variable-snow-fraction", - help="Create surface data with variable snow fraction. If unset, snow is set to uniform " - "fraction.", - action="store_false", + "--uniform-snowpack", + help="Modify surface data to have a uniform snow fraction.", + action="store_true", dest="uni_snow", required=False, - default=True, ) pt_parser.add_argument( - "--allow-multiple-pft", - help="Create surface data with multiple PFTs. If unset, it assumes the whole grid is 100%% " - "single PFT set by --dom-pft.", - action="store_false", + "--overwrite-to-single-pft", + help="Modify surface dataset to be 100%% one single PFT set by --dom-pft.", + action="store_true", dest="overwrite_single_pft", required=False, - default=True, ) pt_parser.add_argument( - "--zero-nonveg", - help="Set all non-vegetation landunits in the surface data to zero.", + "--include-nonveg", + help="Do not zero non-vegetation land units in the surface data.", action="store_true", - dest="zero_nonveg", + dest="include_nonveg", required=False, - default=False, ) pt_parser.add_argument( - "--allow-saturation-excess", - help="Create surface data allowing saturated conditions. If unset saturation excess is set " - "to zero.", + "--cap-saturation", + help="Modify surface data to not allow saturation excess.", action="store_true", - dest="saturation_excess", + dest="cap_saturation", required=False, - default=False, ) pt_parser.add_argument( "--dompft", @@ -484,9 +477,9 @@ def subset_point(args, file_dict: dict): args.create_user_mods, args.overwrite_single_pft, args.dom_pft, - args.zero_nonveg, + args.include_nonveg, args.uni_snow, - args.saturation_excess, + args.cap_saturation, args.out_dir, ) From 5f417ec50b98a158a13258eefca830b367ba0045 Mon Sep 17 00:00:00 2001 From: Adrianna Foster Date: Wed, 5 Jan 2022 16:48:41 -0700 Subject: [PATCH 2/2] more updates to argparse --- python/ctsm/subset_data.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/python/ctsm/subset_data.py b/python/ctsm/subset_data.py index f66b2d52a6..fb7b539655 100644 --- a/python/ctsm/subset_data.py +++ b/python/ctsm/subset_data.py @@ -270,7 +270,6 @@ def get_parser(): action="store_true", dest="create_user_mods", required=False, - default=True, ) subparser.add_argument( "--datm-syr", @@ -298,7 +297,6 @@ def get_parser(): action="store_true", dest="crop_flag", required=False, - default=False, ) if subparser == pt_parser: