\n\n')
f.write('
\n')
f.write('
NCL User Guide examples
\n')
# Write a intro stuff needed for NCL Applications page
def write_apps_page_intro(f):
f.write('
\n')
f.write('
\n')
f.write('
\n\n')
f.write('
\n\n')
f.write('These are some of the NCL examples referenced in the NCL User Guide, in the\n')
f.write('order they appear in the guide. To copy and run any of these examples from a\n')
f.write('UNIX terminal window, type:\n\n')
f.write('
\n')
f.write(' ng4ex xxxxxxx\n')
f.write('
\n\n')
f.write('where
xxxxxxx is the name of the example with out the ".ncl" suffix, for\n')
f.write('example, "NUG_curvilinear_grid". Some of these example require one or more data files,\n')
f.write('which you can download from\n')
f.write('
http://www.ncl.ucar.edu/Document/Manuals/NCL_User_Guide/Data/.\n')
f.write('
\n\n')
# Count number of PNG images with "_lg.png" in the name
def count_lg_png_names(img_dir,nug_name):
# First check for single PNG image
png_file = "%s_lg.png" % nug_name
if(os.path.exists("%s/%s" % (img_dir,png_file))):
return(1)
else:
# Now check for multiple PNG images
png_file = "%s_1_lg.png" % nug_name
if(os.path.exists("%s/%s" % (img_dir,png_file))):
png_files = glob.glob("%s/%s_[0-9]_lg.png" % (img_dir,nug_name))
return(len(png_files))
return(0)
# Write
...
section for NUG example
def write_apps_page_examples(f,img_dir,nug_dict):
for nug_name in nug_dict.keys():
nfiles = count_lg_png_names(img_dir,nug_name)
nug_name_ncl = nug_name + ".ncl"
f.write('
\n')
f.write('\n' % nug_name)
f.write('
\n' % nug_name)
if(nfiles == 1):
f.write('
\n' % nug_name)
f.write('' % nug_name)
elif(nfiles > 1):
limit = 3
for i in range(min(limit,nfiles)):
f.write('
\n' % (nug_name,(i+1)))
f.write('\n' % (nug_name,(i+1)))
f.write('
%s:\n' % (nug_name_ncl,nug_name_ncl))
f.write(nug_dict[nug_name])
f.write('
\n')
if(nfiles == 0):
f.write('This example does not produce any graphics.
\n')
f.write('
\n\n')
# Write a footer for an HTML file
def write_apps_page_footer(f):
f.write('