//! Read all parameters from launch file void DetectingMark::getParams() { // log level - level of messages to pass to log output mLogLevel_ = getIntParam("logLevel", LOG_LEVEL); // Enable or not video control windows mShowVideo_ = getBoolParam("showVideo", SHOW_WINDOW); // main cycle min duration, msec mCycleRate_ = getIntParam("cycleRate", CYCLE_RATE); // flag to use HSV thresholding mUseHsv_ = getBoolParam("useHSV", USE_HSV); // flag to send temp image in topic mSendPreTarget_ = getBoolParam("SendPreTarget", SEND_PRE_TARGET); // HSV range mHmax_ = getIntParam("Hmax", 180); mHmin_ = getIntParam("Hmin", 0); mSmax_ = getIntParam("Smax", 255); mSmin_ = getIntParam("Smin", 0); mVmax_ = getIntParam("Vmax", 255); mVmin_ = getIntParam("Vmin", 0); // source image dimensions mFrameWidth_ = getIntParam("frameWidth", FRAME_WIDTH); mFrameHeight_ = getIntParam("frameHeight", FRAME_HEIGHT); mVideoTopic_ = getStrParam("videoTopic", VIDEO_TOPIC_NAME); // input image source if(nh_.getParam("inputStream", mInpStream_)) { cout << "read inputStream" << endl; // from video file if( mInpStream_ == 0 ) { mInputStream_ = VIDEO; } // from camera else if( mInpStream_ == 1 ) { mInputStream_ = CAMERA; } // from ROS topic else if( mInpStream_ == 2 ) { cout << "inputStream = TOPIC" << endl; mInputStream_ = TOPIC; } } else { cout << "can't read inputStream, use default" << endl; mInputStream_ = VIDEO; } mVideoFile_ = getStrParam("videoFile", VIDEO_FILE_NAME); // Binarization thresholds mThresh_ = getIntParam("thresh", THRESH); mMaxThresh_ = getIntParam("max_thresh", MAX_THRESH); // flag if distortion correction needed mCorrectImage_ = getBoolParam("correctImage", CORRECT_IMAGE_BOOL); // path co calibration file mPathToCalibYaml_ = getStrParam("pathToCalibYaml", PATH_TO_CALIB_YAML); // flag if work on ROI of image mUseROI_ = getBoolParam("useROI", USE_ROI_BOOL); // if using ROI - read it corners if( mUseROI_ ) { mROIx_ = getIntParam("ROIx", ROI_X); mROIy_ = getIntParam("ROIy", ROI_Y); mROIw_ = getIntParam("ROIw", ROI_W); mROIh_ = getIntParam("ROIh", ROI_H); } // angle for lines intersection detection mAngleDiff_ = getIntParam("AngleDiff", ANGLE_DIFFERENCE); // thresholds for Canny detector mCannyThreshold_ = getIntParam("CannyThreshold", CANNY_THRESH); mCannyMaxThreshold_ = getIntParam("CannyMaxThreshold", CANNY_MAX_THRESH); // result publishing mode mAlgoMode_ = getIntParam("AlgoMode", 0); }
struct stratum_default *construct_stratum_defaults( int num_default_files, char **default_files, struct command_line_object *command_line) { /*--------------------------------------------------------------*/ /* Local function definition. */ /*--------------------------------------------------------------*/ void *alloc( size_t, char *, char *); int parse_veg_type( char *); int parse_phenology_type( char *); int parse_dyn_flag( char *); int parse_alloc_flag( char *); /*--------------------------------------------------------------*/ /* Local variable definition. */ /*--------------------------------------------------------------*/ int i, itmp; int strbufLen = 256; int filenameLen = 1024; int paramCnt = 0; char record[MAXSTR]; char *newrecord; char stmp[MAXSTR]; char strbuf[strbufLen]; char outFilename[filenameLen]; double fcel, ftmp, lig_cel_ratio; //FILE *default_file; param *paramPtr = NULL; struct stratum_default *default_object_list; struct epconst_struct *epc; /*--------------------------------------------------------------*/ /* Allocate an array of default objects. */ /*--------------------------------------------------------------*/ default_object_list = (struct stratum_default *) alloc(num_default_files * sizeof(struct stratum_default),"default_object_list", "construct_stratum_defaults" ); /*--------------------------------------------------------------*/ /* Loop through the default files list. */ /*--------------------------------------------------------------*/ for (i=0 ; i<num_default_files; i++) { epc = &(default_object_list[i].epc); /*--------------------------------------------------------------*/ /* Try to open the ith default file. */ /*--------------------------------------------------------------*/ printf("Reading %s\n", default_files[i]); paramCnt = 0; if (paramPtr != NULL) free(paramPtr); paramPtr = readParamFile(¶mCnt, default_files[i]); /*--------------------------------------------------------------*/ /* read the ith default file into the ith object. */ /*--------------------------------------------------------------*/ default_object_list[i].ID = getIntParam(¶mCnt, ¶mPtr, "stratum_default_ID", "%d", 7, 1); // new param name default_object_list[i].epc.veg_type = parse_veg_type(getStrParam(¶mCnt, ¶mPtr, "epc.veg.type", "%s", "TREE", 1)); // param name is "epc.veg.type" in param file default_object_list[i].K_absorptance = getDoubleParam(¶mCnt, ¶mPtr, "K_absorptance", "%lf", 0.8, 1); // parameter misspelled in file as "K_apsorbtance" default_object_list[i].K_reflectance = getDoubleParam(¶mCnt, ¶mPtr, "K_reflectance", "%lf", 0.1, 1); default_object_list[i].K_transmittance = getDoubleParam(¶mCnt, ¶mPtr, "K_transmittance", "%lf", 0.1, 1); default_object_list[i].PAR_absorptance = getDoubleParam(¶mCnt, ¶mPtr, "PAR_absorptance", "%lf", 1.0, 1); // param misspelled in file "PAR_absrptance" default_object_list[i].PAR_reflectance = getDoubleParam(¶mCnt, ¶mPtr, "PAR_reflectance", "%lf", 0.0, 1); default_object_list[i].PAR_transmittance = getDoubleParam(¶mCnt, ¶mPtr, "PAR_transmittance", "%lf", 0.0, 1); default_object_list[i].epc.ext_coef = getDoubleParam(¶mCnt, ¶mPtr, "epc.ext_coef", "%lf", 0.5, 1); default_object_list[i].specific_rain_capacity = getDoubleParam(¶mCnt, ¶mPtr, "specific_rain_capacity", "%lf", 0.00024, 1); default_object_list[i].specific_snow_capacity = getDoubleParam(¶mCnt, ¶mPtr, "specific_snow_capacity", "%lf", 0.00024, 1); default_object_list[i].wind_attenuation_coeff = getDoubleParam(¶mCnt, ¶mPtr, "wind_attenuation_coef", "%lf", 0.4, 1); // param name is "wind_attenuation_coef" in param file default_object_list[i].ustar_overu = getDoubleParam(¶mCnt, ¶mPtr, "ustar_overu", "%lf", -999.9, 1); default_object_list[i].mrc.q10 = getDoubleParam(¶mCnt, ¶mPtr, "mrc.q10", "%lf", 1.5, 1); default_object_list[i].mrc.per_N = getDoubleParam(¶mCnt, ¶mPtr, "mrc.per_N", "%lf", 0.21, 1); default_object_list[i].epc.gr_perc = getDoubleParam(¶mCnt, ¶mPtr, "epc.gr_perc", "%lf", 0.2, 1); default_object_list[i].lai_stomatal_fraction = getDoubleParam(¶mCnt, ¶mPtr, "lai_stomatal_fraction", "%lf", 1.0, 1); default_object_list[i].epc.flnr = getDoubleParam(¶mCnt, ¶mPtr, "epc.flnr", "%lf", 0.1, 1); default_object_list[i].epc.ppfd_coef = getDoubleParam(¶mCnt, ¶mPtr, "epc.ppfd_coef", "%lf", 0.03, 1); default_object_list[i].epc.topt = getDoubleParam(¶mCnt, ¶mPtr, "epc.topt", "%lf", 15.0, 1); default_object_list[i].epc.tmax = getDoubleParam(¶mCnt, ¶mPtr, "epc.tmax", "%lf", 40.0, 1); default_object_list[i].epc.tcoef = getDoubleParam(¶mCnt, ¶mPtr, "epc.tcoef", "%lf", 0.2, 1); default_object_list[i].epc.psi_open = getDoubleParam(¶mCnt, ¶mPtr, "epc.psi_open", "%lf", -0.65, 1); default_object_list[i].epc.psi_close = getDoubleParam(¶mCnt, ¶mPtr, "epc.psi_close", "%lf", -2.5, 1); default_object_list[i].epc.vpd_open = getDoubleParam(¶mCnt, ¶mPtr, "epc.vpd_open", "%lf", 0.0, 1); default_object_list[i].epc.vpd_close = getDoubleParam(¶mCnt, ¶mPtr, "epc.vpd_close", "%lf", 3500.0, 1); default_object_list[i].epc.gl_smax = getDoubleParam(¶mCnt, ¶mPtr, "epc.gl_smax", "%lf", 0.006, 1); default_object_list[i].epc.gl_c = getDoubleParam(¶mCnt, ¶mPtr, "epc.gl_c", "%lf", 0.00006, 1); default_object_list[i].gsurf_slope = getDoubleParam(¶mCnt, ¶mPtr, "gsurf_slope", "%lf", 0.0, 1); default_object_list[i].gsurf_intercept = getDoubleParam(¶mCnt, ¶mPtr, "gsurf_intercept", "%lf", 1000000.0, 1); default_object_list[i].epc.phenology_flag = parse_dyn_flag(getStrParam(¶mCnt, ¶mPtr, "epc.phenology_flag", "%s", "static", 1)); default_object_list[i].epc.phenology_type = parse_phenology_type(getStrParam(¶mCnt, ¶mPtr, "epc.phenology.type", "%s", "EVERGREEN", 1)); default_object_list[i].epc.max_lai = getDoubleParam(¶mCnt, ¶mPtr, "epc.max_lai", "%lf", 12.0, 1); default_object_list[i].epc.proj_sla = getDoubleParam(¶mCnt, ¶mPtr, "epc.proj_sla", "%lf", 9.0, 1); default_object_list[i].epc.lai_ratio = getDoubleParam(¶mCnt, ¶mPtr, "epc.lai_ratio", "%lf", 2.6, 1); default_object_list[i].epc.proj_swa = getDoubleParam(¶mCnt, ¶mPtr, "epc.proj_swa", "%lf", 1.4, 1); default_object_list[i].epc.leaf_turnover = getDoubleParam(¶mCnt, ¶mPtr, "epc.leaf_turnover", "%lf", 0.27, 1); default_object_list[i].epc.day_leafon = getIntParam(¶mCnt, ¶mPtr, "epc.day_leafon", "%d", 91, 1); default_object_list[i].epc.day_leafoff = getIntParam(¶mCnt, ¶mPtr, "epc.day_leafoff", "%d", 260, 1); default_object_list[i].epc.ndays_expand = getIntParam(¶mCnt, ¶mPtr, "epc.ndays_expand", "%d", 30, 1); default_object_list[i].epc.ndays_litfall = getIntParam(¶mCnt, ¶mPtr, "epc.ndays_litfall", "%d", 30, 1); default_object_list[i].epc.leaf_cn = getDoubleParam(¶mCnt, ¶mPtr, "epc.leaf_cn", "%lf", 45.0, 1); default_object_list[i].epc.leaflitr_cn = getDoubleParam(¶mCnt, ¶mPtr, "epc.leaflitr_cn", "%lf", 70.0, 1); default_object_list[i].min_heat_capacity = getDoubleParam(¶mCnt, ¶mPtr, "min_heat_capacity", "%lf", 0.0, 1); default_object_list[i].max_heat_capacity = getDoubleParam(¶mCnt, ¶mPtr, "max_heat_capacity", "%lf", 0.0, 1); default_object_list[i].epc.allocation_flag = parse_alloc_flag(getStrParam(¶mCnt, ¶mPtr, "epc.allocation_flag", "%s", "waring", 1)); /*--------------------------------------------------------------*/ /* NOTE: PLACE ANY GROW READING HERE. */ /*--------------------------------------------------------------*/ if ( (default_object_list[i].epc.leaflitr_cn < default_object_list[i].epc.leaf_cn) && (command_line[0].grow_flag > 0) ){ fprintf(stderr, "WARNING construct_stratum_defaults \n"); fprintf(stderr, " leaf litter C:N < leaf C:N \n"); } default_object_list[i].epc.storage_transfer_prop = getDoubleParam(¶mCnt, ¶mPtr, "epc.storage_transfer_prop", "%lf", 1.0, 1); default_object_list[i].epc.froot_turnover = getDoubleParam(¶mCnt, ¶mPtr, "epc.froot_turnover", "%lf", 0.27, 1); if ((default_object_list[i].epc.veg_type == GRASS) || (default_object_list[i].epc.veg_type == C4GRASS)) { default_object_list[i].epc.deadleaf_turnover = getDoubleParam(¶mCnt, ¶mPtr, "epc.deadleaf_turnover", "%lf", 1.0, 1); } else { default_object_list[i].epc.livewood_turnover = getDoubleParam(¶mCnt, ¶mPtr, "epc.livewood_turnover", "%lf", 0.7, 1); } default_object_list[i].epc.kfrag_base = getDoubleParam(¶mCnt, ¶mPtr, "epc.kfrag_base", "%lf", 0.01, 1); default_object_list[i].epc.daily_mortality_turnover = getFloatParam(¶mCnt, ¶mPtr, "epc.daily_mortality_turnover", "%f", 0.005, 1) / 365; default_object_list[i].epc.froot_cn = getDoubleParam(¶mCnt, ¶mPtr, "epc.froot_cn", "%lf", 139.7, 1); default_object_list[i].epc.livewood_cn = getDoubleParam(¶mCnt, ¶mPtr, "epc.livewood_cn", "%lf", 200.0, 1); default_object_list[i].epc.leaflitr_flab = getDoubleParam(¶mCnt, ¶mPtr, "epc.leaflitr_flab", "%lf", 0.31, 1); // Skipping epc.leaflitr_fcel (pcs 20130117 : comment or var name wrong in orig code: defs/veg_westhemlock.def has 'leaflitr_fcel') fcel = getDoubleParam(¶mCnt, ¶mPtr, "epc.leaflitr_fcel", "%lf", 0.45, 1); // param name in file is "leaflitr_fcel" default_object_list[i].epc.leaflitr_flig = getDoubleParam(¶mCnt, ¶mPtr, "epc.leaflitr_flig", "%lf", 0.24, 1); if ( (float)(epc->leaflitr_flig + epc->leaflitr_flab + fcel) != 1.0 ) { fprintf(stderr,"FATAL ERROR construct_stratum_defaults \n"); fprintf(stderr," litter proportions of labile, cell. and lignin must sum to 1.0 \n"); fprintf(stderr," for default ID %d \n", default_object_list[i].ID); exit(EXIT_FAILURE); } lig_cel_ratio = epc->leaflitr_flig/fcel; /* calculate shielded and unshielded cellulose fraction */ if (lig_cel_ratio < 0.45){ epc->leaflitr_fscel = 0.0; epc->leaflitr_fucel = fcel; } else{ if ((lig_cel_ratio > 0.45) && (lig_cel_ratio < 0.7)){ epc->leaflitr_fscel= (lig_cel_ratio - 0.45)*3.2*fcel; epc->leaflitr_fucel = (1.0 - 3.2*(lig_cel_ratio - 0.45))*fcel; } else { epc->leaflitr_fscel = 0.8*fcel; epc->leaflitr_fucel = 0.2*fcel; } } default_object_list[i].epc.frootlitr_flab = getDoubleParam(¶mCnt, ¶mPtr, "epc.frootlitr_flab", "%lf", 0.23, 1); // Skipping the mortality parameter fcel = getDoubleParam(¶mCnt, ¶mPtr, "epc.frootlitr_fcel", "%lf", 0.41, 1); default_object_list[i].epc.frootlitr_flig = getDoubleParam(¶mCnt, ¶mPtr, "epc.frootlitr_flig", "%lf", 0.36, 1); if ( (float)(epc->frootlitr_flab + epc->frootlitr_flig + fcel) != 1.0 ){ fprintf(stderr,"\nFATAL ERROR construct_stratum_defaults"); fprintf(stderr,"\n froot litter proportions of labile, cell. and lignin must sum to 1.0\n"); exit(EXIT_FAILURE); } lig_cel_ratio = epc->frootlitr_flig/fcel; /* calculate shielded and unshielded cellulose fraction */ if (lig_cel_ratio < 0.45) { epc->frootlitr_fscel = 0.0; epc->frootlitr_fucel = fcel; } else{ if ((lig_cel_ratio > 0.45) && (lig_cel_ratio < 0.7)){ epc->frootlitr_fscel= (lig_cel_ratio - 0.45)*3.2*fcel; epc->frootlitr_fucel = (1.0 - 3.2*(lig_cel_ratio - 0.45))*fcel; } else{ epc->frootlitr_fscel = 0.8*fcel; epc->frootlitr_fucel = 0.2*fcel; } } fcel = getDoubleParam(¶mCnt, ¶mPtr, "epc.deadwood_fcel", "%lf", 0.52, 1); default_object_list[i].epc.deadwood_flig = getDoubleParam(¶mCnt, ¶mPtr, "epc.deadwood_flig", "%lf", 0.48, 1); if (epc->veg_type == TREE) { if ( (float)(epc->deadwood_flig + fcel) != 1.0 ){ fprintf(stderr,"FATAL ERROR construct_stratum_defaults \n"); fprintf(stderr," dead wood proportions of labile, cell. and lignin must sum to 1.0 \n"); exit(EXIT_FAILURE); } lig_cel_ratio = epc->deadwood_flig/fcel; /* calculate shielded and unshielded cellulose fraction */ if (lig_cel_ratio < 0.45) { epc->deadwood_fscel = 0.0; epc->deadwood_fucel = fcel; } else{ if ((lig_cel_ratio > 0.45) && (lig_cel_ratio < 0.7)){ epc->deadwood_fscel= (lig_cel_ratio - 0.45)*3.2*fcel; epc->deadwood_fucel = (1.0 - 3.2*(lig_cel_ratio - 0.45))*fcel; } else{ epc->deadwood_fscel = 0.8*fcel; epc->deadwood_fucel = 0.2*fcel; } } /* epc->deadwood_cn = ((epc->deadwood_fucel + epc->deadwood_fscel + epc->deadwood_flig) * CEL_CN * LIG_CN ) / (LIG_CN * (epc->deadwood_fucel + epc->deadwood_fscel) + CEL_CN * epc->deadwood_flig); if (epc->deadwood_cn < epc->livewood_cn){ fprintf(stderr,"\nFATAL ERROR: construct_canopy_stratum"); fprintf(stderr,"\ndeadwood C:N must be > livewood C:N"); exit(EXIT_FAILURE); } */ epc->deadwood_cn = (epc->deadwood_fucel + epc->deadwood_fscel) * CEL_CN + (epc->deadwood_flig) * LIG_CN; } /* end if tree */ else { epc->deadwood_flig = 0.0; epc->deadwood_fucel = 0.0; epc->deadwood_fscel = 0.0; epc->deadwood_cn = 0.0; } default_object_list[i].epc.alloc_frootc_leafc = getDoubleParam(¶mCnt, ¶mPtr, "epc.alloc_frootc_leafc", "%lf", 1.325, 1); default_object_list[i].epc.alloc_crootc_stemc = getDoubleParam(¶mCnt, ¶mPtr, "epc.alloc_crootc_stemc", "%lf", 0.3, 1); default_object_list[i].epc.alloc_stemc_leafc = getDoubleParam(¶mCnt, ¶mPtr, "epc.alloc_stemc_leafc", "%lf", 1.62, 1); default_object_list[i].epc.alloc_livewoodc_woodc = getDoubleParam(¶mCnt, ¶mPtr, "epc.alloc_livewoodc_woodc", "%lf", 0.073, 1); if (epc->veg_type != TREE){ epc->alloc_crootc_stemc = 0.0; epc->phloemcsa_per_alllai = 0.0; } default_object_list[i].epc.alloc_maxlgf = getDoubleParam(¶mCnt, ¶mPtr, "epc.maxlgf", "%lf", 0.05, 1); // param named 'epc.maxlgf' in parameter file default_object_list[i].epc.alloc_prop_day_growth = getDoubleParam(¶mCnt, ¶mPtr, "epc.alloc_prop_day_growth", "%lf", 0.5, 1); default_object_list[i].epc.dynamic_alloc_prop_day_growth = getIntParam(¶mCnt, ¶mPtr, "epc.dyn_alloc_prop_day_growth", "%d", 0, 1); default_object_list[i].epc.daily_fire_turnover = getDoubleParam(¶mCnt, ¶mPtr, "epc.daily_fire_turnover", "%lf", 0.0, 1); default_object_list[i].epc.height_to_stem_exp = getDoubleParam(¶mCnt, ¶mPtr, "epc.height_to_stem_exp", "%lf", 0.57, 1); default_object_list[i].epc.height_to_stem_coef = getDoubleParam(¶mCnt, ¶mPtr, "epc.height_to_stem_coef", "%lf", 11.39, 1); /*--------------------------------------------------------------*/ /* optionally read in parameters on re-sprouting */ /* and other newly implemented vegetation routines */ /*--------------------------------------------------------------*/ default_object_list[i].epc.min_leaf_carbon = getDoubleParam(¶mCnt, ¶mPtr, "epc.min_leaf_carbon", "%lf", 0.0005, 1); default_object_list[i].epc.max_years_resprout = getIntParam(¶mCnt, ¶mPtr, "epc.max_years_resprout", "%d", 100, 1); default_object_list[i].epc.resprout_leaf_carbon = getDoubleParam(¶mCnt, ¶mPtr, "epc.resprout_leaf_carbon", "%lf", 0.001, 1); default_object_list[i].epc.litter_gsurf_slope = getDoubleParam(¶mCnt, ¶mPtr, "epc.litter_gsurf_slope", "%lf", 0.0, 1); default_object_list[i].epc.litter_gsurf_intercept = getDoubleParam(¶mCnt, ¶mPtr, "epc.litter_gsurf_intercept", "%lf", 100000000, 1); default_object_list[i].epc.coef_CO2 = getDoubleParam(¶mCnt, ¶mPtr, "epc.coef_CO2", "%lf", 1.0, 1); default_object_list[i].epc.root_growth_direction = getDoubleParam(¶mCnt, ¶mPtr, "epc.root_growth_direction", "%lf", 0.8, 1); default_object_list[i].epc.root_distrib_parm = getDoubleParam(¶mCnt, ¶mPtr, "epc.root_distrib_parm", "%lf", 8.0, 1); default_object_list[i].epc.crown_ratio = getDoubleParam(¶mCnt, ¶mPtr, "epc.crown_ratio", "%lf", 0.6, 1); if (epc->veg_type != TREE) default_object_list[i].epc.crown_ratio = 1.0; /*--------------------------------------------------------------*/ /* default values for phenology (leaf onset/offset) model parameters */ /* are set based on Jolly et al., 2005, Global Change Biology */ /* who defined a globally uniform parameter set */ /*--------------------------------------------------------------*/ default_object_list[i].epc.gs_tmin = getDoubleParam(¶mCnt, ¶mPtr, "epc.gs_tmin", "%lf", -2.0, 1); default_object_list[i].epc.gs_tmax = getDoubleParam(¶mCnt, ¶mPtr, "epc.gs_tmax", "%lf", 5.0, 1); default_object_list[i].epc.gs_vpd_min = getDoubleParam(¶mCnt, ¶mPtr, "epc.gs_vpd_min", "%lf", 900, 1); default_object_list[i].epc.gs_vpd_max = getDoubleParam(¶mCnt, ¶mPtr, "epc.gs_vpd_max", "%lf", 4100, 1); default_object_list[i].epc.gs_dayl_min = getDoubleParam(¶mCnt, ¶mPtr, "epc.gs_dayl_min", "%lf", 36000, 1); default_object_list[i].epc.gs_dayl_max = getDoubleParam(¶mCnt, ¶mPtr, "epc.gs_dayl_max", "%lf", 39600, 1); default_object_list[i].epc.gs_psi_min = getDoubleParam(¶mCnt, ¶mPtr, "epc.gs_psi_min", "%lf", -15.0, 1); default_object_list[i].epc.gs_psi_max = getDoubleParam(¶mCnt, ¶mPtr, "epc.gs_psi_max", "%lf", -14.0, 1); default_object_list[i].epc.gs_ravg_days = getDoubleParam(¶mCnt, ¶mPtr, "epc.gs_ravg_days", "%lf", 6, 1); default_object_list[i].epc.max_storage_percent = getDoubleParam(¶mCnt, ¶mPtr, "epc.max_storage_percent", "%lf", 0.2, 1); default_object_list[i].epc.min_percent_leafg = getDoubleParam(¶mCnt, ¶mPtr, "epc.min_percent_leafg", "%lf", default_object_list[i].epc.leaf_turnover, 1); default_object_list[i].epc.dickenson_pa = getDoubleParam(¶mCnt, ¶mPtr, "epc.dickenson_pa", "%lf", 0.25, 1); default_object_list[i].epc.waring_pa = getDoubleParam(¶mCnt, ¶mPtr, "epc.waring_pa", "%lf", 0.8, 1); default_object_list[i].epc.waring_pb = getDoubleParam(¶mCnt, ¶mPtr, "epc.waring_pb", "%lf", 2.5, 1); default_object_list[i].epc.branch_turnover = getDoubleParam(¶mCnt, ¶mPtr, "epc.branch_turnover", "%lf", 0.0, 1) / 365.0; default_object_list[i].epc.Tacclim = getIntParam(¶mCnt, ¶mPtr, "epc.Tacclim", "%d", 0, 1); default_object_list[i].epc.Tacclim_intercpt = getDoubleParam(¶mCnt, ¶mPtr, "epc.Tacclim_intercpt", "%lf",3.22, 1); default_object_list[i].epc.Tacclim_slp = getDoubleParam(¶mCnt, ¶mPtr, "epc.Tacclim_slp", "%lf",0.046, 1); default_object_list[i].epc.Tacclim_days = getIntParam(¶mCnt, ¶mPtr, "epc.Tacclim_days", "%d", 30, 1); /*--------------------------------------------------------------*/ /* litter is assumed to have a mositure capacity of */ /* given by litter_moist_coef default assumes */ /* 200% moisture content by weight following */ /* Helvey, 1964 (deciduous forest in Coweeta) and */ /* Ogee and Brunet (2002) J of Hydrology, for a pine */ /* forest - */ /* so capacity in m is 2*litter carbon * 2(carbon to biomass */ /* / density of water */ /* similarly for litter depth but we assume an organic */ /* matter density */ /*--------------------------------------------------------------*/ default_object_list[i].epc.litter_moist_coef = getDoubleParam(¶mCnt, ¶mPtr, "epc.litter_moist_coef", "%lf", 2.0/1000.0, 1); default_object_list[i].epc.litter_density = getDoubleParam(¶mCnt, ¶mPtr, "epc.litter_density", "%lf", 100.0/2.0, 1); default_object_list[i].epc.gs_psi_range = default_object_list[i].epc.gs_psi_max-default_object_list[i].epc.gs_psi_min; default_object_list[i].epc.gs_dayl_range = default_object_list[i].epc.gs_dayl_max-default_object_list[i].epc.gs_dayl_min; default_object_list[i].epc.gs_vpd_range = default_object_list[i].epc.gs_vpd_max-default_object_list[i].epc.gs_vpd_min; default_object_list[i].epc.gs_trange = default_object_list[i].epc.gs_tmax-default_object_list[i].epc.gs_tmin; /*--------------------------------------------------------------*/ /* plant type defaults - are you an nfixer - are you edible */ /*--------------------------------------------------------------*/ default_object_list[i].epc.nfix = getIntParam(¶mCnt, ¶mPtr, "epc.nfix", "%d", 0, 1); default_object_list[i].epc.edible = getIntParam(¶mCnt, ¶mPtr, "epc.edible", "%d", 1, 1); default_object_list[i].epc.psi_curve = getIntParam(¶mCnt, ¶mPtr, "epc.psi_curve", "%d", 0, 1); default_object_list[i].epc.psi_threshold = getDoubleParam(¶mCnt, ¶mPtr, "epc.psi_threshold", "%lf", -1, 1); default_object_list[i].epc.psi_slp = getDoubleParam(¶mCnt, ¶mPtr, "epc.psi_slp", "%lf", 0.2, 1); default_object_list[i].epc.psi_intercpt = getDoubleParam(¶mCnt, ¶mPtr, "epc.psi_intercpt", "%lf", 1.0, 1); /*--------------------------------------------------------------*/ /* set sunlit sla multiplier this should be an input */ /*--------------------------------------------------------------*/ default_object_list[i].epc.shade_sla_mult = 1.0; /*--------------------------------------------------------------*/ /* Apply sensitivity analysis if appropriate */ /*--------------------------------------------------------------*/ if (command_line[0].vgsen_flag == 1) { default_object_list[i].epc.proj_sla *= command_line[0].veg_sen1; default_object_list[i].epc.shade_sla_mult *= command_line[0].veg_sen2; } /*--------------------------------------------------------------*/ /* Close the ith default file. */ /*--------------------------------------------------------------*/ memset(strbuf, '\0', strbufLen); strcpy(strbuf, default_files[i]); char *s = strbuf; char *y = NULL; char *token = NULL; char filename[256]; // Store filename portion of path in 't' while ((token = strtok(s, "/")) != NULL) { // Save the latest component of the filename strcpy(filename, token); s = NULL; } // Remove the file extension, if one exists memset(strbuf, '\0', strbufLen); strcpy(strbuf, filename); free(s); s = strbuf; token = strtok(s, "."); if (token != NULL) { strcpy(filename, token); } memset(outFilename, '\0', filenameLen); // Concatenate the output prefix with the filename of the input .def file // and "_stratum.params" if (command_line[0].output_prefix != NULL) { strcat(outFilename, command_line[0].output_prefix); if (filename != NULL) { strcat(outFilename, "_"); strcat(outFilename, filename); } strcat(outFilename, "_stratum.params"); } else { if (filename != NULL) { strcat(outFilename, "_"); strcat(outFilename, filename); } strcat(outFilename, "stratum.params"); } printParams(paramCnt, paramPtr, outFilename); } /*end for*/ if (paramPtr != NULL) free(paramPtr); return(default_object_list); } /*end construct_stratum_defaults*/