Skip to content

Commit

Permalink
Merge pull request #262 from TeaganKing/plumber
Browse files Browse the repository at this point in the history
Plumber updates

This addresses #248 In order to implement PLUMBER capabilities
  • Loading branch information
billsacks authored Aug 16, 2024
2 parents 66ce97d + 7e363e7 commit f199f9f
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 6 deletions.
18 changes: 18 additions & 0 deletions cime_config/stream_cdeps.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def create_stream_xml(
data_list_file,
user_mods_file,
available_neon_data=None,
available_plumber_data=None
):
"""
Create the stream xml file and append the required stream input data to the input data list file
Expand Down Expand Up @@ -187,7 +188,17 @@ def create_stream_xml(
{"name": "NEON.NEON_PRECIP.$NEONSITE"},
err_msg="No stream_entry {} found".format(stream_name),
)
elif stream_name.startswith("PLUMBER2"):
self.stream_nodes = super(StreamCDEPS, self).get_child(
"stream_entry",
{"name": "PLUMBER2.$PLUMBER2SITE"},
err_msg="No stream_entry {} found".format(stream_name),
)
elif stream_name.startswith("CLM_USRDAT."):
if 'PLUMBER2' in stream_name:
# if PLUMBER2 is in the stream name
# we want to use PLUMBER2.PLUMBER2SITE instead of CLM_USRDAT.PLUMBER2
continue
self.stream_nodes = super(StreamCDEPS, self).get_child(
"stream_entry",
{"name": "CLM_USRDAT.$CLM_USRDAT_NAME"},
Expand Down Expand Up @@ -244,6 +255,13 @@ def create_stream_xml(
os.path.join(rundir, "inputdata", "atm", neon)
+ "\n"
)
elif available_plumber_data and stream_name.startswith("PLUMBER2"):
rundir = case.get_value("RUNDIR")
for plumber in available_plumber_data:
stream_datafiles += (
os.path.join(rundir, "inputdata", "atm", plumber)
+ "\n"
)
else:
stream_datafiles = child.xml_element.text
stream_datafiles = self._resolve_values(
Expand Down
3 changes: 2 additions & 1 deletion cime_config/stream_definition_v2.0.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="model_grid" type="xs:string" />
<xs:attribute name="compset" type="xs:string" />
<xs:attribute name="compset" type="xs:string" />
<xs:attribute name="CLM_USRDAT_NAME" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
Expand Down
17 changes: 12 additions & 5 deletions datm/cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,16 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path
available_neon_data = None
if 'CLM_USRDAT' in model_grid:
config['model_grid'] = 'CLM_USRDAT'
neonsite = case.get_value("NEONSITE")
if neonsite:
config['neon'] = "True"
# download and use the listing.csv file to determine data availablity
available_neon_data = _get_neon_data_availability(case, neonsite)
if 'NEON' in clm_usrdat_name:
neonsite = case.get_value("NEONSITE")
if neonsite:
config['neon'] = "True"
# download and use the listing.csv file to determine data availablity
available_neon_data = _get_neon_data_availability(case, neonsite)
if 'PLUMBER2' in clm_usrdat_name:
plumber2site = case.get_value('PLUMBER2SITE')
if plumber2site:
config['plumber'] = "True"
else:
config['model_grid'] = model_grid

Expand Down Expand Up @@ -194,6 +199,8 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path
streamlist.append(clm_usrdat_name+"_PRECIP."+neonsite)
if clm_usrdat_name == 'NEON':
streamlist.append(clm_usrdat_name+".NEON_PRECIP."+neonsite)
if clm_usrdat_name == 'PLUMBER2':
streamlist.append(clm_usrdat_name+"."+plumber2site)

bias_correct = nmlgen.get_value("bias_correct")
if bias_correct is not None:
Expand Down
9 changes: 9 additions & 0 deletions datm/cime_config/config_component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,15 @@
<desc>starting year to loop data over</desc>
</entry>

<entry id="DATM_YR_START_FILENAME">
<type>integer</type>
<valid_values></valid_values>
<default_value>9999</default_value>
<group>run_component_datm</group>
<file>env_run.xml</file>
<desc>Start year listed in PLUMBER2 filenames for certain datm_modes. Currently only used in PLUMBER2; leave as the default value (9999) for other cases.</desc>
</entry>

<entry id="DATM_YR_END">
<type>integer</type>
<valid_values></valid_values>
Expand Down
3 changes: 3 additions & 0 deletions datm/cime_config/namelist_definition_datm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
<value datm_mode="1PT" model_grid="CLM_USRDAT" neon="True">
NEON.$NEONSITE
</value>
<value datm_mode="1PT" model_grid="CLM_USRDAT" neon="True">
PLUMBER2.$PLUMBER2SITE
</value>
<value datm_mode="1PT" model_grid="CLM_USRDAT">
CLM_USRDAT.$CLM_USRDAT_NAME
</value>
Expand Down
48 changes: 48 additions & 0 deletions datm/cime_config/stream_definition_datm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
CORE_RYF9091_JRA = JRA55 repeat year forcing, v1.3, 1990-1991 (for forcing POP and CICE)
CORE_RYF0304_JRA = JRA55 repeat year forcing, v1.3, 2003-2004 (for forcing POP and CICE)
ERA5 = ERA5 intra-annual year forcing
NEON = Run with forcing from NEON tower data
PLUMBER2 = Run with forcing from PLUMBER2 tower data
SIMPLE = Namelist-configurable, constant datm forcing for simple experiments
CPLHIST = Streams for lnd or ocn/ice forcing used for spinup
Expand Down Expand Up @@ -341,6 +343,50 @@
<stream_readmode>single</stream_readmode>
</stream_entry>


<!-- =================================== -->
<!-- datm_mode PLUMBER2.$PLUMBER2SITE -->
<!-- =================================== -->

<stream_entry name="PLUMBER2.$PLUMBER2SITE">
<stream_meshfile>
<meshfile>none</meshfile>
</stream_meshfile>
<stream_datafiles>
<file first_year="$DATM_YR_START" last_year="$DATM_YR_END">$DIN_LOC_ROOT/atm/datm7/CLM1PT_data/PLUMBER2/${PLUMBER2SITE}/CLM1PT_data/CTSM_DATM_${PLUMBER2SITE}_${DATM_YR_START_FILENAME}-${DATM_YR_END}.nc</file>
</stream_datafiles>
<stream_datavars>
<var>ZBOT Sa_z</var>
<var>TBOT Sa_tbot</var>
<var>QBOT Sa_shum</var>
<var>WIND Sa_wind</var>
<var>PRECTmms Faxa_precn</var>
<var>FSDS Faxa_swdn</var>
<var>PSRF Sa_pbot</var>
<var>FLDS Faxa_lwdn</var>
</stream_datavars>
<stream_lev_dimname>null</stream_lev_dimname>
<stream_mapalgo>
<mapalgo>none</mapalgo>
</stream_mapalgo>
<stream_vectors>null</stream_vectors>
<stream_year_align>$DATM_YR_ALIGN</stream_year_align>
<stream_year_first>$DATM_YR_START</stream_year_first>
<stream_year_last>$DATM_YR_END</stream_year_last>
<stream_offset>0</stream_offset>
<stream_tintalgo>
<tintalgo>linear</tintalgo>
</stream_tintalgo>
<stream_taxmode>
<taxmode >cycle</taxmode>
<taxmode compset="HIST">limit</taxmode>
</stream_taxmode>
<stream_dtlimit>
<dtlimit>1.5</dtlimit>
</stream_dtlimit>
<stream_readmode>single</stream_readmode>
</stream_entry>

<!-- =================================== -->
<!-- datm_mode CLMGSWP3v1 -->
<!-- =================================== -->
Expand Down Expand Up @@ -4036,6 +4082,7 @@
</stream_taxmode>
<stream_dtlimit>
<dtlimit>1.5</dtlimit>
<dtlimit CLM_USRDAT_NAME="PLUMBER2">30</dtlimit>
</stream_dtlimit>
<stream_readmode>single</stream_readmode>
</stream_entry>
Expand Down Expand Up @@ -4575,6 +4622,7 @@
</stream_taxmode>
<stream_dtlimit>
<dtlimit>1.5</dtlimit>
<dtlimit CLM_USRDAT_NAME="PLUMBER2">30</dtlimit>
</stream_dtlimit>
<stream_readmode>single</stream_readmode>
</stream_entry>
Expand Down
3 changes: 3 additions & 0 deletions doc/source/datm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ DATM_CPLHIST_CASE
DATM_YR_START
- Starting year to loop data over

DATM_YR_START_FILENAME
- Start year listed in PLUMBER2 filename

DATM_YR_END
- Ending year to loop data over

Expand Down

0 comments on commit f199f9f

Please sign in to comment.