WeppConstants.java [src/java/util] Revision:   Date:
/*
 * 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 util;

/**
 *
 * @author <a href="mailto:shaun.case@colostate.edu">Shaun Case</a>
 */
public class WeppConstants {

  public static final String CONFIG_PREFIX = "wepp";
  public static final String CONFIG_SOIL_URL = "soil.input";
  public static final String CONFIG_CONTOURS_URL = "contours";
  public static final String CONFIG_MANAGEMENTS_URL = "managements";
  public static final String CONFIG_STRIPS_URL = "strips";
  public static final String CONFIG_CLIGEN_PRISM_URL = "cligen.prism";
  public static final String CONFIG_CROPS_URL = "crops";
  public static final String CONFIG_OPERATIONS_URL = "operations";
  public static final String CONFIG_RESIDUES_URL = "residues";
  public static final String CONFIG_SOILAOI_URL = "soils";
  public static final String CONFIG_STATECOUNTY_URL = "statecounty";


  public static String buildConfigKey(String version, String URL) {
    String ret_val = null;
    if ((null != version) && (!version.isEmpty())) {
      ret_val = CONFIG_PREFIX + "." + version + "." + URL;
    }

    return ret_val;
  }
  /**
   * conversion factor feet to meters
   */
  public static final double CONV_FT_TO_M = 0.3048;
  /**
   * conversion factor meters to feet
   */
  public static final double CONV_M_TO_FT = 3.28084;
  /**
   * conversion factor kilogram per square meter to tons per acre
   */
  public static final double KGMTPA = (0.2048 * 43560) / 2000.0;
  /**
   * conversion factor tons per acre to kilograms per square meter
   */
  public static final double TPAKGM = 0.22417;

  public enum InitialConditions {
    ANNUAL, FALLOW, PERENNIAL, WOODY
  };

  public static final String defaultInitCond = "__DEFAULT__ 1\n"
      + "Corn after corn\n"
      + "Put here as default by LMOD -> .rot convert - Default corn initial conditions set - continuous corn - spring/summer tillage only\n"
      + "90 percent cover, approximately 200 days since last tillage\n"
      + "500 mm of rain since last tillage in summer prior\n"
      + "__CROP__\n"
      + "1  #landuse\n"
      + "1.10000 0.00000 200 92 0.00000 0.50000\n"
      + "1 # mang annual\n"
      + "500.12601 0.02000 0.50000 0.02000 0.00000\n"
      + "1  # rtyp - temporary\n"
      + "0.00000 0.00000 0.10000 0.20000 0.02540\n"
      + "0.2 0.19997 0.00000 0.00000";

  public static final String defaultFallowInitCond = "__DEFAULT__ 1\n"
      + "Fallow\n"
      + "No residue or canopy cover\n"
      + "Low roughness\n"
      + "fallow system specified here\n"
      + "__CROP__\n"
      + "1  #landuse\n"
      + "1.10000 0.00000 200 2000 0.00000 0.00000\n"
      + "3 # mang fallow\n"
      + "500.00000 0.02000 0.00000 0.02000 0.00000\n"
      + "1  # rtyp - temporary\n"
      + "0.00000 0.00000 0.10000 0.20000 0.00000\n"
      + "0.00000 0.00000 0.00000 0.00000";

  public static final String defaultPereInitCond = "__DEFAULT__ 1\n"
      + "Grass\n"
      + "Initial conditions for a perennial grass strip already in existence\n"
      + "Can use this initial condition to run permanent grass strips\n"
      + "and have no disturbance, planting or other operations\n"
      + "__CROP__\n"
      + "1  #landuse\n"
      + "1.10000 0.50000 200 92 0.00000 0.70000\n"
      + "2 # mang perennial\n"
      + "500.00000 0.02000 0.70000 0.02000 0.00000\n"
      + "1  # rtyp - temporary\n"
      + "0.00000 0.00000 0.10000 0.20000 0.00000\n"
      + "0.20000 0.00000 0.00000 0.00000";

  public static final String defaultWoodyInitCond = "__DEFAULT__ 1\n"
      + "Wood\n"
      + "Initial conditions for a woody vegetaton already in existence\n"
      + "Can use this initial condition to run permanent woods, orchards\n"
      + "with no other planting. No growth, constant rill/interill cover.\n"
      + "__CROP__\n"
      + "1  #landuse\n"
      + "1.10000 __CANOPYCOV__ 1000 1000 0.00000 __INTERRILLCOV__\n"
      + "2 # mang perennial\n"
      + "1000.00000 0.00000 __RILLCOV__ 0.00000 0.00000\n"
      + "1  # rtyp - temporary\n"
      + "0.00000 0.00000 0.00000 0.00000 0.00000\n"
      + "0.00000 0.00000 __USRINTR__ __USRRIL__";


  public static String getInitialCondition(InitialConditions name) {
    switch (name) {
      case WOODY:
        return defaultWoodyInitCond;
      case PERENNIAL:
        return defaultPereInitCond;
      case FALLOW:
        return defaultFallowInitCond;
      case ANNUAL:
        return defaultInitCond;
      default:
        return null;
    }
  }

}