diff --git a/source/imaer-shared/src/main/java/nl/overheid/aerius/shared/domain/calculation/ADMSOptions.java b/source/imaer-shared/src/main/java/nl/overheid/aerius/shared/domain/calculation/ADMSOptions.java index 6ff834cb..6c4653af 100644 --- a/source/imaer-shared/src/main/java/nl/overheid/aerius/shared/domain/calculation/ADMSOptions.java +++ b/source/imaer-shared/src/main/java/nl/overheid/aerius/shared/domain/calculation/ADMSOptions.java @@ -22,6 +22,8 @@ import java.util.List; import java.util.Map; +import com.fasterxml.jackson.annotation.JsonIgnore; + /** * Contains ADMS specific options for a calculation. */ @@ -37,6 +39,7 @@ public class ADMSOptions implements Serializable { private List metYears = new ArrayList<>(); // Map private Map metSiteSurfaceCharacteristics = new HashMap<>(); + private double metSiteLatitude; private boolean plumeDepletionNH3; private boolean plumeDepletionNOX; @@ -91,6 +94,10 @@ public void setMetYears(final List metYears) { this.metYears = metYears; } + public Map getMetSiteSurfaceCharacteristics() { + return metSiteSurfaceCharacteristics; + } + public MetSurfaceCharacteristics getMetSiteCharacteristics(final String meteoYear) { return metSiteSurfaceCharacteristics == null || !metSiteSurfaceCharacteristics.containsKey(meteoYear) ? getLegacyMetSiteCharacteristics() @@ -105,41 +112,58 @@ public void putMetSiteCharacteristics(final String metYear, final MetSurfaceChar this.metSiteSurfaceCharacteristics.put(metYear, msc); } + public double getMetSiteLatitude() { + return metSiteLatitude; + } + + public void setMetSiteLatitude(final double metSiteLatitude) { + this.metSiteLatitude = metSiteLatitude; + } + + @Deprecated + @JsonIgnore public double getMsRoughness() { return getLegacyMetSiteCharacteristics().getRoughness(); } @Deprecated + @JsonIgnore public void setMsRoughness(final double msRoughness) { getLegacyMetSiteCharacteristics().setRoughness(msRoughness); } @Deprecated + @JsonIgnore public double getMsMinMoninObukhovLength() { return getLegacyMetSiteCharacteristics().getMinMoninObukhovLength(); } @Deprecated + @JsonIgnore public void setMsMinMoninObukhovLength(final double msMinMoninObukhovLength) { getLegacyMetSiteCharacteristics().setMinMoninObukhovLength(msMinMoninObukhovLength); } @Deprecated + @JsonIgnore public double getMsSurfaceAlbedo() { return getLegacyMetSiteCharacteristics().getSurfaceAlbedo(); } @Deprecated + @JsonIgnore public void setMsSurfaceAlbedo(final double msSurfaceAlbedo) { getLegacyMetSiteCharacteristics().setSurfaceAlbedo(msSurfaceAlbedo); } @Deprecated + @JsonIgnore public double getMsPriestleyTaylorParameter() { return getLegacyMetSiteCharacteristics().getPriestleyTaylorParameter(); } @Deprecated + @JsonIgnore public void setMsPriestleyTaylorParameter(final double msPriestleyTaylorParameter) { getLegacyMetSiteCharacteristics().setPriestleyTaylorParameter(msPriestleyTaylorParameter); } diff --git a/source/imaer-shared/src/main/java/nl/overheid/aerius/shared/domain/calculation/MetSurfaceCharacteristics.java b/source/imaer-shared/src/main/java/nl/overheid/aerius/shared/domain/calculation/MetSurfaceCharacteristics.java index 6aada1ec..3ad69511 100644 --- a/source/imaer-shared/src/main/java/nl/overheid/aerius/shared/domain/calculation/MetSurfaceCharacteristics.java +++ b/source/imaer-shared/src/main/java/nl/overheid/aerius/shared/domain/calculation/MetSurfaceCharacteristics.java @@ -26,16 +26,18 @@ public class MetSurfaceCharacteristics implements Serializable { private double minMoninObukhovLength; private double surfaceAlbedo; private double priestleyTaylorParameter; + private boolean windInSectors; MetSurfaceCharacteristics() { } private MetSurfaceCharacteristics(final double roughness, final double minMoninObukhovLength, final double surfaceAlbedo, - final double priestleyTaylorParameter) { + final double priestleyTaylorParameter, final boolean windInSectors) { this.roughness = roughness; this.minMoninObukhovLength = minMoninObukhovLength; this.surfaceAlbedo = surfaceAlbedo; this.priestleyTaylorParameter = priestleyTaylorParameter; + this.windInSectors = windInSectors; } public double getRoughness() { @@ -54,6 +56,9 @@ public double getPriestleyTaylorParameter() { return priestleyTaylorParameter; } + public boolean isWindInSectors() { + return windInSectors; + } void setRoughness(final double roughness) { this.roughness = roughness; @@ -71,6 +76,10 @@ void setPriestleyTaylorParameter(final double priestleyTaylorParameter) { this.priestleyTaylorParameter = priestleyTaylorParameter; } + void setWindInSectors(final boolean windInSectors) { + this.windInSectors = windInSectors; + } + public static Builder builder() { return new Builder(); } @@ -80,6 +89,7 @@ public static class Builder { private double minMoninObukhovLength; private double surfaceAlbedo; private double priestleyTaylorParameter; + private boolean windInSectors; public Builder roughness(final double roughness) { this.roughness = roughness; @@ -101,8 +111,13 @@ public Builder priestleyTaylorParameter(final double priestleyTaylorParameter) { return this; } + public Builder windInSectors(final boolean windInSectors) { + this.windInSectors = windInSectors; + return this; + } + public MetSurfaceCharacteristics build() { - return new MetSurfaceCharacteristics(roughness, minMoninObukhovLength, surfaceAlbedo, priestleyTaylorParameter); + return new MetSurfaceCharacteristics(roughness, minMoninObukhovLength, surfaceAlbedo, priestleyTaylorParameter, windInSectors); } } } diff --git a/source/imaer-util/src/main/java/nl/overheid/aerius/util/OptionsMetadataUtil.java b/source/imaer-util/src/main/java/nl/overheid/aerius/util/OptionsMetadataUtil.java index a831eccb..c4e12031 100644 --- a/source/imaer-util/src/main/java/nl/overheid/aerius/util/OptionsMetadataUtil.java +++ b/source/imaer-util/src/main/java/nl/overheid/aerius/util/OptionsMetadataUtil.java @@ -91,12 +91,14 @@ public enum Option { ADMS_SPATIALLY_VARYING_ROUGHNESS, ADMS_COMPLEX_TERRAIN, ADMS_MET_SITE_ID, + ADMS_MET_SITE_LATITUDE, ADMS_MET_DATASET_TYPE, ADMS_MET_YEARS, ADMS_MET_SITE_ROUGHNESS, ADMS_MET_SITE_MIN_MONIN_OBUKHOV_LENGTH, ADMS_MET_SITE_SURFACE_ALBEDO, ADMS_MET_SITE_PRIESTLEY_TAYLOR_PARAMETER, + ADMS_MET_SITE_WIND_IN_SECTORS, /* Road NOX - NO2 calculation related */ ROAD_LOCAL_FRACTION_NO2_RECEPTORS_OPTION, @@ -244,14 +246,15 @@ private static void ncaOptionsFromMap(final NCACalculationOptions options, final if (map.get(Option.ADMS_MET_SITE_ID) != null) { admsOptions.setMetSiteId(Integer.parseInt(map.get(Option.ADMS_MET_SITE_ID))); + admsOptions.setMetSiteLatitude(Optional.ofNullable(map.get(Option.ADMS_MET_SITE_LATITUDE)).map(Double::parseDouble).orElse(0.0)); admsOptions.setMetDatasetType(MetDatasetType.safeValueOf(map.get(Option.ADMS_MET_DATASET_TYPE))); ncaParseMetYears(admsOptions, map); ncaMetSiteOptions(prefixedOptionsMap, admsOptions, map); } admsOptions.setPlumeDepletionNH3(isOrDefault(map, Option.ADMS_PLUME_DEPLETION_NH3, ADMSLimits.ADMS_PLUME_DEPLETION_NH3_DEFAULT)); admsOptions.setPlumeDepletionNOX(isOrDefault(map, Option.ADMS_PLUME_DEPLETION_NOX, ADMSLimits.ADMS_PLUME_DEPLETION_NOX_DEFAULT)); - admsOptions - .setSpatiallyVaryingRoughness(isOrDefault(map, Option.ADMS_SPATIALLY_VARYING_ROUGHNESS, ADMSLimits.SPATIALLY_VARYING_ROUGHNESS_DEFAULT)); + admsOptions.setSpatiallyVaryingRoughness(isOrDefault(map, Option.ADMS_SPATIALLY_VARYING_ROUGHNESS, + ADMSLimits.SPATIALLY_VARYING_ROUGHNESS_DEFAULT)); admsOptions.setComplexTerrain(isOrDefault(map, Option.ADMS_COMPLEX_TERRAIN, ADMSLimits.ADMS_COMPLEX_TERRAIN_DEFAULT)); } @@ -279,6 +282,7 @@ private static void ncaPutMetSiteOptions(final ADMSOptions admsOptions, final St .surfaceAlbedo(getOrDefault(prefixedMap, Option.ADMS_MET_SITE_SURFACE_ALBEDO, ADMSLimits.SURFACE_ALBEDO_DEFAULT)) .priestleyTaylorParameter( getOrDefault(prefixedMap, Option.ADMS_MET_SITE_PRIESTLEY_TAYLOR_PARAMETER, ADMSLimits.PRIESTLEY_TAYLOR_PARAMETER_DEFAULT)) + .windInSectors(isOrDefault(prefixedMap, Option.ADMS_MET_SITE_WIND_IN_SECTORS, false)) .build(); admsOptions.putMetSiteCharacteristics(metYear, msc); } @@ -318,6 +322,9 @@ private static void ncaOptionsToMap(final Map mapToAddTo, final addValue(mapToAddTo, Option.ADMS_SURFACE_ALBEDO, adms.getSurfaceAlbedo(), addDefaults); addValue(mapToAddTo, Option.ADMS_PRIESTLEY_TAYLOR_PARAMETER, adms.getPriestleyTaylorParameter(), addDefaults); addIntValue(mapToAddTo, Option.ADMS_MET_SITE_ID, adms.getMetSiteId(), addDefaults); + if (adms.getMetSiteLatitude() != 0.0) { + addValue(mapToAddTo, Option.ADMS_MET_SITE_LATITUDE, adms.getMetSiteLatitude(), addDefaults); + } addValue(mapToAddTo, Option.ADMS_MET_DATASET_TYPE, adms.getMetDatasetType(), addDefaults); ncaAddMetSite(mapToAddTo, addDefaults, adms); // Always add the following fields to the GML as it also gives an indication if run in demo mode. @@ -356,6 +363,9 @@ private static void addADMSMetSiteOptions(final Map mapToAddTo, addValue(mapToAddTo, prefix + Option.ADMS_MET_SITE_MIN_MONIN_OBUKHOV_LENGTH.toKey(), msc.getMinMoninObukhovLength(), addDefaults); addValue(mapToAddTo, prefix + Option.ADMS_MET_SITE_SURFACE_ALBEDO.toKey(), msc.getSurfaceAlbedo(), addDefaults); addValue(mapToAddTo, prefix + Option.ADMS_MET_SITE_PRIESTLEY_TAYLOR_PARAMETER.toKey(), msc.getPriestleyTaylorParameter(), addDefaults); + if (msc.isWindInSectors()) { + addValue(mapToAddTo, prefix + Option.ADMS_MET_SITE_WIND_IN_SECTORS.toKey(), String.valueOf(msc.isWindInSectors()), addDefaults); + } } private static void addValue(final Map mapToAddTo, final Option key, final Object value, final boolean addDefaults) {