3
# read quasars.tsv from VizieR and convert to JSON
6
$TSV = "./quasars.tsv";
7
$JSON = "./catalog.json";
13
open (JSON, ">$JSON");
15
print JSON "\t\"version\": \"0.1.1\",\n";
16
print JSON "\t\"shortName\": \"A catalogue of quasars\",\n";
17
print JSON "\t\"quasars\":\n";
20
for ($i=0;$i<scalar(@catalog);$i++) {
21
if ($catalog[$i] =~ /^([a-zA-Z0-9]+)/) {
22
($name,$RA,$DE,$z,$Vmag,$bV,$Amag) = split(";", $catalog[$i]);
24
($hour,$min,$sec) = split(" ",$RA);
25
$outRA = $hour."h".$min."m".$sec."s";
27
($deg,$min,$sec) = split(" ",$DE);
28
$outDE = $deg."d".$min."m".$sec."s";
30
$name =~ s/(\s{2,})//gi;
38
if ($name ne 'M 31') {
39
$out = "\t\t\"".$name."\":\n";
41
$out .= "\t\t\t\"RA\": \"".$outRA."\",\n";
42
$out .= "\t\t\t\"DE\": \"".$outDE."\",\n";
43
$out .= "\t\t\t\"z\": ".$z.",\n";
44
$out .= "\t\t\t\"Vmag\": ".$Vmag;
46
$out .= ",\n\t\t\t\"Amag\": ".$Amag;
49
$out .= ",\n\t\t\t\"bV\": ".$bV;
53
if ($i<scalar(@catalog)-1) {