def test_strds_info(self):
        iface = GRaaSInterface(self.gconf)
        status, info = iface.layer_info(layer_name="ECAD.PERMANENT.strds.precipitation_1950_2013_yearly_mm")
        pprint(info)

        self.assertEqual(status, 200)
        self.assertTrue("temporal_type" in info)
        self.assertTrue("aggregation_type" in info)
        self.assertTrue("creation_time" in info)
        self.assertTrue("creator" in info)
        self.assertTrue("granularity" in info)
        self.assertTrue("modification_time" in info)
        self.assertTrue("number_of_maps" in info)
class GRaaSDataProductId(DataProductId):
    def __init__(self):
        self.iface = GRaaSInterface()

    @swagger.doc(GET_DATA_PRODUCT_ID_DOC)
    def get(self, product_id):

        # List strds maps from the GRASS location

        location, mapset, datatype, layer = self.iface.layer_def_to_components(
            product_id)

        status_code, layer_data = self.iface.layer_info(layer_name=product_id)
        if status_code != 200:
            return make_response(
                jsonify(
                    {
                        "description":
                        "An internal error occurred "
                        "while catching GRASS GIS layer information "
                        "for layer <%s>!\n Error: %s"
                        "" % (product_id, str(layer_data))
                    }, 400))

        # Get the projection from the GRASS mapset
        status_code, mapset_info = self.iface.mapset_info(location=location,
                                                          mapset=mapset)
        if status_code != 200:
            return make_response(
                jsonify(
                    {
                        "description":
                        "An internal error occurred "
                        "while catching mapset info "
                        "for mapset <%s>!" % mapset
                    }, 400))

        description = "Raster dataset"
        if datatype.lower() == "strds":
            description = "Space time raster dataset"
        if datatype.lower() == "vector":
            description = "Vector dataset"

        source = "GRASS GIS location/mapset path: /%s/%s" % (location, mapset)
        srs = mapset_info["projection"]
        extent = SpatialExtent(left=float(layer_data["west"]),
                               right=float(layer_data["east"]),
                               top=float(layer_data["north"]),
                               bottom=float(layer_data["south"]),
                               srs=srs)

        print(layer_data)

        if datatype.lower() == "strds":
            time = DateTime()
            time["from"] = layer_data["start_time"]
            time["to"] = layer_data["end_time"]

            bands = BandDescription(band_id=product_id)

            info = dict(product_id=product_id,
                        extent=extent,
                        source=source,
                        description=description,
                        time=time,
                        bands=bands,
                        temporal_type=layer_data["start_time"],
                        number_of_maps=layer_data["number_of_maps"],
                        min_min=layer_data["min_min"],
                        min_max=layer_data["min_max"],
                        max_min=layer_data["max_min"],
                        max_max=layer_data["max_max"],
                        ewres_max=layer_data["ewres_max"],
                        ewres_min=layer_data["ewres_min"],
                        nsres_max=layer_data["nsres_max"],
                        nsres_min=layer_data["nsres_min"],
                        map_time=layer_data["map_time"],
                        granularity=layer_data["granularity"],
                        aggregation_type=layer_data["aggregation_type"],
                        creation_time=layer_data["creation_time"],
                        modification_time=layer_data["modification_time"],
                        mapset=mapset,
                        location=location)
        else:
            info = dict(
                product_id=product_id,
                extent=extent,
                source=source,
                description=description,
                mapset=mapset,
                location=location,
                title=layer_data["title"],
                comments=layer_data["comments"],
                datatype=layer_data["datatype"],
                cells=layer_data["cells"],
                cols=layer_data["cols"],
                rows=layer_data["rows"],
                ewres=layer_data["ewres"],
                nsres=layer_data["nsres"],
            )

        return make_response(jsonify(info), 200)