-
Notifications
You must be signed in to change notification settings - Fork 14
3. The Castor GitHub Directory
Castor is not a self-contained piece of software with a sophisticated graphical user interface. Thus, at the outset, it can appear complex to new users. Here we provide an overview of the Castor program 'structure' to simplify navigation of the program code.
The Castor code structure is complex, as it contains a lot of analysis code that are peripheral to running the Castor model. However, to most users, much of this code can be ignored, unless you are interested in understanding some of the more detailed analyses completed to parameterize the Castor model.
All of the programming code needed to run Castor is available on GitHub, an internet repository for developing software code. To run the Castor code on a local computer, you will need to clone the repository code to that computer. Once you have downloaded the code (called a pull), you can make changes to it on your local version, track and save these changes using Git version control software (called a commit), and then, if necessary, upload (called a push) the code back to the GitHub repository. The technology is designed to support version control and collaborative programming, and may take some time for new users to get used to. For more details on how to use this technology, see our Quick Start tutorial.
Below we provide a table of contents with links to the GitHub code to help you navigate the Castor program. If you navigate to the Castor GitHub repository, you will see a typical folder directory in the "Code" tab, including the following folders:
Note that if you clone the repository, you will see the same folder directory structure in the folder where you cloned the GitHub to your local computer.
You will notice that most these folders are named after a type of programming language (Java, Python, R, SQL). Thus, the overarching hierarchy of the Castor program is organized by programming language.
Within Castor we use Java code to create homogeneous harvest blocks from the forest inventory data. Currently, it's the only part of the Castor program that uses Java programming language. We used it here because of Java's flexibility in creating object classes; R is more limited in it's ability to create unique object types.
This piece of code gets used with the blockingCastor SpaDES module of Castor.
This folder contains some scripts that use Python language for processing large spatial datasets (e.g., the forest inventory). Python code is currently not used within the Castor program directly, but may be a useful reference if working with spatial datasets.
This folder contains SQL scripts for creating or manipulating PostgreSQL data. Similar to the Python scripts, they are not directly used by the Castor program. However, these scripts may be useful when needing to develop new data to be used within Castor.
The bulk of the scripts needed to run the Castor program are located in the R folder. If you open that folder you get the following folder directory:
- .Require
- Params
- SpaDES-modules
- TSR
- apps
- caribou_habitat
- caribou_protected_area
- climate
- digital_elevation_model
- fire
- functions
- moose
- range_scale_habitat_analysis
- roads
- wolves
However, again here there are many folders that are peripheral to the Castor program itself.
The TSR folder contains some scripts for downloading and manipulating climate data, calculating trend in forest harvest, and calculating the area of timber harvest land base in caribou ranges. The caribou_habitat and range_scale_habitat_analysis folders contain scripts that document in detail the development of a caribou habitat model using a resource selection function approach. The caribou_protected_area contains scripts for identifying protected areas for caribou. The climate folder contains some scripts for testing the relationship between spatial climate variable estimates and caribou locations. The digital_elevation_model folder contains a script for downloading and aggregating this data from the provincial dataset. The fire folder contains scripts for calculating and summarizing the amount of area burned in caribou areas. The moose folder contains scripts for relating moose density to habitat measures. The roads folder contains scripts for manipulating and creating large scale spatial roads datasets. The wolves folder contains scripts of existing models to estimate wolf density from ungulate density. These folders are not described in more detail here, as they are peripheral to running the Castor model. However, there may be elements of these scripts useful for future analyses, or that could be referred to in more detail for understanding how some aspects of the Castor model were parameterized.
The apps folder contains scripts for ShinyR web applications. Most of these are not related to Castor (i.e., CaribouBC, WildLift, and gar_assessment), and thus not discussed in detail. However, the web applications related to Castor are the Castor explorer and Castor scenario applications. These web applications are documented in more detail here.
The key folders for running the Castor model are SpaDES-modules, Params and functions. We will discuss these folders in more detail in the next section.
The documentation folder contains RMarkdown scripts that describe various aspects of Castor. Much of the documentation has been or currently is being moved to this wiki. However, importantly, it contains a Quick Start Tutorial for new users to get up and running with a Castor model.
The reports folder contains several sub-folders with RMarkdown documents that document some aspects of the Castor model. It contains the following sub-folders:
The caribou_rsf folder documents the caribou habitat model used in the rsfCastor module of Castor. Specifically, the 12_RSF_version4.Rmd file describes the habitat model used in Castor.
The harvest folder documents the process for developing harvest blocks in the blockingCastor module.
The postgresql folder contains documentation for many of the SQL functions used to run Castor (i.e., functions located here). The FAIB_PostGIS_Raster_Function_Documentation file provides a detailed description of these functions.
The roads folder contains documentation for how roads are simulated in the roadCastor module. The draft-Castor-roads file describes each of the road simulation approaches.