Cell2Fire Installation Issues

This document provides a comprehensive guide on installing and setting up the Cell2Fire project from the repository at Cell2Fire GitHub. It also includes necessary changes made to the source code to resolve issues encountered during the setup.

1. Clone the Repository

First, clone the repository to your local machine:

git clone https://github.com/cell2fire/Cell2Fire.git
cd Cell2Fire
        

2. Set Up the Conda Environment

Create and activate a new Conda environment for the project:

conda create --name cell2fire python=3.11
conda activate cell2fire
        

3. Install Dependencies

Install the required dependencies listed in the requirements.txt file:

pip install -r requirements.txt
        

4. Install imread Library

4.1 Install Required Libraries

Ensure you have the necessary libraries installed:

brew install libjpeg libpng libtiff
        

4.2 Set Environment Variables

Set the environment variables so that the compiler can find the header files and libraries. Add the following lines to your ~/.zshrc file:

export LDFLAGS="-L/opt/homebrew/opt/jpeg/lib"
export CPPFLAGS="-I/opt/homebrew/opt/jpeg/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/jpeg/lib/pkgconfig"
export LDFLAGS="-L/opt/homebrew/opt/jpeg/lib -L/opt/homebrew/opt/libpng/lib"
export CPPFLAGS="-I/opt/homebrew/opt/jpeg/include -I/opt/homebrew/opt/libpng/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/jpeg/lib/pkgconfig:/opt/homebrew/opt/libpng/lib/pkgconfig"
export LDFLAGS="-L/opt/homebrew/opt/jpeg/lib -L/opt/homebrew/opt/libpng/lib -L/opt/homebrew/opt/libtiff/lib"
export CPPFLAGS="-I/opt/homebrew/opt/jpeg/include -I/opt/homebrew/opt/libpng/include -I/opt/homebrew/opt/libtiff/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/jpeg/lib/pkgconfig:/opt/homebrew/opt/libpng/lib/pkgconfig:/opt/homebrew/opt/libtiff/lib/pkgconfig"
        

After editing, source the .zshrc file to apply the changes:

source ~/.zshrc
        

4.3 Install imread

Finally, install the imread library:

pip install imread
        

5. Resolve Source Code Issues

5.1 Modify Stats.py

Problem: groupby tuple issue

Change the line 1208 from:

SummaryDF[["STDBurned", "STDHarvested"]] = Ah[["NonBurned", "Burned", "Harvested", "Hour"]].groupby('Hour')["Burned","Harvested"].std()[["Burned","Harvested"]]
        

To:

SummaryDF[["STDBurned", "STDHarvested"]] = Ah[["NonBurned", "Burned", "Harvested", "Hour"]].groupby('Hour')[["Burned", "Harvested"]].std()[["Burned", "Harvested"]]
        

Problem: figsize unexpected keyword argument

Change the lines that use plt.savefig with figsize argument (such as line 607):

plt.savefig(os.path.join(self._StatsFolder, "SpreadTree_FreqGraph_" + outname + ".png"), figsize=(10, 10))
        

To:

plt.savefig(os.path.join(self._StatsFolder, "SpreadTree_FreqGraph_" + outname + ".png"))
        

5.2 Install scipy

If scipy is not installed, install it using:

pip install scipy
        

5.3 Install pyxdg

Install pyxdg using:

pip install pyxdg
        

6. Run the Demo

To run a demo provided in the repository, use the following command:

python main.py --input-instance-folder ../data/Sub40x40/ --output-folder ../results/Sub40x40 --ignitions --sim-years 1 --nsims 5 --finalGrid --weather rows --nweathers 1 --Fire-Period-Length 1.0 --output-messages --ROS-CV 0.0 --seed 123 --stats --allPlots --IgnitionRad 5 --grids --combine
        

Summary

In this document, we covered: