Search in sources :

Example 1 with Full

use of gov.usgs.cida.coastalhazards.model.summary.Full in project coastal-hazards by USGS-CIDA.

the class StormUtil method buildFullText.

private static Full buildFullText(Map<String, String> titleParts, String title, String surgeDescription) {
    Full full = new Full();
    String fullText = "This dataset contains a coastal erosion hazards analysis for " + titleParts.get("name") + ". The analysis is based on a storm-impact scaling model " + "that combines observations of beach morphology with hydrodynamic models to predict how sandy beaches, " + "the first line of defense for many coasts exposed to tropical storms and hurricanes, will respond during " + "a direct landfall. Storm-induced total water levels, due to both surge and waves, are compared to beach " + "and dune elevations to determine the probabilities of three types of coastal change - collision (dune erosion), " + "overwash, and inundation. " + surgeDescription + " Maximum wave heights in 20-m water depth, obtained from the " + "NOAA WaveWatch3 model 7-day forecast, were used to compute wave runup elevations at the shoreline. " + "Dune elevations were extracted from lidar topographic surveys. \n\nDisclaimer: This product is based on " + "published research results of the USGS National Assessment of Coastal Change Hazards Project and is " + "intended to indicate the potential for coastal change caused by storm surge and wave runup. This product is " + "based on an analysis that simplifies complex coastal change processes to two important aspects - " + "measured dune elevations and predicted total water levels. As such, the actual changes " + "that occur during extreme storms may be different than what is described here. Results " + "apply to open coast environments and do not consider potential coastal change along " + "inland waters. The public should not base evacuation decisions on this product. Citizens " + "should follow the evacuation advice of local emergency management authorities. ";
    full.setTitle(title);
    full.setText(fullText);
    full.setPublications(new ArrayList<>());
    return full;
}
Also used : Full(gov.usgs.cida.coastalhazards.model.summary.Full)

Example 2 with Full

use of gov.usgs.cida.coastalhazards.model.summary.Full in project coastal-hazards by USGS-CIDA.

the class StormUtil method buildStormTemplateSummary.

public static Summary buildStormTemplateSummary(Layer layer) {
    Summary summary = new Summary();
    Document cswDoc = getStormCswDocument(layer);
    if (cswDoc != null) {
        String title = MetadataUtil.extractFirstStringFromCswDoc(cswDoc, "/*/metadata/idinfo/citation/citeinfo/title");
        Map<String, String> titleParts = parseTitleParts(title);
        String cswAbstract = MetadataUtil.extractFirstStringFromCswDoc(cswDoc, "/*/metadata/idinfo/descript/abstract");
        List<String> dataSrcList = MetadataUtil.extractStringsFromCswDoc(cswDoc, "/*/metadata/dataqual/lineage/srcinfo/srccite/citeinfo/title");
        String surgeDescription = buildSurgeDescription(cswDoc);
        Tiny tiny = buildTinyText(titleParts);
        Medium medium = buildMediumText(titleParts);
        Full full = buildFullText(titleParts, title, surgeDescription);
        Legend legend = buildLegendText(titleParts);
        summary.setTiny(tiny);
        summary.setMedium(medium);
        summary.setFull(full);
        summary.setLegend(legend);
    }
    return summary;
}
Also used : Legend(gov.usgs.cida.coastalhazards.model.summary.Legend) Medium(gov.usgs.cida.coastalhazards.model.summary.Medium) Tiny(gov.usgs.cida.coastalhazards.model.summary.Tiny) Summary(gov.usgs.cida.coastalhazards.model.summary.Summary) Document(org.w3c.dom.Document) Full(gov.usgs.cida.coastalhazards.model.summary.Full)

Example 3 with Full

use of gov.usgs.cida.coastalhazards.model.summary.Full in project coastal-hazards by USGS-CIDA.

the class TemplateResource method gatherTemplateSummary.

