/usr/share/doc/stilts/sun256/jelExamples.html is in stilts-doc 3.1.2-2.
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 | <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="sun-style.css">
<title>Examples</title>
</head>
<body>
<hr>
<a href="jelAdvanced.html">Next</a> <a href="uk.ac.starlink.ttools.func.Formats.html">Previous</a> <a href="jel.html">Up</a> <a href="index.html">Contents</a> <br> <b>Next: </b><a href="jelAdvanced.html">Advanced Topics</a><br>
<b>Up: </b><a href="jel.html">Algebraic Expression Syntax</a><br>
<b>Previous: </b><a href="uk.ac.starlink.ttools.func.Formats.html">Formats</a><br>
<hr>
<h3><a name="jelExamples">10.6 Examples</a></h3>
<p>Here are some examples for defining new columns;
the expressions below could appear as the <code><expr></code> in a
<code>tpipe</code> <code>addcol</code> or <code>sortexpr</code>
<a href="filterSteps.html">command</a>).
<dl>
<dt><strong>Average</strong></dt>
<dd><pre>
(first + second) * 0.5
</pre></dd>
<dt><strong>Square root</strong></dt>
<dd><pre>
sqrt(variance)
</pre></dd>
<dt><strong>Angle conversion</strong></dt>
<dd><pre>
radiansToDegrees(DEC_radians)
degreesToRadians(RA_degrees)
</pre></dd>
<dt><strong>Conversion from string to number</strong></dt>
<dd><pre>
parseInt($12)
parseDouble(ident)
</pre></dd>
<dt><strong>Conversion from number to string</strong></dt>
<dd><pre>
toString(index)
</pre></dd>
<dt><strong>Conversion between numeric types</strong></dt>
<dd><pre>
toShort(obs_type)
toDouble(range)
</pre><em>or</em><pre>
(short) obs_type
(double) range
</pre></dd>
<dt><strong>Conversion from sexagesimal to degrees</strong></dt>
<dd><pre>
hmsToDegrees(RA1950)
dmsToDegrees(decDeg,decMin,decSec)
</pre></dd>
<dt><strong>Conversion from degrees to sexagesimal</strong></dt>
<dd><pre>
degreesToDms($3)
degreesToHms(RA,2)
</pre></dd>
<dt><strong>Outlier clipping</strong></dt>
<dd><pre>
min(1000, max(value, 0))
</pre></dd>
<dt><strong>Converting a magic value to null</strong></dt>
<dd><pre>
jmag == 9999 ? NULL : jmag
</pre></dd>
<dt><strong>Converting a null value to a magic one</strong></dt>
<dd><pre>
NULL_jmag ? 9999 : jmag
</pre></dd>
<dt><strong>Taking the third scalar element from an array-valued column</strong></dt>
<dd><pre>
psfCounts[2]
</pre></dd>
<dt><strong>Converting spectral type to numeric value
(e.g. "L3.5" -> 23.5, "M7" -> 17)</strong></dt>
<dd><pre>
"MLT".indexOf(spType.charAt(0)) * 10 + parseDouble(substring(spType,1)) + 10
</pre>
Note this uses a couple of Java
<a href="http://docs.oracle.com/javase/6/docs/api//java/lang/String.html">String</a>
instance methods (<a href="instanceMethods.html">Section 10.7.2</a>)
which are not explicitly documented in this section.
</dd>
</dl>
Here are some examples of boolean expressions that could be used
for row selection (appearing in a <code>tpipe</code> <code>select</code>
command)
<dl>
<dt><strong>Within a numeric range</strong></dt>
<dd><pre>
RA > 100 && RA < 120 && Dec > 75 && Dec < 85
</pre></dd>
<dt><strong>Within a circle</strong></dt>
<dd><pre>
$2*$2 + $3*$3 < 1
skyDistanceDegrees(ra0,dec0,hmsToDegrees(RA),dmsToDegrees(DEC))<15./3600.
</pre></dd>
<dt><strong>First 100 rows</strong></dt>
<dd><pre>
index <= 100
</pre>
(though you could use <code>tpipe cmd='head 100'</code> instead)
</dd>
<dt><strong>Every tenth row</strong></dt>
<dd><pre>
index % 10 == 0
</pre>
(though you could use <code>tpipe cmd='every 10'</code> instead)
</dd>
<dt><strong>String equality/matching</strong></dt>
<dd><pre>
equals(SECTOR, "ZZ9 Plural Z Alpha")
equalsIgnoreCase(SECTOR, "zz9 plural z alpha")
startsWith(SECTOR, "ZZ")
contains(ph_qual, "U")
</pre></dd>
<dt><strong>String regular expression matching</strong></dt>
<dd><pre>
matches(SECTOR, "[XYZ] Alpha")
</pre></dd>
<dt><strong>Test for non-blank value</strong></dt>
<dd><pre>
! NULL_ellipticity
</pre></dd>
</dl>
</p>
<hr><a href="jelAdvanced.html">Next</a> <a href="uk.ac.starlink.ttools.func.Formats.html">Previous</a> <a href="jel.html">Up</a> <a href="index.html">Contents</a> <br> <b>Next: </b><a href="jelAdvanced.html">Advanced Topics</a><br>
<b>Up: </b><a href="jel.html">Algebraic Expression Syntax</a><br>
<b>Previous: </b><a href="uk.ac.starlink.ttools.func.Formats.html">Formats</a><br>
<hr><i>STILTS - Starlink Tables Infrastructure Library Tool Set<br>Starlink User Note256<br>STILTS web page:
<a href="http://www.starlink.ac.uk/stilts/">http://www.starlink.ac.uk/stilts/</a><br>Author email:
<a href="mailto:m.b.taylor@bristol.ac.uk">m.b.taylor@bristol.ac.uk</a><br>Mailing list:
<a href="mailto:topcat-user@jiscmail.ac.uk">topcat-user@jiscmail.ac.uk</a><br></i></body>
</html>
|