Skip to content

Commit

Permalink
- Added ProjectCategory to NCACalculationOptions
Browse files Browse the repository at this point in the history
- Added ProjectCategory to OptionsMetadataUtil and -test
  • Loading branch information
MichielJanssen-DAT committed Oct 10, 2024
1 parent c1f6c54 commit 0988591
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public class NCACalculationOptions implements Serializable {

private static final long serialVersionUID = 1L;

private ProjectCategory projectCategory = ProjectCategory.AGRICULTURE;

/**
* Regional area for which a permit calculation would apply to.
*/
Expand All @@ -40,7 +42,7 @@ public class NCACalculationOptions implements Serializable {
/**
* List of meteo years to calculate.
*/
private List<String> meteoYears = new ArrayList<>();
private final List<String> meteoYears = new ArrayList<>();

/**
* ADMS version to use.
Expand All @@ -67,6 +69,15 @@ public class NCACalculationOptions implements Serializable {
*/
private Double roadLocalFractionNO2;


public ProjectCategory getProjectCategory() {
return projectCategory;
}

public void setProjectCategory(final ProjectCategory projectCategory) {
this.projectCategory = projectCategory;
}

public String getPermitArea() {
return permitArea;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import nl.overheid.aerius.shared.domain.calculation.NCACalculationOptions;
import nl.overheid.aerius.shared.domain.calculation.OPSOptions;
import nl.overheid.aerius.shared.domain.calculation.OwN2000CalculationOptions;
import nl.overheid.aerius.shared.domain.calculation.ProjectCategory;
import nl.overheid.aerius.shared.domain.calculation.RoadLocalFractionNO2Option;

/**
Expand Down Expand Up @@ -90,6 +91,7 @@ public enum Option {

/* ADMS options related */
ADMS_VERSION,
ADMS_PROJECT_CATEGORY,
ADMS_PERMIT_AREA,
ADMS_MIN_MONIN_OBUKHOV_LENGTH,
ADMS_SURFACE_ALBEDO,
Expand Down Expand Up @@ -238,6 +240,7 @@ private static void opsOptionsToMap(final OPSOptions options, final Map<String,

private static void ncaOptionsFromMap(final NCACalculationOptions options, final Map<Option, String> map,
final Map<String, Map<Option, String>> prefixedOptionsMap) {
options.setProjectCategory(ProjectCategory.safeValueOf(map.get(Option.ADMS_PROJECT_CATEGORY)));
options.setPermitArea(map.get(Option.ADMS_PERMIT_AREA));
options.setRoadLocalFractionNO2ReceptorsOption(RoadLocalFractionNO2Option.safeValueOf(map.get(Option.ROAD_LOCAL_FRACTION_NO2_RECEPTORS_OPTION)));
options.setRoadLocalFractionNO2PointsOption(RoadLocalFractionNO2Option.safeValueOf(map.get(Option.ROAD_LOCAL_FRACTION_NO2_POINTS_OPTION)));
Expand Down Expand Up @@ -315,6 +318,7 @@ private static void ncaParseMetYears(final ADMSOptions admsOptions, final Map<Op
private static void ncaOptionsToMap(final Map<String, String> mapToAddTo, final NCACalculationOptions options, final boolean addDefaults) {
if (options != null) {
addValue(mapToAddTo, Option.ADMS_VERSION, options.getAdmsVersion(), addDefaults);
addValue(mapToAddTo, Option.ADMS_PROJECT_CATEGORY, options.getProjectCategory(), addDefaults);
addValue(mapToAddTo, Option.ADMS_PERMIT_AREA, options.getPermitArea(), addDefaults);
addValue(mapToAddTo, Option.ROAD_LOCAL_FRACTION_NO2_RECEPTORS_OPTION, options.getRoadLocalFractionNO2ReceptorsOption(), addDefaults);
addValue(mapToAddTo, Option.ROAD_LOCAL_FRACTION_NO2_POINTS_OPTION, options.getRoadLocalFractionNO2PointsOption(), addDefaults);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import nl.overheid.aerius.shared.domain.calculation.NCACalculationOptions;
import nl.overheid.aerius.shared.domain.calculation.OPSOptions;
import nl.overheid.aerius.shared.domain.calculation.OwN2000CalculationOptions;
import nl.overheid.aerius.shared.domain.calculation.ProjectCategory;
import nl.overheid.aerius.shared.domain.calculation.RoadLocalFractionNO2Option;
import nl.overheid.aerius.shared.domain.calculation.SubReceptorsMode;
import nl.overheid.aerius.shared.domain.meteo.Meteo;
Expand Down Expand Up @@ -198,6 +199,7 @@ void testNcaOptions() {
final NCACalculationOptions ncaOptions = options.getNcaCalculationOptions();

ncaOptions.setAdmsVersion("5.0.0.1");
ncaOptions.setProjectCategory(ProjectCategory.AGRICULTURE);
ncaOptions.setPermitArea("London");
ncaOptions.setRoadLocalFractionNO2ReceptorsOption(RoadLocalFractionNO2Option.ONE_CUSTOM_VALUE);
ncaOptions.setRoadLocalFractionNO2PointsOption(RoadLocalFractionNO2Option.ONE_CUSTOM_VALUE);
Expand Down Expand Up @@ -281,6 +283,7 @@ void testNcaOptionsRoundtrip() {
final NCACalculationOptions ncaOptions = options.getNcaCalculationOptions();

ncaOptions.setPermitArea("London");
ncaOptions.setProjectCategory(ProjectCategory.ROADS);
ncaOptions.setRoadLocalFractionNO2ReceptorsOption(RoadLocalFractionNO2Option.ONE_CUSTOM_VALUE);
ncaOptions.setRoadLocalFractionNO2PointsOption(RoadLocalFractionNO2Option.ONE_CUSTOM_VALUE);
ncaOptions.setRoadLocalFractionNO2(0.4);
Expand Down

0 comments on commit 0988591

Please sign in to comment.