User Customizations - HeritageNetwork/Regional_SDM GitHub Wiki

The following customizations are needed for running these SDM scripts on this project's server. They may also be useful for others:

  • Change a default setting in MikTex so that packages are installed automatically

    1. open MiKTeX console
    2. choose "Stay in User Mode"
    3. Choose settings, choose "Always install missing packages on-the-fly"
    4. Exit
  • Change the temp file location for RStudio because C: is too small

    1. create a file called .Renviron
    2. include in this file this line TMPDIR = "D:/R_tmp"
    3. Place this file in C:\Users\yournamehere\Documents (at the same level as the R folder)
  • Also set the raster temp file location and the CRAN snapshot date

    1. create a file called .Rprofile
    2. add these three lines
      dir.create("D:/R_tmp", showWarnings = F)
      options(rasterTmpDir="D:/R_tmp")
      
    3. Place this file in C:\Users\yournamehere\Documents (at the same level as the R folder)
  • Set PATH environments for MikTex and OSGeo4

    1. click search/magnifier in lower left corner
    2. type PATH in the window
    3. select "Edit Environment Variables for your account" (might have to click on gear to make it appear)
    4. in upper window, select the line with "Path" on the left, choose "Edit..."
    5. Add "C:\OSGeo4W64\bin" and "C:\Program Files\MiKTeX 2.9\miktex\bin\x64", separated by a semi-colon ";"
    6. OK, OK
    7. Close everything, log out of mobiprep, log back in.
  • Set a link to env vars so you don't have space-hogging duplicate copies in _data

    1. the full set of rasters (env vars) are stored here: G:\terrestrialEnvVars_30m_masked
    2. open a windows command windows (type cmd in search window)
    3. navigate to the raster folder in your repo (Regional_SDM\_data\env_vars\raster). Hint: typing drive-letter-plus-colon alone at the command line without "cd" (like this >f:) changes drives in this windows command prompt environment.
    4. create a hard link (junction) to the envvar folder, name it ras with the command
      • mklink /J ras G:\terrestrialEnvVars_30m_masked
    5. it should report "Junction created for ras <<==>> G:\terrestrialEnvVars_30m_masked"
    6. now in script 0_user_run_SDM.R, set loc_envVars = here("_data","env_vars","raster", "ras")
    7. (if, at some time you want to remove this link, use rmdir ras in cmd window. It won't delete the destination files, only the link)
  • Change the Windows %Temp% directory for ArcGIS to use (some tools may be ignoring geoprocessing environment settings)

    1. click the search magnifier lens in lower left corner and search for "path"
    2. choose "Edit Environment variables for your account" (note, do not choose "Edit the system environment variables" as this needs admin permissions)
    3. Look in the System Variables box at the bottom of the Environment Variables window. Scroll down to the TEMP and TMP variables are both set to "D:\Pro_GP_Scratch". If you can't modify these system vars, add these two variables (TMP and TEMP) to your user environment, and set as above.
  • Set up a connection to the Access tracking database in R (this is also documented at N:\tracking_database\how_to_connect_to_tracking_DB_inR.r)

    1. First, make sure you have the most recent version copied to N:/tracking_database and renamed to MoBI_Tracking_currentVersion.accdb
    2. Second, set up an ODBC connection. You only need to do this once, if you continue to connect to the db with the same name
      1. click magnifier (search) in lower left, type "ODBC" in search window, open "ODBC Data Sources (64 bit)"
      2. On User DSN tab, choose "Add", then choose "Microsoft Access Driver (.mdb,.accdb)", click on Finish
      3. In Data Source Name, put "mobi_spp_tracking", then select the DB using the Select button. "OK", then close out.
  • Set up git, as described here

    1. https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup mainly these two
      • git config --global user.name
      • git config --global user.email
⚠️ **GitHub.com Fallback** ⚠️