Installation
Python Environment Preparation
TopoPyScale is tested for Python 3.13. You may create a new virtual environment using conda prior to installation.
Option 1 (recommended):
conda create -n downscaling python=3.13 ipython
conda activate downscaling
# Recomended way to install dependencies:
conda install -c conda-forge xarray matplotlib scikit-learn pandas numpy netcdf4 h5netcdf rasterio pyproj dask geopandas
# install forked version of Topocalc compatible with Python >3.9 (tested with 3.13)
pip install git+https://github.com/ArcticSnow/topocalc
Latest Release Installation
TopoPyScale has been tested on the OS: - [x] Linux Ubuntu - [x] MacOS - [ ] Windows
Installing CDO
TopoPyScale uses CDO to merge daily netcdf into yearly files. To install CDO, make sure to no install the version 2.5 which has an issue. Either pick an earlier version or >2.5.
Installation and documentatino avaialble on the website of the Max Planck Institute
Setting up cdsapi
CDS is the Copernicus portal from which TopoPyScale will download the ERA5 data. Accessing these data is free but requires some additional setup. You need to setup your cdsapi with the Copernicus API key system. Follow this tutorial after creating an account with Copernicus. On Linux, create a file nano ~/.cdsapirc with inside:
Setting up Google Cloud authentification
In order to use the routine to download ERA5 data from the Google Cloud Storage, you will need to setup your system with the google-cloud-cli. Follow Google's instructions: https://cloud.google.com/sdk/docs/install
Development version Installation
Go to Development page
Step 1. Clone the repository
Clone the GitHub repo:
Step 2. Install it in editable/development mode
This lets you modify the source code and have changes take effect immediately:
The -e flag means editable — for development work.
Step 3. Verify your setup
Check that Python is using your local copy:
You should see something like:
Install Pvlib with SPA C-implementation
By default, TopoPyScale uses the Python Numpy implementatino of Pvlib to compute solar position. The Pvlib library offers multiple method to compute the solar position, with one using a C-implementation. Because of licensing, the C files are not distributed within the Pvlib library. This requries a special manipulation to execute:
- Clone the Pvlib repository from github:
git clone git@github.com:pvlib/pvlib-python.git - uninstall the pvlib library previously installed:
pip uninstall pvlib - Go download the
spa.candspa.hfrom https://midcdmz.nrel.gov/spa/#register - Place the files into the folder:
pvlib-python/pvlib/spa_c_files/ - then :
Install FSM2oshd
TopoPyScale incorporates an export option for the snow-canopy model FSM2oshd. This function requires elements that are outside the current scope of TopoPyScale. Missing elements are all the forest structural parameters that require the model CANRAD as well as a number of additional external dataset about forest properties. Nevertheless, the installation of FSM2oshd is as follow: