def _get_range_value(self, col, doc):
        """For a given range column name, return the appropriate representation given a document"""
        # TODO: This is information model dependent. Could extract somewhere
        res = None
        try:
            if col == "vertical_range":  # Resource vertical intent (NUMRANGE)
                geoc = None
                if "geospatial_bounds" in doc:
                    geoc = doc["geospatial_bounds"]
                elif "constraint_list" in doc:
                    # Find the first one - alternatively could expand a bbox
                    for cons in doc["constraint_list"]:
                        if isinstance(cons, dict) and cons.get("type_", None) == "GeospatialBounds":
                            geoc = cons
                            break
                if geoc:
                    try:
                        geovals = dict(z1=float(geoc["geospatial_vertical_min"]),
                                       z2=float(geoc["geospatial_vertical_max"]))
                        if any((geovals["z1"], geovals["z2"])):
                            res = "[%s, %s]" % (geovals["z1"], geovals["z2"])
                    except __HOLE__ as ve:
                        log.warn("GeospatialBounds vertical values not parseable %s: %s", geoc, ve)

            elif col == "temporal_range":  # Resource temporal intent (NUMRANGE)
                tempc = None
                if "nominal_datetime" in doc:
                    # Case for DataProduct resources
                    tempc = doc["nominal_datetime"]
                elif "constraint_list" in doc:
                    # Case for Deployment resources
                    # Find the first one - alternatively could expand a bbox
                    for cons in doc["constraint_list"]:
                        if isinstance(cons, dict) and cons.get("type_", None) == "TemporalBounds":
                            tempc = cons
                            break
                #elif "ts_created" in doc and "ts_updated" in doc:
                #    # All other resources.
                #    # Values are in seconds float since epoch
                #    tempc = dict(start_datetime=parse_ion_ts(doc["ts_created"]),
                #                 end_datetime=parse_ion_ts(doc["ts_updated"]))

                if tempc and tempc["start_datetime"] and tempc["end_datetime"]:
                    try:
                        geovals = dict(t1=float(tempc["start_datetime"]),
                                       t2=float(tempc["end_datetime"]))
                        if any((geovals["t1"], geovals["t2"])):
                            res = "[%s, %s]" % (geovals["t1"], geovals["t2"])
                    except ValueError as ve:
                        log.warn("TemporalBounds values not parseable %s: %s", tempc, ve)
            if res:
                log.debug("Numrange column %s value: %s", col, res)
        except Exception as ex:
            log.warn("Could not compute value for numrange column %s: %s", col, ex)
        return res
dataset/ETHPy150Open ooici/pyon/pyon/datastore/postgresql/base_store.py/PostgresDataStore._get_range_value