globalContainer = new NetCDFSettingsContainer(); container = new NetCDFLayerSettingsContainer(globalContainer); map.put(NetCDFSettingsContainer.NETCDFOUT_KEY, container);
@Override public IModel<CoverageInfo> createOwnModel( IModel<? extends LayerInfo> layerModel, boolean isNew) { CoverageInfo info = (CoverageInfo) layerModel.getObject().getResource(); // Check if the MetadataMap already contains the NetCDF Settings MetadataMap map = info.getMetadata(); NetCDFLayerSettingsContainer container = map.get(NetCDFSettingsContainer.NETCDFOUT_KEY, NetCDFLayerSettingsContainer.class); // If not present, add it to the map if (isNew || container == null) { // container = new NetCDFLayerSettingsContainer(); // Getting NetCDF Settings from the Global ones GeoServer gs = GeoServerExtensions.bean(GeoServer.class); MetadataMap globalMap = gs.getGlobal().getSettings().getMetadata(); NetCDFSettingsContainer globalContainer = globalMap.get( NetCDFSettingsContainer.NETCDFOUT_KEY, NetCDFSettingsContainer.class); // If not present, create a new container if (globalContainer == null) { globalContainer = new NetCDFSettingsContainer(); } container = new NetCDFLayerSettingsContainer(globalContainer); map.put(NetCDFSettingsContainer.NETCDFOUT_KEY, container); } return new Model<>(info); } }
@Before public void setUpInternal() throws Exception { // Creatign models LayerInfo layerInfo = getCatalog().getLayerByName(getLayerId(MockData.TASMANIA_DEM)); layerModel = new Model<LayerInfo>(layerInfo); ResourceInfo resource = layerInfo.getResource(); resourceModel = new Model<ResourceInfo>(resource); // Add Element to MetadataMap MetadataMap metadata = resource.getMetadata(); if (!metadata.containsKey(NetCDFSettingsContainer.NETCDFOUT_KEY)) { metadata.put(NetCDFSettingsContainer.NETCDFOUT_KEY, new NetCDFLayerSettingsContainer()); } }
@Before public void setUpInternal() throws Exception { // Creatign models LayerInfo layerInfo = getCatalog().getLayerByName(getLayerId(MockData.TASMANIA_DEM)); layerModel = new Model<LayerInfo>(layerInfo); ResourceInfo resource = layerInfo.getResource(); resourceModel = new Model<CoverageInfo>((CoverageInfo) resource); // Add Element to MetadataMap MetadataMap metadata = resource.getMetadata(); if (!metadata.containsKey(NetCDFSettingsContainer.NETCDFOUT_KEY)) { metadata.put(NetCDFSettingsContainer.NETCDFOUT_KEY, new NetCDFLayerSettingsContainer()); } }
/** 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); }
NetCDFLayerSettingsContainer container = new NetCDFLayerSettingsContainer(); container.setCompressionLevel(0); container.setShuffle(true);
NetCDFLayerSettingsContainer container = new NetCDFLayerSettingsContainer(); container.setCompressionLevel(isCompressed ? 9 : 0); container.setShuffle(true);
@Override protected void convertInput() { globalAttributes.visitChildren(new Component.IVisitor<Component>() { @Override public Object component(Component component) { if (component instanceof FormComponent) { FormComponent<?> formComponent = (FormComponent<?>) component; formComponent.processInput(); } return Component.IVisitor.CONTINUE_TRAVERSAL; } }); compressionLevel.processInput(); dataPacking.processInput(); shuffle.processInput(); standardName.processInput(); uom.processInput(); List<GlobalAttribute> info = globalAttributes.getModelObject(); NetCDFLayerSettingsContainer convertedInput = new NetCDFLayerSettingsContainer(); convertedInput.setCompressionLevel(compressionLevel.getModelObject()); convertedInput.setGlobalAttributes(info); convertedInput.setDataPacking(dataPacking.getModelObject()); convertedInput.setShuffle(shuffle.getModelObject()); convertedInput.setLayerName(standardName.getModelObject()); convertedInput.setLayerUOM(uom.getModelObject()); setConvertedInput(convertedInput); } }
NetCDFLayerSettingsContainer container = new NetCDFLayerSettingsContainer(); container.setCompressionLevel(0); container.setShuffle(true);
standardName.processInput(); uom.processInput(); NetCDFLayerSettingsContainer convertedInput = new NetCDFLayerSettingsContainer(); convertedInput.setCompressionLevel(compressionLevel.getModelObject()); convertedInput.setGlobalAttributes(globalAttributes.getModelObject());