[Volute] r5267 - in trunk/projects/semantics/vocabularies: . refframe refposition

Volute commit messages volutecommits at g-vo.org
Tue Dec 11 15:42:48 CET 2018


Author: msdemlei
Date: Tue Dec 11 15:42:48 2018
New Revision: 5267

Log:
vocabularies: + refframe as sent in by MCD.

Also, convert.py now bails out on CSV syntax errors.

Added:
   trunk/projects/semantics/vocabularies/refframe/
   trunk/projects/semantics/vocabularies/refframe/README
   trunk/projects/semantics/vocabularies/refframe/terms.csv
Modified:
   trunk/projects/semantics/vocabularies/Makefile
   trunk/projects/semantics/vocabularies/convert.py
   trunk/projects/semantics/vocabularies/refposition/terms.csv
   trunk/projects/semantics/vocabularies/vocabs.conf

Modified: trunk/projects/semantics/vocabularies/Makefile
==============================================================================
--- trunk/projects/semantics/vocabularies/Makefile	Tue Dec 11 15:12:04 2018	(r5266)
+++ trunk/projects/semantics/vocabularies/Makefile	Tue Dec 11 15:42:48 2018	(r5267)
@@ -2,14 +2,14 @@
 	python convert.py vocabs.conf
 
 dist.tar.gz: all
-	tar -cvzf $@ $(BUILT_DIRS)
+	tar -czf $@ $(BUILT_DIRS)
 
 FAIL = $(error "Need to define ROOT_URI for make local")
 
 local: clean
 ifdef ROOT_URI
 	python convert.py --root-uri $(ROOT_URI) vocabs.conf
-	(cd build; tar -cvzf ../local.tar.gz *)
+	(cd build; tar -czf ../local.tar.gz *)
 else
 	$(FAIL)
 endif

Modified: trunk/projects/semantics/vocabularies/convert.py
==============================================================================
--- trunk/projects/semantics/vocabularies/convert.py	Tue Dec 11 15:12:04 2018	(r5266)
+++ trunk/projects/semantics/vocabularies/convert.py	Tue Dec 11 15:42:48 2018	(r5267)
@@ -506,33 +506,39 @@
     last_predicate = None
     terms = []
     with open(src_name) as f:
-        for rec in csv.reader(f, delimiter=";"):
+        for index, rec in enumerate(csv.reader(f, delimiter=";")):
             rec = [(s or None) for s in rec]
 
-            hierarchy_level = int(rec[1])
-            if hierarchy_level-1>len(parent_stack):
-                parent_stack.append(last_predicate)
-            while hierarchy_level-1<len(parent_stack):
-                parent_stack.pop()
-            last_predicate = rec[0]
-            if not is_URI(last_predicate):
-                last_predicate = "#"+last_predicate
-
-            if parent_stack:
-                parent = parent_stack[-1]
-            else:
-                parent = None
-
-            if len(rec)<5:
-                synonym = None
-            else:
-                synonym = rec[4]
-                if not is_URI(synonym):
-                    synonym = "#"+synonym
-
-            terms.append(
-                Term(rec[0], rec[2].decode("utf-8"), 
-                    rec[3].decode("utf-8"), parent, synonym))
+            try:
+                hierarchy_level = int(rec[1])
+                if hierarchy_level-1>len(parent_stack):
+                    parent_stack.append(last_predicate)
+                while hierarchy_level-1<len(parent_stack):
+                    parent_stack.pop()
+                last_predicate = rec[0]
+                if not is_URI(last_predicate):
+                    last_predicate = "#"+last_predicate
+
+                if parent_stack:
+                    parent = parent_stack[-1]
+                else:
+                    parent = None
+
+                if len(rec)<5:
+                    synonym = None
+                else:
+                    synonym = rec[4]
+                    if not is_URI(synonym):
+                        synonym = "#"+synonym
+
+                terms.append(
+                    Term(rec[0], rec[2].decode("utf-8"), 
+                        rec[3].decode("utf-8"), parent, synonym))
+            except IndexError:
+                sys.exit(
+                    "{}, rec {}: Incomplete record {}.".format(
+                        src_name, index, rec))
+                    
     
     return terms
 
