WeppConstants.java [src/java/util] Revision: default  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 final String CONFIG_WEPP_HILLSLOPE_URL = "wepp";


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

    return null;
  }
  /**
   * Maximum number of unique id's (soil, management) in a grid
   */
  public static final int MAX_IDS = 500;
  /**
   * 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;
  /**
   * Maximum number of WEPP points in a slope profile
   */
  public static final int MAX_WEPP_SLOPE_POINTS = 100;
  /**
   * Maximum number of channels in a WEPP watershed simulation
   */
  public static final int MAX_WEPP_CHANNELS = 1000;
  /**
   * Ha to Acres
   */
  public static final double CONV_HA_TO_AC = 2.47105;

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

  public enum GridType {
    BYTE_GRID, INT_GRID, FLOAT_GRID
  };
  
  public enum Orientation {
      NOTFOUND,UNKNOWN, TOP, LEFT, RIGHT, ANY
  };
  
  public enum SubcatchmentType {
      ALL, TOP, LEFT, RIGHT  
  };
  
  public static final int TOP = 0;
  public static final int LEFT = 1;
  public static final int RIGHT = 2;
  public static final int ALL = 3;

  public static final int NORTH_D8 = 3;
  public static final int NORTH_EAST_D8 = 2;
  public static final int EAST_D8 = 1;
  public static final int SOUTH_EAST_D8 = 8;
  public static final int SOUTH_D8 = 7;
  public static final int SOUTH_WEST_D8 = 6;
  public static final int WEST_D8 = 5;
  public static final int NORTH_WEST_D8 = 4;

  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;
    }
  }

}