Commit 68233032 authored by Haffenden Austin's avatar Haffenden Austin
Browse files

Initial commit to gitlab

parents
{
}
\ No newline at end of file
{
"tempName" : "Untitled1"
}
\ No newline at end of file
{
"tempName" : "Untitled1"
}
\ No newline at end of file
{
}
\ No newline at end of file
{
}
\ No newline at end of file
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F1.%20data_preparation%2FClaro%2FClaro_landscape_products.R="8532C250"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F1.%20data_preparation%2FIFN%2FifnHelpers%2FR%2Ffor_LC_init.R="CF71DB7"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F1.%20data_preparation%2FIFN%2FifnHelpers%2FR%2Ffrom_ecology_files.R="3F1052E5"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F1.%20data_preparation%2FIFN%2FifnHelpers%2FR%2Fread_species_info.R="FDEAB314"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F1.%20data_preparation%2FIFN%2FifnHelpers%2FR%2Fspecies2leafhabit.R="87FFF67A"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F1.%20data_preparation%2FIFN%2FifnHelpers%2FR%2Fspecies_names_table.R="387FA6D7"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F1.%20data_preparation%2FIFN%2Fifn_download_processing.R="63E4DE02"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F1.%20data_preparation%2FLAI%2Ffra_lai_nasa.R="41947961"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F1.%20data_preparation%2FLAI%2Finitial_graphs.R="4615F345"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F1.%20data_preparation%2FLAI%2Fsonohat_forrestser.R="2A0E9981"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F2.%20Landclim_setup%2FALIEN_growth_calibration_plot_setup.R="5D1FAE18"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F2.%20Landclim_setup%2FIFN_input_data_preparation.R="5BBC53B2"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F2.%20Landclim_setup%2FTG14_landclim_setup_individual_files.R="263C83B6"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F2.%20Landclim_setup%2FTG14_landclim_setup_individual_files_redo_landscape_DELETEME.R="FF638EBE"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F2.%20Landclim_setup%2FTG14_plot_setup_for_LC_growth_calibration_one_sp.R="75DBE281"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F2.%20Landclim_setup%2FlandclimSetup%2FR%2Fcreate_SED_files.R="B7B47E88"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F2.%20Landclim_setup%2FlandclimSetup%2FR%2Fmake_SED_landscape.R="70B8947A"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F3.%20calibration_validation%2FTG14%2FTG14_cal_server_WORKING.R="56434FBE"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F3.%20calibration_validation%2FTG14%2FTG14_two_spp_dummyData.Rmd="91ED7594"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F3.%20calibration_validation%2FTG14_calibration_fm_template_Landclim_testdata.R="6F241567"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F3.%20calibration_validation%2FrunMyModel%2FrunMyModel_SA.R="E0FF7FC5"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F7.%20blog_posts%2FALIEN%2F1.%20ALIEN_growth_calibration_single_spp_SUB_plot_setup_castsati.R="7000F4BC"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F8.%20r_packages%2FifnHelpers%2FR%2Ffrom_ecology_files.R="DAB73BDE"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F8.%20r_packages%2FlandclimSetup%2FR%2FIFN_forrester_foliage_pars.R="42170F6F"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F8.%20r_packages%2FlandclimSetup%2FR%2FSED_climate_from_dataframe.R="B8410670"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F8.%20r_packages%2FlandclimSetup%2FR%2FSED_climate_from_list.R="1D48DE86"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F8.%20r_packages%2FlandclimSetup%2FR%2Fadd_to_init_file.R="84F4D5AE"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F8.%20r_packages%2FlandclimSetup%2FR%2Fcheck_SED_files.R="86820CEB"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F8.%20r_packages%2FlandclimSetup%2FR%2Fcreate_IFN_species_pars.R="7F8B973E"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F8.%20r_packages%2FlandclimSetup%2FR%2Fcreate_SED_XML_input.R="FB701E3"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F8.%20r_packages%2FlandclimSetup%2FR%2Fcreate_SED_XML_species.R="5B7FA14B"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F8.%20r_packages%2FlandclimSetup%2FR%2Fcreate_SED_climate_file.R="B8D32014"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F8.%20r_packages%2FlandclimSetup%2FR%2Fcreate_SED_files.R="29E1E89D"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F8.%20r_packages%2FlandclimSetup%2FR%2Fcreate_SED_files_OLD.R="4624F475"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F8.%20r_packages%2FlandclimSetup%2FR%2Fcreate_SED_files_WORKING.R="64B3172B"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F8.%20r_packages%2FlandclimSetup%2FR%2Fcreate_SED_initialstate_file.R="60309688"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F8.%20r_packages%2FlandclimSetup%2FR%2Fcreate_SED_raster.R="C31AEAAC"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F8.%20r_packages%2FlandclimSetup%2FR%2Fcreate_SED_sim_file.R="FB687DA4"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F8.%20r_packages%2FlandclimSetup%2FR%2Fcreate_harvest_pars.R="80D84E87"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F8.%20r_packages%2FlandclimSetup%2FR%2Fcreate_tree_init_params.R="78236CEA"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F8.%20r_packages%2FlandclimSetup%2FR%2Fget_climate_fm_ISIMIP_stk.R="A3CA67C7"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F8.%20r_packages%2FlandclimSetup%2FR%2Fget_ifn_climate.R="D1EB3C1A"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F8.%20r_packages%2FlandclimSetup%2FR%2Fget_lapse_rates.R="46D31D8C"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F8.%20r_packages%2FlandclimSetup%2FR%2Flapse_adjust_climate.R="E3EB9D98"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F8.%20r_packages%2FlandclimSetup%2FR%2Fmake_SED_landscape.R="190FB9A9"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F8.%20r_packages%2FlandclimSetup%2FR%2Fmake_single_raster.R="1455FCE7"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F8.%20r_packages%2FlandclimSetup%2FR%2Fread_climate_file.R="201FDA59"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F8.%20r_packages%2FlandclimSetup%2FR%2Fsetup_init_file.R="9DDF48A7"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F8.%20r_packages%2FlandclimSetup%2FR%2Fwrite_SED_climate_data.R="927F4323"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F8.%20r_packages%2FlandclimSetup%2FR%2Fwrite_climate_file_NON_SED.R="9D03814A"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F8.%20r_packages%2FlandclimSetup%2FR%2Fwrite_latitude_to_climate_file.R="968CB9BC"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F8.%20r_packages%2FlandclimSetup%2FR%2Fwrite_species_xml.R="39EE21B0"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F9.%20r_packages%2FlandclimSetup%2FR%2FSED_climate_from_dataframe.R="76EC7219"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F9.%20r_packages%2FlandclimSetup%2FR%2Fcheck_SED_files.R="16D7366E"
%2Fmedia%2Faustin%2FDATADRIVE1%2Fgit_repos%2Fcode_working%2F9.%20r_packages%2FlandclimSetup%2FR%2Fcreate_simulation_file.R="CEB15CD5"
~%2FDesktop%2FSED_climate_from_list.R="822E9866"
~%2Fpartage%2Faustin.haffenden%2FPrivate%2Flandclim%2Flandclim_calibration%2FTG14_one_sp%2Fgraphs%2Fexploratory_one_sp.Rmd="DB1E88F7"
~%2Fpartage%2Faustin.haffenden%2FPrivate%2Flandclim%2Flandclim_calibration%2FTG14_one_sp%2Fgraphs%2Fgrowth_function_investigation.Rmd="716D1A70"
{
"collab_server" : "",
"contents" : "#' @title Script to create and check the Landclim SED climate files from a\n#' climate list\n#' @description This script takes a list of climate data frames with\n#' each element in the form:\n#' x (lon), y (lat), year, temperature (jan - dec),\n#' precipitiation (jan - dec) and creates the necessary spatially\n#' explicit data files (SED) for landclim\n#' @param\n#' @param\n#' @return NULL\n#' @keywords CoFoLaMo, Dischma, spin-up, climate\n#' @author Austin Haffenden\n#' @example /don't run {}\n#'\nSED_climate_from_list <- function(clim_list, \n latitude, \n ref_elev, \n file_prefix, \n clim_dir, \n start_file_number = 0) { # number you want the years to start at\n \n save_clim <- function(list_no, start_file_number){\n \n curr_clim <- clim_list[[list_no]]\n #print(curr_clim[1,])\n \n #curr_year <- unique(curr_clim$year)\n #lc_year <- curr_year - min_year + year_offset\n lc_year <- (list_no-1) + start_file_number\n # cat(\"list_no is: \", list_no, \"\\n\")\n # cat(\"start_file_number is: \", start_file_number, \"\\n\")\n # cat(\"lc_year is: \", lc_year, \"\\n\")\n # stop()\n\n curr_file <- file.path(clim_dir, paste0(paste(file_prefix, lc_year, sep = \"_\"), \".txt\"))\n cat(curr_file, \"\\n\")\n con <- file(curr_file, open = \"wt\")\n\n writeLines(\"#header\tinfo#\", con)\n writeLines(paste(latitude, \"#average latitude of the sites -\tused\tfor\tcacluating\tdrought\tindex\tin\tmodel\tbugmann#\"), con)\n writeLines(paste(ref_elev, \"#reference elevation#\"), con)\n writeLines(\"#\tmean\tmonthly\ttemperature\t?C\ttotal\tmonthly\tprecipitation\tmm\t#\", con)\n writeLines(\"#\tx y year jan\tfeb\tmarz\tapril\tmai\tjune\tjuly\taug\tsept\toct\tnov\tdec\tjan\tfeb\tmarz\tapril\tmai\tjune\tjuly\taug\tsept\toct\tnov\tdec\t#\", con)\n\n write.table(as.matrix(curr_clim),\n #file = file.path(clim_dir, paste0(paste(file_prefix, i-1, sep = \"_\"), \".txt\") ),\n file = con,\n row.names = FALSE, col.names = FALSE,\n append = TRUE)\n close(con)\n \n }\n \n # now just for test to call function\n # years <- unique(clim_list$year) \n # min_year <- min(years)\n \n #doParallel::registerDoParallel(cores = 3)\n #plyr::ddply(clim_list, ~ year, save_clim, min_year) \n #.parallel = TRUE)\n \n list_levels <- seq(1, length(clim_list), 1)\n \n # start_no <- start_file_number\n # return(start_no)\n lapply(list_levels, save_clim, start_file_number)\n \n return(1)\n}\n\n\n",
"created" : 1505899568092.000,
"dirty" : false,
"encoding" : "UTF-8",
"folds" : "",
"hash" : "721695189",
"id" : "2E825329",
"lastKnownWriteTime" : 1505908007,
"last_content_update" : 1505908007089,
"path" : "/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/SED_climate_from_list.R",
"project_path" : "R/SED_climate_from_list.R",
"properties" : {
},
"relative_order" : 2,
"source_on_save" : false,
"source_window" : "",
"type" : "r_source"
}
\ No newline at end of file
{
"collab_server" : "",
"contents" : "#' @title Script to create and check the Landclim SED climate files from a\n#' climate data frame\n#' @description This script takes a climate data frame in the form:\n#' x (lon), y (lat), year, temperature (jan - dec),\n#' precipitiation (jan - dec) and creates the necessary spatially\n#' explicit data files (SED) for landclim\n#' @param\n#' @param\n#' @return NULL\n#' @keywords CoFoLaMo, Dischma, spin-up, climate\n#' @author Austin Haffenden\n#' @example /don't run {}\n#'\nSED_climate_from_dataframe <- function(clim_file, \n latitude, \n ref_elev, \n file_prefix, \n clim_dir, \n year_offset = 0) { # number you want the years to start at\n \n save_clim <- function(curr_clim, min_year){\n \n curr_year <- unique(curr_clim$year)\n lc_year <- curr_year - min_year + year_offset\n \n curr_file <- file.path(clim_dir, paste0(paste(file_prefix, lc_year, sep = \"_\"), \".txt\"))\n cat(curr_file, \"\\n\")\n con <- file(curr_file, open = \"wt\")\n\n writeLines(\"#header\tinfo#\", con)\n writeLines(paste(latitude, \"#average latitude of the sites -\tused\tfor\tcacluating\tdrought\tindex\tin\tmodel\tbugmann#\"), con)\n writeLines(paste(ref_elev, \"#reference elevation#\"), con)\n writeLines(\"#\tmean\tmonthly\ttemperature\t?C\ttotal\tmonthly\tprecipitation\tmm\t#\", con)\n writeLines(\"#\tx y year jan\tfeb\tmarz\tapril\tmai\tjune\tjuly\taug\tsept\toct\tnov\tdec\tjan\tfeb\tmarz\tapril\tmai\tjune\tjuly\taug\tsept\toct\tnov\tdec\t#\", con)\n\n write.table(as.matrix(curr_clim),\n #file = file.path(clim_dir, paste0(paste(file_prefix, i-1, sep = \"_\"), \".txt\") ),\n file = con,\n row.names = FALSE, col.names = FALSE,\n append = TRUE)\n close(con)\n \n }\n \n # now just for test to call function\n years <- unique(clim_file$year) \n #return(years)\n min_year <- min(years)\n \n #doParallel::registerDoParallel(cores = 3)\n plyr::ddply(clim_file, ~ year, save_clim, min_year) \n #.parallel = TRUE)\n return(1)\n}\n\n\n",
"created" : 1505896091390.000,
"dirty" : false,
"encoding" : "UTF-8",
"folds" : "",
"hash" : "2803068391",
"id" : "3535A39A",
"lastKnownWriteTime" : 1505896402,
"last_content_update" : 1505896402138,
"path" : "/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/SED_climate_from_dataframe.R",
"project_path" : "R/SED_climate_from_dataframe.R",
"properties" : {
},
"relative_order" : 1,
"source_on_save" : false,
"source_window" : "",
"type" : "r_source"
}
\ No newline at end of file
{
"collab_server" : "",
"contents" : "#' @title Creates teh simulation file\n#' @description Requires a base_SED_ctl.xml file to be in the xml dir\n#' @param\n#' @param\n#' @return NULL\n#' @keywords CoFoLaMo, Dischma, spin-up, climate\n#' @author Austin Haffenden\n#' @example /don't run {}\n#'\ncreate_SED_sim_file <- function(sim_simulation_dir, \n sim_xml_dir,\n file_root) {\n \n dir.create(sim_simulation_dir)\n \n base_SED_ctl <- XML::xmlRoot(XML::xmlTreeParse(file.path(sim_xml_dir, \"base_SED_ctl.xml\")))\n \n XML::xmlValue(XML::xmlChildren(base_SED_ctl)[[\"climate\"]][[\"fileNameStructure\"]]) <- paste0(\"../climate/\", file_root, \"/\", file_root, \"_{year}.txt\")\n \n XML::xmlValue(XML::xmlChildren(base_SED_ctl)[[\"speciesAttributes\"]]) <- paste0(\"../xml_input/\", file_root, \"_species.xml\")\n XML::xmlValue(XML::xmlChildren(base_SED_ctl)[[\"treeInitState\"]]) <- paste0(\"../initialstate/\", file_root, \"_tree_init.csv\")\n \n XML::xmlValue(XML::xmlChildren(base_SED_ctl)[[\"landtypePars\"]]) <- paste0(\"../xml_input/landType_noregeneration.xml\")\n \n XML::xmlValue(XML::xmlChildren(base_SED_ctl)[[\"landMask\"]]) <- paste0(\"../landscape/\", file_root, \"/\",\"SED_landtype.asc\")\n XML::xmlValue(XML::xmlChildren(base_SED_ctl)[[\"soilDepth\"]]) <- paste0(\"../landscape/\", file_root, \"/\",\"SED_soildepth.asc\")\n XML::xmlValue(XML::xmlChildren(base_SED_ctl)[[\"slope\"]]) <- paste0(\"../landscape/\", file_root, \"/\",\"SED_slope.asc\")\n XML::xmlValue(XML::xmlChildren(base_SED_ctl)[[\"aspect\"]]) <- paste0(\"../landscape/\", file_root, \"/\",\"SED_aspect.asc\")\n XML::xmlValue(XML::xmlChildren(base_SED_ctl)[[\"elevation\"]]) <- paste0(\"../landscape/\", file_root, \"/\", \"SED_elevation.asc\")\n XML::xmlValue(XML::xmlChildren(base_SED_ctl)[[\"availableNitrogen\"]]) <- paste0(\"../landscape/\", file_root, \"/\",\"SED_nitrogen.asc\")\n XML::xmlValue(XML::xmlChildren(base_SED_ctl)[[\"landtype\"]]) <- paste0(\"../landscape/\", file_root, \"/\",\"SED_landtype.asc\")\n \n XML::xmlValue(XML::xmlChildren(base_SED_ctl)[[\"output\"]][[\"path\"]]) <- paste0(\"../output/\", file_root)\n XML::xmlValue(XML::xmlChildren(base_SED_ctl)[[\"iterations\"]]) <- 1\n XML::saveXML(base_SED_ctl, file = file.path(sim_simulation_dir, paste0(file_root, \"_ctl.xml\")))\n \n \n}",
"created" : 1506074458652.000,
"dirty" : false,
"encoding" : "UTF-8",
"folds" : "",
"hash" : "487048078",
"id" : "8D57EF8F",
"lastKnownWriteTime" : 1509026928,
"last_content_update" : 1509026928614,
"path" : "/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/create_SED_sim_file.R",
"project_path" : "R/create_SED_sim_file.R",
"properties" : {
"tempName" : "Untitled1"
},
"relative_order" : 3,
"source_on_save" : false,
"source_window" : "",
"type" : "r_source"
}
\ No newline at end of file
{"default_chunk_options":{"echo":true,"error":false},"working_dir":null}
\ No newline at end of file
"0","#detach(""package:landclimGrowth"", unload = TRUE) # during package building"
"0","library(landclimGrowth)"
"0","library(landclimCalibration)"
"0","library(rhelpers)"
"0","set_paths()"
"0","root_dir <- c(""/home/austin/partage/austin.haffenden/Private/landclim/landclim_calibration/TG14_one_sp"")"
/home/austin/Desktop/SED_climate_from_list.R="30D49998"
/media/austin/DATADRIVE1/git_repos/code_working/1. data_preparation/Claro/Claro_landscape_products.R="713372D"
/media/austin/DATADRIVE1/git_repos/code_working/1. data_preparation/IFN/ifn_download_processing.R="AF31BFBD"
/media/austin/DATADRIVE1/git_repos/code_working/1. data_preparation/LAI/fra_lai_nasa.R="B0522104"
/media/austin/DATADRIVE1/git_repos/code_working/1. data_preparation/LAI/initial_graphs.R="7CE87914"
/media/austin/DATADRIVE1/git_repos/code_working/1. data_preparation/LAI/sonohat_forrestser.R="45CEB67F"
/media/austin/DATADRIVE1/git_repos/code_working/2. Landclim_setup/IFN_input_data_preparation.R="DEABC03B"
/media/austin/DATADRIVE1/git_repos/code_working/2. Landclim_setup/TG14_plot_setup_for_LC_growth_calibration_one_sp.R="31D030E3"
/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/IFN_forrester_foliage_pars.R="5E56B539"
/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/SED_climate_from_dataframe.R="88830A42"
/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/SED_climate_from_list.R="AFCB20F3"
/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/add_to_init_file.R="1C6414CD"
/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/check_SED_files.R="D05132B"
/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/create_IFN_species_pars.R="30B99465"
/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/create_SED_XML_species.R="FAA88A7D"
/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/create_SED_climate_file.R="7602A2B8"
/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/create_SED_files.R="99D18415"
/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/create_SED_initialstate_file.R="A5788C35"
/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/create_SED_raster.R="3BE94EC9"
/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/create_SED_sim_file.R="7C055F16"
/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/create_harvest_pars.R="DA1A4702"
/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/create_tree_init_params.R="6D35DD5"
/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/get_climate_fm_ISIMIP_stk.R="F5D9B72F"
/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/get_ifn_climate.R="B548EF8E"
/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/get_lapse_rates.R="F8DD57BD"
/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/lapse_adjust_climate.R="A353D90C"
/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/make_SED_landscape.R="6557A8A4"
/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/make_single_raster.R="8062E5E"
/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/read_climate_file.R="72FE6BA8"
/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/setup_init_file.R="B29E3CF"
/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/write_SED_climate_data.R="EDDD9C97"
/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/write_climate_file_NON_SED.R="D3FE6318"
/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/write_latitude_to_climate_file.R="D882E799"
/media/austin/DATADRIVE1/git_repos/code_working/8. r_packages/landclimSetup/R/write_species_xml.R="5A4A084E"
Package: landclimSetup
Type: Package
Title: Takes prepared data files and formats them to meet landclim requirements
Version: 0.0.0.9000
Authors@R: c(
person("Austin", "Haffenden", email = "austin.haffenden@irstea.fr", role = "cre", "aut"))
Maintainer: <austin.haffenden@irstea.fr>
Description: More about what it does (maybe more than one line)
Use four spaces when indenting paragraphs within the Description.
License: GPL-3
Encoding: UTF-8
LazyData: true
Imports:
raster,
dplyr,
doParallel,
rts,
XML,
ifnHelpers
RoxygenNote: 5.0.1
Suggests: testthat
exportPattern("^[[:alpha:]]+")
# creates init file parameters for the species not represented by randomly selecting
# values from a species of the same leaf type
IFN_forrester_foliage_pars <- function(spp_name,
spp_leaf_type,
in_component = "Leaf area") {
curr_dat <- subset(for_pars, Component == in_component)
# cat("spp_name: ", spp_name, "\n")
# cat("spp_leaf_type: ", spp_leaf_type, "\n")
#
# forr_spp
forr_spp <- curr_dat$spp_id
# if we have the params for our species
if(spp_name %in% forr_spp) {
out_dat <- subset(curr_dat, spp_id == spp_name)[, c("B0", "B1")]
return(out_dat)
} else if(spp_leaf_type == "EVERGREEN") {
out_dat <- subset(curr_dat, spp_id == "conifer")[, c("B0", "B1")]
return(out_dat)
}else if(spp_leaf_type == "DECIDUOUS") {
out_dat <- subset(curr_dat, spp_id == "broad_leaf")[, c("B0", "B1")]
return(out_dat)
} else {
stop(paste0("Spp_name: ", spp_name, " and spp_leaf_type : ", spp_leaf_type, " unknown in landclimSetup::IFN_forrester_foliage_pars"))
}
}
\ No newline at end of file
#' @title Script to create and check the Landclim SED climate files from a
#' climate data frame
#' @description This script takes a climate data frame in the form:
#' x (lon), y (lat), year, temperature (jan - dec),
#' precipitiation (jan - dec) and creates the necessary spatially
#' explicit data files (SED) for landclim
#' @param
#' @param
#' @return NULL
#' @keywords CoFoLaMo, Dischma, spin-up, climate
#' @author Austin Haffenden
#' @example /don't run {}
#'
SED_climate_from_dataframe <- function(clim_file,
latitude,
ref_elev,
file_prefix,
clim_dir,
year_offset = 0) { # number you want the years to start at
save_clim <- function(curr_clim, min_year){
curr_year <- unique(curr_clim$year)
lc_year <- curr_year - min_year + year_offset
curr_file <- file.path(clim_dir, paste0(paste(file_prefix, lc_year, sep = "_"), ".txt"))
cat(curr_file, "\n")
con <- file(curr_file, open = "wt")
writeLines("#header info#", con)
writeLines(paste(latitude, "#average latitude of the sites - used for cacluating drought index in model bugmann#"), con)
writeLines(paste(ref_elev, "#reference elevation#"), con)
writeLines("# mean monthly temperature ?C total monthly precipitation mm #", con)
writeLines("# x y year jan feb marz april mai june july aug sept oct nov dec jan feb marz april mai june july aug sept oct nov dec #", con)
write.table(as.matrix(curr_clim),
#file = file.path(clim_dir, paste0(paste(file_prefix, i-1, sep = "_"), ".txt") ),
file = con,
row.names = FALSE, col.names = FALSE,
append = TRUE)
close(con)
}
# now just for test to call function
years <- unique(clim_file$year)
#return(years)
min_year <- min(years)
#doParallel::registerDoParallel(cores = 3)
plyr::ddply(clim_file, ~ year, save_clim, min_year)
#.parallel = TRUE)
return(1)
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment