Skip to content

Commit

Permalink
Replace VriAdjustInputWriter with VdypOutputWriter and remove VRI_OUT…
Browse files Browse the repository at this point in the history
…PUT control keys (duplication)
  • Loading branch information
mjunkin committed Sep 10, 2024
1 parent b1b7d54 commit ff1731d
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 287 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
import ca.bc.gov.nrs.vdyp.io.parse.control.BaseControlParser;
import ca.bc.gov.nrs.vdyp.io.parse.streaming.StreamingParser;
import ca.bc.gov.nrs.vdyp.io.parse.streaming.StreamingParserFactory;
import ca.bc.gov.nrs.vdyp.io.write.VriAdjustInputWriter;
import ca.bc.gov.nrs.vdyp.io.write.VdypOutputWriter;
import ca.bc.gov.nrs.vdyp.math.FloatMath;
import ca.bc.gov.nrs.vdyp.model.BaseVdypLayer;
import ca.bc.gov.nrs.vdyp.model.BaseVdypPolygon;
Expand Down Expand Up @@ -165,7 +165,7 @@ protected static void doMain(VdypStartApplication<?, ?, ?, ?> app, final String.
.filter(x -> !x.getName().contains("Volume")).toList();
}

protected VriAdjustInputWriter vriWriter;
protected VdypOutputWriter vriWriter;

protected Map<String, Object> controlMap = new HashMap<>();

Expand Down Expand Up @@ -227,7 +227,7 @@ public void init(FileSystemFileResolver resolver, Map<String, Object> controlMap

setControlMap(controlMap);
closeVriWriter();
vriWriter = new VriAdjustInputWriter(controlMap, resolver);
vriWriter = new VdypOutputWriter(controlMap, resolver);
}

protected abstract BaseControlParser getControlFileParser();
Expand Down Expand Up @@ -508,7 +508,7 @@ public int findEmpiricalRelationshipParameterIndex(String specAlias, BecDefiniti
return group;
}

protected VriAdjustInputWriter getVriWriter() {
protected VdypOutputWriter getVriWriter() {
return vriWriter;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ public enum ControlKey {
FORWARD_INPUT_GROWTO(14),

// FIP/VRI Outputs
VRI_OUTPUT_VDYP_POLYGON(15), VRI_OUTPUT_VDYP_LAYER_BY_SPECIES(16), VRI_OUTPUT_VDYP_LAYER_BY_SP0_BY_UTIL(18),

// VDYP Forward Outputs
// VDYP Forward, Bank and Adjust Inputs and Outputs
VDYP_OUTPUT_VDYP_POLYGON(15), VDYP_OUTPUT_VDYP_LAYER_BY_SPECIES(16), VDYP_OUTPUT_VDYP_LAYER_BY_SP0_BY_UTIL(18),
VDYP_OUTPUT_COMPATIBILITY_VARIABLES(19),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ public VdypOutputWriter(Map<String, Object> controlMap, FileResolver resolver) t
getOutputStream(controlMap, resolver, ControlKey.VDYP_OUTPUT_VDYP_POLYGON.name()),
getOutputStream(controlMap, resolver, ControlKey.VDYP_OUTPUT_VDYP_LAYER_BY_SPECIES.name()),
getOutputStream(controlMap, resolver, ControlKey.VDYP_OUTPUT_VDYP_LAYER_BY_SP0_BY_UTIL.name()),
Optional.of(
controlMap.containsKey(ControlKey.VDYP_OUTPUT_COMPATIBILITY_VARIABLES.name()) ? Optional.of(
getOutputStream(controlMap, resolver, ControlKey.VDYP_OUTPUT_COMPATIBILITY_VARIABLES.name())
)
) : Optional.empty()
);
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ void testInitNoControlFiles() throws IOException, ResourceParseException {
}

private MockFileResolver dummyIo() {
controlMap.put(ControlKey.VRI_OUTPUT_VDYP_POLYGON.name(), "DUMMY1");
controlMap.put(ControlKey.VRI_OUTPUT_VDYP_LAYER_BY_SPECIES.name(), "DUMMY2");
controlMap.put(ControlKey.VRI_OUTPUT_VDYP_LAYER_BY_SP0_BY_UTIL.name(), "DUMMY3");
controlMap.put(ControlKey.VDYP_OUTPUT_VDYP_POLYGON.name(), "DUMMY1");
controlMap.put(ControlKey.VDYP_OUTPUT_VDYP_LAYER_BY_SPECIES.name(), "DUMMY2");
controlMap.put(ControlKey.VDYP_OUTPUT_VDYP_LAYER_BY_SP0_BY_UTIL.name(), "DUMMY3");

MockFileResolver resolver = new MockFileResolver("Test");
resolver.addStream("DUMMY1", (OutputStream) new ByteArrayOutputStream());
Expand Down
Loading

0 comments on commit ff1731d

Please sign in to comment.