@@ -60,6 +60,7 @@ SYNOPSIS
6060 Create the namelist for CLM
6161REQUIRED OPTIONS
6262 -cimeroot "directory" Path to cime directory
63+ -landroot "directory" Path to the land models parent directory, ie <>/ctsm
6364 -config "filepath" Read the given CLM configuration cache file.
6465 Default: "config_cache.xml".
6566 -configuration "cfg" The overall configuration being used [ clm | nwp ]
@@ -259,6 +260,7 @@ sub process_commandline {
259260 $nl_flags -> {' cmdline' } = " @ARGV \n " ;
260261
261262 my %opts = ( cimeroot => undef ,
263+ landroot => undef ,
262264 config => " config_cache.xml" ,
263265 configuration => undef ,
264266 csmdata => undef ,
@@ -300,6 +302,7 @@ sub process_commandline {
300302
301303 GetOptions(
302304 " cimeroot=s" => \$opts {' cimeroot' },
305+ " landroot=s" => \$opts {' landroot' },
303306 " driver=s" => \$opts {' driver' },
304307 " clm_demand=s" => \$opts {' clm_demand' },
305308 " co2_ppmv=f" => \$opts {' co2_ppmv' },
@@ -3779,15 +3782,14 @@ sub setup_logic_c_isotope {
37793782 add_default($opts , $nl_flags -> {' inputdata_rootdir' }, $definition , $defaults , $nl , ' use_c14_bombspike' , ' use_c14' => $use_c14 );
37803783 $use_c14_bombspike = $nl -> get_value(' use_c14_bombspike' );
37813784 if ( &value_is_true($use_c14_bombspike ) ) {
3782- if ( defined ( $stream_fldfilename_atm_c14 ) ) {
3783- &add_logical_to_nl_flags( $nl_flags , $nl , " use_c14_bombspike " );
3784- setup_logic_c14_streams( $opts , $nl_flags , $definition , $defaults , $nl );
3785- } else {
3785+ &add_logical_to_nl_flags( $nl_flags , $nl , " use_c14_bombspike " );
3786+ setup_logic_c14_streams( $opts , $nl_flags , $definition , $defaults , $nl );
3787+ $stream_fldfilename_atm_c14 = $nl -> get_value( ' stream_fldfilename_atm_c14 ' );
3788+ if ( ! defined ( $stream_fldfilename_atm_c14 ) ) {
37863789 add_default($opts , $nl_flags -> {' inputdata_rootdir' }, $definition , $defaults , $nl , ' atm_c14_filename' ,
37873790 ' use_c14' => $use_c14 , ' use_cn' => $nl_flags -> {' use_cn' }, ' use_c14_bombspike' => $nl -> get_value(' use_c14_bombspike' ),
3788- ' ssp_rcp' => $nl_flags -> {' ssp_rcp' } );
3791+ ' ssp_rcp' => $nl_flags -> {' ssp_rcp' }, ' cmip_era ' => $nl_flags -> { ' cmip_era ' } );
37893792 }
3790- $stream_fldfilename_atm_c14 = $nl -> get_value(' stream_fldfilename_atm_c14' );
37913793 $atm_c14_filename = $nl -> get_value(' atm_c14_filename' );
37923794 if ( defined ($stream_fldfilename_atm_c14 ) && defined ($atm_c14_filename ) ) {
37933795 $log -> fatal_error(" Both stream_fldfilename_atm_c14 and atm_c14_filename set, only one should be set" );
@@ -3809,15 +3811,14 @@ sub setup_logic_c_isotope {
38093811 add_default($opts , $nl_flags -> {' inputdata_rootdir' }, $definition , $defaults , $nl , ' use_c13_timeseries' , ' use_c13' => $use_c13 );
38103812 $use_c13_timeseries = $nl -> get_value(' use_c13_timeseries' );
38113813 if ( &value_is_true($use_c13_timeseries ) ) {
3812- if ( defined ( $stream_fldfilename_atm_c13 ) ) {
3813- &add_logical_to_nl_flags( $nl_flags , $nl , " use_c13_timeseries " );
3814- setup_logic_c13_streams( $opts , $nl_flags , $definition , $defaults , $nl );
3815- } else {
3814+ &add_logical_to_nl_flags( $nl_flags , $nl , " use_c13_timeseries " );
3815+ setup_logic_c13_streams( $opts , $nl_flags , $definition , $defaults , $nl );
3816+ $stream_fldfilename_atm_c13 = $nl -> get_value( ' stream_fldfilename_atm_c13 ' );
3817+ if ( ! defined ( $nl -> get_value( ' stream_fldfilename_atm_c13 ' )) ) {
38163818 add_default($opts , $nl_flags -> {' inputdata_rootdir' }, $definition , $defaults , $nl , ' atm_c13_filename' ,
38173819 ' use_c13' => $use_c13 , ' use_cn' => $nl_flags -> {' use_cn' }, ' use_c13_timeseries' => $nl -> get_value(' use_c13_timeseries' ),
38183820 ' ssp_rcp' => $nl_flags -> {' ssp_rcp' } );
38193821 }
3820- $stream_fldfilename_atm_c13 = $nl -> get_value(' stream_fldfilename_atm_c13' );
38213822 $atm_c13_filename = $nl -> get_value(' atm_c13_filename' );
38223823 if ( defined ($stream_fldfilename_atm_c13 ) && defined ($atm_c13_filename ) ) {
38233824 $log -> fatal_error(" Both stream_fldfilename_atm_c13 and atm_c13_filename set, only one should be set" );
@@ -3859,7 +3860,11 @@ sub setup_logic_c13_streams {
38593860
38603861 add_default($opts , $nl_flags -> {' inputdata_rootdir' }, $definition , $defaults , $nl , ' stream_fldfilename_atm_c13' ,
38613862 ' use_c13' => $nl_flags -> {' use_c13' }, ' use_c13_timeseries' => $nl_flags -> {' use_c13_timeseries' },
3862- ' ssp_rcp' => $nl_flags -> {' ssp_rcp' });
3863+ ' ssp_rcp' => $nl_flags -> {' ssp_rcp' }, ' cmip_era' => $nl_flags -> {' cmip_era' }, ' nofail' => 1);
3864+ # If stream_fldfilename_atm_c13 is not defined then return and get the cmip6 file format version
3865+ if ( ! defined ( $nl -> get_value( " stream_fldfilename_atm_c13" ) ) ) {
3866+ return ;
3867+ }
38633868
38643869 add_default($opts , $nl_flags -> {' inputdata_rootdir' }, $definition , $defaults , $nl , ' stream_year_first_atm_c13' ,
38653870 ' sim_year' => $nl_flags -> {' sim_year' }, ' sim_year_range' => $nl_flags -> {' sim_year_range' });
@@ -3885,13 +3890,16 @@ sub setup_logic_c14_streams {
38853890
38863891 add_default($opts , $nl_flags -> {' inputdata_rootdir' }, $definition , $defaults , $nl , ' stream_fldfilename_atm_c14' ,
38873892 ' use_c14' => $nl_flags -> {' use_c14' }, ' use_c14_bombspike' => $nl_flags -> {' use_c14_bombspike' },
3888- ' ssp_rcp' => $nl_flags -> {' ssp_rcp' });
3893+ ' ssp_rcp' => $nl_flags -> {' ssp_rcp' }, ' nofail' => 1);
3894+ # If stream_fldfilename_atm_c14 is not defined then return and get the cmip6 file format version
3895+ if ( ! defined ( $nl -> get_value( " stream_fldfilename_atm_c14" ) ) ) {
3896+ return ;
3897+ }
38893898
3890- add_default($opts , $nl_flags -> {' inputdata_rootdir' }, $definition , $defaults , $nl , ' stream_meshfile_atm_c14' ,
3899+ add_default($opts , $nl_flags -> {' inputdata_rootdir' }, $definition , $defaults , $nl , ' stream_meshfile_atm_c14' ,
38913900 ' use_c14' => $nl_flags -> {' use_c14' }, ' use_c14_bombspike' => $nl_flags -> {' use_c14_bombspike' });
38923901 if ( &remove_leading_and_trailing_quotes( $nl -> get_value( " stream_meshfile_atm_c14" ) ) eq " none" ) {
3893- # TODP: Change this to a fatal when we start using this
3894- $log -> warning( " stream_meshfile_atm_c14 is set to 'none' which will only copy the first latitude to the globe" )
3902+ $log -> fatal_error( " stream_meshfile_atm_c14 is set to 'none' which will only copy the first latitude to the globe" )
38953903 }
38963904
38973905 add_default($opts , $nl_flags -> {' inputdata_rootdir' }, $definition , $defaults , $nl , ' stream_year_first_atm_c14' ,
@@ -4493,10 +4501,12 @@ sub setup_logic_cropcal_streams {
44934501 add_default($opts , $nl_flags -> {' inputdata_rootdir' }, $definition , $defaults , $nl , ' stream_fldFileName_swindow_start' );
44944502 add_default($opts , $nl_flags -> {' inputdata_rootdir' }, $definition , $defaults , $nl , ' stream_fldFileName_swindow_end' );
44954503 add_default($opts , $nl_flags -> {' inputdata_rootdir' }, $definition , $defaults , $nl , ' stream_fldfilename_cultivar_gdds' ,
4504+ ' cropcals_rx' => $cropcals_rx ,
4505+ ' cropcals_rx_adapt' => $cropcals_rx_adapt ,
44964506 ' lnd_tuning_mode' => $nl_flags -> {' lnd_tuning_mode' }
44974507 );
44984508 if ( &value_is_true($cropcals_rx_adapt ) ) {
4499- add_default($opts , $nl_flags -> {' inputdata_rootdir' }, $definition , $defaults , $nl , ' stream_fldFileName_gdd20_baseline' , ' stream_gdd20_seasons' => $stream_gdd20_seasons );
4509+ add_default($opts , $nl_flags -> {' inputdata_rootdir' }, $definition , $defaults , $nl , ' stream_fldFileName_gdd20_baseline' , ' stream_gdd20_seasons' => $stream_gdd20_seasons , ' lnd_tuning_mode ' => $nl_flags -> { ' lnd_tuning_mode ' } );
45004510 }
45014511 }
45024512
@@ -5573,17 +5583,22 @@ sub add_default {
55735583 # The default values for input pathnames are relative. If the namelist
55745584 # variable is defined to be an absolute pathname, then prepend
55755585 # the CESM inputdata root directory.
5576- if (not defined $settings {' no_abspath' }) {
5577- if (defined $settings {' set_abspath' }) {
5578- $val = set_abs_filepath($val , $settings {' set_abspath' });
5579- } else {
5580- if ($is_input_pathname eq ' abs' ) {
5581- $val = set_abs_filepath($val , $inputdata_rootdir );
5582- if ( $test_files and ($val !~ / null|none/ ) and (! -f " $val " ) ) {
5583- $log -> fatal_error(" file not found: $var = $val " );
5584- }
5585- }
5586- }
5586+ if ($is_input_pathname eq ' landroot' ) {
5587+ # my $landroot = $opts->{'landroot'};
5588+ $val = set_abs_filepath($val ,$opts -> {' landroot' });
5589+ } else {
5590+ if (not defined $settings {' no_abspath' }) {
5591+ if (defined $settings {' set_abspath' }) {
5592+ $val = set_abs_filepath($val , $settings {' set_abspath' });
5593+ } else {
5594+ if ($is_input_pathname eq ' abs' ) {
5595+ $val = set_abs_filepath($val , $inputdata_rootdir );
5596+ if ( $test_files and ($val !~ / null|none/ ) and (! -f " $val " ) ) {
5597+ $log -> fatal_error(" file not found: $var = $val " );
5598+ }
5599+ }
5600+ }
5601+ }
55875602 }
55885603
55895604 # query the definition to find out if the variable takes a string value.
0 commit comments