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.
First, clone the repository to your local machine:
git clone https://github.com/cell2fire/Cell2Fire.git
cd Cell2Fire
Create and activate a new Conda environment for the project:
conda create --name cell2fire python=3.11
conda activate cell2fire
Install the required dependencies listed in the requirements.txt
file:
pip install -r requirements.txt
imread
LibraryEnsure you have the necessary libraries installed:
brew install libjpeg libpng libtiff
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
imread
Finally, install the imread
library:
pip install imread
Stats.py
groupby
tuple issueChange 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"]]
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"))
scipy
If scipy
is not installed, install it using:
pip install scipy
pyxdg
Install pyxdg
using:
pip install pyxdg
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
In this document, we covered:
imread
library with required environment variables.