Ejemplo n.º 1
0
def get_gebco_data():
    r = request.get_json()
    dataset = r.get("dataset", "gebco")
    band = r.get("band", "elevation")
    image_id = r.get("imageId", None)

    start_date = r.get("startDate", None)
    end_date = r.get("endDate", None)
    image_num_limit = r.get("limit", None)
    min = r.get("min", None)
    max = r.get("max", None)

    if dataset:
        source = "projects/dgds-gee/bathymetry/" + dataset + "/2019"
    if image_id:
        source = image_id

    image_info = dgds_functions.get_dgds_data(
        source=source,
        dataset=dataset,
        image_id=image_id,
        band=band,
        start_date=start_date,
        end_date=end_date,
        image_num_limit=image_num_limit,
        min=min,
        max=max,
    )
    if not image_info:
        raise error_handler.InvalidUsage("No images returned.")

    return Response(json.dumps(image_info),
                    status=200,
                    mimetype="application/json")
Ejemplo n.º 2
0
def get_msfd_data():
    """
    Get Crucial data. Either groundwater_declining_trend, or evaporation_deficit dataset must be provided.
    See datasets_visualization_parameters.json for possible bands to request as band
    :return:
    """
    r = request.get_json()
    dataset = r.get("dataset", None)
    image_id = r.get("imageId", None)
    band = r.get("band", None)

    function = r.get("function", None)
    start_date = r.get("startDate", None)
    end_date = r.get("endDate", None)
    image_num_limit = r.get("limit", None)
    min = r.get("min", None)
    max = r.get("max", None)

    if not band:
        msg = f"band is a required parameter"
        logger.error(msg)
        raise error_handler.InvalidUsage(msg)
    if dataset:
        source = "projects/dgds-gee/msfd/" + dataset
    elif image_id:
        source = image_id
    else:
        msg = f"dataset or image_id is a required parameter"
        logger.error(msg)
        raise error_handler.InvalidUsage(msg)

    image_info = dgds_functions.get_dgds_data(
        source=source,
        dataset=dataset,
        image_id=image_id,
        band=band,
        function=function,
        start_date=start_date,
        end_date=end_date,
        image_num_limit=image_num_limit,
        min=min,
        max=max,
    )
    if not image_info:
        raise error_handler.InvalidUsage("No images returned.")

    return Response(json.dumps(image_info),
                    status=200,
                    mimetype="application/json")
Ejemplo n.º 3
0
def get_chasm_data():
    """
    Get metocean data. dataset must be provided.
    :return:
    """
    r = request.get_json()
    dataset = r.get("dataset", None)
    band = r["band"]
    image_id = r.get("imageId", None)

    function = r.get("function", None)
    start_date = r.get("startDate", None)
    end_date = r.get("endDate", None)
    image_num_limit = r.get("limit", None)
    min = r.get("min", None)
    max = r.get("max", None)

    source = None
    # Can provide either dataset and/or image_id
    if not (dataset or image_id):
        msg = f"dataset or imageId required."
        logger.error(msg)
        raise error_handler.InvalidUsage(msg)

    if dataset:
        source = "projects/dgds-gee/chasm/" + dataset
    elif image_id:
        image_location_parameters = image_id.split("/")
        source = ("/").join(image_location_parameters[:-1])

    image_info = dgds_functions.get_dgds_data(
        source=source,
        dataset=dataset,
        image_id=image_id,
        band=band,
        function=function,
        start_date=start_date,
        end_date=end_date,
        image_num_limit=image_num_limit,
        min=min,
        max=max,
    )
    if not image_info:
        raise error_handler.InvalidUsage("No images returned.")

    return Response(json.dumps(image_info),
                    status=200,
                    mimetype="application/json")
Ejemplo n.º 4
0
def get_gll_dtm_data():
    r = request.get_json()
    band = r.get("band", "elevation")

    imageid = "users/maartenpronk/gll_dtm/gll_dtm_v1"
    image_info = dgds_functions.get_dgds_data(
        source=None,
        image_id=imageid,
        band=band,
    )
    if not image_info:
        raise error_handler.InvalidUsage("No images returned.")

    return Response(json.dumps(image_info),
                    status=200,
                    mimetype="application/json")
Ejemplo n.º 5
0
def get_glossis_data():
    """
    Get GLOSSIS data. Either currents, wind, or waterlevel dataset must be provided.
    If waterlevel dataset is requested, must specify if band water_level_surge, water_level,
    or astronomical_tide is requested
    :return:
    """
    r = request.get_json()
    dataset = r.get("dataset", None)
    image_id = r.get("imageId", None)
    band = r.get("band", None)

    function = r.get("function", None)
    start_date = r.get("startDate", None)
    end_date = r.get("endDate", None)
    image_num_limit = r.get("limit", None)
    min = r.get("min", None)
    max = r.get("max", None)

    if not (dataset or image_id):
        msg = f"dataset or imageId required."
        logger.error(msg)
        raise error_handler.InvalidUsage(msg)
    if dataset:
        source = "projects/dgds-gee/glossis/" + dataset
    if image_id:
        image_location_parameters = image_id.split("/")
        source = ("/").join(image_location_parameters[:-1])

    image_info = dgds_functions.get_dgds_data(
        source=source,
        dataset=dataset,
        image_id=image_id,
        band=band,
        function=function,
        start_date=start_date,
        end_date=end_date,
        image_num_limit=image_num_limit,
        min=min,
        max=max,
    )
    if not image_info:
        raise error_handler.InvalidUsage("No images returned.")

    return Response(json.dumps(image_info),
                    status=200,
                    mimetype="application/json")