Package: pysyncrosim
pysyncrosimThe Python interface toSyncroSimInstallationpysyncrosimcan be installed using either thecondaorpippackage managers.condais a general package manager capable of installing packages from many sources, butpipis strictly a Python package manager. While the installation instructions below are based on a Windows 10 operating system, similar steps can be used to installpysyncrosimfor Linux.Before beginning the installation ofpysyncrosim, make sure you have the latest release ofSyncroSiminstalled.Dependenciespysyncrosimwas tested and developed usingPython 3.8andSyncroSim 2.3.10. Becausepysyncrosimusesrasteriofor integrating spatial data, it also requires a C library dependency: GDAL >=2.3.python>=3.8

pandas=1.3.2

numpy=1.21.2

rasterio>=1.2.6UsingcondaFollow these steps to get started withcondaand usecondato installpysyncrosim.Installcondausing the Miniconda or Anaconda installer (in this tutorial we use Miniconda). To install Miniconda, followthis linkand under theLatest Miniconda Installer Links, download Miniconda for your operating system. Open the Miniconda installer and follow the default steps to installconda. For more information, see theconda documentation.To useconda, open the command prompt that was installed with the Miniconda installer. To find this prompt, type "anaconda prompt" in theWindows Search Bar. You should see an option appear calledAnaconda Prompt (miniconda3). Select this option to open a command line window. All code in the next steps will be typed in this window.You can either installpysyncrosimand its dependencies into your base environment, or set up a newcondaenvironment (recommended). Run the code below to set up and activate a newcondaenvironment called "myenv" that uses Python 3.8.# Create new conda environment
conda create -n myenv python=3.8

# Activate environment
conda activate myenvYou should now see that "(base)" has been replaced with "(myenv)" at the beginning of each prompt.Set the package channel forconda. To be able to install the dependencies forpysyncrosim, you need to access theconda-forgepackage channel. To configure this channel, run the following code in the Anaconda Prompt.# Set conda-forge package channel
conda config --add channels conda-forgeInstallpysyncrosimusingconda install. Installingpysyncrosimwill also install its dependencies:pandas,numpy, andrasterio.# Install pysyncrosim
conda install pysyncrosimpysyncrosimshould now be installed and ready to use!UsingpipUsepipto installpysyncrosimto your default python installation. You can install Python fromhttps://www.python.org/downloads/. You can also find information on how to installpipfrom thepip documentation.Installpysyncrosimusingpip install. Installingpysyncrosimwill also install its dependencies:pandas,numpy, andrasterio.# Make sure you are using the latest version of pip
pip install --upgrade pip

# Install pysyncrosim
pip install pysyncrosimUsageGetting StartedFor a basic usage example with thehelloworldSpatialpackage, see thespatial_demo.pyandinput-raster.tifin theexamplesfolder. To download the spatial_demo.py file, view the file on GitHub and selectRaw. From the raw view, right-click and selectSave As.... To run the spatial demo, you will also need to install thematplotlibPython package. You can install this package using the following code.# Install matplotlib
conda install matplotlibRunning pysyncrosim in SpyderIf usingconda, thespyderIDE is easy to install and straightforward to use.First, installspydereither in your base environment or in yourcondaenvironment using the following code.# Install spyder
conda install spyderOpen the IDE by typingspyderin the command prompt.# Open spyder
spyderNote: you may get a pop-up saying you have a missing dependency,rtree. You can safely ignore this warning.Within the IDE, change the working directory to the directory containing yourpysyncrosimscripts (e.g.spatial_demo.pyandinput-raster.tif)Open and run yourpysyncrosimscripts from the left-hand window. You can run scripts line-by-line inspyderby selecting the line(s) you want to run and pressing F9.SyncroSim Package DevelopmentIf you wish to design SyncroSim packages using python andpysyncrosim, you can follow theCreating a PackageandEnhancing a Packagetutorials on theSyncroSim documentation website. Note thatSyncroSim v2.3.10is required to develop python-based SyncroSim packages.