protected Summary gatherTemplateSummary(Summary previousSummary, List<Item> children) {
    Summary newSummary = Summary.copyValues(previousSummary, null);
    String keywords = previousSummary.getKeywords();
    Set<String> keywordSet = keywordsFromString(keywords);
    Set<Publication> publicationSet = new LinkedHashSet<>();
    Full full = previousSummary.getFull();
    List<Publication> publications = full.getPublications();
    publicationSet.addAll(publications);
    if (children != null) {
        for (Item item : children) {
            Set<String> childKeywords = keywordsFromString(item.getSummary().getKeywords());
            keywordSet.addAll(childKeywords);
            List<Publication> childPubs = item.getSummary().getFull().getPublications();
            for (Publication pub : childPubs) {
                publicationSet.add(Publication.copyValues(pub, null));
            }
        }
    }
    String newKeywords = StringUtils.join(keywordSet, "|");
    newSummary.setKeywords(newKeywords);
    newSummary.getFull().setPublications(Lists.newArrayList(publicationSet));
    return newSummary;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) Item(gov.usgs.cida.coastalhazards.model.Item) Summary(gov.usgs.cida.coastalhazards.model.summary.Summary) Publication(gov.usgs.cida.coastalhazards.model.summary.Publication) Full(gov.usgs.cida.coastalhazards.model.summary.Full)

Example 4 with Full

use of gov.usgs.cida.coastalhazards.model.summary.Full in project coastal-hazards by USGS-CIDA.

the class FullSummaryAdapter method deserialize.

@Override
public Full deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
    Full result = new Full();
    if (json instanceof JsonObject) {
        JsonObject fullJson = (JsonObject) json;
        result.setTitle(fullJson.getAsJsonPrimitive("title").getAsString());
        result.setText(fullJson.getAsJsonPrimitive("text").getAsString());
        List<Publication> fullPubList = new LinkedList<>();
        JsonObject publications = fullJson.getAsJsonObject("publications");
        for (PublicationType type : PublicationType.values()) {
            JsonArray typedArray = publications.getAsJsonArray(type.name());
            if (typedArray != null) {
                List<Map<String, Object>> typeList = context.deserialize(typedArray, ArrayList.class);
                for (Map<String, Object> pubMap : typeList) {
                    if (!pubMap.containsKey(Publication.TITLE) || !pubMap.containsKey(Publication.LINK)) {
                        throw new IllegalStateException("Expected publication, was not a publication");
                    }
                    Publication pub = new Publication();
                    pub.setTitle((String) pubMap.get(Publication.TITLE));
                    pub.setLink((String) pubMap.get(Publication.LINK));
                    pub.setType(type);
                    fullPubList.add(pub);
                }
            }
        }
        result.setPublications(fullPubList);
    }
    return result;
}
Also used : PublicationType(gov.usgs.cida.coastalhazards.model.summary.Publication.PublicationType) JsonObject(com.google.gson.JsonObject) Publication(gov.usgs.cida.coastalhazards.model.summary.Publication) Full(gov.usgs.cida.coastalhazards.model.summary.Full) LinkedList(java.util.LinkedList) JsonArray(com.google.gson.JsonArray) JsonObject(com.google.gson.JsonObject) Map(java.util.Map)

Aggregations

Full (gov.usgs.cida.coastalhazards.model.summary.Full)4 Publication (gov.usgs.cida.coastalhazards.model.summary.Publication)2 Summary (gov.usgs.cida.coastalhazards.model.summary.Summary)2 JsonArray (com.google.gson.JsonArray)1 JsonObject (com.google.gson.JsonObject)1 Item (gov.usgs.cida.coastalhazards.model.Item)1 Legend (gov.usgs.cida.coastalhazards.model.summary.Legend)1 Medium (gov.usgs.cida.coastalhazards.model.summary.Medium)1 PublicationType (gov.usgs.cida.coastalhazards.model.summary.Publication.PublicationType)1 Tiny (gov.usgs.cida.coastalhazards.model.summary.Tiny)1 LinkedHashSet (java.util.LinkedHashSet)1 LinkedList (java.util.LinkedList)1 Map (java.util.Map)1 Document (org.w3c.dom.Document)1