<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package usda.weru.nrmv;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.StringTokenizer;
import org.apache.commons.lang.WordUtils;

/**
 *
 * @author Benjamin.Todd
 */
public class ConvertPlot extends NrmvConverter {

    /**
     *
     */
    public ConvertPlot() {
    }

    /**
     *
     */
    @Override
    public void setLinesToSkip() {
        this.linesToSkip = 3;
    }

    /**
     *
     * @param s
     */
    public void setVariables(String s) {
        StringTokenizer st;
        variables = new ArrayList&lt;String&gt;();
        st = new StringTokenizer(s, "|", false);
        while (st.hasMoreTokens()) {
            variables.add(st.nextToken());
        }
    }

    /**
     *
     * @param pw
     */
    @Override
    public void printUnits(PrintWriter pw) {
        pw.println();

        // this.printLineCommas(pw, temp);
        pw.println("unit,,kg/m^2,kg/m^2,kg/m^2,m/s,degrees from N,mm,content,mm,degrees from N,mm,mm,J/cm^2,fraction,Mg/m^2,fraction,Mg/m^3,percent,percent,"
                + "index,index,kg/m^2,fraction,m,m,biodrag,Fraction (0-1),m,index,index,biodrag,fraction,fraction,0 or 1,0 or 1,velocity,velocity,velocity,velocity,velocity,threshhold,threshhold,threshhold,threshhold,velocity,velocity,velocity,velocity,velocity,threshold,threshhold,threshold,threshold,mm,mm,mm,fraction");
    }
      @Override
    public void printSummaryUnits(PrintWriter pw) {
        pw.println();

        // this.printLineCommas(pw, temp);
        pw.println("unit,,kg/m^2,kg/m^2,kg/m^2,m/s,degrees from N,mm,content,mm,degrees from N,mm,mm,J/cm^2,fraction,Mg/m^2,fraction,Mg/m^3,percent,percent,"
                + "index,index,kg/m^2,fraction,m,m,biodrag,Fraction (0-1),m,index,index,biodrag,fraction,fraction,0 or 1,0 or 1,velocity,velocity,velocity,velocity,velocity,threshhold,threshhold,threshhold,threshhold,velocity,velocity,velocity,velocity,velocity,threshold,threshhold,threshold,threshold,mm,mm,mm,fraction");
    }

    /**
     *
     */
    @Override
    public void setVariables() {
        variables = new ArrayList&lt;String&gt;();
        variables.add("time");
      // variables.add("id");
        variables.add("total erosion loss");
        variables.add("suspension erosion loss");
        variables.add("pm10 erosion loss");
        variables.add("maximum wind speed");
        variables.add("wind direction");
        variables.add("precipitation");
        variables.add("soil surface water content");
        variables.add("ridge height");
        variables.add("ridge orientation");
        variables.add("random roughness");
        variables.add("aggregate size geometric mean diameter");
        variables.add("aggregate stability");
        variables.add("crust fraction");
        variables.add("loose mass on crust");
        variables.add("loose mass crust cover fraction");
        variables.add("soil bulk density");
        variables.add("total flat cover percent");
        variables.add("total stem cover percent");
        variables.add("crop leaf area index");
        variables.add("crop stem area index");
        variables.add("crop stem mass");
        variables.add("crop canopy cover fraction");
        variables.add("crop height");
        variables.add("crop representative stem diameter");
        variables.add("crop biodrag");
        variables.add("crop total soil cover");
        variables.add("residue mass weighted average height");
        variables.add("residue stem area index");
        variables.add("residue leaf area index");
        variables.add("residue biodrag");
        variables.add("residue canopy cover fraction");
        variables.add("residue soil cover fraction");
        variables.add("1 - erosion was entered");
        variables.add("1 - snow depth prevented erosion");
        variables.add("anemometer located friction velocity");
        variables.add("site surface random roughness adjusted friction velocity");
        variables.add("site surface oriented roughness adjusted friction velocity");
        variables.add("site biodrag adjusted friction velocity");
        variables.add("site friction velocity");
        variables.add("bare friction velocity threshold");
        variables.add("flat cover increases threshold");
        variables.add("surface wetness increases threshold");
        variables.add("ag density increases threshold");
        variables.add("resultant threshold friction velocity");
        variables.add("ratio anemometer located friction velocity");
        variables.add("ratio site surface random roughness adjusted friction velocity");
        variables.add("ratio site surface oriented roughness adjusted friction velocity");
        variables.add("ratio site biodrag adjusted friction velocity");
        variables.add("ratio bare friction Velocity threshold");
        variables.add("ratio flat cover increases threshold");
        variables.add("ratio surface wetness increases threshold");
        variables.add("ratio ag density increases threshold");
        variables.add("surface soil fraction less than 0.84 milimeters");
        variables.add("surface soil fraction greater than 2 milimeters");
        variables.add("surface soil aerodynamic roughness");
        variables.add("soil surface fraction which does not emit");
        for (int i = 0; i &lt; variables.size(); i++) {
            variables.set(i, WordUtils.capitalize(variables.get(i)));
        }
    }

    /**
     *
     * @param al
     * @return
     */
    @Override
    public ArrayList&lt;String&gt; changeData(ArrayList&lt;String&gt; al) {
        int i = Integer.parseInt(al.get(0));
        String str = convertNumber(i);
        al.set(0, str);
       // al.set(1, "1");
        al.subList(1, 5).clear();
        al.subList(57, al.size()).clear();
        return al;
    }

    @Override
    public void setUnits() {
           units = new ArrayList&lt;String&gt;();
       String sUnit = ",Date,kg/m^2,kg/m^2,kg/m^2,m/s,degrees from N,mm,0-1,mm,degrees from N,mm,mm,J/cm^2,0-1,Mg/m^2,0-1,Mg/m^3,percent,percent,"
                + "index,index,kg/m^2,0-1,m,m,biodrag,0-1 ,m,index,index,biodrag,0-1,0-1,0 or 1,0 or 1,velocity,velocity,velocity,velocity,velocity,velocity,velocity,velocity,velocity,velocity,Velocity Ratio,Velocity Ratio,Velocity Ratio,Velocity Ratio,Velocity Ratio,Velocity Ratio,Velocity Ratio,Velocity Ratio,0-1,0-1,mm,0-1";
       StringTokenizer st = new StringTokenizer(sUnit,",", false);
       while(st.hasMoreTokens())
               {
        units.add(st.nextToken());
    }
    }
}
</pre></body></html>