test_class.file: vortex-api/src/test/java/mil/army/usace/hec/vortex/io/AscDataWriterTest.java
test_class.identifier: AscDataWriterTest
test_case.body: @Test
      void AscDataWriterWritesDssFile(){
          String inFile = new File(getClass().getResource(
                  "/normalizer/qpe.dss").getFile()).toString();
          String variableName = "///PRECIPITATION/02JAN2017:1200/02JAN2017:1300//";
  
          DataReader reader = DataReader.builder()
                  .path(inFile)
                  .variable(variableName)
                  .build();
  
          List<VortexData> dtos = new ArrayList<>(reader.getDtos());
  
          String fileName = ImageUtils.generateFileName("qpe", (VortexGrid) dtos.get(0), ImageFileType.ASC);
  
          Path destination = Paths.get("C:/Temp",fileName);
  
          DataWriter writer = DataWriter.builder()
                  .destination(destination)
                  .data(dtos)
                  .build();
  
          writer.write();
      }
test_case.class_method_signature: AscDataWriterTest.AscDataWriterWritesDssFile()
test_case.full_signature: @Test void AscDataWriterWritesDssFile()
test_case.identifier: AscDataWriterWritesDssFile
test_case.invocations: toString getFile getResource getClass build variable path builder getDtos generateFileName get get build data destination builder write
test_case.modifiers: @Test
test_case.parameters: ()
test_case.return: void
test_case.signature: void AscDataWriterWritesDssFile()
focal_class.file: vortex-api/src/main/java/mil/army/usace/hec/vortex/io/AscDataWriter.java
focal_class.identifier: AscDataWriter
focal_class.class_method_signature: AscDataWriter.AscDataWriter(DataWriterBuilder builder)
focal_class.full_signature:   AscDataWriter(DataWriterBuilder builder)
focal_class.identifier: AscDataWriter
focal_class.parameters: (DataWriterBuilder builder)
focal_class.signature:  AscDataWriter(DataWriterBuilder builder)
focal_class.class_method_signature: AscDataWriter.write()
focal_class.full_signature: @Override public void write()
focal_class.identifier: write
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void write()
focal_class.superclass: extends DataWriter
focal_method.body: @Override
      public void write() {
          List<VortexGrid> grids = data.stream()
                  .filter(vortexData -> vortexData instanceof VortexGrid)
                  .map(vortexData -> (VortexGrid) vortexData)
                  .collect(Collectors.toList());
  
          grids.forEach(grid -> {
              VortexGrid gridOut;
              if (grid.dy() < 0){
                  gridOut = grid;
              } else {
                  float[] flipped = MatrixUtils.flipArray(grid.data(), grid.nx(), grid.ny());
                  gridOut = VortexGrid.builder()
                          .dx(grid.dx()).dy(grid.dy())
                          .nx(grid.nx()).ny(grid.ny())
                          .originX(grid.originX())
                          .originY(grid.originY() + grid.dy() * grid.ny())
                          .wkt(grid.wkt())
                          .data(flipped)
                          .units(grid.units())
                          .fileName(grid.fileName())
                          .shortName(grid.shortName())
                          .fullName(grid.fullName())
                          .description(grid.description())
                          .startTime(grid.startTime())
                          .endTime(grid.endTime())
                          .interval(grid.interval())
                          .build();
              }
  
              Dataset dataset = RasterUtils.getDatasetFromVortexGrid(gridOut);
              ArrayList<String> gdalOptions = new ArrayList<>();
              gdalOptions.add("-of");
              gdalOptions.add("AAIGrid");
              gdalOptions.add("-co");
              gdalOptions.add("FORCE_CELLSIZE=TRUE");
              TranslateOptions translateOptions = new TranslateOptions(new Vector<>(gdalOptions));
              Dataset out = gdal.Translate(destination.toString(), dataset, translateOptions);
              out.FlushCache();
              out.delete();
          });
      }
focal_method.class_method_signature: AscDataWriter.write()
focal_method.full_signature: @Override public void write()
focal_method.identifier: write
focal_method.invocations: collect map filter stream toList forEach dy flipArray data nx ny build interval endTime startTime description fullName shortName fileName units data wkt originY originX ny nx dy dx builder dx dy nx ny originX originY dy ny wkt units fileName shortName fullName description startTime endTime interval getDatasetFromVortexGrid add add add add Translate toString FlushCache delete
focal_method.modifiers: @Override public
focal_method.parameters: ()
focal_method.return: void
focal_method.signature: void write()