Esempio n. 1
0
def _get_sensor_fixed_metadata(sensorId, query_date):
    # Get the json path for the sensor by identifier
    sensors = Sensors(base="", station=STATION_NAME, sensor=sensorId)
    jsonpath = sensors.get_fixed_jsonpath_for_sensor()

    sensor_file = SENSOR_METADATA_CACHE + jsonpath
    if os.path.exists(sensor_file):
        with open(sensor_file, 'r') as sf:
            md_json = json.load(sf)
            if type(md_json) == list:
                if type(md_json[0] == dict):
                    current_metadata = find_json_for_date(query_date, md_json)
            return current_metadata
    else:
        # TODO: What should happen here?
        return None
Esempio n. 2
0
def _get_sensor_fixed_metadata_json(sensorId):
    """
    Assumes that the sensor fixed metadata stored in Clowder is authoritative
    Ignore the fixed metadata in the JSON object and return the fixed metadata URL in Clowder.
    """
    # TODO: Compare to known fixed metadata structure
    # TODO; We only need this one -- duplicate method in metadata.py

    # Get the json path for the sensor by identifier
    sensors = Sensors(base="", station=STATION_NAME, sensor=sensorId)
    jsonpath = sensors.get_fixed_jsonpath_for_sensor()

    return {
        "url":
        "https://github.com/terraref/sensor-metadata/blob/master/" + jsonpath
    }