#!/usr/bin/env perl
use strict;
my @dirs = ('../../ccsm_utils/Tools/per5lib', '../../ccsm_utils/Tools/perl5lib/Build');
unshift @INC, @dirs;
require Build::NamelistDefinition;
use lib "../../ccsm_utils/Tools/perl5lib";
my $image_dir = "./images";
print <<"END_of_Start";
CESM Component Models Namelist Definitions
Search or Browse DATM Component Model Namelist Variables
This page contains the complete list of DATM namelist variables
available. They are grouped by categories designed to aid browsing.
Clicking on the name of a variable will display descriptive
information. If search terms are entered in the text box below, the
list will be condensed to contain only matched variables.
DATM namelists can be separated into two groups, stream-independent namelist variables that are
specific to the DATM model and stream-specific
namelist variables that are contained in share code.
In particular, strdata (short for "stream data") input is
set via a fortran namelist called "shr_strdata_nml". That namelist,
the strdata datatype, and the methods are contained in the share
source code file, "models/csm_share/shr/shr_strdata_mod.F90". In
general, strdata input defines an array of input streams and
operations to perform on those streams. Therefore, many namelist
inputs are arrays of character strings. Different variable of the
same index are associated. For instance, mapalgo(1) spatial
interpolation will be performed between streams(1) and the target
domain.
For stream-independent input, the namelist input filename is
hardwired in the data model code to "datm_in" (or datm_in_NNNN for
multiple instances) and the namelist group is called "datm_nml". The
variable formats are character string (char), integer (int), double
precision real (r8), or logical (log) or one dimensional arrays of any
of those things (array of ...).
For stream-dependent input, the namelist input file is
"datm_atm_in" (or datm_atm_in_NNNN for multiple instances) and the
namelist group is "shr_strdata_nml". One of the variables in
shr_strdata_nml is the datamode value. The mode is selected by a
character string set in the strdata namelist variable datamode. Each
data model has a unique set of datamode values that it supports.
Those for DATM are listed in detail in the datamode.
Found standard names matching query:
END_of_Start
my $nldef_file = "../../../models/atm/datm/bld/namelist_files/namelist_definition_datm.xml";
my $nldef = Build::NamelistDefinition->new($nldef_file);
# Get list of categories in the definition file.
my @nldef_cats = $nldef->get_categories();
# Construct hash from @nldef_cats and use it to keep track of
# the categories that aren't treated explicitly below, then add them to the
# table at the end.
my %nldef_cats = ();
foreach my $k (@nldef_cats) {
$nldef_cats{$k} = '';
}
# The default output will organize the namelist variables according to the
# "category" attribute which is part of the definition. The ordering of the
# categories is set in the @categories array. The table headings are defined
# in the %cat_heading hash (order is not important in the hash definition).
my @categories = qw/
streams
datm
/;
my %cat_heading = (
'streams' => 'DATM: Stream Settings (file datm_atm_in) ',
'datm' => 'DATM: Non-stream Settings (file datm_in) ',
);
foreach my $cat (@categories) {
unless ($cat_heading{$cat} eq 'exclude') {
# Print table
print_start_table($cat, $cat_heading{$cat});
# get alphabetized list all the variable names in the category
my @vars = $nldef->get_var_names('category'=>$cat);
# get corresponding type and documentation
foreach my $var (@vars) {
my $type = $nldef->get_var_type($var);
my $doc = $nldef->get_var_doc_html($var);
my $grp = $nldef->get_group_name($var);
print_row($var, $type, $doc, $grp);
}
# Finish table
print_end_table();
}
$nldef_cats{$cat} = 'done';
}
# Finish
print <<"END_of_html";
END_of_html
#--------------------------------------------------------------------------------------------
sub print_start_table {
my $category = shift;
my $hdr = shift;
print <<"START_table";
$hdr
Namelist Variable
Type
Group
START_table
}
#--------------------------------------------------------------------------------------------
sub print_row {
my $name = shift;
my $type = shift;
my $doc = shift;
my $grp = shift;
print <<"END_of_row";