#!/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 CAM Component Model Namelist Variables
This page contains the complete list of CAM namelist variables. 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.
Found standard names matching query:
END_of_Start
my $nldef_file = "../../../models/atm/cam/bld/namelist_files/namelist_definition.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/
initial_conditions
restart
history
diagnostics
cosp
test_tracers
topo
tropo
dyn_fv
dyn_fv_off
homme
dyn_spectral
dry_conv_adj
conv
cldfrc
cldsed
pbl
radiation
gw_drag
rayleigh_friction
solar
scam
cam_chem
dry_deposition
ghg_chem
waccm_ghg
waccm
waccm_phys
o3_data_cam
ghg_cam
co2_cycle
aero_data_cam
phys_debug
performance
perf_dp_coup
physconst
rad_drv
repro_sum
pbuf
build
/;
# Set headings for the table. Set the heading to 'exclude' to exclude a
# category from the table.
my %cat_heading = (
'initial_conditions'=> 'CAM: Initial Conditions',
'restart' => 'CAM: Restart (Continuation and Branch) Runs',
'history' => 'CAM: History and Initial Conditions Output',
'diagnostics' => 'CAM: Diagnostics',
'cosp' => 'CAM: Diagnostics - COSP Cloud Simulator Package',
'test_tracers' => 'CAM: Diagnostics - Test Tracers',
'topo' => 'CAM: Boundary Datasets - Topography',
'tropo' => 'CAM: Boundary Datasets - Tropopause',
'dyn_fv' => 'CAM: Dynamics - Finite Volume (FV)',
'dyn_fv_off' => 'CAM: Dynamics - Finite Volume - Offline mode',
'homme' => 'CAM: Dynamics - Spectral Element (SE)',
'dyn_spectral' => 'CAM: Dynamics - Spectral (Eulerian and SLD)',
'dry_conv_adj' => 'CAM: Physics - Dry Convective Adjustment',
'conv' => 'CAM: Physics - Moist Convection and Microphysics',
'cldfrc' => 'CAM: Physics - Cloud Fraction',
'cldsed' => 'CAM: Physics - Cloud Sedimentation',
'pbl' => 'CAM: Physics - Boundary Layer and Vertical Diffusion',
'radiation' => 'CAM: Physics - Radiation',
'gw_drag' => 'CAM: Physics - Gravity Wave Drag',
'rayleigh_friction' => 'CAM: Physics - Rayleigh Friction',
'solar' => 'CAM: Physics - Solar Parameters',
'scam' => 'CAM: Physics - Single Column Mode',
'cam_chem' => 'CAM: Chemistry - CAM-CHEM and WACCM',
'dry_deposition' => 'CAM: Chemistry - Dry Deposition',
'ghg_chem' => 'CAM: Chemistry - Simple GHG Mode',
'waccm_ghg' => 'CAM: Chemistry - WACCM in Simple GHG Mode',
'waccm' => 'CAM: Chemistry - WACCM only',
'waccm_phys' => 'CAM: WACCM Physics',
'o3_data_cam' => 'CAM: Species - Ozone - Prescribed (CAM3 version)',
'ghg_cam' => 'CAM: Species - Greenhouse Gases - Prescribed (CAM version)',
'co2_cycle' => 'CAM: Species - CO2 in Active Carbon Cycle (CCSM version)',
'aero_data_cam' => 'CAM: Species - Aerosol - Prescribed (CAM3 version)',
'phys_debug' => 'CAM: Debugging - Physics',
'performance' => 'CAM: Performance - Tuning and Profiling',
'perf_dp_coup' => 'CAM: Performance - Dynamics-Physics Coupler',
'physconst' => 'CAM: Physical Constants',
'rad_drv' => 'CAM: Utilities - Offline Radiation Driver',
'repro_sum' => 'CAM: Utilities - Reproducible Distributed Sum Calculation',
'pbuf' => 'CAM: Utilities - Physics Buffer',
'build' => 'CAM: exclude',
);
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";