attributes.add(new GlobalAttribute("custom_attribute", "testing WCS")); attributes.add(new GlobalAttribute("Conventions", "CF-1.6")); attributes.add(new GlobalAttribute("NULLAttribute", null)); container.setGlobalAttributes(attributes);
attributes.add(new GlobalAttribute("custom_attribute", "testing WCS")); attributes.add(new GlobalAttribute("Conventions", "CF-1.6")); container.setGlobalAttributes(attributes);
/** Configure NetCDF output settings for <code>Temperature_surface</code>. */ private void configureTemperatureSurface() { NetCDFLayerSettingsContainer container = new NetCDFLayerSettingsContainer(); container.setCopyAttributes(true); List<VariableAttribute> variableAttributes = new ArrayList<VariableAttribute>(); variableAttributes.add( new VariableAttribute("test-variable-attribute", "Test Variable Attribute")); variableAttributes.add(new VariableAttribute("Grib2_Parameter_Category", "Test Category")); container.setVariableAttributes(variableAttributes); List<ExtraVariable> extraVariables = new ArrayList<ExtraVariable>(); extraVariables.add(new ExtraVariable("reftime", "forecast_reference_time", "time")); extraVariables.add(new ExtraVariable("reftime", "scalar_forecast_reference_time", "")); container.setExtraVariables(extraVariables); List<GlobalAttribute> globalAttributes = new ArrayList<GlobalAttribute>(); globalAttributes.add(new GlobalAttribute("test-global-attribute", "Test Global Attribute")); globalAttributes.add(new GlobalAttribute("test-global-attribute-integer", "42")); globalAttributes.add(new GlobalAttribute("test-global-attribute-double", "1.5")); container.setGlobalAttributes(globalAttributes); CoverageInfo info = getCatalog().getCoverageByName(getLayerId(TEMPERATURE_SURFACE)); info.getMetadata().put(NetCDFSettingsContainer.NETCDFOUT_KEY, container); getCatalog().save(info); }
@Override protected void onClick(AjaxRequestTarget target, Form form) { newValue.processInput(); newKey.processInput(); String key = newKey.getModelObject(); if (key == null || key.isEmpty()) { ParamResourceModel rm = new ParamResourceModel( "NetCDFOutSettingsPanel.nonEmptyKey", null, ""); error(rm.getString()); } else { String value = newValue.getModelObject(); GlobalAttribute attribute = new GlobalAttribute(key, value); if (!globalAttributes.getModelObject().contains(attribute)) { globalAttributes.getModelObject().add(attribute); } newKey.setModel(Model.of("")); // Reset the key field newValue.setModel(Model.of("")); // Reset the Value field target.addComponent(container); } } };
@Override protected void onClick(AjaxRequestTarget ajaxTarget, Form form) { newKey.processInput(); newValue.processInput(); String key = newKey.getModelObject(); String value = newValue.getModelObject(); if (key == null || key.trim().isEmpty()) { ParamResourceModel rm = new ParamResourceModel("NetCDFOut.emptyKey", null, ""); error(rm.getString()); } else { GlobalAttribute attribute = new GlobalAttribute(key, value); if (!globalAttributes.getModelObject().contains(attribute)) { globalAttributes.getModelObject().add(attribute); } newKey.setModel(Model.of("")); newValue.setModel(Model.of("")); ajaxTarget.add(container); } } };
/** Adds the global attributes from the settings in the UI */ protected void addGlobalAttributesFromSettings() { // Add global attributes from settings if (globalAttributes != null) { for (NetCDFSettingsContainer.GlobalAttribute att : globalAttributes) { if (att.getKey().equalsIgnoreCase(NetCDFUtilities.CONVENTIONS)) { writer.addGroupAttribute( null, new Attribute( NetCDFUtilities.COORD_SYS_BUILDER, NetCDFUtilities.COORD_SYS_BUILDER_CONVENTION)); } writer.addGroupAttribute(null, buildAttribute(att.getKey(), att.getValue())); } } }