Skip to content

Commit

Permalink
add luh timeseries file to the setup_cmdl_fates_mode
Browse files Browse the repository at this point in the history
This also adds checking use_fates_sp setup requirements and luh setup requirements
  • Loading branch information
glemieux committed Feb 7, 2024
1 parent 6fec55d commit 0cacc12
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion components/elm/bld/ELMBuildNamelist.pm
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,8 @@ sub setup_cmdl_fates_mode {
"use_fates_planthydro", "use_fates_ed_st3", "use_fates_ed_prescribed_phys",
"use_fates_inventory_init", "use_fates_fixed_biogeog", "use_fates_nocomp","use_fates_sp",
"fates_inventory_ctrl_filename","use_fates_logging", "use_fates_tree_damage",
"use_fates_parteh_mode","use_fates_cohort_age_tracking","use_snicar_ad", "use_fates_luh");
"use_fates_parteh_mode","use_fates_cohort_age_tracking","use_snicar_ad", "use_fates_luh",
"fluh_timeseries");
foreach my $var ( @list ) {
if ( defined($nl->get_value($var)) ) {
$nl_flags->{$var} = $nl->get_value($var);
Expand Down Expand Up @@ -3300,6 +3301,39 @@ sub setup_logic_fates {
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fates_paramfile', 'phys'=>$nl_flags->{'phys'});
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fluh_timeseries', 'phys'=>$nl_flags->{'phys'});

# For FATES SP mode make sure no-competion, and fixed-biogeography are also set
# And also check for other settings that can't be trigged on as well
my $var = "use_fates_sp";
if ( defined($nl->get_value($var)) ) {
if ( &value_is_true($nl->get_value($var)) ) {
my @list = ( "use_fates_nocomp", "use_fates_fixed_biogeog" );
foreach my $var ( @list ) {
if ( ! &value_is_true($nl->get_value($var)) ) {
fatal_error("$var is required when FATES SP is on (use_fates_sp)" );
}
}
# spit-fire can't be on with FATES SP mode is active
if ( $nl->get_value('fates_spitfire_mode') > 0 ) {
fatal_error('fates_spitfire_mode can NOT be set to greater than 0 when use_fates_sp is true');
}
}
}
# check that fates landuse change mode has the necessary luh2 landuse timeseries data
my $var = "use_fates_luh";
if ( defined($nl->get_value($var)) ) {
if ( &value_is_true($nl->get_value($var)) ) {
$var = "fluh_timeseries";
add_default($test_files, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var,
'phys'=>$nl_flags->{'phys'}, 'hgrid'=>$nl_flags->{'res'},
'sim_year_range'=>$nl_flags->{'sim_year_range'}, nofail=>1 );
my $fname = remove_leading_and_trailing_quotes( $nl->get_value($var) );
if ( ! defined($nl->get_value($var)) ) {
fatal_error("$var is required when use_fates_luh is set" );
} elsif ( ! -f "$fname" ) {
fatal_error("$fname does NOT point to a valid filename" );
}
}
}
}
}

Expand Down

0 comments on commit 0cacc12

Please sign in to comment.