/usr/share/metview/etc/macro_templates.txt is in metview-data 5.0.0~beta.1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | {basic for loop}
for _ = _ to _ do
<code>
end for
{for loop with step}
for _ = _ to _ by _ do
<code>
end for
{basic while loop}
while _ do
<code>
end while
{basic repeat loop}
repeat
<code>
until _
{loop through a list}
loop _ in _
<code>
end loop
{basic if test}
if _ then
<code>
end if
{if/else test}
if _ then
<code>
else
<code>
end if
{if/else if/else test}
if _ then
<code>
else if _ then
<code>
else
<code>
end if
{when statement}
when
<test> :
<code>
end
<test> :
<code>
end
end when
{case statement}
case _ of
_ :
<code>
end
_ :
<code>
end
otherwise :
<code>
end
end case
{function with no parameters}
# ----------------------------------------------------------------------------
# Function : func_name
#
# Author (date) : anonymous (--/--/2004)
#
# Description :
#
# Return value :
# ----------------------------------------------------------------------------
function func_name ()
end func_name
{function with general parameters}
# ----------------------------------------------------------------------------
# Function : func_name
#
# Author (date) : anonymous (--/--/2004)
#
# Description :
#
# Parameters :
#
# Return value :
# ----------------------------------------------------------------------------
function func_name (param1, param2)
end func_name
{function with specific parameters}
# ----------------------------------------------------------------------------
# Function : func_name
#
# Author (date) : anonymous (--/--/2004)
#
# Description :
#
# Parameters :
#
# Return value :
# ----------------------------------------------------------------------------
function func_name (param1: type, param2: type)
end func_name
{function with any no of parameters}
# ----------------------------------------------------------------------------
# Function : func_name
#
# Author (date) : anonymous (--/--/2004)
#
# Description :
#
# Parameters :
#
# Return value :
# ----------------------------------------------------------------------------
function func_name
loop arg in arguments()
end loop
end func_name
{function for macro library}
# **************************************************************************
# Function : name
#
# Syntax :
#
# Author (date) : Anonymous (--/--/----)
#
# Category :
#
# OneLineDesc :
#
# Description :
#
# Parameters :
#
# Return Value :
#
# Dependencies :
#
# Example Usage :
#
# **************************************************************************
function func_name (param1: type, param2: type)
end func_name
{runmode tests}
# Execute specific code depending on the runmode
strMode = runmode()
case strMode of
'execute':
print ('Running in execute mode')
end
'visualise' :
print ('Running in visualise mode')
end
'examine' :
print ('Running in examine mode')
end
'save' :
print ('Running in save mode')
end
'edit' :
print ('Running in edit mode')
end
'batch' :
print ('Running in batch mode')
end
'prepare' :
print ('Running in prepare mode')
end
otherwise :
fail ('Running in unknown mode - ' & strMode)
end
end case
{plot export}
# depending on the run mode, write the plot to a PNG file
# or else use the default action, which is to plot to the screen.
# Other output formats are available, e.g. using ps_output()
# or pdf_output().
strMode = runmode()
if strMode = 'execute' or strMode = 'batch' then
png = png_output (
output_name : 'my_plot',
output_resolution : 900
)
setoutput(png)
end if
{SCM interactive plot}
# we supply an empty parameter definition for the function, which will mean that
# a user interface will be brought up using default values
scm_plot_params = ()
mvl_plot_scm_data(scm_plot_params)
{SCM batch plot}
# we supply a parameter definition with some preferences. If mode = interactive,
# then a user interface will appear so that the user can make further selections;
# otherwise the macro will run using only the arguments defined here (and will
# produce a PostScript file).
scm_plot_params =
(
mode : 'batch', # 'interactive' or 'batch'
netcdf_1 : 'scm_out.nc',
#netcdf_2 : 'scm_out_2.nc', # should be nil, or omit the parameter if no comparison file
comparison_mode : 'overlay', # 'overlay' or 'difference'
output_mode : 'ps', # 'ps' or 'screen'
output_path : 'scm_out', # only if mode='batch'. Do not supply an extension.
param_selection : 'list', # 'list', 'file' or 'all'
param_list_path : nil, # path to a text file containing each parameter name on a new line
param_list : ['t_skin', 'top_lwrad_clr', 'u_wind_10m'] # if param_selection is 'list'
)
mvl_plot_scm_data(scm_plot_params)
|