@@ -582,6 +588,11 @@
         dest="root_uri", 
         default="http://www.ivoa.net/rdf/",
         metavar="URI")
+    parser.add_argument("--build-only",
+        help="Only build VOCNAME (if available in vocabs.conf)",
+        action="store",
+        dest="build_only",
+        metavar="VOCNAME")
     parser.add_argument("--dest-dir",
         help="Write HTML and RDF output files to PATH (default: build).",
         action="store",
@@ -601,6 +612,8 @@
     meta = read_meta(args.vocab_config, args.root_uri)
         
     for vocab_def in meta:
+        if args.build_only and args.build_only!=vocab_def["name"]:
+            continue
         build_vocab(vocab_def, args.dest_dir)
 
 

Added: trunk/projects/semantics/vocabularies/refframe/README
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/projects/semantics/vocabularies/refframe/README	Tue Dec 11 15:42:48 2018	(r5267)
@@ -0,0 +1,3 @@
+This list of reference frames evolved from a list originating in
+STC-1 (http://ivoa.net/Documents/cover/STC-20071030.html).  Mark
+Cresitello-Dittmar brought it into a hierarchical form.

Added: trunk/projects/semantics/vocabularies/refframe/terms.csv
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/projects/semantics/vocabularies/refframe/terms.csv	Tue Dec 11 15:42:48 2018	(r5267)
@@ -0,0 +1,49 @@
+EQUATORIAL;1;EQUATORIAL;"NOT A VOCABULARY TERM"
+ICRS;2;ICRS;"International Celestial Reference System"
+FK4;2;FK4;"Fundamental Katalog, system 4; Besselian. (Requires Equinox; default B1950.0.)"
+FK5;2;FK5;"Fundamental Katalog, system 5; Julian. (Requires Equinox; default J2000.0)"
+ECLIPTIC;1;ECLIPTIC;"NOT A VOCABULARY TERM"
+ECLIPTIC;2;ECLIPTIC;"Ecliptic coordinates"
+GALACTIC;1;GALACTIC;"NOT A VOCABULARY TERM"
+GALACTIC_I;2;GALACTIC_I;"Old Galactic coordinates"
+GALACTIC_II;2;GALACTIC_II;"New Galactic coordinates"
+SUPER_GALACTIC;2;SUPER_GALACTIC;"Super-galactic coordinates (pole at GALACTIC_II (47.37, +6.32); origin at GALACTIC_II (137.37, 0))"
+GEOGRAPHIC;1;GEOGRAPHIC;"NOT A VOCABULARY TERM"
+GEO_C;2;GEO_C;"Geographic (geocentric) coordinates: longitude, latitude, geocentric distance."
+GEO_D;2;GEO_D;"Geodetic coordinates: longitude, latitude, elevation (Semi-major axis and inverse flattening of the reference spheroid may need to be provided; default is IAU 1976 (6378140 m, 298.2577))"
+MAG;2;MAG;"Geomagnetic coordinates "
+GSE;2;GSE;"Geocentric Solar Ecliptic coordinates "
+GSM;2;GSM;"Geocentric Solar Magnetic coordinates "
+SOLAR;1;SOLAR;"NOT A VOCABULARY TERM"
+SM;2;SM;"Solar Magnetic coordinates "
+HGC;2;HGC;"Heliographic coordinates (Carrington) "
+HGS;2;HGS;"Heliographic coordinates (Stonyhurst) "
+HEEQ;2;HEEQ;"Heliographic Earth Equatorial coordinates "
+HRTN;2;HRTN;"Heliographic Radial-Tangential-Normal coordinates "
+HPC;2;HPC;"Helioprojective Cartesian coordinates "
+HPR;2;HPR;"Helioprojective Polar coordinates "
+HCC;2;HCC;"Heliocentric Cartesian coordinates "
+HGI;2;HGI;"Heliographic Inertial coordinates "
+PLANETARY;1;PLANETARY;"NOT A VOCABULARY TERM"
+MERCURY_C;2;MERCURY_C;"Planetocentric coordinates on Mercury "
+VENUS_C;2;VENUS_C;"Planetocentric coordinates on Venus "
+LUNA_C;2;LUNA_C;"Selenocentric coordinates "
+MARS_C;2;MARS_C;"Planetocentric coordinates on Mars "
+JUPITER_C_III;2;JUPITER_C_III;"Planetocentric coordinates on Jupiter, system III "
+SATURN_C_III;2;SATURN_C_III;"Planetocentric coordinates on Saturn, system III "
+URANUS_C_III;2;URANUS_C_III;"Planetocentric coordinates on Uranus, system III "
+NEPTUNE_C_III;2;NEPTUNE_C_III;"Planetocentric coordinates on Neptune, system III "
+PLUTO_C;2;PLUTO_C;"Planetocentric coordinates on Pluto, system III "
+MERCURY_G;2;MERCURY_G;"Planetographic coordinates on Mercury "
+VENUS_G;2;VENUS_G;"Planetographic coordinates on Venus "
+LUNA_G;2;LUNA_G;"Selenographic coordinates "
+MARS_G;2;MARS_G;"Planetographic coordinates on Mars "
+JUPITER_G_III;2;JUPITER_G_III;"Planetographic coordinates on Jupiter, system III "
+SATURN_G_III;2;SATURN_G_III;"Planetographic coordinates on Saturn, system III "
+URANUS_G_III;2;URANUS_G_III;"Planetographic coordinates on Uranus, system III "
+NEPTUNE_G_III;2;NEPTUNE_G_III;"Planetographic coordinates on Neptune, system III "
+PLUTO_G;2;PLUTO_G;"Planetographic coordinates on Pluto "
+OTHER;1;OTHER;"NOT A VOCABULARY TERM"
+AZ_EL;2;AZ_EL;"Local azimuth and elevation. (Ground-based observations; Azimuth from North through East.)"
+BODY;2;BODY;"Generic "BODY" coordinates"
+UNKNOWN;2;UNKNOWN;"Unknown reference frame. (Only to be used as a last resort or for simulations. The client is responsible for assigning a suitable default.)"

Modified: trunk/projects/semantics/vocabularies/refposition/terms.csv
==============================================================================
--- trunk/projects/semantics/vocabularies/refposition/terms.csv	Tue Dec 11 15:12:04 2018	(r5266)
+++ trunk/projects/semantics/vocabularies/refposition/terms.csv	Tue Dec 11 15:42:48 2018	(r5267)
@@ -1,7 +1,6 @@
 TOPOCENTER;1;Topocenter;The location of the instrument that made the observation
-GEOCENTER;1;The center of the earth
-BARYCENTER;1;The barycenter of the solar system
-HELIOCENTER;1;The center of the sun
-EMBARYCENTER;1;The barycenter of the Earth-Moon system
-UNKNOWN;1; The times cannot be transformed to a different reference position reliably.  This is to be used for simulated data or for data for which the reference position has been lost.
-
+GEOCENTER;1;Geocenter;The center of the earth
+BARYCENTER;1;Solar System Barycenter;The barycenter of the solar system
+HELIOCENTER;1;Heliocenter;The center of the sun
+EMBARYCENTER;1;Earth-Moon Barycenter;The barycenter of the Earth-Moon system
+UNKNOWN;1;Unknown;The times cannot be transformed to a different reference position reliably.  This is to be used for simulated data or for data for which the reference position has been lost.

Modified: trunk/projects/semantics/vocabularies/vocabs.conf
==============================================================================
--- trunk/projects/semantics/vocabularies/vocabs.conf	Tue Dec 11 15:12:04 2018	(r5266)
+++ trunk/projects/semantics/vocabularies/vocabs.conf	Tue Dec 11 15:42:48 2018	(r5267)
@@ -44,3 +44,12 @@
 title:Reference Positions
 description:A collection of reference positions in common use in astronomy.
 authors: Rots, A.; Demleitner, M.
+
+[refframe]
+timestamp:2019-03-15
+title:Reference Frames
+description:A collection of reference frames in common use in astronomy,
+	organised by top-level categories (equatorial, galactic, etc).
+authors: Rots, A.; Demleitner, M.
+
+


More information about the Volutecommits mailing list