GUI1Parser.java [src/java/m/weps] Revision: f91250fd462a7eea76dc2ac0c64cfe29df96b77e Date: Fri Feb 05 09:36:59 MST 2016
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package m.weps;
import java.util.ArrayList;
import java.util.logging.Logger;
import util.ErosionConst;
/**
*
* @author User
*/
public class GUI1Parser {
public static final Logger LOG = Logger.getLogger(GUI1Parser.class.getName());
@Deprecated
public static void parseGUI1(String data,WepsOutput wo){ // The values pulled from this file were not correct
boolean bNanFound = false;
// If we get to a point that we want values from an entire column it might be nice to sort the data into a double array but
// for now I am just counting from the end of the list because we just need a few from the total row.
String[] values = data.split("\\|");
ArrayList<String> trimValues = new ArrayList<>();
for(int i=0;i<values.length;i++){
trimValues.add(values[i].trim());
}
wo.saltation = trimValues.get(trimValues.size()-62-1); // I think I wrote it like this because the 62 was how far back it was and the -1 for 0 indexing
wo.suspension = trimValues.get((trimValues.size()-61-1));
wo.pm10 = trimValues.get((trimValues.size()-60-1));
if (wo.saltation.equals("NaN"))
{
wo.saltation = "0.0000";
wo.bNaN = true;
bNanFound = true;
}
if (wo.suspension.equals("NaN"))
{
wo.suspension = "0.0000";
wo.bNaN = true;
bNanFound = true;
}
if (wo.pm10.equals("NaN"))
{
wo.pm10 = "0.0000";
wo.bNaN = true;
bNanFound = true;
}
if (bNanFound)
LOG.warning("Parsing gui1_data.out: " + ErosionConst.WEPS_FOUND_NAN_IN_OUTPUT);
LOG.info("wo.saltation: "+wo.saltation);
LOG.info("wo.suspension: "+wo.suspension);
}
}