@@ -1880,7 +1880,11 @@ sub setup_logic_irrigate {
1880
1880
if ( $physv -> as_long() >= $physv -> as_long(" clm4_5" ) ) {
1881
1881
add_default($opts , $nl_flags -> {' inputdata_rootdir' }, $definition , $defaults , $nl , ' irrigate' ,
1882
1882
' use_crop' => $nl_flags -> {' use_crop' }, ' use_cndv' => $nl_flags -> {' use_cndv' } );
1883
- $nl_flags -> {' irrigate' } = lc ($nl -> get_value(' irrigate' ));
1883
+ if ( &value_is_true($nl -> get_value(' irrigate' ) ) ) {
1884
+ $nl_flags -> {' irrigate' } = " .true."
1885
+ } else {
1886
+ $nl_flags -> {' irrigate' } = " .false."
1887
+ }
1884
1888
}
1885
1889
}
1886
1890
@@ -2074,6 +2078,9 @@ sub setup_logic_create_crop_landunit {
2074
2078
if ( &value_is_true($nl_flags -> {' use_fates' }) && &value_is_true($nl -> get_value($var )) ) {
2075
2079
$log -> fatal_error( " $var is true and yet use_fates is being set, which contradicts that (use_fates requires $var to be .false." );
2076
2080
}
2081
+ if ( (! &value_is_true($nl_flags -> {' use_fates' })) && (! &value_is_true($nl -> get_value($var ))) ) {
2082
+ $log -> fatal_error( " $var is false which is ONLY allowed when FATES is being used" );
2083
+ }
2077
2084
}
2078
2085
}
2079
2086
@@ -2566,9 +2573,6 @@ sub setup_logic_do_transient_crops {
2566
2573
if (string_is_undef_or_empty($nl -> get_value(' flanduse_timeseries' ))) {
2567
2574
$cannot_be_true = " $var can only be set to true when running a transient case (flanduse_timeseries non-blank)" ;
2568
2575
}
2569
- elsif (!&value_is_true($nl -> get_value(' use_crop' ))) {
2570
- $cannot_be_true = " $var can only be set to true when running with use_crop = true" ;
2571
- }
2572
2576
elsif (&value_is_true($nl -> get_value(' use_fates' ))) {
2573
2577
# In principle, use_fates should be compatible with
2574
2578
# do_transient_crops. However, this hasn't been tested, so to be safe,
@@ -2594,6 +2598,13 @@ sub setup_logic_do_transient_crops {
2594
2598
$log -> fatal_error($cannot_be_true );
2595
2599
}
2596
2600
2601
+ my $dopft = " do_transient_pfts" ;
2602
+ # Make sure the value agrees with the do_transient_pft flag
2603
+ if ( ( &value_is_true($nl -> get_value($var ))) && (! &value_is_true($nl -> get_value($dopft ))) ||
2604
+ (! &value_is_true($nl -> get_value($var ))) && ( &value_is_true($nl -> get_value($dopft ))) ) {
2605
+ $log -> fatal_error(" $var and $dopft do NOT agree and need to" );
2606
+ }
2607
+
2597
2608
}
2598
2609
}
2599
2610
@@ -3047,9 +3058,12 @@ sub setup_logic_fertilizer {
3047
3058
my ($opts , $nl_flags , $definition , $defaults , $nl , $physv ) = @_ ;
3048
3059
3049
3060
if ( $physv -> as_long() >= $physv -> as_long(" clm4_5" ) ) {
3050
- $nl_flags -> {' use_crop' } = $nl -> get_value(' use_crop' );
3051
3061
add_default($opts , $nl_flags -> {' inputdata_rootdir' }, $definition , $defaults , $nl , ' use_fertilizer' ,
3052
3062
' use_crop' => $nl_flags -> {' use_crop' } );
3063
+ my $use_fert = $nl -> get_value(' use_fertilizer' );
3064
+ if ( (! &value_is_true($nl_flags -> {' use_crop' })) && &value_is_true($use_fert ) ) {
3065
+ $log -> fatal_error(" use_ferilizer can NOT be on without prognostic crop\n " );
3066
+ }
3053
3067
}
3054
3068
}
3055
3069
@@ -3062,9 +3076,11 @@ sub setup_logic_grainproduct {
3062
3076
my ($opts , $nl_flags , $definition , $defaults , $nl , $physv ) = @_ ;
3063
3077
3064
3078
if ( $physv -> as_long() >= $physv -> as_long(" clm4_5" ) ) {
3065
- $nl_flags -> {' use_crop' } = $nl -> get_value(' use_crop' );
3066
3079
add_default($opts , $nl_flags -> {' inputdata_rootdir' }, $definition , $defaults , $nl , ' use_grainproduct' ,
3067
3080
' use_crop' => $nl_flags -> {' use_crop' }, ' phys' => $physv -> as_string() );
3081
+ if ( (! &value_is_true($nl_flags -> {' use_crop' })) && &value_is_true($nl -> get_value(' use_grainproduct' ) ) ) {
3082
+ $log -> fatal_error(" use_grainproduct can NOT be on without prognostic crop\n " );
3083
+ }
3068
3084
}
3069
3085
}
3070
3086
0 commit comments