*********** * Name: emask.gs * Purpose: creates a mask for selecting or deselecting individual ensemble * members; modified from Wesley Ebisuzaki's monmask.gs (v1.0.1) * Defines a mask ("emask") where the n'th ensemble member is set to one * and the others are undefined and a second mask ("emaskinv") where the * nth ensemble member is set to undefined and the others to 1. * Version: 1.0, Fri Dec 10 15:44:36 FLEST 2010 * Author: Stefan Fronzek, stefan(dot)fronzek(at)ymparisto(dot)fi *********** function emask(arg) if (arg = '' | arg <= 0) say 'emask.gs - creates a mask for selecting or deselecting individual ensemble' say ' members; modified from Wesley Ebisuzaki"s monmask.gs (v1.0.1)' say ' Defines a mask ("emask") where the nth ensemble member is set to one' say ' and the others are undefined and a second mask ("emaskinv") where the' say ' nth ensemble member is set to undefined and the others to 1.' say 'Usage: run emask {e}' say ' e - ensemble member in the e-dimension' say 'Example: in a 10-member ensemble, deselect a member when calculating averages' say ' set lat 40' say ' set lon -90' say ' set e 1 10' say ' run emask 5' say ' set e 1' say ' display ave(expression*emaskinv,e=1,e=10)' exit endif monm1=arg-1 'define emask=1' 'define emasklng=const(emask(e-' monm1 '),0,-u)' 'define emasksht=const(emask(e-' arg '),0,-u)' 'define emask=emasklng-emasksht' 'define emask=maskout(emask,emask-0.5)' 'define emaskinv=maskout(1,-1*const(emask,-1,-u))' exit