gemini-hlsw / lucuma-catalog   0.47.2

Scala versions: 3.x
Scala.js versions: 1.x


Scala JVM/JS library to read votable catalogs.


VOTable is an xml format to deliver astronomical table based data.

It has a heritage based on FITS, having a preamble of metadata describing the table rows and the data in a table format

lucuma-catalog provides functions to read the xml and convert it to lucuma-core SiderealTarget.


lucuma-catalog is centered around a single function.

  def siderealTargets(catalog: CatalogName): Pipe[F, String, EitherNec[CatalogProblem, Target.Sidereal]]

The function is an fs2 Pipe that will take a Stream[F, String], attempt to first parse its xml content and then produce a stream of Target.Sidereals. This means we don't need to wait for the whole document to be parsed to start getting results.

Note that we fail at the level of targets, this would allow to keep getting results even if one particular target cannot be read for any reason

Though VOTable is a formal standard different catalogs can use different metadata and thus we need to tell the targets function what specific catalog we are using.


import lucuma.catalog._

val file    = new File("votabl.xml")

Blocker[IO].use { blocker =>
    .readAll[IO](Paths.get(file.toURI), blocker, 1024)

Examples for JVM and JS are provided Each example will query Simbad using sttp as http client and pretty print the result.


To stream parse xml we are using fs2-data-xml and fs2-data-csv