diff options
Diffstat (limited to 'vendor/voclient/libvotable/examples')
35 files changed, 3480 insertions, 0 deletions
diff --git a/vendor/voclient/libvotable/examples/Makefile b/vendor/voclient/libvotable/examples/Makefile new file mode 100644 index 00000000..f431d3a0 --- /dev/null +++ b/vendor/voclient/libvotable/examples/Makefile @@ -0,0 +1,174 @@ +#/////////////////////////////////////////////////////////////////////////////// +#// +#// Makefile for the libVOTable example tasks. +#// +#/////////////////////////////////////////////////////////////////////////////// + +# primary dependencies + +NAME = VOTable +VERSION = 1.0 +PLATFORM := $(shell uname -s) +#PLATFORM = LINUX +#PLATFORM = MACOSX +#PLATFORM = CYGWIN +HERE := $(shell /bin/pwd) + + +# secondary dependencies + +LIBBASE = lib$(NAME) +STATICLIB = $(HERE)/$(LIBBASE).a +SHAREDLIB = $(HERE)/$(LIBBASE).so.$(VERSION) + + +# stuff that's precious to keep + +.PRECIOUS: $(STATICLIB) $(SHAREDLIB) +.KEEP_STATE: + + +# includes, flags and libraries +CC = gcc +CINCS = -I$(HERE) -I../ -I../include -L../ -L../../lib/ -L../ +CFLAGS = -g -Wall -D$(PLATFORM) $(CINCS) + +#F77 = g77 +F77 = gfortran -m64 +FFLAGS = -g -Wall + + + +# list of source and include files + +C_SRCS = votconcat.c votcompress.c votdump.c votget.c \ + votinfo.c votcopy.c +C_OBJS = votconcat.o votcompress.o votdump.o votget.o \ + votinfo.o votcopy.o +C_INCS = + +F77_SRCS = votpos_f77.f votdump_f77.f +F77_OBJS = votpos_f77.o votdump_f77.o +F77_INCS = + +SPP_SRCS = votget_spp.x votinfo_spp.x +SPP_OBJS = votget_spp.o votinfo_spp.o +SPP_INCS = votParse_spp.h + + +LIBS = -lVOTable -lcfitsio -lcurl -lm + +SPP_TASKS = votget_spp votinfo_spp +F77_TASKS = votpos_f77 votdump_f77 +C_TASKS = votcompress votcopy votdump votget votinfo votconcat votpos + +TARGETS = $(C_TASKS) # $(F77_TASKS) $(SPP_TASKS) + + +# Targets + +all: c_progs + +c_progs: $(C_TASKS) +spp_progs: $(SPP_TASKS) +f77_progs: $(F77_TASKS) + +clean: + /bin/rm -rf .make.state .nse_depinfo *.[aeo] *.dSYM + /bin/rm -rf $(TARGETS) + +everything: + make clean + make all + make install + +help: HELP + +install: all + + + +############################################################################### +# Unit test programs to be built. +############################################################################### + +demo: $(TARGETS) + + +########################### +# C Test programs +########################### + +zz: zz.c + $(CC) $(CFLAGS) -I/usr/local/include -o zz zz.c $(LIBS) -lcfitsio + +zztest: zztest.c + $(CC) $(CFLAGS) -o zztest zztest.c $(LIBS) + +votcompress: votcompress.c + $(CC) $(CFLAGS) -o votcompress votcompress.c $(LIBS) + +votconcat: votconcat.c + $(CC) $(CFLAGS) -o votconcat votconcat.c $(LIBS) + +votcopy: votcopy.c + $(CC) $(CFLAGS) -o votcopy votcopy.c $(LIBS) + +votdump: votdump.c + $(CC) $(CFLAGS) -o votdump votdump.c $(LIBS) + +votget: votget.c + $(CC) $(CFLAGS) -o votget votget.c $(LIBS) -lcurl + +votinfo: votinfo.c + $(CC) $(CFLAGS) -o votinfo votinfo.c $(LIBS) + +votpos: votpos.c + $(CC) $(CFLAGS) -o votpos votpos.c $(LIBS) + + + +########################### +# SPP Test programs +########################### + +votget_spp: votget_spp.x + xc -/I../ -/L../ votget_spp.x -lVOTable + +votinfo_spp: votinfo_spp.x + xc -/I../ -/L../ votinfo_spp.x -lVOTable + + + +########################### +# Fortran Test programs. +########################### + +votpos_f77: votpos_f77.f + $(F77) $(FFLAGS) -o votpos_f77 votpos_f77.f ../libVOTable.a -lc + +votdump_f77: votdump_f77.f + $(F77) $(FFLAGS) -o votdump_f77 votdump_f77.f -L../ -lVOTable -lm -lc + + + + +############################################################################### +# Leave this stuff alone. +############################################################################### + +$(STATICLIB): $(C_SRCS:%.c=Static/%.o) + /usr/bin/ar rv $@ $? +Static/%.o: %.c $(C_INCS) + /usr/bin/gcc $(CINCS) $(CFLAGS) -c $< -o $@ +Static: + /bin/mkdir $@ + chmod 777 $@ + +$(SHAREDLIB): $(C_SRCS:%.c=Shared/%.o) + /usr/bin/ld -shared -o $@ $? -lc -ldl +Shared/%.o: %.c $(C_INCS) + /usr/bin/gcc $(CINCS) $(CFLAGS) -fpic -shared -c $< -o $@ +Shared: + /bin/mkdir $@ + chmod 777 $@ diff --git a/vendor/voclient/libvotable/examples/README b/vendor/voclient/libvotable/examples/README new file mode 100644 index 00000000..b766b527 --- /dev/null +++ b/vendor/voclient/libvotable/examples/README @@ -0,0 +1,15 @@ + +This directory contains example programs using the libvotable interface. +These tasks are meant to be useful and tutorial in how to use the API to +do common things. + +Current Tasks: + + votconcat Concatenate RESOURCES into a single VOTable + votcomp Remove pretty-print whitespace from a VOTable + votdump Dump a VOTable in another format + votget Extract image access references and download + votlint Check a VOTable for correctness + votinfo Print information about the structure of a VOTable + votpos Extract position information from a VOTable + votsplit Split RESOURCEs from a VOTable to single VOTables diff --git a/vendor/voclient/libvotable/examples/_tasks b/vendor/voclient/libvotable/examples/_tasks new file mode 100644 index 00000000..c334a8e0 --- /dev/null +++ b/vendor/voclient/libvotable/examples/_tasks @@ -0,0 +1,19 @@ + +This directory contains example programs using the libvotable interface. +These tasks are meant to be useful and tutorial in how to use the API to +do common things. + +Current Tasks: + + votcomp Remove pretty-print whitespace from a VOTable + votget Extract image access references and download + Download ..... + + votlint Check a VOTable for correctness + votinfo Print information about the structure of a VOTable + + votdump Dump a VOTable in another format + votpos Extract position information from a VOTable + + votconcat Concatenate RESOURCES into a single VOTable + votsplit Split RESOURCEs from a VOTable to single VOTables diff --git a/vendor/voclient/libvotable/examples/data/scs_3c273.xml b/vendor/voclient/libvotable/examples/data/scs_3c273.xml new file mode 100644 index 00000000..9cb55b5b --- /dev/null +++ b/vendor/voclient/libvotable/examples/data/scs_3c273.xml @@ -0,0 +1,316 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE VOTABLE SYSTEM "http://us-vo.org/xml/VOTable.dtd"> +<VOTABLE version="v1.0"> + <DESCRIPTION> + Multimission Archive at STScI (MAST) archive.stsci.edu + send questions to: archive@stsci.edu + </DESCRIPTION> +<DEFINITIONS> + <COOSYS ID="myJ2000" system="eq_FK5" equinox="2000." epoch="2000."/> +</DEFINITIONS> +<RESOURCE type="results"> +<INFO name="QUERY_STATUS" value="OK"></INFO> +<PARAM ID="RA" name="RA" datatype="float" unit="degrees" value="187.278"></PARAM> +<PARAM ID="DEC" name="DEC" datatype="float" unit="degrees" value="2.05239"></PARAM> +<PARAM ID="max_records" name="max_records" value="2000"></PARAM> +<PARAM ID="verb" name="verb" value="1"></PARAM> +<PARAM ID="ordercolumn1" name="ordercolumn1" value="ang_sep"></PARAM> +<PARAM ID="ordercolumn2" name="ordercolumn2" value="sci_targname"></PARAM> +<PARAM ID="ordercolumn3" name="ordercolumn3" value="sci_data_set_name"></PARAM> +<PARAM ID="sci_aec" name="sci_aec" value="S"></PARAM> +<PARAM ID="sr" name="sr" datatype="float" unit="degrees" value="0.0004"></PARAM> +<PARAM ID="coordformat" name="coordformat" value="sex"></PARAM> +<PARAM ID="mission" name="mission" value="hst"></PARAM> +<PARAM ID="found_rows" name="found_rows" value="79"></PARAM> +<TABLE name="HST"> +<DESCRIPTION>MAST HST Search: 79 row(s) returned!</DESCRIPTION> +<FIELD name="Dataset" datatype="char" ucd="ID_MAIN" ><DESCRIPTION>Data set name First character indicates instrument; L=COS; I=WFC3; J=ACS; N=NICMOS; O=STIS; U=WFPC2; W=WFPC; X=FOC; Y=FOS; Z=GHRS; F=FGS; V=HSP; + </DESCRIPTION> +</FIELD> +<FIELD name="Target Name" datatype="char" ucd="ID_TARGET"><DESCRIPTION>Observer assigned target name; uppercase; no blank characters; spaces sometimes filled with - ; use with wildcards + </DESCRIPTION> +</FIELD> +<FIELD name="RA (J2000)" datatype="double" ucd="POS_EQ_RA_MAIN" unit="degrees" ref="myJ2000" ><DESCRIPTION>Right Ascension (J2000) + </DESCRIPTION> +</FIELD> +<FIELD name="Dec (J2000)" datatype="double" ucd="POS_EQ_DEC_MAIN" unit="degrees" ref="myJ2000" ><DESCRIPTION>Declination (J2000) + </DESCRIPTION> +</FIELD> +<FIELD name="Ref" datatype="int" ucd="REFER_CODE" ><DESCRIPTION>The number of known literature references associated with the listed proposal ID (HST) or data set name. + </DESCRIPTION> +</FIELD> +<FIELD name="Start Time" datatype="char" ucd="TIME_DATE" arraysize="*" ><DESCRIPTION>Observation start time + </DESCRIPTION> +</FIELD> +<FIELD name="Stop Time" datatype="char" ucd="TIME_DATE" arraysize="*" ><DESCRIPTION>Observation stop time + </DESCRIPTION> +</FIELD> +<FIELD name="Exp Time" datatype="float" ucd="TIME_EXPTIME" unit="seconds"><DESCRIPTION>Exposure time + </DESCRIPTION> +</FIELD> +<FIELD name="Instrument" datatype="char" ucd="INST_ID" arraysize="*" ><DESCRIPTION>Instrument used + </DESCRIPTION> +</FIELD> +<FIELD name="Apertures" datatype="char" ucd="INST_APERT" arraysize="*" ><DESCRIPTION>Aperture configuration See <a href="/hst/aperturelist.html"> a complete list</a> + </DESCRIPTION> +</FIELD> +<FIELD name="Filters/Gratings" datatype="char" ucd="INST_FILTER" arraysize="*" ><DESCRIPTION>Filter used. See <a href="/hst/filterlist.html"> a more complete list</a>; Sometimes combined so wildcard search may be needed + </DESCRIPTION> +</FIELD> +<FIELD name="Proposal ID" datatype="int" ucd="OBS_ID" ><DESCRIPTION>Integer assign to each proposal + </DESCRIPTION> +</FIELD> +<FIELD name="Release Date" datatype="char" ucd="TIME_DATE" arraysize="*" ><DESCRIPTION>Date data become publicly available + </DESCRIPTION> +</FIELD> +<FIELD name="Preview Name" datatype="char" ucd="ID_DATA" arraysize="*" ><DESCRIPTION>Preview name (generally the same as the data set name) + </DESCRIPTION> +</FIELD> +<FIELD name="High-Level Science Products" datatype="int" ><DESCRIPTION>Number of known High Level Science Products + </DESCRIPTION> +</FIELD> +<FIELD name="Ang Sep (')" datatype="float" ucd="POS_ANG_DIST_GENERAL" unit="arcmin"><DESCRIPTION>Angular Separation</DESCRIPTION></FIELD> +<DATA> +<TABLEDATA> +<TR> +<TD>J9MU09011</TD><TD>PG1226+023</TD><TD>187.277916667</TD><TD>2.05238888889</TD><TD>3</TD><TD>2007-01-17 12:40:27</TD><TD>2007-01-17 12:43:19</TD><TD>120.000</TD><TD>ACS</TD><TD>HRC</TD><TD>F550M;CLEAR2S</TD><TD>10833</TD><TD>2008-01-17 23:15:18</TD><TD>J9MU09011</TD><TD></TD><TD>0.005</TD> +</TR> +<TR> +<TD>J9MU09021</TD><TD>PG1226+023</TD><TD>187.277916667</TD><TD>2.05238888889</TD><TD>3</TD><TD>2007-01-17 12:44:09</TD><TD>2007-01-17 12:47:01</TD><TD>120.000</TD><TD>ACS</TD><TD>HRC</TD><TD>F550M;CLEAR2S</TD><TD>10833</TD><TD>2008-01-17 23:15:41</TD><TD>J9MU09021</TD><TD></TD><TD>0.005</TD> +</TR> +<TR> +<TD>J9MU09031</TD><TD>PG1226+023</TD><TD>187.277916667</TD><TD>2.05238888889</TD><TD>3</TD><TD>2007-01-17 12:47:51</TD><TD>2007-01-17 12:53:43</TD><TD>300.000</TD><TD>ACS</TD><TD>HRC</TD><TD>F550M;CLEAR2S</TD><TD>10833</TD><TD>2008-01-17 23:15:52</TD><TD>J9MU09031</TD><TD></TD><TD>0.005</TD> +</TR> +<TR> +<TD>J9MU09041</TD><TD>PG1226+023</TD><TD>187.277916667</TD><TD>2.05238888889</TD><TD>3</TD><TD>2007-01-17 12:54:33</TD><TD>2007-01-17 13:00:25</TD><TD>300.000</TD><TD>ACS</TD><TD>HRC</TD><TD>F550M;CLEAR2S</TD><TD>10833</TD><TD>2008-01-17 23:16:13</TD><TD>J9MU09041</TD><TD></TD><TD>0.005</TD> +</TR> +<TR> +<TD>J9MU09051</TD><TD>PG1226+023</TD><TD>187.277916667</TD><TD>2.05238888889</TD><TD>3</TD><TD>2007-01-17 13:01:13</TD><TD>2007-01-17 13:12:01</TD><TD>600.000</TD><TD>ACS</TD><TD>HRC</TD><TD>F550M;CLEAR2S</TD><TD>10833</TD><TD>2008-01-17 23:57:58</TD><TD>J9MU09051</TD><TD></TD><TD>0.005</TD> +</TR> +<TR> +<TD>J9MU09061</TD><TD>PG1226+023</TD><TD>187.277916667</TD><TD>2.05238888889</TD><TD>3</TD><TD>2007-01-17 13:12:47</TD><TD>2007-01-17 13:23:35</TD><TD>600.000</TD><TD>ACS</TD><TD>HRC</TD><TD>F550M;CLEAR2S</TD><TD>10833</TD><TD>2008-01-17 23:26:37</TD><TD>J9MU09061</TD><TD></TD><TD>0.005</TD> +</TR> +<TR> +<TD>F2BV0101M</TD><TD>1226+023INCA221-83</TD><TD>187.277916667</TD><TD>2.05238888889</TD><TD>1</TD><TD>1994-05-07 18:45:59</TD><TD>1994-05-07 19:18:27</TD><TD>167.599</TD><TD>FGS</TD><TD>3</TD><TD>F583W</TD><TD>5333</TD><TD>1995-05-08 15:21:47</TD><TD></TD><TD></TD><TD>0.005</TD> +</TR> +<TR> +<TD>F2BV0106M</TD><TD>1226+023INCA221-83</TD><TD>187.277916667</TD><TD>2.05238888889</TD><TD>1</TD><TD>1994-05-07 18:59:32</TD><TD>1994-05-07 19:18:27</TD><TD>167.521</TD><TD>FGS</TD><TD>3</TD><TD>NOCHANGE;F583W</TD><TD>5333</TD><TD>1995-05-08 15:23:58</TD><TD></TD><TD></TD><TD>0.005</TD> +</TR> +<TR> +<TD>F2BV010BM</TD><TD>1226+023INCA221-83</TD><TD>187.277916667</TD><TD>2.05238888889</TD><TD>1</TD><TD>1994-05-07 19:12:36</TD><TD>1994-05-07 19:18:27</TD><TD>167.445</TD><TD>FGS</TD><TD>3</TD><TD>NOCHANGE;F583W</TD><TD>5333</TD><TD>1995-05-08 15:25:59</TD><TD></TD><TD></TD><TD>0.005</TD> +</TR> +<TR> +<TD>X0LA0101T</TD><TD>3C273</TD><TD>187.278</TD><TD>2.05227777778</TD><TD>3</TD><TD>1992-02-24 19:43:03</TD><TD>1992-02-24 20:07:59</TD><TD>1301.125</TD><TD>FOC</TD><TD>512X512</TD><TD>CLEAR1;CLEAR2;F210M;CLEAR4</TD><TD>1227</TD><TD>1993-02-24 16:27:34</TD><TD>X0LA0101T</TD><TD></TD><TD>0.007</TD> +</TR> +<TR> +<TD>X0LA0102T</TD><TD>3C273</TD><TD>187.278</TD><TD>2.05227777778</TD><TD>3</TD><TD>1992-02-24 21:02:04</TD><TD>1992-02-24 21:10:20</TD><TD>277.125</TD><TD>FOC</TD><TD>512X512</TD><TD>F4ND;CLEAR2;F210M;CLEAR4</TD><TD>1227</TD><TD>1993-02-24 22:07:10</TD><TD>X0LA0102T</TD><TD></TD><TD>0.007</TD> +</TR> +<TR> +<TD>X0LA0201T</TD><TD>3C273</TD><TD>187.278</TD><TD>2.05227777778</TD><TD>3</TD><TD>1992-03-01 12:29:08</TD><TD>1992-03-01 12:49:04</TD><TD>1002.125</TD><TD>FOC</TD><TD>512X512</TD><TD>CLEAR1;CLEAR2;F170M;CLEAR4</TD><TD>1227</TD><TD>1993-03-01 22:23:59</TD><TD>X0LA0201T</TD><TD></TD><TD>0.007</TD> +</TR> +<TR> +<TD>X0LA0202T</TD><TD>3C273</TD><TD>187.278</TD><TD>2.05227777778</TD><TD>3</TD><TD>1992-03-01 13:47:19</TD><TD>1992-03-01 14:07:15</TD><TD>1195.750</TD><TD>FOC</TD><TD>512X512</TD><TD>CLEAR1;CLEAR2;F170M;CLEAR4</TD><TD>1227</TD><TD>1993-03-02 15:42:36</TD><TD>X0LA0202T</TD><TD></TD><TD>0.007</TD> +</TR> +<TR> +<TD>X0LA0203T</TD><TD>3C273</TD><TD>187.278</TD><TD>2.05227777778</TD><TD>3</TD><TD>1992-03-01 15:24:06</TD><TD>1992-03-01 15:40:42</TD><TD>995.750</TD><TD>FOC</TD><TD>512X512</TD><TD>CLEAR1;CLEAR2;F140M;CLEAR4</TD><TD>1227</TD><TD>1993-03-01 22:29:18</TD><TD>X0LA0203T</TD><TD></TD><TD>0.007</TD> +</TR> +<TR> +<TD>X0LA0204T</TD><TD>3C273</TD><TD>187.278</TD><TD>2.05227777778</TD><TD>3</TD><TD>1992-03-01 17:00:22</TD><TD>1992-03-01 17:16:58</TD><TD>995.750</TD><TD>FOC</TD><TD>512X512</TD><TD>CLEAR1;CLEAR2;F140M;CLEAR4</TD><TD>1227</TD><TD>1993-03-01 22:34:33</TD><TD>X0LA0204T</TD><TD></TD><TD>0.007</TD> +</TR> +<TR> +<TD>X0LA0301T</TD><TD>3C273</TD><TD>187.278</TD><TD>2.05227777778</TD><TD>3</TD><TD>1992-03-01 18:53:50</TD><TD>1992-03-01 19:10:26</TD><TD>995.750</TD><TD>FOC</TD><TD>512X512</TD><TD>F2ND;CLEAR2;F210M;CLEAR4</TD><TD>1227</TD><TD>1993-03-01 22:40:39</TD><TD>X0LA0301T</TD><TD></TD><TD>0.007</TD> +</TR> +<TR> +<TD>X0LA0302T</TD><TD>3C273</TD><TD>187.278</TD><TD>2.05227777778</TD><TD>3</TD><TD>1992-03-01 20:18:25</TD><TD>1992-03-01 20:35:01</TD><TD>995.750</TD><TD>FOC</TD><TD>512X512</TD><TD>CLEAR1;CLEAR2;F210M;CLEAR4</TD><TD>1227</TD><TD>1993-03-01 22:47:26</TD><TD>X0LA0302T</TD><TD></TD><TD>0.007</TD> +</TR> +<TR> +<TD>O44301010</TD><TD>3C273</TD><TD>187.278</TD><TD>2.05225</TD><TD>5</TD><TD>1999-01-31 20:04:29</TD><TD>1999-01-31 20:21:27</TD><TD>974.000</TD><TD>STIS</TD><TD>52X2</TD><TD>G430L</TD><TD>7568</TD><TD>2007-01-22 16:28:03</TD><TD>O44301010</TD><TD></TD><TD>0.008</TD> +</TR> +<TR> +<TD>O44301020</TD><TD>3C273</TD><TD>187.278</TD><TD>2.05225</TD><TD>5</TD><TD>1999-01-31 20:27:04</TD><TD>1999-01-31 20:40:44</TD><TD>776.000</TD><TD>STIS</TD><TD>52X2</TD><TD>G750L</TD><TD>7568</TD><TD>2007-01-22 15:25:32</TD><TD>O44301020</TD><TD></TD><TD>0.008</TD> +</TR> +<TR> +<TD>O44301UPQ</TD><TD>3C273</TD><TD>187.278</TD><TD>2.05225</TD><TD>5</TD><TD>1999-01-31 19:57:01</TD><TD>1999-01-31 19:59:54</TD><TD>0.700</TD><TD>STIS</TD><TD>F28X50LP</TD><TD>MIRVIS</TD><TD>7568</TD><TD>2007-01-19 05:38:45</TD><TD></TD><TD></TD><TD>0.008</TD> +</TR> +<TR> +<TD>Y0G40203T</TD><TD>PG1226+023</TD><TD>187.277958333</TD><TD>2.05225</TD><TD>32</TD><TD>1991-01-14 14:52:58</TD><TD>1991-01-14 15:16:30</TD><TD>21.600</TD><TD>FOS</TD><TD>0.3</TD><TD>MIRROR</TD><TD>3088</TD><TD>1991-02-14 17:32:03</TD><TD></TD><TD></TD><TD>0.009</TD> +</TR> +<TR> +<TD>Y0G40102T</TD><TD>PG1226+023</TD><TD>187.277916667</TD><TD>2.05222222222</TD><TD>32</TD><TD>1991-01-16 13:30:23</TD><TD>1991-01-16 13:30:48</TD><TD>0.240</TD><TD>FOS</TD><TD>4.3</TD><TD>MIRROR</TD><TD>3088</TD><TD>1991-02-16 15:02:58</TD><TD></TD><TD></TD><TD>0.011</TD> +</TR> +<TR> +<TD>Y0G40105T</TD><TD>PG1226+023</TD><TD>187.277916667</TD><TD>2.05222222222</TD><TD>32</TD><TD>1991-01-16 16:52:23</TD><TD>1991-01-16 16:54:36</TD><TD>120.320</TD><TD>FOS</TD><TD>4.3</TD><TD>MIRROR</TD><TD>3088</TD><TD>1991-02-17 00:33:22</TD><TD></TD><TD></TD><TD>0.011</TD> +</TR> +<TR> +<TD>Y0G40106T</TD><TD>PG1226+023</TD><TD>187.277916667</TD><TD>2.05222222222</TD><TD>32</TD><TD>1991-01-16 17:00:07</TD><TD>1991-01-16 17:08:52</TD><TD>500.000</TD><TD>FOS</TD><TD>4.3</TD><TD>G130H</TD><TD>3088</TD><TD>1991-02-17 00:35:33</TD><TD>Y0G40106T</TD><TD>2</TD><TD>0.011</TD> +</TR> +<TR> +<TD>Y0G40107T</TD><TD>PG1226+023</TD><TD>187.277916667</TD><TD>2.05222222222</TD><TD>32</TD><TD>1991-01-16 18:21:15</TD><TD>1991-01-16 18:38:44</TD><TD>1000.000</TD><TD>FOS</TD><TD>1.0</TD><TD>G130H</TD><TD>3088</TD><TD>1991-02-17 00:36:58</TD><TD>Y0G40107T</TD><TD>2</TD><TD>0.011</TD> +</TR> +<TR> +<TD>Y0G40109T</TD><TD>PG1226+023</TD><TD>187.277916667</TD><TD>2.05222222222</TD><TD>32</TD><TD>1991-01-16 19:56:52</TD><TD>1991-01-16 20:23:05</TD><TD>1500.000</TD><TD>FOS</TD><TD>0.5</TD><TD>G130H</TD><TD>3088</TD><TD>1991-02-17 00:40:19</TD><TD>Y0G40109T</TD><TD>2</TD><TD>0.011</TD> +</TR> +<TR> +<TD>Y0G4010BT</TD><TD>PG1226+023</TD><TD>187.277916667</TD><TD>2.05222222222</TD><TD>32</TD><TD>1991-01-16 21:33:26</TD><TD>1991-01-16 21:56:09</TD><TD>1300.000</TD><TD>FOS</TD><TD>0.3</TD><TD>G130H</TD><TD>3088</TD><TD>1991-02-17 00:43:34</TD><TD>Y0G4010BT</TD><TD>2</TD><TD>0.011</TD> +</TR> +<TR> +<TD>Y0G4010CT</TD><TD>PG1226+023</TD><TD>187.277916667</TD><TD>2.05222222222</TD><TD>32</TD><TD>1991-01-16 23:09:35</TD><TD>1991-01-16 23:32:18</TD><TD>1300.000</TD><TD>FOS</TD><TD>0.3</TD><TD>G130H</TD><TD>3088</TD><TD>1991-02-17 00:45:13</TD><TD>Y0G4010CT</TD><TD>2</TD><TD>0.011</TD> +</TR> +<TR> +<TD>Y0G4010FT</TD><TD>PG1226+023</TD><TD>187.277916667</TD><TD>2.05222222222</TD><TD>32</TD><TD>1991-01-17 02:23:40</TD><TD>1991-01-17 02:58:37</TD><TD>2000.000</TD><TD>FOS</TD><TD>0.25X2.0</TD><TD>G130H</TD><TD>3088</TD><TD>1991-02-17 14:42:02</TD><TD>Y0G4010FT</TD><TD>2</TD><TD>0.011</TD> +</TR> +<TR> +<TD>Y0G40202T</TD><TD>PG1226+023</TD><TD>187.277916667</TD><TD>2.05222222222</TD><TD>32</TD><TD>1991-01-14 14:42:27</TD><TD>1991-01-14 14:43:53</TD><TD>0.480</TD><TD>FOS</TD><TD>4.3</TD><TD>MIRROR</TD><TD>3088</TD><TD>1991-02-14 17:28:47</TD><TD></TD><TD></TD><TD>0.011</TD> +</TR> +<TR> +<TD>Y0G40207T</TD><TD>PG1226+023</TD><TD>187.277916667</TD><TD>2.05222222222</TD><TD>32</TD><TD>1991-01-14 17:56:03</TD><TD>1991-01-14 18:12:31</TD><TD>705.000</TD><TD>FOS</TD><TD>1.0</TD><TD>G190H</TD><TD>3088</TD><TD>1991-02-15 00:47:09</TD><TD>Y0G40207T</TD><TD>2</TD><TD>0.011</TD> +</TR> +<TR> +<TD>Y0G40209T</TD><TD>PG1226+023</TD><TD>187.277916667</TD><TD>2.05222222222</TD><TD>32</TD><TD>1991-01-14 19:31:53</TD><TD>1991-01-14 19:56:56</TD><TD>1071.600</TD><TD>FOS</TD><TD>0.5</TD><TD>G190H</TD><TD>3088</TD><TD>1991-02-15 00:50:19</TD><TD>Y0G40209T</TD><TD>2</TD><TD>0.011</TD> +</TR> +<TR> +<TD>Y0G4020BT</TD><TD>PG1226+023</TD><TD>187.277916667</TD><TD>2.05222222222</TD><TD>32</TD><TD>1991-01-14 21:08:28</TD><TD>1991-01-14 21:29:53</TD><TD>930.600</TD><TD>FOS</TD><TD>0.3</TD><TD>G190H</TD><TD>3088</TD><TD>1991-02-15 00:53:59</TD><TD>Y0G4020BT</TD><TD>2</TD><TD>0.011</TD> +</TR> +<TR> +<TD>Y0G4020CT</TD><TD>PG1226+023</TD><TD>187.277916667</TD><TD>2.05222222222</TD><TD>32</TD><TD>1991-01-14 22:44:36</TD><TD>1991-01-14 23:06:01</TD><TD>930.600</TD><TD>FOS</TD><TD>0.3</TD><TD>G190H</TD><TD>3088</TD><TD>1991-02-15 01:22:14</TD><TD>Y0G4020CT</TD><TD>2</TD><TD>0.011</TD> +</TR> +<TR> +<TD>Y0G4020ET</TD><TD>PG1226+023</TD><TD>187.277916667</TD><TD>2.05222222222</TD><TD>32</TD><TD>1991-01-15 00:23:25</TD><TD>1991-01-15 00:44:45</TD><TD>930.600</TD><TD>FOS</TD><TD>0.3</TD><TD>G270H</TD><TD>3088</TD><TD>1991-02-15 01:25:46</TD><TD>Y0G4020ET</TD><TD>2</TD><TD>0.011</TD> +</TR> +<TR> +<TD>Y0G4020FT</TD><TD>PG1226+023</TD><TD>187.277916667</TD><TD>2.05222222222</TD><TD>32</TD><TD>1991-01-15 01:58:16</TD><TD>1991-01-15 02:19:36</TD><TD>930.600</TD><TD>FOS</TD><TD>0.3</TD><TD>G270H</TD><TD>3088</TD><TD>1991-02-15 17:07:09</TD><TD>Y0G4020FT</TD><TD>2</TD><TD>0.011</TD> +</TR> +<TR> +<TD>Y0G4020HT</TD><TD>PG1226+023</TD><TD>187.277916667</TD><TD>2.05222222222</TD><TD>32</TD><TD>1991-01-15 03:35:45</TD><TD>1991-01-15 04:00:43</TD><TD>1071.600</TD><TD>FOS</TD><TD>0.5</TD><TD>G270H</TD><TD>3088</TD><TD>1991-02-15 17:13:19</TD><TD>Y0G4020HT</TD><TD>2</TD><TD>0.011</TD> +</TR> +<TR> +<TD>Y0G4020JT</TD><TD>PG1226+023</TD><TD>187.277916667</TD><TD>2.05222222222</TD><TD>32</TD><TD>1991-01-15 10:03:19</TD><TD>1991-01-15 10:19:44</TD><TD>705.000</TD><TD>FOS</TD><TD>1.0</TD><TD>G270H</TD><TD>3088</TD><TD>1991-02-15 17:17:21</TD><TD>Y0G4020JT</TD><TD>2</TD><TD>0.011</TD> +</TR> +<TR> +<TD>Y0G4020LT</TD><TD>PG1226+023</TD><TD>187.277916667</TD><TD>2.05222222222</TD><TD>32</TD><TD>1991-01-15 11:41:08</TD><TD>1991-01-15 11:49:40</TD><TD>366.600</TD><TD>FOS</TD><TD>4.3</TD><TD>G270H</TD><TD>3088</TD><TD>1991-02-15 17:21:44</TD><TD>Y0G4020LT</TD><TD>2</TD><TD>0.011</TD> +</TR> +<TR> +<TD>Y0G4020MT</TD><TD>PG1226+023</TD><TD>187.277916667</TD><TD>2.05222222222</TD><TD>32</TD><TD>1991-01-15 11:57:18</TD><TD>1991-01-15 11:57:19</TD><TD>1.000</TD><TD>FOS</TD><TD>0.25X2.0</TD><TD>G270H</TD><TD>3088</TD><TD>1991-02-15 17:31:46</TD><TD></TD><TD></TD><TD>0.011</TD> +</TR> +<TR> +<TD>Y0G4020NT</TD><TD>PG1226+023</TD><TD>187.277916667</TD><TD>2.05222222222</TD><TD>32</TD><TD>1991-01-15 13:16:26</TD><TD>1991-01-15 13:49:16</TD><TD>1410.000</TD><TD>FOS</TD><TD>0.25X2.0</TD><TD>G270H</TD><TD>3088</TD><TD>1991-02-15 17:56:38</TD><TD>Y0G4020NT</TD><TD>2</TD><TD>0.011</TD> +</TR> +<TR> +<TD>Y0G4020PT</TD><TD>PG1226+023</TD><TD>187.277916667</TD><TD>2.05222222222</TD><TD>32</TD><TD>1991-01-15 16:30:20</TD><TD>1991-01-15 17:03:17</TD><TD>1410.000</TD><TD>FOS</TD><TD>0.25X2.0</TD><TD>G190H</TD><TD>3088</TD><TD>1991-02-15 23:26:24</TD><TD>Y0G4020PT</TD><TD>2</TD><TD>0.011</TD> +</TR> +<TR> +<TD>F2M40301M</TD><TD>3C273</TD><TD>187.277958333</TD><TD>2.05219444444</TD><TD>1</TD><TD>1995-03-21 17:09:36</TD><TD>1995-03-21 19:06:07</TD><TD>1595.950</TD><TD>FGS</TD><TD>3</TD><TD>PUPIL</TD><TD>5686</TD><TD>1996-03-25 21:27:39</TD><TD></TD><TD></TD><TD>0.012</TD> +</TR> +<TR> +<TD>F2M40302M</TD><TD>3C273</TD><TD>187.277958333</TD><TD>2.05219444444</TD><TD>1</TD><TD>1995-03-21 18:42:08</TD><TD>1995-03-21 19:06:06</TD><TD>1095.950</TD><TD>FGS</TD><TD>3</TD><TD>PUPIL</TD><TD>5686</TD><TD>1996-03-25 21:27:57</TD><TD></TD><TD></TD><TD>0.012</TD> +</TR> +<TR> +<TD>Y0NB0101T</TD><TD>3C273</TD><TD>187.277958333</TD><TD>2.05219444444</TD><TD>13</TD><TD>1991-07-09 04:56:16</TD><TD>1991-07-09 04:57:04</TD><TD>0.500</TD><TD>FOS</TD><TD>4.3</TD><TD>MIRROR</TD><TD>1029</TD><TD>1992-07-08 14:53:51</TD><TD></TD><TD></TD><TD>0.012</TD> +</TR> +<TR> +<TD>Y0NB0102T</TD><TD>3C273</TD><TD>187.277958333</TD><TD>2.05219444444</TD><TD>13</TD><TD>1991-07-09 06:15:02</TD><TD>1991-07-09 06:48:36</TD><TD>1440.000</TD><TD>FOS</TD><TD>4.3</TD><TD>G130H</TD><TD>1029</TD><TD>1992-07-08 14:57:27</TD><TD>Y0NB0102T</TD><TD></TD><TD>0.012</TD> +</TR> +<TR> +<TD>Y0NB0103T</TD><TD>3C273</TD><TD>187.277958333</TD><TD>2.05219444444</TD><TD>13</TD><TD>1991-07-09 07:54:24</TD><TD>1991-07-09 08:27:58</TD><TD>1440.000</TD><TD>FOS</TD><TD>4.3</TD><TD>G190H</TD><TD>1029</TD><TD>1992-07-08 15:00:30</TD><TD>Y0NB0103T</TD><TD></TD><TD>0.012</TD> +</TR> +<TR> +<TD>Y0NB0104T</TD><TD>3C273</TD><TD>187.277958333</TD><TD>2.05219444444</TD><TD>13</TD><TD>1991-07-09 09:31:18</TD><TD>1991-07-09 10:04:52</TD><TD>1440.000</TD><TD>FOS</TD><TD>4.3</TD><TD>G270H</TD><TD>1029</TD><TD>1992-07-08 15:03:26</TD><TD>Y0NB0104T</TD><TD></TD><TD>0.012</TD> +</TR> +<TR> +<TD>Y0NB0105T</TD><TD>3C273</TD><TD>187.277958333</TD><TD>2.05219444444</TD><TD>13</TD><TD>1991-07-09 11:06:41</TD><TD>1991-07-09 11:40:15</TD><TD>1440.000</TD><TD>FOS</TD><TD>4.3</TD><TD>G190H</TD><TD>1029</TD><TD>1992-07-08 21:27:23</TD><TD>Y0NB0105T</TD><TD></TD><TD>0.012</TD> +</TR> +<TR> +<TD>Y0NB0106T</TD><TD>3C273</TD><TD>187.277958333</TD><TD>2.05219444444</TD><TD>13</TD><TD>1991-07-09 12:43:32</TD><TD>1991-07-09 13:17:06</TD><TD>1440.000</TD><TD>FOS</TD><TD>4.3</TD><TD>G130H</TD><TD>1029</TD><TD>1992-07-08 21:31:32</TD><TD>Y0NB0106T</TD><TD></TD><TD>0.012</TD> +</TR> +<TR> +<TD>Y0G40103T</TD><TD>PG1226+023</TD><TD>187.277958333</TD><TD>2.05216666667</TD><TD>32</TD><TD>1991-01-16 15:09:10</TD><TD>1991-01-16 15:32:44</TD><TD>43.200</TD><TD>FOS</TD><TD>0.3</TD><TD>MIRROR</TD><TD>3088</TD><TD>1991-02-16 17:22:01</TD><TD></TD><TD></TD><TD>0.013</TD> +</TR> +<TR> +<TD>Y0G4010ET</TD><TD>PG1226+023</TD><TD>187.277916667</TD><TD>2.05216666667</TD><TD>32</TD><TD>1991-01-17 00:52:23</TD><TD>1991-01-17 00:59:07</TD><TD>90.000</TD><TD>FOS</TD><TD>0.25X2.0</TD><TD>G130H</TD><TD>3088</TD><TD>1991-02-17 14:37:39</TD><TD></TD><TD></TD><TD>0.015</TD> +</TR> +<TR> +<TD>J8CW08011</TD><TD>3C273</TD><TD>187.27775</TD><TD>2.05227777778</TD><TD>23</TD><TD>2002-07-19 21:46:06</TD><TD>2002-07-19 23:40:19</TD><TD>2200.000</TD><TD>ACS</TD><TD>HRC-CORON1.8</TD><TD>F606W;CLEAR2S</TD><TD>8992</TD><TD>2002-10-18 15:31:39</TD><TD>J8CW08011</TD><TD></TD><TD>0.016</TD> +</TR> +<TR> +<TD>J8CW08041</TD><TD>3C273</TD><TD>187.27775</TD><TD>2.05227777778</TD><TD>23</TD><TD>2002-07-20 00:58:05</TD><TD>2002-07-20 02:55:31</TD><TD>2550.000</TD><TD>ACS</TD><TD>HRC-CORON1.8</TD><TD>F606W;CLEAR2S</TD><TD>8992</TD><TD>2002-10-18 11:44:17</TD><TD>J8CW08041</TD><TD></TD><TD>0.016</TD> +</TR> +<TR> +<TD>J8CW08071</TD><TD>3C273</TD><TD>187.27775</TD><TD>2.05227777778</TD><TD>23</TD><TD>2002-07-20 04:10:52</TD><TD>2002-07-20 04:54:11</TD><TD>2550.000</TD><TD>ACS</TD><TD>HRC-CORON1.8</TD><TD>F475W;CLEAR2S</TD><TD>8992</TD><TD>2002-10-18 13:40:44</TD><TD>J8CW08071</TD><TD></TD><TD>0.016</TD> +</TR> +<TR> +<TD>J8CW08081</TD><TD>3C273</TD><TD>187.27775</TD><TD>2.05227777778</TD><TD>23</TD><TD>2002-07-20 05:46:32</TD><TD>2002-07-20 06:30:21</TD><TD>2580.000</TD><TD>ACS</TD><TD>HRC-CORON1.8</TD><TD>F475W;CLEAR2S</TD><TD>8992</TD><TD>2002-10-18 13:41:38</TD><TD>J8CW08081</TD><TD></TD><TD>0.016</TD> +</TR> +<TR> +<TD>J8CW09011</TD><TD>3C273</TD><TD>187.27775</TD><TD>2.05227777778</TD><TD>23</TD><TD>2002-07-20 07:33:34</TD><TD>2002-07-20 08:11:02</TD><TD>2200.000</TD><TD>ACS</TD><TD>HRC-CORON1.8</TD><TD>CLEAR1S;F814W</TD><TD>8992</TD><TD>2002-10-18 13:42:40</TD><TD>J8CW09011</TD><TD></TD><TD>0.016</TD> +</TR> +<TR> +<TD>J8CW09021</TD><TD>3C273</TD><TD>187.27775</TD><TD>2.05227777778</TD><TD>23</TD><TD>2002-07-20 08:58:50</TD><TD>2002-07-20 09:42:39</TD><TD>2580.000</TD><TD>ACS</TD><TD>HRC-CORON1.8</TD><TD>CLEAR1S;F814W</TD><TD>8992</TD><TD>2002-10-18 13:44:22</TD><TD>J8CW09021</TD><TD></TD><TD>0.016</TD> +</TR> +<TR> +<TD>J8CW08N4Q</TD><TD>3C273</TD><TD>187.277708333</TD><TD>2.05227777778</TD><TD>23</TD><TD>2002-07-19 20:56:45</TD><TD>2002-07-19 20:56:57</TD><TD>10.000</TD><TD>ACS</TD><TD>HRC-ACQ</TD><TD>F502N;CLEAR2S</TD><TD>8992</TD><TD>2002-10-18 15:29:56</TD><TD>J8CW08N4Q</TD><TD></TD><TD>0.019</TD> +</TR> +<TR> +<TD>J8CW09P3Q</TD><TD>3C273</TD><TD>187.277708333</TD><TD>2.05227777778</TD><TD>23</TD><TD>2002-07-20 07:30:00</TD><TD>2002-07-20 07:30:12</TD><TD>10.000</TD><TD>ACS</TD><TD>HRC-ACQ</TD><TD>F502N;CLEAR2S</TD><TD>8992</TD><TD>2002-10-18 13:47:01</TD><TD>J8CW09P3Q</TD><TD></TD><TD>0.019</TD> +</TR> +<TR> +<TD>J8EA01011</TD><TD>3C273</TD><TD>187.277708333</TD><TD>2.05227777778</TD><TD>0</TD><TD>2003-04-11 11:01:05</TD><TD>2003-04-11 11:36:42</TD><TD>1950.000</TD><TD>ACS</TD><TD>WFC2-ORAMP</TD><TD>CLEAR1L;FR782N</TD><TD>9294</TD><TD>2004-04-12 03:50:34</TD><TD>J8EA01011</TD><TD></TD><TD>0.019</TD> +</TR> +<TR> +<TD>J8EA02011</TD><TD>3C273</TD><TD>187.277708333</TD><TD>2.05227777778</TD><TD>0</TD><TD>2003-04-12 11:02:00</TD><TD>2003-04-12 11:37:37</TD><TD>1950.000</TD><TD>ACS</TD><TD>WFC2-ORAMP</TD><TD>CLEAR1L;FR601N</TD><TD>9294</TD><TD>2004-04-12 18:02:45</TD><TD>J8EA02011</TD><TD></TD><TD>0.019</TD> +</TR> +<TR> +<TD>O5D301010</TD><TD>3C273</TD><TD>187.277708333</TD><TD>2.05227777778</TD><TD>8</TD><TD>2000-06-21 22:30:18</TD><TD>2000-06-21 23:05:06</TD><TD>2088.000</TD><TD>STIS</TD><TD>0.2X0.2</TD><TD>E140M</TD><TD>8017</TD><TD>2006-12-24 07:46:48</TD><TD>O5D301010</TD><TD></TD><TD>0.019</TD> +</TR> +<TR> +<TD>O5D301020</TD><TD>3C273</TD><TD>187.277708333</TD><TD>2.05227777778</TD><TD>8</TD><TD>2000-06-21 23:58:49</TD><TD>2000-06-22 00:47:08</TD><TD>2899.000</TD><TD>STIS</TD><TD>0.2X0.2</TD><TD>E140M</TD><TD>8017</TD><TD>2006-12-24 09:53:33</TD><TD>O5D301020</TD><TD></TD><TD>0.019</TD> +</TR> +<TR> +<TD>O5D301030</TD><TD>3C273</TD><TD>187.277708333</TD><TD>2.05227777778</TD><TD>8</TD><TD>2000-06-22 01:35:20</TD><TD>2000-06-22 02:23:39</TD><TD>2899.000</TD><TD>STIS</TD><TD>0.2X0.2</TD><TD>E140M</TD><TD>8017</TD><TD>2006-12-26 19:09:22</TD><TD>O5D301030</TD><TD></TD><TD>0.019</TD> +</TR> +<TR> +<TD>O5D301040</TD><TD>3C273</TD><TD>187.277708333</TD><TD>2.05227777778</TD><TD>8</TD><TD>2000-06-22 03:11:50</TD><TD>2000-06-22 04:00:09</TD><TD>2899.000</TD><TD>STIS</TD><TD>0.2X0.2</TD><TD>E140M</TD><TD>8017</TD><TD>2006-12-26 20:53:33</TD><TD>O5D301040</TD><TD></TD><TD>0.019</TD> +</TR> +<TR> +<TD>O5D301050</TD><TD>3C273</TD><TD>187.277708333</TD><TD>2.05227777778</TD><TD>8</TD><TD>2000-06-22 04:48:21</TD><TD>2000-06-22 05:36:40</TD><TD>2899.000</TD><TD>STIS</TD><TD>0.2X0.2</TD><TD>E140M</TD><TD>8017</TD><TD>2006-12-26 22:12:01</TD><TD>O5D301050</TD><TD></TD><TD>0.019</TD> +</TR> +<TR> +<TD>O5D301LNQ</TD><TD>3C273</TD><TD>187.277708333</TD><TD>2.05227777778</TD><TD>8</TD><TD>2000-06-21 21:31:12</TD><TD>2000-06-21 21:34:12</TD><TD>4.100</TD><TD>STIS</TD><TD>F28X50LP</TD><TD>MIRVIS</TD><TD>8017</TD><TD>2006-12-27 00:34:53</TD><TD></TD><TD></TD><TD>0.019</TD> +</TR> +<TR> +<TD>O5D301LOQ</TD><TD>3C273</TD><TD>187.277708333</TD><TD>2.05227777778</TD><TD>8</TD><TD>2000-06-21 22:23:53</TD><TD>2000-06-21 22:23:55</TD><TD>2.000</TD><TD>STIS</TD><TD>0.2X0.2</TD><TD>MIRVIS</TD><TD>8017</TD><TD>2006-12-27 02:04:58</TD><TD></TD><TD></TD><TD>0.019</TD> +</TR> +<TR> +<TD>O5D301LPQ</TD><TD>3C273</TD><TD>187.277708333</TD><TD>2.05227777778</TD><TD>8</TD><TD>2000-06-21 22:26:35</TD><TD>2000-06-21 22:26:37</TD><TD>2.000</TD><TD>STIS</TD><TD>0.2X0.2</TD><TD>MIRVIS</TD><TD>8017</TD><TD>2006-12-24 14:43:31</TD><TD></TD><TD></TD><TD>0.019</TD> +</TR> +<TR> +<TD>O5D302010</TD><TD>3C273</TD><TD>187.277708333</TD><TD>2.05227777778</TD><TD>8</TD><TD>2000-05-02 07:54:28</TD><TD>2000-05-02 08:29:16</TD><TD>2088.000</TD><TD>STIS</TD><TD>0.2X0.2</TD><TD>E140M</TD><TD>8017</TD><TD>2006-12-27 03:29:28</TD><TD>O5D302010</TD><TD></TD><TD>0.019</TD> +</TR> +<TR> +<TD>O5D302020</TD><TD>3C273</TD><TD>187.277708333</TD><TD>2.05227777778</TD><TD>8</TD><TD>2000-05-02 09:17:07</TD><TD>2000-05-02 10:05:26</TD><TD>2899.000</TD><TD>STIS</TD><TD>0.2X0.2</TD><TD>E140M</TD><TD>8017</TD><TD>2006-12-27 19:17:29</TD><TD>O5D302020</TD><TD></TD><TD>0.019</TD> +</TR> +<TR> +<TD>O5D302CVQ</TD><TD>3C273</TD><TD>187.277708333</TD><TD>2.05227777778</TD><TD>8</TD><TD>2000-05-02 07:42:19</TD><TD>2000-05-02 07:45:19</TD><TD>4.100</TD><TD>STIS</TD><TD>F28X50LP</TD><TD>MIRVIS</TD><TD>8017</TD><TD>2006-12-27 22:39:35</TD><TD></TD><TD></TD><TD>0.019</TD> +</TR> +<TR> +<TD>O5D302CWQ</TD><TD>3C273</TD><TD>187.277708333</TD><TD>2.05227777778</TD><TD>8</TD><TD>2000-05-02 07:48:03</TD><TD>2000-05-02 07:48:05</TD><TD>2.000</TD><TD>STIS</TD><TD>0.2X0.2</TD><TD>MIRVIS</TD><TD>8017</TD><TD>2006-12-28 00:18:22</TD><TD></TD><TD></TD><TD>0.019</TD> +</TR> +<TR> +<TD>O5D302CXQ</TD><TD>3C273</TD><TD>187.277708333</TD><TD>2.05227777778</TD><TD>8</TD><TD>2000-05-02 07:50:45</TD><TD>2000-05-02 07:50:47</TD><TD>2.000</TD><TD>STIS</TD><TD>0.2X0.2</TD><TD>MIRVIS</TD><TD>8017</TD><TD>2006-12-27 20:58:25</TD><TD></TD><TD></TD><TD>0.019</TD> +</TR> +<TR> +<TD>O5G045JZQ</TD><TD>3C273</TD><TD>187.277708333</TD><TD>2.05227777778</TD><TD>5</TD><TD>2000-03-16 07:37:02</TD><TD>2000-03-16 07:47:02</TD><TD>600.000</TD><TD>STIS</TD><TD>25MAMA</TD><TD>G140L</TD><TD>8144</TD><TD>2000-09-12 19:30:11</TD><TD>O5G045JZQ</TD><TD></TD><TD>0.019</TD> +</TR> +<TR> +<TD>O5G045K0Q</TD><TD>3C273</TD><TD>187.277708333</TD><TD>2.05227777778</TD><TD>5</TD><TD>2000-03-16 07:49:45</TD><TD>2000-03-16 07:54:45</TD><TD>300.000</TD><TD>STIS</TD><TD>25MAMA</TD><TD>G230L</TD><TD>8144</TD><TD>2000-09-12 19:30:55</TD><TD>O5G045K0Q</TD><TD></TD><TD>0.019</TD> +</TR> +<TR> +<TD>Y0G40205T</TD><TD>PG1226+023</TD><TD>187.278208333</TD><TD>2.05211111111</TD><TD>32</TD><TD>1991-01-14 16:26:59</TD><TD>1991-01-14 16:29:12</TD><TD>120.320</TD><TD>FOS</TD><TD>4.3</TD><TD>MIRROR</TD><TD>3088</TD><TD>1991-02-14 17:53:03</TD><TD></TD><TD></TD><TD>0.022</TD> +</TR> +<TR> +<TD>Y0G40206T</TD><TD>PG1226+023</TD><TD>187.278208333</TD><TD>2.05211111111</TD><TD>32</TD><TD>1991-01-14 16:34:11</TD><TD>1991-01-14 16:42:45</TD><TD>366.600</TD><TD>FOS</TD><TD>4.3</TD><TD>G190H</TD><TD>3088</TD><TD>1991-02-14 17:54:18</TD><TD>Y0G40206T</TD><TD>2</TD><TD>0.022</TD> +</TR> +</TABLEDATA> +</DATA> +</TABLE> +</RESOURCE> +</VOTABLE> diff --git a/vendor/voclient/libvotable/examples/data/sia_m51.xml b/vendor/voclient/libvotable/examples/data/sia_m51.xml new file mode 100644 index 00000000..b7b96267 --- /dev/null +++ b/vendor/voclient/libvotable/examples/data/sia_m51.xml @@ -0,0 +1,47 @@ +<?xml version="1.0"?> +<!DOCTYPE VOTABLE SYSTEM "http://us-vo.org/xml/VOTable.dtd"> + +<VOTABLE> + <RESOURCE type="results"> + <PARAM value="202.468,47.1947" name="INPUT:POS"> + <DESCRIPTION>Center of image to be generated</DESCRIPTION></PARAM> + <PARAM value="0.1" name="INPUT:SIZE"> + <DESCRIPTION>Size of image in degrees, use 0 to get default</DESCRIPTION></PARAM> + <PARAM value="Image/FITS,Image/JPEG" name="INPUT:FORMAT"> + <DESCRIPTION>Output format requested</DESCRIPTION></PARAM> + <PARAM value="300,300" name="INPUT:NAXIS"> + <DESCRIPTION>Number of pixels in image, use 0 to get default sized pixels (SIZE>0)</DESCRIPTION></PARAM> + <PARAM value="Tan" name="INPUT:PROJ"> + <DESCRIPTION>Map Projection</DESCRIPTION></PARAM> + <PARAM value="ICRS" name="INPUT:CFRAME"> + <DESCRIPTION>Coordinate system</DESCRIPTION></PARAM> + <PARAM value="2000" name="INPUT:EQUINOX"> + <DESCRIPTION>Equinox (for FK4 and FK5)</DESCRIPTION></PARAM> + <PARAM value="Clip" name="INPUT:INTERPOLATION"> + <DESCRIPTION>Sampler: NN, LI, Clip, Lanczos, Spline</DESCRIPTION></PARAM> + <PARAM name="INPUT:big"> + <DESCRIPTION>Include very large images</DESCRIPTION></PARAM> + <PARAM name="INPUT:small"> + <DESCRIPTION>Include small (less than 5x5 pixel) images</DESCRIPTION></PARAM> + + <TABLE> + + <FIELD name="Survey" ucd="VOX:Image_Title" datatype="char" arraysize="*"/> + <FIELD name="Ra" ucd="POS_EQ_RA_MAIN" datatype="double"/> + <FIELD name="Dec" ucd="POS_EQ_DEC_MAIN" datatype="double"/> + <FIELD name="Dim" ucd="VOX:Image_Naxes" datatype="int"/> + <FIELD name="Size" ucd="VOX:Image_Naxis" datatype="int" arraysize="*"/> + <FIELD name="Scale" ucd="VOX:Image_Scale" datatype="double" arraysize="*"/> + <FIELD name="Format" ucd="VOX:Image_Format" datatype="char" arraysize="*"/> + <FIELD name="PixFlags" ucd="VOX:Image_PixFlags" datatype="char" arraysize="*"/> + <FIELD name="URL" ucd="VOX:Image_AccessReference" datatype="char" arraysize="*"/> + <FIELD name="LogicalName" ucd="VOX:LogicalName" datatype="char" arraysize="*"/> + <DATA> + <TABLEDATA> +<TR><TD>dss</TD><TD>202.468</TD><TD>47.1947</TD><TD>2</TD><TD>300 300</TD><TD>-3.333333333333334E-4 3.333333333333334E-4</TD><TD>image/fits</TD><TD>F</TD><TD><![CDATA[http://skyview.gsfc.nasa.gov/cgi-bin/images?position=202.468%2C47.1947&survey=dss&pixels=300%2C300&sampler=Clip&size=0.10000000000000002%2C0.10000000000000002&projection=Tan&coordinates=J2000.0&return=FITS]]></TD> +<TD>1</TD></TR> +<TR><TD>dss</TD><TD>202.468</TD><TD>47.1947</TD><TD>2</TD><TD>300 300</TD><TD>-3.333333333333334E-4 3.333333333333334E-4</TD><TD>image/jpeg</TD><TD>F</TD><TD><![CDATA[http://skyview.gsfc.nasa.gov/cgi-bin/images?position=202.468%2C47.1947&survey=dss&pixels=300%2C300&sampler=Clip&size=0.10000000000000002%2C0.10000000000000002&projection=Tan&coordinates=J2000.0&nofits=1&quicklook=jpeg&return=jpeg]]></TD> +<TD>1</TD></TR> +</TABLEDATA></DATA></TABLE> +<INFO name="QUERY_STATUS" value="OK" /> +</RESOURCE></VOTABLE> diff --git a/vendor/voclient/libvotable/examples/votParse_spp.h b/vendor/voclient/libvotable/examples/votParse_spp.h new file mode 120000 index 00000000..0af751c7 --- /dev/null +++ b/vendor/voclient/libvotable/examples/votParse_spp.h @@ -0,0 +1 @@ +../votParse_spp.h
\ No newline at end of file diff --git a/vendor/voclient/libvotable/examples/votcompress.c b/vendor/voclient/libvotable/examples/votcompress.c new file mode 100644 index 00000000..c983ec95 --- /dev/null +++ b/vendor/voclient/libvotable/examples/votcompress.c @@ -0,0 +1,72 @@ +/** + * VOTCOMP + * + * Example program to "compress" a VOTable by deleting pretty-print + * whitespace. + * + * Usage: + * votcomp [-o <fname> | '-'] [-i N] <votable> + * Where + * -i <N> Number of indention spaces (zero by default) + * -o <fname> Name of output file (or '-' for stdout) + * <votable> Name of file to compress + */ + +#include <stdio.h> +#include <unistd.h> +#include <stdlib.h> +#include <string.h> + +#include "votParse.h" + +int vot = 0; /* VOTable handle */ +int indent = 0; /* indentation flag */ +char *fname = NULL, /* input file name */ + *oname = NULL; /* output filename */ + + +/** + * Program entry point. + */ +int main (int argc, char **argv) +{ + /* Parse the arguments. + */ + if (argc < 2) { + fprintf (stderr, + "Usage: votcomp [-o <fname> | '-'] [-i N] <votable>\n"); + return (ERR); + + } else if (argc >= 2) { + register int i; + + for (i=1; i < argc; i++) { + if (argv[i][0] == '-' && strlen (argv[i]) > 1) { + switch (argv[i][1]) { + case 'i': indent = atoi(argv[++i]); break; + case 'o': oname = argv[++i]; break; + default: + fprintf (stderr, "Invalid argument '%c'\n", argv[i][1]); + return (1); + } + } else + fname = argv[i]; + } + } + + + /* Open the table (this also parses it). In a real application we + * would do an access() check on the file, but the open call below will + * print error information. + */ + if ((vot = vot_openVOTABLE (fname)) <= 0) { + fprintf (stderr, "Error opening VOTable '%s'\n", fname); + return (ERR); + } + + /* Output the XML file. */ + vot_writeVOTable (vot, (oname ? oname : "stdout"), indent); + + vot_closeVOTABLE (vot); /* close the table */ + return (OK); +} diff --git a/vendor/voclient/libvotable/examples/votcompress_f77.f b/vendor/voclient/libvotable/examples/votcompress_f77.f new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/vendor/voclient/libvotable/examples/votcompress_f77.f diff --git a/vendor/voclient/libvotable/examples/votcompress_spp.x b/vendor/voclient/libvotable/examples/votcompress_spp.x new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/vendor/voclient/libvotable/examples/votcompress_spp.x diff --git a/vendor/voclient/libvotable/examples/votconcat.c b/vendor/voclient/libvotable/examples/votconcat.c new file mode 100644 index 00000000..e7361e56 --- /dev/null +++ b/vendor/voclient/libvotable/examples/votconcat.c @@ -0,0 +1,92 @@ +/** + * VOTCONCAT + * + * Example program to concatenate N input tables to a new output table. + * + * Usage: + * votconcat [-o <out>] <vot1> <vot2> ..... + * + * Where + * <vot1> First input table + * <vot2> Second input table + * -o <out> Optional output table, otherwise stdout + */ + +#include <stdio.h> +#include <unistd.h> +#include <stdlib.h> +#include <string.h> + +#include "votParse.h" + +#define MAX_FILES 1024 + +char *infile[MAX_FILES]; +int in_vot[MAX_FILES]; +int in_res[MAX_FILES]; + +int nfiles = 0; /* Number of input files */ +int out = 0; /* Output VOTable handle */ +int vot = 0; /* First VOTable handle */ +int res = 0; /* <RESOURCE> handle */ + + +/** + * Program entry point. + */ +int +main (int argc, char **argv) +{ + char *out_fname = (char *) "stdout"; + int i, verbose = 0, indent = 1;; + + + if (argc < 3) { + fprintf (stderr, "Usage: votconcat [-o <out>] <vot1> <vot2> ....\n"); + return (1); + + } else if (argc >= 2) { + for (i=1; i < argc; i++) { + if (argv[i][0] == '-' && strlen (argv[i]) > 1) { + switch (argv[i][1]) { + case 'i': indent = atoi (argv[++i]); break; + case 'o': out_fname = argv[++i]; break; + case 'v': verbose++; break; + default: + fprintf (stderr, "Unrecognized option '%c'\n", argv[i][1]); + return (1); + } + } else + infile[nfiles++] = argv[i]; + } + } + + + /* Open output table. + */ + out = vot_openVOTABLE (NULL); + + /* Loop over the input tables on the cmdline. + */ + for (i=0; i < nfiles; i++) { + vot = vot_openVOTABLE (infile[i]); /* Parse the table */ + + /* Concat tables. + */ + if ((res = vot_getRESOURCE (vot))) + vot_attachNode (out, res); + + vot_closeVOTABLE (vot); /* Close the tables */ + } + + /* Write it out. + */ + vot_writeVOTable (out, out_fname, indent); + + /* Close (and free) the output table. + */ + if (out) + vot_closeVOTABLE (out); + + return (0); +} diff --git a/vendor/voclient/libvotable/examples/votconcat_f77.f b/vendor/voclient/libvotable/examples/votconcat_f77.f new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/vendor/voclient/libvotable/examples/votconcat_f77.f diff --git a/vendor/voclient/libvotable/examples/votconcat_spp.x b/vendor/voclient/libvotable/examples/votconcat_spp.x new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/vendor/voclient/libvotable/examples/votconcat_spp.x diff --git a/vendor/voclient/libvotable/examples/votcopy.c b/vendor/voclient/libvotable/examples/votcopy.c new file mode 100644 index 00000000..f8808752 --- /dev/null +++ b/vendor/voclient/libvotable/examples/votcopy.c @@ -0,0 +1,208 @@ +/** + * VOTCOPY -- Copy a VOTable to a different format. + * + * Usage: + * votcopp [-f <fmt>] [-o <fname>] <votable> + * Where + * -f <fmt> Output format (XML, CSV, TSV, HTML, etc) + * -h Print help summary + * -i <N> Indention at each level for VOTable output + * -o <fname> Name of output file + * + * --noheader Don't write a header + * --help Print help summary + * + * <votable> Name of input file to compress + */ + +#include <stdio.h> +#include <unistd.h> +#include <stdlib.h> +#include <string.h> + +#include "votParse.h" + + +int votcopy (int argc, char **argv); + +/** + * Program Main. This is just a wrapper around the interface routine. + */ +int +main (int argc, char **argv) +{ + return votcopy (argc, argv); +} + + + +/************************************************************************ + * * + * VOTCOPY -- Copy a votable to a new format, converting format if * + * needed. * + * * + ************************************************************************/ + +#define FORMATS "|vot|asv|bsv|csv|tsv|html|shtml|fits|xml" + +#define VOT 0 /* A new VOTable */ +#define ASV 1 /* ascii separated values */ +#define BSV 2 /* bar separated values */ +#define CSV 3 /* comma separated values */ +#define TSV 4 /* tab separated values */ +#define HTML 5 /* standalone HTML document */ +#define SHTML 6 /* single HTML <table> */ +#define FITS 7 /* FITS binary table */ +#define XML 8 /* VOTable alias */ + +#define SZ_FORMAT 32 + + +char *fmt = NULL; /* format string */ +int vot = 0; /* VOTable root handle */ +int indent = 0; /* indention at each level */ +int ofmt = CSV; /* format */ +int hdr = TRUE; + + +static int strdic (char *in_str, char *out_str, int maxchars, char *dict); + + +/** + * Application entry point. + */ +int +votcopy (int argc, char **argv) +{ + register int i; + int stat = OK; + char *ifname = NULL, *name = NULL, *ofname = NULL, format[SZ_FORMAT]; + + + /* Parse the argument list. + */ + if (argc < 2) { + fprintf (stderr, "Usage: votcopy [-o <fname>] [-f <fmt>] <votable>\n"); + return (1); + + } else if (argc >= 2) { + for (i=1; i < argc; i++) { + if (argv[i][0] == '-' && strlen (argv[i]) > 1) { + switch (argv[i][1]) { + case 'f': fmt = argv[++i]; break; + case 'i': indent = atoi (argv[++i]); break; + case 'o': name = argv[++i]; break; + default: + fprintf (stderr, "Invalid argument '%c'\n", argv[i][1]); + return (1); + } + } else + ifname = argv[i]; + } + } + ofname = (name ? name : "stdout"); + + + /* Open and parse the input table. + */ + if ( (vot = vot_openVOTABLE (ifname) ) <= 0) { + fprintf (stderr, "Error opening VOTable '%s'\n", ifname); + return (ERR); + } + + /* Output the new format. + */ + switch (strdic (fmt, format, SZ_FORMAT, FORMATS)) { + case VOT: vot_writeVOTable (vot, ofname, indent); break; + case ASV: vot_writeASV (vot, ofname); break; + case BSV: vot_writeBSV (vot, ofname); break; + case CSV: vot_writeCSV (vot, ofname); break; + case TSV: vot_writeTSV (vot, ofname); break; + case HTML: vot_writeHTML (vot, ifname, ofname); break; + case SHTML: vot_writeSHTML (vot, ifname, ofname); break; + case FITS: vot_writeFITS (vot, ofname); break; + case XML: vot_writeVOTable (vot, ofname, indent); break; + default: + fprintf (stderr, "Unknown output format '%s'\n", format); + stat = ERR; + } + vot_closeVOTABLE (vot); /* close the table */ + + return (stat); +} + + +/** + * STRDIC -- Search a dictionary string for a match with an input string. + * The input string may be an abbreviation of a dictionary entry, however, + * it is an error if the abbreviation is not unique. The entries in the + * dictionary string are separated by a delimiter character which is the + * first character of the dictionary string. The full name of the matched + * dictionary entry found is returned in out_str; the function value is + * the word index of the dictionary entry. The output string may be the + * same as the input string. + */ + +#include <ctype.h> + +static int strdic ( + char *in_str, /* Input string, always lower case */ + char *out_str, /* Output string as found in dictionary */ + int maxchars, /* Maximum length of output string */ + char *dict /* Dictionary string */ +) +{ + char ch, fch; + int start, len, ip, i, match, entry; + + + if (dict == NULL || dict[0] == '\0') + return (0); + + for (i=0; isspace(in_str[i]); i++) + ; + + start = i; + match = 0; + ip = 1; + len = strlen (&in_str[start]); + fch = in_str[start]; + + + /* Search the dictionary string. If the input string matches a + * dictionary entry it is either an exact match (len = dictionary + * entry length) or a legal abbreviation. If an abbreviation + * matches two entries it is ambiguous and an error. + */ + for (entry=0; dict[ip] != '\0'; entry=entry+1) { + if (dict[ip] == fch) { + if (strncmp (&dict[ip], &in_str[start], len) == 0) { + for (i=0; i < maxchars; i++) { + ch = dict[ip+i-1]; + if ((ch == dict[0]) || (ch == '\0')) + break; + out_str[i] = ch; + } + out_str[i] = '\0'; + + if ((dict[ip+len] == dict[0]) || (dict[ip+len] == '\0')) + return (entry); /* exact match */ + else { + /* If we already have a match and the new match is not + * exact, then the abbreviation is ambiguous. + */ + if (match != 0) + return (0); + else + match = entry; + } + } + } + + do { + ip = ip + 1; + } while (dict[ip-1] != dict[0] && dict[ip] != '\0'); + } + + return (match); +} diff --git a/vendor/voclient/libvotable/examples/votcopy_f77.f b/vendor/voclient/libvotable/examples/votcopy_f77.f new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/vendor/voclient/libvotable/examples/votcopy_f77.f diff --git a/vendor/voclient/libvotable/examples/votcopy_spp.x b/vendor/voclient/libvotable/examples/votcopy_spp.x new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/vendor/voclient/libvotable/examples/votcopy_spp.x diff --git a/vendor/voclient/libvotable/examples/votdump.c b/vendor/voclient/libvotable/examples/votdump.c new file mode 100644 index 00000000..331fa1d3 --- /dev/null +++ b/vendor/voclient/libvotable/examples/votdump.c @@ -0,0 +1,114 @@ +/** + * VOTDUMP + * + * Example program to convert a VOTable to a delimited file, ...the long way. + * + * Usage: + * votdump [-b|-c|-s|-t] <votable> + * + * Where + * -b use '|' as the delimiter (Bar) + * -c use ',' as the delimiter (CSV) + * -s use ' ' as the delimiter (space-delimited) + * -t use '\t' as the delimiter (TSV) + * + * <votable> Name of file to dump, or '-' for stding + */ + +#include <stdio.h> +#include <unistd.h> +#include <stdlib.h> +#include <string.h> + +#include "votParse.h" + + +int vot = 0; /* VOTable handle */ + +/** + * Program entry point. + */ +int +main (int argc, char **argv) +{ + char *fname, *name, *id, *ucd, *s, delim=','; + int res, tab, data, tdata, field, tr, td; /* handles */ + int i, ncols; + + + if (argc < 2) { + fprintf (stderr, "Usage: votdump [-b|-c|-s|-t] <votable>\n"); + return (1); + + } else if (argc >= 2) { + for (i=1; i < argc; i++) { + if (argv[i][0] == '-' && strlen (argv[i]) > 1) { + switch (argv[i][1]) { + case 'b': delim = '|'; break; /* bar */ + case 'c': delim = ','; break; /* comma */ + case 't': delim = '\t'; break; /* tab */ + case 's': delim = ' '; break; /* space */ + default: + fprintf (stderr, "Invalid delimiter '%c'\n", argv[i][1]); + return (1); + } + } else + fname = argv[i]; + } + } + + + /* Open the table. This also parses it. + */ + if ( (vot = vot_openVOTABLE (fname) ) <= 0) { + fprintf (stderr, "Error opening VOTable '%s'\n", argv[1]); + return (1); + } + + res = vot_getRESOURCE (vot); /* get RESOURCES */ + if (vot_getLength (res) > 1) { + fprintf (stderr, "Error: multiple <RESOURCES> not supported\n"); + return (1); + } + + tab = vot_getTABLE (res); + data = vot_getDATA (tab); + tdata = vot_getTABLEDATA (data); + ncols = vot_getNCols (tdata); + + + /* Print the Column header names. + */ + printf ("# "); + for (field=vot_getFIELD (tab),i=0; field; field = vot_getNext (field),i++) { + name = vot_getAttr (field, "name"); /* find reasonable value */ + id = vot_getAttr (field, "id"); + ucd = vot_getAttr (field, "ucd"); + if (name || id || ucd) + printf ("%s", (name ? name : (id ? id : ucd)) ); + else + printf ("col%d", i); + if (i < (ncols-1)) + printf ("%c", delim); + } + printf ("\n"); + + + /* Now dump the data. + */ + for (tr=vot_getTR (tdata); tr; tr=vot_getNext(tr)) { + for (td=vot_getTD(tr),i=0; td; td=vot_getNext(td),i++) { + printf ("%s", ((s = vot_getValue (td)) ? s : "") ); + if (i < (ncols-1)) + printf ("%c", delim); + } + printf ("\n"); + } + + + /* Close the table. + */ + vot_closeVOTABLE (vot); + + return (0); +} diff --git a/vendor/voclient/libvotable/examples/votdump_f77.f b/vendor/voclient/libvotable/examples/votdump_f77.f new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/vendor/voclient/libvotable/examples/votdump_f77.f diff --git a/vendor/voclient/libvotable/examples/votdump_spp.x b/vendor/voclient/libvotable/examples/votdump_spp.x new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/vendor/voclient/libvotable/examples/votdump_spp.x diff --git a/vendor/voclient/libvotable/examples/votget.c b/vendor/voclient/libvotable/examples/votget.c new file mode 100644 index 00000000..15ddac32 --- /dev/null +++ b/vendor/voclient/libvotable/examples/votget.c @@ -0,0 +1,801 @@ +/** + * VOTGET -- Download all access references in a VOTable. + * + * Usage: + * + * votget [-b <base>] [-c <col>] [-u <ucd>] [-v] [-x] [-o fname] <file> + * + * Where + * -b <base> Base output filename + * -e [<extn>] Extension to add to filename (or auto) + * -f <fmt> Download only specified <type> + * -h Print help summary + * -s Use sequential file numbers + * -t Input file is temporary, delete when done + * -u <ucd> Use ucd to identify acref column + * + * -o <fname> Output extracted filename (or 'stdout' or '-') + * -v Verbose output + * -x Extract access references + * + * -A <colnum> Col number to use as acref column (0-indexed) + * -B Background, i.e. run in forked child process + * -C Cache the downloaded file + * -D Set download directory + * -F <colnum> Col number to use as format column (0-indexed) + * -N <N> Number of simultaneous downloads + * + * +d debug output + * + * <file> Name of file to process, or '-' for stdin + */ + + +int votget (int argc, char **argv); + +/** + * Program Main. This is just a wrapper around the interface routine. + */ +int +main (int argc, char **argv) +{ + return votget (argc, argv); +} + + + +/************************************************************************ + * * + * VOTGET -- Download the access references in a VOTable. * + * * + ************************************************************************/ + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <string.h> +#include <fcntl.h> +#include <sys/errno.h> +#include <sys/types.h> +#include <sys/uio.h> +#include <sys/stat.h> +#include <pthread.h> + +#include <curl/curl.h> +#include <curl/types.h> +#include <curl/easy.h> + +#include "votParse.h" + + +#define SZ_FNAME 256 /* max size of a file name */ +#define SZ_URL 4096 /* max URL size */ +#define MIN_THREADS 4 /* min no. simultaneous thread */ +#define MAX_THREADS 64 /* max no. simultaneous threads */ +#define MAX_DOWNLOADS 4096 /* max no. files to download */ +#define MAX_TRYS 3 /* max download attempts */ + +#define NAXIS_UCD "VOX:Image_Naxis" +#define NAXES_UCD "VOX:Image_Naxes" +#define SCALE_UCD "VOX:Image_Scale" +#define ACREF_UCD "VOX:Image_AccessReference" +#define FORMAT_UCD "VOX:Image_Format" + + +int vot = 0; /* VOTable handle */ +int verbose = 0; /* verbose parameter */ +int debug = 0; /* debug flag */ +int extract = 0; /* extract references only */ +int detach = 0; /* run as detached process */ +int nfiles = 0; /* number of download files */ +int ngot = 0; /* number of files downloaded */ +int seq = 0; /* use sequential file numbers */ +int isCache = 0; /* is this a cache file? */ +int isTemp = 0; /* is this a temp file? */ +int acol = -1; /* access reference column */ +int tcol = -1; /* image type column */ + +int nthreads = MIN_THREADS; /* number of download threads */ +int maxTrys = MAX_TRYS; /* download attempts */ + +char *base = "file"; /* output base filename */ +char *extn = NULL; /* output filename extension */ +char *dir = NULL; /* download directory */ +char *afname = NULL; /* output acref filename */ + +char *acref = NULL; /* acref url */ +char *acref_ucd = NULL; /* acref UCD */ +char *fmt = NULL; /* image format */ +char *fmt_ucd = NULL; /* image format UCD */ + +FILE *afd = (FILE *) NULL; /* acref file descriptor */ + +pthread_mutex_t counter_mut = PTHREAD_MUTEX_INITIALIZER; + + +typedef struct { + char url[SZ_URL]; /* access URL */ + char fname[SZ_URL]; /* local filename */ + int tnum; /* worker thread number */ +} Acref, *AcrefP; + +Acref aclist[MAX_DOWNLOADS]; /* access list */ + + +/* Private methods. + */ +static int vot_isVOTable (char *infile); +static int vot_acrefColumn (handle_t tab); +static int vot_typeColumn (handle_t tab); +static int vot_getURL (char *url, char *ofname); +static int vot_loadText (char *infile); +static int vot_loadVOTable (char *infile); + +static void vot_saveAcref (char *acref, int num); +static void *vot_getAclist (void *arg); +static void vot_printAclist (); +static void vot_Usage (); + +static unsigned int vot_sum32 (char *str); + + + +/** + * Program entry point. + */ +int +votget (int argc, char **argv) +{ + int i, stat = OK; + char *fname; + + + if (argc < 2) { + vot_Usage (); + return (1); + + } else if (argc >= 2) { + for (i=1; i < argc; i++) { + if (argv[i][0] == '-' && strlen (argv[i]) > 1) { + switch (argv[i][1]) { + + case 'h': vot_Usage (); return (0); + + case 'b': base = argv[++i]; break; + case 'f': fmt = argv[++i]; break; + case 's': seq++; break; + case 't': isTemp++; break; + case 'u': acref_ucd = argv[++i]; break; + + case 'o': afname = argv[++i]; break; + case 'v': verbose++; break; + case 'x': extract++; break; + + case 'A': acol = atoi(argv[++i]); break; + case 'B': detach++; break; + case 'C': isCache++; break; + case 'D': dir = argv[++i]; break; + case 'F': tcol = atoi(argv[++i]); break; + case 'N': nthreads = atoi(argv[++i]); break; + + default: + fprintf (stderr, "Invalid argument '%c'\n", argv[i][1]); + return (1); + } + } else if (argv[i][0] == '+' && strlen (argv[i]) > 1) { + switch (argv[i][1]) { + case 'd': debug++; break; + } + } else + fname = argv[i]; + } + } + + + /* Setup defaults and initialize. + */ + memset (&aclist[0], 0, MAX_DOWNLOADS); + if (!fmt_ucd) + fmt_ucd = FORMAT_UCD; + if (!acref_ucd) + acref_ucd = ACREF_UCD; + + if (afname && (afd = fopen (afname, "w+")) == (FILE *) NULL) { + if (verbose) + fprintf (stderr, "Error: cannot open output file '%s'\n", afname); + return (ERR); + } + + + /* Determine the type of input file. + */ + switch ((vot = vot_isVOTable (fname))) { + case -1: stat = ERR; goto done_; + case 0: vot_loadText (fname); break; + case 1: vot_loadVOTable (fname); break; + } + + + /* If all we're doing is extracting the URLs we can quit now. + */ + if (extract) + goto done_; + + if (debug) { + fprintf (stderr, "acol = %d tcol = %d\n", acol, tcol); + fprintf (stderr, "Downloading %d files ....\n", nfiles); + vot_printAclist (); + } + + + /* If we've been asked to detach, fork off to do the downloads in + * a child, and return to the caller. + */ + if (detach) { + pid_t pid; + + switch ((pid = fork ())) { + case -1: return (ERR); /* We are an error */ + case 0: break; /* We are the child */ + default: return (OK); /* We are the parent */ + } + } + + + /* Initialize the download directory. + */ + if (dir) { + if (access (dir, F_OK) < 0) + mkdir (dir, 0644); + if (access (dir, W_OK) < 0) { + if (verbose) + fprintf (stderr, "Error: Cannot write to directory '%s'\n", dir); + return (1); + } + chdir (dir); + } + + /* Do the downloads. + */ + if (nfiles < MIN_THREADS) + nthreads = nfiles; + + if (nthreads == 1) { + vot_getAclist (NULL); + + } else { + /* Spawn the worker threads. + */ + int rc = 0, tc = 0, status = 0, tnum[MAX_THREADS]; + pthread_attr_t attr; /* thread attributes */ + pthread_t thread[MAX_THREADS]; + + + /* Initialize the service processing thread attributes and run 'em. + */ + pthread_attr_init (&attr); + pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_JOINABLE); + + if (verbose) + fprintf (stderr, "Starting download ....\r"); + + for (tc=0; tc < nthreads; tc++) { + tnum[tc] = tc; + if ((rc = pthread_create (&thread[tc], &attr, vot_getAclist, + (void *)&tnum[tc]))) { + fprintf (stderr, "ERROR: pthread_create() fails, code=%d\n", + rc); + exit (-1); + } + } + + /* Free attribute and wait for the threads to complete. + */ + pthread_attr_destroy (&attr); + for (tc=0; tc < nthreads; tc++) { + if ((rc = pthread_join (thread[tc], (void **)&status)) ) { + if (rc != ESRCH) { + fprintf (stderr, + "ERROR: pthread_join() fails, code=%d status=%d\n", + rc, status); + exit (-1); + } + } + } + + if (verbose) { + fprintf (stderr, "Downloaded %d files -- Download complete\n", + nfiles); + fflush (stderr); + } + } + + + /* Remove input file if it is temporary. + */ + if (isTemp) + unlink (fname); + + /* Close the table and clean up. + */ +done_: + + return (OK); +} + + +/********************************************************************** +** Private Procedures +**********************************************************************/ + + +/** + * VOT_USAGE -- Print the task usage and exit. + */ +static void +vot_Usage () +{ +fprintf (stderr, + "\n" + " Usage:\n" + "\n" + " votget [-b <base>] [-c <col>] [-u <ucd>] [-v] [-x] [-o fname] <file>\n" + "\n" + " Where\n" + " -b <base> Base output filename\n" + " -e [<extn>] Extension to add to filename (or auto)\n" + " -f <fmt> Download only specified <type>\n" + " -h Print help summary\n" + " -s Use sequential file numbers\n" + " -t Input file is temporary, delete when done\n" + " -u <ucd> Use ucd to identify acref column\n" + "\n" + " -o <fname> Output extracted filename (or 'stdout' or\n" + " '-')\n" + " -v Verbose output\n" + " -x Extract access references\n" + "\n" + " -A <colnum> Col number to use as acref column (0-indexed)\n" + " -B Background, i.e. run in forked child process\n" + " -C Cache the downloaded file\n" + " -D Set download directory\n" + " -F <colnum> Col number to use as format column\n" + " (0-indexed)\n" + " -N <N> Number of simultaneous downloads\n" + "\n" + " +d debug output\n" + "\n" + " <file> Name of file to process, or '-' for stdin\n" + ); +} + + + +/** + * VOT_LOADTEXT -- Load the access list from a text file. We assume the + * list is simply one url per line. + */ +static int +vot_loadText (char *infile) +{ + int i = 0, fd, nread = 0, tnum = 0, sz = 0; + char *acref, *buf, *ip; + struct stat info; + + if ((fd = open (infile, O_RDONLY)) < 0) + return (-1); + + if (stat (infile, &info) < 0) /* read the whole file */ + return (-1); + sz = info.st_size; + buf = calloc (sz + 1, sizeof(char)); + nread = read (fd, buf, sz); + close (fd); + + acref = buf; /* point to 1st url */ + for (i=0; *acref; i++) { + for (ip=acref; *ip && *ip != '\n'; ip++) + ; + *ip = '\0'; + + vot_saveAcref (acref, i); + + acref = ip + 1; + nfiles++; + tnum++; + } + + if (afd) /* close the acref file */ + fclose (afd); + + return (nfiles); +} + + +/** + * VOT_LOADVOTABLE -- Load the access list from a VOTable. + */ +static int +vot_loadVOTable (char *infile) +{ + int i, tnum = 0; + int res, tab, data, tdata, tr; + char *acref; + + + /* Open the table. This also parses it. + */ + if ( (vot = vot_openVOTABLE (infile) ) <= 0) { + if (verbose) + fprintf (stderr, "Error opening VOTable '%s'\n", infile); + return (ERR); + } + + /* Loop over all the resources in the file. In most cases there will + * only be one <RESOURCE>, if not then the selection applies to all + * valid tables. + */ + for (res = vot_getRESOURCE (vot); res; res = vot_getNext (res)) { + + /* Get the <TABLE> element. + */ + if (! (tab = vot_getTABLE (res))) { + if (verbose) fprintf (stderr, "Error: No <TABLE> in <RESOURCE>\n"); + continue; + } + data = vot_getDATA (tab); + tdata = vot_getTABLEDATA (data); + + /* Loop through the FIELDs to find the acref. Let the cmdline param + * override the acref column ucd. + */ + acol = (acol < 0 ? vot_acrefColumn (tab) : acol); + tcol = (tcol < 0 ? vot_typeColumn (tab) : tcol); + + /* Now scan the data table for acrefs. We got the acref column above + * so lookup the table cell directly for each row, either printing + * out the acref for a simple extract, or by adding to the access + * list to be processed below. + */ + i = 0; + for (tr=vot_getTR (tdata); tr; tr=vot_getNext(tr)) { + acref = vot_getTableCell (tdata, i, acol); + if (tcol >= 0) { + char *format = vot_getTableCell (tdata, i, tcol); + + if (format && fmt && strcasestr (format, fmt) == NULL) + continue; + } + + vot_saveAcref (acref, i); + + nfiles++; + tnum++; + i++; + } + } + + vot_closeVOTABLE (vot); + if (afd) /* close the acref file */ + fclose (afd); + + return (nfiles); +} + + +/** + * VOT_SAVEACREF -- Save the URL to the access list. + */ +static void +vot_saveAcref (char *acref, int num) +{ + if (afd) + fprintf (afd, "%s\n", acref); + else if (extract) + printf ("%s\n", acref); + else { + /* Save to the access list. + */ + aclist[num].tnum = ((nthreads == 1) ? 0 : (num % nthreads)); + strcpy (aclist[num].url, acref); + sprintf (aclist[num].fname, "%s%u", base, + (seq ? num : vot_sum32 (acref)) ); + } +} + + +/** + * VOT_ISVOTABLE -- Determine in the input file is a VOTable or URL @file. + * We return zero if the file cannot be parsed as a valid VOTable (i.e. + * we assume it is an @file of URLs), or else we return the root handle to + * the parsed file. + */ + +#define SZ_READ 2880 + +static int +vot_isVOTable (char *infile) +{ + FILE *fd = (FILE *) NULL; + char buf[SZ_READ]; + register int nread;; + + + /* read the first 1024 bytes and search for a 'votable' string... */ + if (access (infile, F_OK) < 0) { + if (verbose) + fprintf (stderr, "Error: Cannot open input file '%s'\n", infile); + return (-1); + + } else if ((fd = fopen (infile, "r"))) { + memset (buf, 0, SZ_READ); + nread = fread (buf, sizeof (char), SZ_READ, fd); + fclose (fd); + + return (strcasestr (buf, "votable") ? 1 : 0); + } + return ( 0 ); +} + + +/** + * VOT_ACREFCOLUMN -- Determine the access column for the given table. + */ +static int +vot_acrefColumn (handle_t tab) +{ + register int i = 0, acol = -1; + handle_t field; + char *ucd; + + + /* Loop through the FIELDs to find the acref. + */ + for (field=vot_getFIELD(tab); field; field=vot_getNext(field),i++) { + ucd = vot_getAttr (field, "ucd"); + if (ucd && strcasecmp (acref_ucd, ucd) == 0) { + acol = i; + break; + } + } + + if (acol < 0) { /* make sure we found a column */ + if (verbose) + fprintf (stderr, "Error: no acref column found (%s)\n", acref); + return (-1); + } + + return (acol); +} + + +/** + * VOT_TYPECOLUMN -- Determine the type column for the given table. + */ +static int +vot_typeColumn (handle_t tab) +{ + register int i = 0; + handle_t field; + char *ucd; + + + /* Loop through the FIELDs to find the type. Use a generous match. + */ + if (tcol < 0) { + for (field=vot_getFIELD(tab); field; field=vot_getNext(field),i++) { + ucd = vot_getAttr (field, "ucd"); + if (ucd && strcasestr (ucd, fmt_ucd)) { + tcol = i; + break; + } + } + } + + return (tcol); +} + + +/** + * VOT_GETACLIST -- Download all the files for the specified thread. + */ +static void * +vot_getAclist (void *arg) +{ + register int i, j, done = 0, ret = 0; + int threadNum = 0; + + if (arg) + threadNum = *(int *)arg; + + for (i=0; i < nfiles; i++) { + if (aclist[i].tnum == threadNum) { + for (j=0; j < maxTrys; j++) + if ((ret = vot_getURL (aclist[i].url, aclist[i].fname))) + break; + done += ret; + } + } + + pthread_exit (NULL); +} + + +/** + * VOT_GETURL -- Utility routine to do a simple URL download to the file. + */ +static int +vot_getURL (char *url, char *ofname) +{ + int stat = 0; + char lockfile[SZ_FNAME], dot[SZ_FNAME], errBuf[CURL_ERROR_SIZE]; + char fname[SZ_FNAME]; + FILE *fd; + CURL *curl_handle; + + + /* Initialize the lock file. + */ + memset (lockfile, 0, SZ_FNAME); + memset (dot, 0, SZ_FNAME); + + sprintf (lockfile, ".%s.LOCK", ofname); + sprintf (dot, ".%s", ofname); + + if (access (lockfile, F_OK) == 0 && access (dot, F_OK) < 0) { + /* Download currently in progress, perhaps on another thread? + */ + return (0); + } else if (access (lockfile, F_OK) == 0 && access (dot, F_OK) == 0) { + /* Download complete, stray lockfile. + */ + unlink (lockfile); + } else if (access (lockfile, F_OK) < 0) { + /* No lock file, create one. + */ + creat (lockfile, O_CREAT); + } + + + /* Append filename extension if specified. + */ + if (extn) + sprintf (fname, "%s.%s", ofname, extn); + else + strcpy (fname, ofname); + + + /* For the CURL operation to download the file. + */ + curl_global_init (CURL_GLOBAL_ALL); /* init curl session */ + curl_handle = curl_easy_init (); + + if ((fd = fopen (fname, "wb")) == NULL) { /* open the output file */ + if (verbose) + fprintf (stderr, "Error: cannot open output file '%s'\n", fname); + curl_easy_cleanup (curl_handle); + return 0; + } + + /* Set cURL options + */ + curl_easy_setopt (curl_handle, CURLOPT_URL, url); + curl_easy_setopt (curl_handle, CURLOPT_NOPROGRESS, 1L); + curl_easy_setopt (curl_handle, CURLOPT_WRITEDATA, fd); + curl_easy_setopt (curl_handle, CURLOPT_ERRORBUFFER, errBuf); + + /* Do the download. + */ + if ((stat = curl_easy_perform (curl_handle)) != 0) { + /* Error in download, clean up. + */ + if (verbose) + fprintf (stderr, "Error: can't download '%s' : %s\n", url, errBuf); + unlink (fname); unlink (lockfile); + fclose (fd); /* close the file */ + curl_easy_cleanup (curl_handle); /* cleanup curl stuff */ + return (0); + } + + fclose (fd); /* close the file */ + curl_easy_cleanup (curl_handle); /* cleanup curl stuff */ + + /* Save the URL to a "dotfile" is we're downloading to a cache. + */ + if (isCache) { + if ((fd = fopen (dot, "w")) == NULL) { /* open cache file */ + if (verbose) + fprintf (stderr, "Error: cannot open cache file '%s'\n", dot); + return 0; + } + fprintf (fd, "%s\n", url); + fclose (fd); + } + + /* If we didn't specify an extension, try to determin the file type + * automatically. + */ + if (!extn) { + int dfd; + + if ((dfd = open (fname, O_RDONLY)) > 0) { + char buf[1024], new[SZ_FNAME]; + + (void) read (dfd, buf, 1024); + + memset (new, 0, SZ_FNAME); + if (strncmp ("SIMPLE", buf, 6) == 0) { /* FITS */ + sprintf (new, "%s.fits", fname); + rename (fname, new); + } + close (dfd); + } + } + + pthread_mutex_lock (&counter_mut); + ngot++; + if (verbose) { + fprintf (stderr, "Downloaded %d of %d files ....\r", ngot, nfiles); + fflush (stderr); + } + pthread_mutex_unlock (&counter_mut); + + /* Remove the lock file to indicate we are done. + */ + unlink (lockfile); + + return (1); +} + + +/** + * VOT_SUM32 -- Internet checksum, 32 bit unsigned integer version. + */ + +static unsigned int +vot_sum32 (char *str) +{ + register int i; + unsigned int *iarray, sum = 0; + int len, carry=0, newcarry=0; + + iarray = (unsigned int *) str; + len = strlen (str) / 4; + + for (i=0; i<len; i++) { + if (iarray[i] > ~ sum) + carry++; + sum += iarray[i]; + } + + while (carry) { + if (carry > ~ sum) + newcarry++; + sum += carry; + carry = newcarry; + newcarry = 0; + } + + return (sum); +} + + + +/****************************************************************************** +** Debug Utilities +******************************************************************************/ + +/** + * VOT_GETACLIST -- Download all the files for the specified thread. + */ +static void +vot_printAclist () +{ + register int i; + + fprintf (stderr, "\nAccess List: nfiles = %d\n", nfiles); + for (i=0; i < nfiles; i++) { + fprintf (stderr, "%2d: url='%20.20s...' fname='%s' tnum=%d\n", + i, aclist[i].url, aclist[i].fname, aclist[i].tnum); + } +} diff --git a/vendor/voclient/libvotable/examples/votget_f77.f b/vendor/voclient/libvotable/examples/votget_f77.f new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/vendor/voclient/libvotable/examples/votget_f77.f diff --git a/vendor/voclient/libvotable/examples/votget_spp.x b/vendor/voclient/libvotable/examples/votget_spp.x new file mode 100644 index 00000000..210bfe99 --- /dev/null +++ b/vendor/voclient/libvotable/examples/votget_spp.x @@ -0,0 +1,132 @@ +## +# VOTGET +# +# Example program to download all access references in a VOTable using +# the IRAF/SPP interface. +# +# Usage: +# votget <votable> [<params>] +# +# Where task parameters are: +# +# base=<str> base output filename +# col=N col number to use as acref column (0-indexed) +# ucd=<str> use ucd to identify acref column +# verbose[+-] verbose output +# <votable> Name of file to dump, or '-' for stdin +# +# @file votget_spp.x +# @author M. Fitzpatrick +# @date 4/16/2011 + + +include "votParse_spp.h" + +define DEF_BASE "file" + + +task votget = t_votget # task declaration + + +# T_VOTGET -- Task entry point code. + +procedure t_votget () + +char base[SZ_FNAME], ucd[SZ_FNAME], votable[SZ_PATHNAME] +int col +bool verbose + +int clgeti(), votget() +bool clgetb() + +begin + # Get the task parameters. + call clgstr ("votable", votable, SZ_PATHNAME) + call clgstr ("base", base, SZ_FNAME) + call clgstr ("ucd", ucd, SZ_FNAME) + col = clgeti ("col") + verbose = clgetb ("verbose") + + # Call the application part of the task. + if (votget (votable, "fits", base, col, ucd, verbose) != OK) { + if (verbose) + call eprintf ("Error calling votget()\n") + } +end + + +# VOTGET -- Application-level interface entry point. + +int procedure votget (votable, fmt, base, col, ucd_col, verbose) + +char votable[SZ_FNAME] #i votable to parse +char fmt[SZ_FNAME] #i requested format +char base[SZ_FNAME] #i base filename +int col #i col number to use +char ucd_col[SZ_FNAME] #i UCD to use +bool verbose #i verbose output + +pointer vot +char fname[SZ_FNAME], acref_ucd[SZ_FNAME], imfmt[SZ_FNAME] +char acref[SZ_LINE], ucd[SZ_FNAME] +int i, field, acref_col, acfmt_col, nread + +# Declare the libVOTable functions we'll be using. +pointer votinit() +int strcmp(), strsearch(), url_get(), vx_getNext() + +begin + # Initialize the VOT struct and parse the table. + vot = votinit (votable) + + # Figure out which table column we want. Note that we assume there + # is only one <RESOURCE> element. The caller may pass in a specific + # column to be used, otherwise look for for the named UCD. + + call aclrc (acref_ucd, SZ_FNAME) + if (col > 0) { + acref_col = col + } else { + if (ucd_col[1] != EOS) + call strcpy (ucd_col, acref_ucd, SZ_FNAME) + else + call strcpy (DEF_ACREF_UCD, acref_ucd, SZ_FNAME) + + # Find the access reference column number. + i = 0 + for (field=VOT_FIELD(vot); field > 0; field=vx_getNext (field)) { + call vx_getAttr (field, "ucd", ucd, SZ_FNAME) + if (strcmp (ucd, acref_ucd) == 0) { + acref_col = i + break + } else if (strcmp (ucd, DEF_FORMAT_UCD) == 0) + acfmt_col = i + i = i + 1 + } + } + + # Download the files. + for (i=0; i < VOT_NROWS(vot); i=i+1) { + call vx_getTableCell (VOT_TDATA(vot), i, acfmt_col, imfmt, SZ_FNAME) + + if (fmt[1] != EOS && strsearch (imfmt, fmt) > 0) { + call vx_getTableCell (VOT_TDATA(vot), i, acref_col, + acref, SZ_LINE) + + # Create the local filename. + call sprintf (fname, SZ_FNAME, "%s%03d.%s") + call pargstr (base) + call pargi (i) + call pargstr (fmt) + + if (verbose) { + call eprintf ("Downloading row %d\n") + call pargi (i+1) + } + nread = url_get (acref, fname, NULL) + } + } + + # Clean up. + call votclose (vot) +end diff --git a/vendor/voclient/libvotable/examples/votinfo.c b/vendor/voclient/libvotable/examples/votinfo.c new file mode 100644 index 00000000..2a9476b4 --- /dev/null +++ b/vendor/voclient/libvotable/examples/votinfo.c @@ -0,0 +1,192 @@ +/* + * VOTINFO + * + * Print information about the structure of a VOTable. + * + * Usage: + * votinfo [-v] <votable> + */ + +#include <stdio.h> +#include <unistd.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> + +#include "votParse.h" + + +int vot = 0; /* VOTable handle */ + +int verbose = 0; /* options */ +int warn = 0; /* warning options */ + +static void ppMultiLine (char *result, int poffset, int pwidth, int maxchars); + +int +main (int argc, char **argv) +{ + char *fname, *name, *ucd, *desc, *value; + int res, tab, data, tdata, field, handle; + int i, len, ncols, nrows; + + + if (argc < 2) { + fprintf (stderr, "Usage: votinfo <votable>\n"); + return (1); + + } else if (argc >= 2) { + for (i=1; i < argc; i++) { + if (argv[i][0] == '-') { + switch (argv[i][1]) { + case 'v': verbose++; break; + case 'w': warn++; break; + default: + fprintf (stderr, "Invalid option '%s'\n", argv[i]); + return (1); + } + } else { + fname = argv[i]; + break; + } + } + } + + + /* Open the table. This also parses it. + */ + vot_setWarnings (warn); + if ( (vot = vot_openVOTABLE (fname) ) <= 0) { + fprintf (stderr, "Error opening VOTable '%s'\n", argv[1]); + return (1); + } + + + res = vot_getRESOURCE (vot); /* get handles */ + tab = vot_getTABLE (res); + data = vot_getDATA (tab); + tdata = vot_getTABLEDATA (data); + nrows = vot_getNRows (tdata); + ncols = vot_getNCols (tdata); + + + /* Print a table summary. + */ + printf ("%s\n\n", (fname[0] == '-' ? "Stdin" : fname)); + + printf (" Resources: %d\tType: %-12s\t Table Size: %d x %d\n", + vot_getLength (res), vot_getDATATypeString (data), ncols, nrows); + + handle = vot_getINFO (res); + printf (" INFO: %d\n", (handle ? vot_getLength (handle) : 0)); + + handle = vot_getPARAM (res); + printf (" PARAM: %d\t", (len=(handle ? vot_getLength(handle):0))); + if (verbose) { + for (len-- ; handle; handle=vot_getNext(handle),len--) { + name = vot_getAttr (handle, "id"); + value = vot_getAttr (handle, "value"); + printf ("%s = %s ", name, value); + if (len) + printf ("\n\t\t\t"); + } + } + printf ("\n"); + + + /* + handle = vot_getCOOSYS (res); + printf (" COOSYS: %d\n", vot_getLength (handle)); + + handle = vot_getDESCRIPTION (res); + desc = vot_getValue (handle); + printf (" Description: "); + ppMultiLine (desc, 16, 63, 4096); + printf ("\n\n"); + */ + + + + /* Print the column info in verbose mode. + */ + if (verbose) { + printf ("\n\t\t\tName\t\t\tUCD\n\n"); + i = 0; + for (field=vot_getFIELD(tab); field; field=vot_getNext (field)) { + name = vot_getAttr (field, "name"); + ucd = vot_getAttr (field, "ucd"); + + printf (" Field %2d: %-20s\t%-30s\n", + ++i, (name ? name : ""), (ucd ? ucd : "")); + + /* If very-verbose, print a FIELD description. + */ + if (verbose > 1) { + if ( (desc = vot_getValue (vot_getDESCRIPTION (field))) ) + printf ("\t Desc: %-s\n\n", desc); + } + } + } + + + vot_closeVOTABLE (vot); /* close the table */ + + return (0); +} + + +/** + * ppMultiLine + * + * Print a lengthy string on multiple lines. Used to print the last column + * of a table where we indent the carried-over lines to the specified offset. + * No effort is made to break lines at a 'nice' spot since long URLs and + * such won't fit anyway, so we just cut the line and continue. + */ + +static void +ppMultiLine (char *result, int poffset, int pwidth, int maxchars) +{ + register int i, j, ellipses = 0; + int len = strlen((result ? result : "")); + char *ip; + + + if (result) + len = strlen (result); + else + return; + + ip = &result[len-1]; /* strip trailing w/s */ + while ((isspace(*ip) || *ip == '\n') && ip > result) + *ip-- = '\0'; + + if (len > maxchars) { + result[maxchars] = '\0'; + len = maxchars; + ellipses++; + } + + if (len < pwidth) { + for (ip=result; *ip && isspace(*ip); ) + ip++; + printf ("%s", ip); + } else { + j = pwidth; + for (i=0; i < len; ) { + while (isspace (result[i])) i++; + printf ("%-*.*s\n", pwidth, pwidth, &result[i]); + i = j + 1; + j += pwidth; + printf ("%*s", poffset, " "); + if (j > len) { + while (isspace (result[i])) i++; + printf ("%s", &result[i]); + if (ellipses) + printf (" (read more)...."); + break; + } + } + } +} + diff --git a/vendor/voclient/libvotable/examples/votinfo_f77.f b/vendor/voclient/libvotable/examples/votinfo_f77.f new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/vendor/voclient/libvotable/examples/votinfo_f77.f diff --git a/vendor/voclient/libvotable/examples/votinfo_spp.x b/vendor/voclient/libvotable/examples/votinfo_spp.x new file mode 100644 index 00000000..dcc67cc3 --- /dev/null +++ b/vendor/voclient/libvotable/examples/votinfo_spp.x @@ -0,0 +1,129 @@ +## +# SPPINFO -- SPP test program to print the structure of a votable. +# +# @file votget_spp.x +# @author M. Fitzpatrick +# @date 4/16/2011 + + +task info = t_info + +include "sppvotable.h" + + +define DEF_FILE "sample.xml" + + + + +# INFO -- Trivial SPP task to print the structure of a VOTable. This is +# similar to the C program of the same name. + +procedure t_info () + +char fname[SZ_FNAME] +char name[SZ_FNAME], ucd[SZ_FNAME], desc[SZ_LINE], value[SZ_LINE] + +int vot, res, tab, data, tdata, field, handle +int i, len, ncols, nrows + +bool verbose, clgetb() + + +int vx_openVOTABLE() +int vx_getRESOURCE(), vx_getTABLE(), vx_getDATA(), vx_getPARAM() +int vx_getTABLEDATA(), vx_getFIELD(), vx_getINFO(), vx_getNext() +int vx_getDESCRIPTION(), vx_getCOOSYS() +int vx_getNCols(), vx_getNRows(), vx_getLength() + +begin + # Get the parameters. + call clgstr ("fname", fname, SZ_FNAME) + verbose = clgetb ("verbose") + + + # Open and parse the votable. + vot = vx_openVOTABLE (fname) + if (vot <= 0) { + call eprintf ("Cannot open file: '%s'\n") + call pargstr (fname) + return + } + + # Now get various handles from the table. + res = vx_getRESOURCE (vot) + tab = vx_getTABLE (res) + data = vx_getDATA (tab) + tdata = vx_getTABLEDATA (data) + + ncols = vx_getNCols (tdata) + nrows = vx_getNRows (tdata) + + # Print a table summary. + call printf ("%s\n\n") + call pargstr (fname) + + call printf (" Resources: %d\t Table Size: %d x %d\n") + call pargi (vx_getLength (res)) + call pargi (ncols) + call pargi (nrows) + + handle = vx_getINFO (res) + call printf (" INFO: %d\n") + call pargi (vx_getLength (handle)) + + # Print the table PARAMs. + handle = vx_getPARAM (res) + len = vx_getLength (handle) + call printf (" PARAM: %d\t") + call pargi (len) + if (verbose) { + while (handle > 0) { + call vx_getAttr (handle, "id", name, SZ_FNAME) + call vx_getAttr (handle, "value", value, SZ_LINE) + + call printf ("%s = %s ") + call pargstr (name) + call pargstr (value) + + if (len > 1) + call printf ("\n\t\t\t") + + len = len - 1 + handle = vx_getNext (handle) + } + } + call printf ("\n") + + # Print and table desccription. + call vx_getValue (vx_getDESCRIPTION (res), desc, SZ_LINE) + call printf (" Description: %s\n\n ") + call pargstr (desc) + + + # Print the column info in verbose mode. + if (verbose) { + call printf ("\n\t\t\tName\t\t\tUCD\n\n") + + i = 0 + for (field=vx_getFIELD(tab); field > 0; field=vx_getNext (field)) { + call vx_getAttr (field, "name", name, SZ_FNAME) + call vx_getAttr (field, "ucd", ucd, SZ_FNAME) + + call printf (" Field %2d: %-20.20s\t%-30.30s\n") + call pargi (i) + call pargstr (name) + call pargstr (ucd) + + handle = vx_getDESCRIPTION (field) + call vx_getValue (handle, desc, SZ_LINE) + call printf ("\t Desc: %-s\n\n") + call pargstr (desc) + + i = i + 1 + } + } + + # Clean up. + call vx_closeVOTABLE (vot) +end diff --git a/vendor/voclient/libvotable/examples/votpos.c b/vendor/voclient/libvotable/examples/votpos.c new file mode 100644 index 00000000..a4c87150 --- /dev/null +++ b/vendor/voclient/libvotable/examples/votpos.c @@ -0,0 +1,111 @@ +/* + * VOTPOS + * + * Extract the main RA/Dec columns from a VOTable. + * + * Usage: + * votpos -o <outname> <votable> + */ + +#include <stdio.h> +#include <unistd.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> + +#include "votParse.h" + + +int vot = 0; /* VOTable handle */ +char *oname = NULL; /* Output file name */ + +int verbose = 0; /* options */ +int warn = 0; /* warning options */ + +int +main (int argc, char **argv) +{ + char *fname, *ucd; + int res, tab, data, tdata, field; + int i, ncols, nrows; + int ra_col=-1, dec_col=-1, number=1; + FILE *fd = stdout; + + + if (argc < 2) { + fprintf (stderr, "Usage: votinfo <votable>\n"); + return (1); + + } else if (argc >= 2) { + for (i=1; i < argc; i++) { + if (argv[i][0] == '-') { + switch (argv[i][1]) { + case 'o': oname = argv[++i]; break; + case 'v': verbose++; break; + case 'w': warn++; break; + case 'n': number--; break; + default: + fprintf (stderr, "Invalid option '%s'\n", argv[i]); + return (1); + } + } else { + fname = argv[i]; + break; + } + } + } + + if (oname) { + if ((fd = fopen (oname, "w+")) == (FILE *) NULL) + return (1); + } + + /* Open the table. This also parses it. + */ + vot_setWarnings (warn); + if ( (vot = vot_openVOTABLE (fname) ) <= 0) { + fprintf (stderr, "Error opening VOTable '%s'\n", argv[1]); + return (1); + } + + + res = vot_getRESOURCE (vot); /* get handles */ + tab = vot_getTABLE (res); + data = vot_getDATA (tab); + tdata = vot_getTABLEDATA (data); + nrows = vot_getNRows (tdata); + ncols = vot_getNCols (tdata); + + + /* Find the columns. + */ + for (i=0, field=vot_getFIELD(tab); field; field=vot_getNext (field),i++) { + if ((ucd = vot_getAttr (field, "ucd"))) { + if ((strcmp (ucd, "POS_EQ_RA_MAIN") == 0) || /* UCD 1 */ + (strcmp (ucd, "pos.eq.ra;meta.main") == 0)) /* UCD 1+ */ + ra_col = i; + if ((strcmp (ucd, "POS_EQ_DEC_MAIN") == 0) || /* UCD 1 */ + (strcmp (ucd, "pos.eq.dec;meta.main") == 0)) /* UCD 1+ */ + dec_col = i; + } + } + + /* Print the position cells. + */ + for (i=0; i < nrows; i++) { + if (number) + fprintf (fd, "%d %s %s\n", i, + vot_getTableCell (tdata, i, ra_col), + vot_getTableCell (tdata, i, dec_col)); + else + fprintf (fd, "%s %s\n", + vot_getTableCell (tdata, i, ra_col), + vot_getTableCell (tdata, i, dec_col)); + } + + if (fd != stdout) + fclose (fd); + + vot_closeVOTABLE (vot); /* close the table */ + return (0); +} diff --git a/vendor/voclient/libvotable/examples/votpos_f77.f b/vendor/voclient/libvotable/examples/votpos_f77.f new file mode 100644 index 00000000..a998f8be --- /dev/null +++ b/vendor/voclient/libvotable/examples/votpos_f77.f @@ -0,0 +1,61 @@ +C +C F77POS -- Fortran example task to extract position columns from a votable. +C +C M.Fitzpatrick, NOAO, Aug 2009 + + program f77pos + + character ra*16, dec*16, ucd*30 + integer vot, res, tab, data, tdata, field + integer i, ncols, nrows + integer ra_col, dec_col + + +C Declare the libvotable functions we'll be using. +C + integer vf_openvotable, vf_getresource, vf_gettable + integer vf_getdata, vf_gettabledata, vf_getnext + integer vf_getfield, vf_getnrows, vf_getncols + + +C Parse the table. +C + vot = vf_openvotable ("sample.xml") + res = vf_getresource (vot) + tab = vf_gettable (res) + data = vf_getdata (tab) + tdata = vf_gettabledata (data) + +C Get some useful values. +C + nrows = vf_getnrows (tdata) + ncols = vf_getncols (tdata) + print *, nrows, " ", ncols + +C Get the RA and DEC columns by matching the UCD. +C + field = vf_getfield (tab) + do 90 i = 1, ncols +C Get the UCD for this FIELD + call vf_getattr (field, "ucd", ucd, 30) + if (ucd .eq. "POS_EQ_RA_MAIN") ra_col = i + if (ucd .eq. "POS_EQ_DEC_MAIN") dec_col = i + +C Get the next FIELD (i.e. column) in the table. + field = vf_getnext (field) +90 continue + + +C Loop through the data table and print the selected columns. +C + do 91 i = 1, nrows +C Get the value of the cell + call vf_gettablecell (tdata, i, ra_col, ra, 16) + call vf_gettablecell (tdata, i, dec_col, dec, 16) + + print *, ra, " ", dec +91 continue + + stop + end + diff --git a/vendor/voclient/libvotable/examples/votpos_spp.x b/vendor/voclient/libvotable/examples/votpos_spp.x new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/vendor/voclient/libvotable/examples/votpos_spp.x diff --git a/vendor/voclient/libvotable/examples/votsplit.c b/vendor/voclient/libvotable/examples/votsplit.c new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/vendor/voclient/libvotable/examples/votsplit.c @@ -0,0 +1 @@ + diff --git a/vendor/voclient/libvotable/examples/votsplit_f77.f b/vendor/voclient/libvotable/examples/votsplit_f77.f new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/vendor/voclient/libvotable/examples/votsplit_f77.f diff --git a/vendor/voclient/libvotable/examples/votsplit_spp.x b/vendor/voclient/libvotable/examples/votsplit_spp.x new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/vendor/voclient/libvotable/examples/votsplit_spp.x diff --git a/vendor/voclient/libvotable/examples/xx.c b/vendor/voclient/libvotable/examples/xx.c new file mode 100644 index 00000000..7174456c --- /dev/null +++ b/vendor/voclient/libvotable/examples/xx.c @@ -0,0 +1,78 @@ +/** + * VOTCONCAT + * + * Example program to concatenate two input tables to a new output table. + * + * Usage: + * votconcat [-o <out>] <vot1> <vot2> + * + * Where + * <vot1> First input table + * <vot2> Second input table + * -o <out> Optional output table, otherwise stdout + */ + +#include <stdio.h> +#include <unistd.h> +#include <stdlib.h> +#include <string.h> + +#include "votParse.h" + + +int vot1 = 0; /* First VOTable handle */ +int vot2 = 0; /* Second VOTable handle */ +int vot3 = 0; /* Output VOTable handle */ +int res1 = 0, /* RESOURCE handles */ + res2 = 0; + +int +main (int argc, char **argv) +{ + char *out_fname = (char *) NULL, *in1 = NULL, *in2 = NULL; + int i, verbose = 0; + + + if (argc < 3) { + fprintf (stderr, "Usage: votconcat [-o <out>] <vot1> <vot2>\n"); + return (1); + + } else if (argc >= 2) { + for (i=1; i < argc; i++) { + if (argv[i][0] == '-' && strlen (argv[i]) > 1) { + switch (argv[i][1]) { + case 'o': out_fname = argv[++i]; break; + case 'v': verbose++; break; + default: + fprintf (stderr, "Unrecognized option '%c'\n", argv[i][1]); + return (1); + } + } else { + if (in1) /* first table already open */ + in2 = argv[i]; + else + in1 = argv[i]; + } + } + } + + vot1 = vot_openVOTABLE (in1); /* Parse the files */ + vot2 = vot_openVOTABLE (in2); + + res1 = vot_getRESOURCE (vot1); /* Get RESOURCEs */ + res2 = vot_getRESOURCE (vot2); + + vot3 = vot_openVOTABLE (out_fname); /* Open output table */ + + vot_attachNode (vot3, res1); /* Concat tables */ + vot_attachNode (vot3, res2); + + vot_writeVOTable (vot3, "stdout", 1); /* Write it out */ + + vot_closeVOTABLE (vot1); /* Close the tables */ + vot_closeVOTABLE (vot2); + if (vot3) + vot_closeVOTABLE (vot3); + + return (0); +} diff --git a/vendor/voclient/libvotable/examples/zz.c b/vendor/voclient/libvotable/examples/zz.c new file mode 100644 index 00000000..c6c6746a --- /dev/null +++ b/vendor/voclient/libvotable/examples/zz.c @@ -0,0 +1,465 @@ +/* + * Test program to convert to a FITS file + * + * Usage: + * votinfo [-v] <votable> + */ + +#include <stdio.h> +#include <unistd.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> + +#include "votParse.h" +#include "votParseP.h" +#include "fitsio.h" + + +int vot = 0; /* VOTable handle */ +int verbose = 0; /* options */ +int warn = 0; /* options */ + +void zvot_writeFITS (handle_t vot, char *oname); + +int vot_addFITSMeta (int handle, fitsfile *fp, char *meta, int index); +int vot_addFieldMeta (int handle, fitsfile *fp, int index); +int vot_writeFITSData (fitsfile *fp, char **data, char *fmt[], + int nrows, int ncols); +void printerror (int status); + + +#define MAX_FIELDS 256 + +int +main (int argc, char **argv) +{ + char *fname, *oname; + int i; + + + if (argc < 2) { + fprintf (stderr, "Usage: votinfo <votable>\n"); + return (1); + + } else if (argc >= 2) { + for (i=1; i < argc; i++) { + if (argv[i][0] == '-') { + switch (argv[i][1]) { + case 'o': oname = argv[++i]; break; + case 'v': verbose++; break; + case 'w': warn++; break; + default: + fprintf (stderr, "Invalid option '%s'\n", argv[i]); + return (1); + } + } else { + fname = argv[i]; + break; + } + } + } + + + /* Open the input VOTable, this also parses it. + */ + vot_setWarnings (warn); + if ( (vot = vot_openVOTABLE (fname) ) <= 0) { + fprintf (stderr, "Error opening VOTable '%s'\n", fname); + return (1); + } + + if (oname == NULL) { + fprintf (stderr, "Error: No output name specified.\n"); + return (1); + } else { + zvot_writeFITS (vot, oname); + } + + + return (0); +} + + +void +zvot_writeFITS (handle_t vot, char *oname) +{ + char *name, *unit, *dtype, *width, **cells, *cell, *asize; + char *ttype[MAX_FIELDS], *tform[MAX_FIELDS], *tunit[MAX_FIELDS], *ch; + int res, tab, data, tdata, field, handle, hdutype, *widths, *spaces; + int i, j, len, ncols, nrows, status = 0, resnum = 1, bitpix = 8; + long naxis = 0, naxes[2] = { 0, 0 }; + fitsfile *fp; /* CFITSIO descriptor */ + + + + if (fits_create_file (&fp, oname, &status)) /* create new FITS file */ + printerror (status); + + if ( fits_create_img (fp, bitpix, naxis, naxes, &status) ) + printerror (status); + + + /* Loop over all <RESOURCE> elements in the file, creating an new + * extension for each one. + */ + for (res=vot_getRESOURCE (vot); res; res=vot_getNext(res) ) { + + /* Get handles for the current resource. + */ + tab = vot_getTABLE (res); + data = vot_getDATA (tab); + tdata = vot_getTABLEDATA (data); + nrows = vot_getNRows (tdata); + ncols = vot_getNCols (tdata); + + /* Allocate space for the data cells. Read in the cells so we can + * convert it for output. Also collect the widths so we can + * properly size the table. + */ + cells = (char **) calloc (1, (nrows * ncols) * sizeof (char *)); + widths = (int *) calloc (1, ncols * sizeof (int)); + spaces = (int *) calloc (1, ncols * sizeof (int)); + for (i = 0; i < nrows; i++) { + for (j = 0; j < ncols; j++) { + cell = cells[i*ncols+j] = vot_getTableCell(tdata, i, j); + + if ((len = strlen (cell)) > widths[j]) + widths[j] = len; + + if (cell[0] && strchr (cell, (int)' ') && len > 1 && i < 1) { + for (ch=cell; *ch; ch++) { + if (*ch == ' ') + spaces[j]++; + } + } + } + } + + + memset (&ttype[0], 0, MAX_FIELDS); /* initialize */ + memset (&tform[0], 0, MAX_FIELDS); + memset (&tunit[0], 0, MAX_FIELDS); + + /* Move to proper extension HDU. + */ + if (fits_movabs_hdu (fp, resnum++, &hdutype, &status)) + printerror (status); + + /* Get the column attributes and set them in the header. + */ + i = 0; + for (field=vot_getFIELD(tab); field; field=vot_getNext (field)) { + dtype = vot_getAttr (field, "datatype"); + width = vot_getAttr (field, "width"); + asize = vot_getAttr (field, "arraysize"); + + if ((name = vot_getAttr (field, "name"))) + ttype[i] = (name ? name : strdup ("X")); + if ((unit = vot_getAttr (field, "unit"))) + tunit[i] = (unit ? unit : strdup ("Y")); + + tform[i] = calloc (1, 16); + if (strncasecmp (dtype, "char", 4) == 0) { + if (asize[0]) { + sprintf (tform[i], "%dA", + (asize[0] == '*' ? widths[i] : atoi (asize))); + } else + strcpy (tform[i], "A"); + + } else if (strncasecmp (dtype, "float", 4) == 0) { + if (spaces[i]) + sprintf (tform[i], "%dE", spaces[i]+1); + else + strcpy (tform[i], "E"); + + } else if (strncasecmp (dtype, "double", 4) == 0) { + if (spaces[i]) + sprintf (tform[i], "%dD", spaces[i]+1); + else + strcpy (tform[i], "D"); + + } else if (strncasecmp (dtype, "int", 3) == 0) { + if (spaces[i]) + sprintf (tform[i], "%dJ", spaces[i]+1); + else + strcpy (tform[i], "J"); + } + + if (dtype) free ( (void *) dtype); + if (width) free ( (void *) width); + if (asize) free ( (void *) asize); + i++; + } + + /* Append a new empty binary table onto the FITS file + */ + if (fits_create_tbl (fp, BINARY_TBL, nrows, ncols, ttype, tform, + tunit, "extname", &status)) + printerror (status); + + /* Add UCD and UTYPE keywords for the FIELDs if defined. + */ + for (i=1,field=vot_getFIELD(tab); field; field=vot_getNext (field)) + vot_addFieldMeta (field, fp, i++); + + /* Add keywords for all the <INFO> and <PARAM> elements. + */ + handle = vot_getINFO (res); + for (i=1, len=vot_getLength (handle); i < len; i++) { + vot_addFITSMeta (handle, fp, "INFO", i); + handle = vot_getNext (handle); + } + + handle = vot_getPARAM (res); + for (i=1, len=vot_getLength (handle); i < len; i++) { + vot_addFITSMeta (handle, fp, "PARAM", i); + handle = vot_getNext (handle); + } + + + /* Write the data to the file. + */ + vot_writeFITSData (fp, cells, tform, nrows, ncols); + + /* Free the allocated pointers. + */ + for (i=0; i < ncols; i++) { + if (ttype[i]) free ((void *) ttype[i]); + if (tunit[i]) free ((void *) tunit[i]); + if (tform[i]) free ((void *) tform[i]); + } + if (cells) free ((void *) cells); + if (widths) free ((void *) widths); + if (spaces) free ((void *) spaces); + } + + + vot_closeVOTABLE (vot); /* close the VOTable */ + if (fits_close_file (fp, &status)) /* close the FITS file */ + printerror (status); +} + + +int +vot_addFITSMeta (int handle, fitsfile *fp, char *meta, int index) +{ + char *id, *nam, *val, *unit, keyw[SZ_FNAME], comment[SZ_FNAME]; + int status = 0; + + + if ( (id = vot_getAttr (handle, "id")) ) { /* ID attribute */ + memset (keyw, 0, SZ_FNAME); + memset (comment, 0, SZ_FNAME); + sprintf (keyw, "%3.3sID%d", meta, index); + sprintf (comment, "%s id attribute", meta); + if (fits_update_key (fp, TSTRING, keyw, id, comment, &status)) + printerror ( status ); + } + + if ( (nam = vot_getAttr (handle, "name")) ) { /* NAME attribute */ + memset (keyw, 0, SZ_FNAME); + memset (comment, 0, SZ_FNAME); + sprintf (keyw, "%3.3sNAM%d", meta, index); + sprintf (comment, "%s name attribute", meta); + + if (fits_update_key (fp, TSTRING, keyw, nam, comment, &status)) + printerror ( status ); + } + + if ( (val = vot_getAttr (handle, "value")) ) { /* VALUE attribute */ + memset (keyw, 0, SZ_FNAME); + memset (comment, 0, SZ_FNAME); + sprintf (keyw, "%3.3sVAL%d", meta, index); + sprintf (comment, "%s val attribute", meta); + + if (fits_update_key (fp, TSTRING, keyw, val, comment, &status)) + printerror ( status ); + } + + if ( (unit = vot_getAttr (handle, "unit")) ) { /* UNIT attribute */ + memset (keyw, 0, SZ_FNAME); + memset (comment, 0, SZ_FNAME); + sprintf (keyw, "%3.3sUNI%d", meta, index); + sprintf (comment, "%s unit attribute", meta); + + if (fits_update_key (fp, TSTRING, keyw, unit, comment, &status)) + printerror ( status ); + } + + return (0); +} + + +int +vot_addFieldMeta (int handle, fitsfile *fp, int index) +{ + char *ucd, *utype, *id, keyw[SZ_FNAME]; + int status = 0; + + + if ( (ucd = vot_getAttr (handle, "ucd")) ) { /* UCD attribute */ + memset (keyw, 0, SZ_FNAME); + sprintf (keyw, "TUCD%d", index); + if (fits_update_key (fp, TSTRING, keyw, ucd, "UCD attribute", &status)) + printerror ( status ); + } + + if ( (utype = vot_getAttr (handle, "utype")) ) { /* UTYPE attribute */ + memset (keyw, 0, SZ_FNAME); + sprintf (keyw, "TUTYPE%d", index); + if (fits_update_key (fp, TSTRING, keyw, utype, "UTYPE attribute", + &status)) + printerror ( status ); + } + + if ( (id = vot_getAttr (handle, "id")) ) { /* ID attribute */ + memset (keyw, 0, SZ_FNAME); + sprintf (keyw, "TID%d", index); + if (fits_update_key (fp, TSTRING, keyw, id, "ID attribute", &status)) + printerror ( status ); + } + + return (0); +} + +int +vot_writeFITSData (fitsfile *fp, char **data, char *fmt[], int nrows, int ncols) +{ + int i, j, n, type, width, status = 0; + char **ccol, *tform, cell[1024], *tok, *sep = " ", *brkt = NULL; + float *fcol; + double *dcol; + long *icol; + long frow = 1, felem = 1; + + + for (j = 0; j < ncols; j++) { + + tform = fmt[j]; + width = atoi (tform); + type = strlen (tform) - 1; + + switch (tform[type]) { + case 'A': /* CHAR */ + ccol = (char **) calloc (1, (nrows * (width+1) * sizeof (char *))); + + for (i = 0; i < nrows; i++) + ccol[i] = (char *) data[i * ncols + j]; + + fits_write_col (fp, TSTRING, j+1, frow,felem, nrows, ccol, &status); + free ((void *) ccol); + break; + + case 'D': /* DOUBLE */ + dcol = (double *) calloc (1, (nrows * (width+1) * sizeof (double))); + + if (width == 0) { + for (i = 0; i < nrows; i++) + ((double *) dcol)[i] = (double) atof (data[i * ncols + j]); + fits_write_col (fp, TDOUBLE, j+1, frow,felem, nrows, dcol, + &status); + } else { + double *dp = dcol, *dpr = dp; + + for (i = 0; i < nrows; i++) { + brkt = NULL; + memset (cell, 0, 1024); + strcpy (cell, data[i * ncols + j]); + + dpr = dp; + for (n=1, tok=strtok_r (cell, sep, &brkt); tok; + tok=strtok_r (NULL, sep, &brkt), n++) + *dp++ = (double) atof (tok); + for ( ; n < width; n++) /* missing values */ + *dp++ = (double) 0.0; + + fits_write_col (fp, TDOUBLE, j+1, i+1,felem, width, dpr, + &status); + } + } + + free ((void *) dcol); + break; + + case 'E': /* FLOAT */ + fcol = (float *) calloc (1, (nrows * (width+1) * sizeof (float))); + + if (width == 0) { + for (i = 0; i < nrows; i++) + ((float *) fcol)[i] = (float) atof (data[i * ncols + j]); + fits_write_col (fp, TFLOAT, j+1, frow,felem, nrows, fcol, + &status); + } else { + float *rp = fcol, *rpr = rp; + + for (i = 0; i < nrows; i++) { + brkt = NULL; + memset (cell, 0, 1024); + strcpy (cell, data[i * ncols + j]); + + rpr = rp; + for (n=1, tok=strtok_r (cell, sep, &brkt); tok; + tok=strtok_r (NULL, sep, &brkt), n++) + *rp++ = (float) atof (tok); + for ( ; n < width; n++) /* missing values */ + *rp++ = (float) 0.0; + + fits_write_col (fp, TFLOAT, j+1, i+1,felem, width, rpr, + &status); + } + } + + free ((void *) fcol); + break; + + case 'J': /* INT */ + icol = (long *) calloc (1, (nrows * (width+1) * sizeof (long))); + + if (width == 0) { + for (i = 0; i < nrows; i++) + ((long *) icol)[i] = (long) atoi (data[i * ncols + j]); + fits_write_col (fp, TLONG, j+1, frow,felem, nrows, icol, + &status); + } else { + long *ip = icol, *ipr = ip; + + for (i = 0; i < nrows; i++) { + brkt = NULL; + memset (cell, 0, 1024); + strcpy (cell, data[i * ncols + j]); + + ipr = ip; + for (n=1, tok=strtok_r (cell, sep, &brkt); tok; + tok=strtok_r (NULL, sep, &brkt), n++) + *ip++ = (long) atoi (tok); + for ( ; n < width; n++) /* missing values */ + *ip++ = (long) 0; + + fits_write_col (fp, TLONG, j+1, i+1,felem, width, ipr, + &status); + } + } + + free ((void *) icol); + break; + + default: + fprintf (stderr, "Invalid column type '%c'\n", tform[type]); + continue; + } + } + + return (0); +} + + +void printerror (int status) +{ + if (status) { + fits_report_error (stderr, status); /* print error report */ + exit (status); + } + return; +} + diff --git a/vendor/voclient/libvotable/examples/zztest.c b/vendor/voclient/libvotable/examples/zztest.c new file mode 100644 index 00000000..ff5add17 --- /dev/null +++ b/vendor/voclient/libvotable/examples/zztest.c @@ -0,0 +1,427 @@ + + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <string.h> + +#include "votParse.h" + + + +typedef struct colum { + char name[100]; + char ucd[1000]; +} col_t; + +int +pseudocode1(char *fname) +{ + handle_t vot, res, data, tab, field, tr, td, fits, stream, tdata, + bin; + int nrows, ncols, i, l, m, use_direct = 1; + char *str, *extnum, *href, *ucd, *name; + + printf("--------------Test 1-------------------------------------------\n"); + + col_t *col; + + vot = vot_openVOTABLE(fname); + + /* Loop over RESOURCES. */ + res = vot_getRESOURCE(vot); + + printf("Table has toplevel %i RESOURCE elements\n", + vot_getLength(res)); + + while (res) { + tab = vot_getTABLE(res); + + /* Print column info. */ + + /* Get the data element. */ + data = vot_getDATA(tab); + + /* Get data stored as a TABLEDATA XML block. */ + tdata = vot_getTABLEDATA(data); + + col = (col_t *) calloc(vot_getNCols(tdata), sizeof(col_t)); + + for (field = vot_getFIELD(tab), i = 0; field; field = vot_getNext(field), i++) { + name = vot_getAttr(field, "name"); + ucd = vot_getAttr(field, "ucd"); + + if (name != NULL) + strcpy(col[i].name, name); + + if (ucd != NULL) + strcpy(col[i].ucd, ucd); + + printf("%s, ", col[i].name); + } + + printf("\n"); + + switch (vot_getDATAType(data)) { + case TY_TABLEDATA: + + if (use_direct) { + /* Get the table data cells by direct index. */ + tr = vot_getTR(tdata); + nrows = vot_getLength(tr); + ncols = vot_getLength(vot_getTD(tr)); + + for (l = 0; l < nrows; l++) { + for (m = 0; m < ncols; m++) { + str = vot_getTableCell(tdata, l, m); + printf("%s\n", str); + } + + printf("--\n"); + } + } else { + /* Get the table data cells by looping over rows/cols. */ + for (tr = vot_getTR(tdata); tr; tr = vot_getNext(tr)) { + for (td = vot_getTD(tr); td; td = vot_getNext(td)) { + str = vot_getValue(td); + printf("%s\n", str); + } + } + } + + break; + + case TY_BINARY: + /* + * Get data stored as inline binary. If the encoding of the + * stream is based64 read the sequence of bytes and decode. + */ + + bin = vot_getBINARY(data); + stream = vot_getSTREAM(bin); + + if (strcasecmp("base64", vot_getAttr(stream, "encoding")) == 0) + str = vot_getValue(stream); + printf("%s\n", str); + + break; + + case TY_FITS: + /* + * Read FITS data. Assumes a particular extension of an MEF is + * avaliable for download at the given href. + */ + fits = vot_getFITS(data); + extnum = vot_getAttr(fits, "extnum"); + + stream = vot_getSTREAM(fits); + href = vot_getAttr(stream, "href"); + + /* Download the FITS file. */ + + break; + + default: + printf("Error: Invalid table DATA type.\n"); + } + + res = vot_getNext(res); + } + + + printf("--------------\\Test 1-----------------------------------------\n"); + + return (0); + +} + +int +pseudocode2(char *fname) +{ + handle_t vot, res, p; + + printf("--------------Test 2-------------------------------------------\n"); + vot = vot_openVOTABLE(fname); + + res = vot_getRESOURCE(vot); + + for (p = vot_getChild(res); p; p = vot_getSibling(p)) { + if (vot_typeOf(p) == TY_PARAM) + printf("PARAM name=%s value=%s\n", + vot_getAttr(p, "name"), vot_getAttr(p, "value")); + } + + printf("\n"); + res = vot_getRESOURCE(vot); + + for (p = vot_getPARAM(res); p; p = vot_getNext(p)) { + printf("PARAM name=%s value=%s\n", + vot_getAttr(p, "name"), vot_getAttr(p, "value")); + } + + + printf("------------\\Test 2-------------------------------------------\n"); + + return (0); +} + +int +pseudocode3(char *fname) +{ + handle_t vot, res, param, info; + + printf("--------------Test 3-------------------------------------------\n"); + vot = vot_openVOTABLE(fname); + + if ((info = vot_getINFO(vot))) { + if (strcasecmp(vot_getAttr(info, "name"), "error") == 0) + printf("ERROR: VALUE=%s\n", vot_getAttr(info, "value")); + } else { + printf("File OK.\n"); + } + + + vot = vot_openVOTABLE(fname); + res = vot_getRESOURCE(vot); + param = vot_getPARAM(res); + info = vot_getINFO(res); + + if ((param) && strcasecmp(vot_getAttr(param, "name"), "error") == 0) { + /* SCS alternate method where PARAN defines value the error string. */ + printf("ERROR: VALUE=%s\n", vot_getAttr(param, "value")); + } else if ((info) && strcasecmp(vot_getAttr(info, "name"), "QUERY_STATUS") == 0) { + /* + * All-other DAL methods where PARAM and INFO of the RESOURCE defines + * a QUERY_STATUS of the result. + */ + if (strcasecmp(vot_getAttr(info, "value"), "OK") == 0) + printf("FILE OK.\n"); + else + printf("ERROR: Value=%s\n", vot_getValue(info)); + } else + printf("FILE OK.\n"); + + + printf("------------\\Test 3-------------------------------------------\n"); + return (0); +} + +int +pseudocode4(void) +{ + handle_t vot, res, data, tab, f, tr, td, tdata, desc, info; + int nrows = 5, ncols = 10, i, j; + char colname[50]; + char **data_m; + char **ip; + char *tmpstr; + + printf("--------------Test 4-------------------------------------------\n"); + + data_m = (char **) calloc((nrows * ncols), sizeof(char *)); + + ip = data_m; + + for (i = 0; i < nrows; i++) { + for (j = 0; j < ncols; j++) { + tmpstr = (char *) calloc(30, sizeof(char)); + sprintf(tmpstr, "row: %i, col: %i", i, j); + *ip++ = tmpstr; + } + } + + + vot = vot_openVOTABLE(NULL); + + res = vot_newNode(vot, TY_RESOURCE); + vot_setAttr(res, "id", "newtable"); + + desc = vot_newNode(vot, TY_DESCRIPTION); + vot_setValue(desc, "This is a test description."); + + tab = vot_newNode(res, TY_TABLE); + + for (i = 0; i < 10; i++) { + f = vot_newNode(tab, TY_FIELD); + sprintf(colname, "col%d", i); + vot_setAttr(f, "name", colname); + vot_setAttr(f, "id", colname); + } + + data = vot_newNode(tab, TY_DATA); + tdata = vot_newNode(data, TY_TABLEDATA); + + for (i = 0; i < nrows; i++) { + tr = vot_newNode(tdata, TY_TR); + for (j = 0; j < ncols; j++) { + td = vot_newNode(tr, TY_TD); + vot_setValue(td, (char *) data_m[(i * ncols) + j]); + } + } + + info = vot_newNode(tab, TY_INFO); + vot_setAttr(info, "id", "STATUS"); + vot_setAttr(info, "value", "OK"); + + vot_writeVOTable(vot, "stdout", 1); + + + printf("------------\\Test 4-------------------------------------------\n"); + + return (0); +} + +int +pseudocode5_copy(char *fname1, char *fname2) +{ + handle_t vot2, res2, cres2; + handle_t vot1, res1, cres1; + handle_t vot3; + + printf("--------------Test 5-------------------------------------------\n"); + + vot1 = vot_openVOTABLE(fname1); + printf("Handles: %i\n", vot_handleCount()); + vot2 = vot_openVOTABLE(fname2); + printf("Handles: %i\n", vot_handleCount()); + + res1 = vot_getRESOURCE(vot1); + res2 = vot_getRESOURCE(vot2); + + cres1 = vot_copyElement(res1, 0); + cres2 = vot_copyElement(res2, 0); + printf("Handles: %i\n", vot_handleCount()); + + vot3 = vot_openVOTABLE(NULL); + + vot_attachNode(vot3, cres1); + vot_attachNode(vot3, cres2); + + vot_writeVOTable(vot3, "stdout", 1); + + printf("Handles: %i\n", vot_handleCount()); + vot_closeVOTABLE(vot1); + vot_closeVOTABLE(vot2); + vot_closeVOTABLE(vot3); + vot_closeVOTABLE(cres2); + vot_closeVOTABLE(cres1); + printf("Handles: %i\n", vot_handleCount()); + vot_deleteNode(cres2); + vot_deleteNode(cres1); + printf("Handles: %i\n", vot_handleCount()); + vot_writeVOTable(vot3, "stdout", 1); + + printf("------------\\Test 5-------------------------------------------\n"); + return (0); +} + +int +pseudocode5(char *fname1, char *fname2) +{ + handle_t vot2, res2; + handle_t vot1, res1; + handle_t vot3; + + printf("--------------Test 5-------------------------------------------\n"); + + vot1 = vot_openVOTABLE(fname1); + vot2 = vot_openVOTABLE(fname2); + + res1 = vot_getRESOURCE(vot1); + res2 = vot_getRESOURCE(vot2); + + vot3 = vot_openVOTABLE(NULL); + + vot_attachNode(vot3, res1); + vot_attachNode(vot3, res2); + + vot_writeVOTable(vot3, "stdout", 1); + printf("Handles: %i\n", vot_handleCount()); + vot_closeVOTABLE(vot1); + printf("Handles: %i\n", vot_handleCount()); + vot_closeVOTABLE(vot2); + printf("Handles: %i\n", vot_handleCount()); + vot_closeVOTABLE(vot3); + printf("Handles: %i\n", vot_handleCount()); + vot_writeVOTable(vot3, "stdout", 1); + + printf("------------\\Test 5-------------------------------------------\n"); + return (0); +} + +int +pseudocode6(void) +{ + + printf("--------------Test 6-------------------------------------------\n"); + printf("------------\\Test 6-------------------------------------------\n"); + return (0); +} + +void +copy_test(char *fname) +{ + handle_t vot, copy; + + printf("--------------Copy Test-------------------------------------------\n"); + vot = vot_openVOTABLE(fname); + + /* + vot_writeVOTable(vot, "stdout", 1); + */ + + printf("Handles: %i\n", vot_handleCount()); + + + copy = vot_copyElement(vot, 0); + + + /* + vot_writeVOTable(copy, "stdout", 1); + */ + + printf("Handles: %i\n", vot_handleCount()); + + vot_closeVOTABLE(copy); + + printf("Handles: %i\n", vot_handleCount()); + + + + vot_closeVOTABLE(vot); + + printf("Handles: %i\n", vot_handleCount()); + + printf("------------\\Copy Test-------------------------------------------\n"); + +} + + + +int +main(int argc, char **argv) +{ + char *fname = "zztest.xml"; + char *fname2 = "zzdummy.xml"; + + + printf("Hello World!\n"); + + + /* + */ + pseudocode1(fname); + pseudocode2(fname); + pseudocode3(fname); + pseudocode4(); + + pseudocode5(fname, fname2); + pseudocode5_copy(fname, fname2); + + pseudocode6(); + + copy_test(fname); + + + return (0); +} diff --git a/vendor/voclient/libvotable/examples/zztest.sh b/vendor/voclient/libvotable/examples/zztest.sh new file mode 100644 index 00000000..4002e8c8 --- /dev/null +++ b/vendor/voclient/libvotable/examples/zztest.sh @@ -0,0 +1,5 @@ +#!/bin/csh -f + +/bin/rm -f foo* + +votget_spp.e votget votable=data/sia_m51.xml base=foo ucd="" col=0 verbose=no diff --git a/vendor/voclient/libvotable/examples/zzurl.txt b/vendor/voclient/libvotable/examples/zzurl.txt new file mode 100644 index 00000000..61401d7f --- /dev/null +++ b/vendor/voclient/libvotable/examples/zzurl.txt @@ -0,0 +1,20 @@ +http://iraf.noao.edu/zdata/h_n5194-2_f814_wf4.fits +http://iraf.noao.edu/zdata/h_n5194-2_f555_pc.fits +http://iraf.noao.edu/zdata/h_n5194-2_f814_pc.fits +http://iraf.noao.edu/zdata/h_n5194-2_f814_wf3.fits +http://iraf.noao.edu/zdata/h_n5194-2_f814_wf2.fits +http://iraf.noao.edu/zdata/h_n5194-2_f814_mosaic.fits +http://iraf.noao.edu/zdata/h_n5194-2_f555_wf4.fits +http://iraf.noao.edu/zdata/h_n5194-2_f555_wf3.fits +http://iraf.noao.edu/zdata/h_n5194-2_f555_wf2.fits +http://iraf.noao.edu/zdata/h_n5194-2_f555_mosaic.fits +http://iraf.noao.edu/zdata/h_n5194-1_f555_pc.fits +http://iraf.noao.edu/zdata/h_n5194-1_f814_pc.fits +http://iraf.noao.edu/zdata/h_n5194-1_f814_wf4.fits +http://iraf.noao.edu/zdata/h_n5194-1_f814_wf3.fits +http://iraf.noao.edu/zdata/h_n5194-1_f814_wf2.fits +http://iraf.noao.edu/zdata/h_n5194-1_f814_mosaic.fits +http://iraf.noao.edu/zdata/h_n5194-1_f555_wf4.fits +http://iraf.noao.edu/zdata/h_n5194-1_f555_wf3.fits +http://iraf.noao.edu/zdata/h_n5194-1_f555_mosaic.fits +http://iraf.noao.edu/zdata/h_n5194-1_f555_wf2.fits |