Skip to content

Commit

Permalink
Merge pull request #3 from adrifoster/subsetdata_update
Browse files Browse the repository at this point in the history
Updating flags wording to avoid confusions
  • Loading branch information
negin513 authored Jan 6, 2022
2 parents 72261e3 + 5f417ec commit 717ce37
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 29 deletions.
12 changes: 6 additions & 6 deletions python/ctsm/site_and_regional/single_point_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
37 changes: 14 additions & 23 deletions python/ctsm/subset_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -277,7 +270,6 @@ def get_parser():
action="store_true",
dest="create_user_mods",
required=False,
default=True,
)
subparser.add_argument(
"--datm-syr",
Expand Down Expand Up @@ -305,7 +297,6 @@ def get_parser():
action="store_true",
dest="crop_flag",
required=False,
default=False,
)

if subparser == pt_parser:
Expand Down Expand Up @@ -484,9 +475,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,
)

Expand Down

0 comments on commit 717ce37

Please sign in to comment.