/** 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 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 { VariableAttribute attribute = new VariableAttribute(key, value); if (!variableAttributes.getModelObject().contains(attribute)) { variableAttributes.getModelObject().add(attribute); } newKey.setModel(Model.of("")); newValue.setModel(Model.of("")); ajaxTarget.add(container); } } };