Skip to content

Commit

Permalink
Update installation instructions (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
tcmetzger authored Mar 21, 2024
1 parent 75c717b commit bc198c5
Show file tree
Hide file tree
Showing 4 changed files with 174 additions and 13 deletions.
76 changes: 69 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,74 @@ Covering those functions is a future goal of this project.
The current code in this repo are early experiments with the goal of exploring details fo the Fortran works and testing different options for creating an interface with C.
Later on, we will use this knowledge to bind it with Python

### Usage
## Prerequisites

* Make sure you have all the sources:
pyRTE-RRTMGP is currently only tested on x86_64 architecture with Linux and MacOS. The package might also work with other architectures (such as Apple Silicone or Linux ARM), but this is not tested.

To build and install the package, you need the conda package manager. If you don't have conda installed, you can install it from [here](https://docs.conda.io/en/latest/miniconda.html).

The package source code is hosted [on GitHub](https://github.com/earth-system-radiation/pyRTE-RRTMGP) and uses git submodules to include the [RTE+RRTMGP Fortran software](https://earth-system-radiation.github.io/rte-rrtmgp/). The easiest way to install pyRTE-RRTMGP is to use `git`. You can install git from [here](https://git-scm.com/downloads).

### Installation with conda (recommended)

1. Clone the repository:

```bash
git clone [email protected]:earth-system-radiation/pyRTE-RRTMGP.git
```

or

```bash
git clone https://github.com/earth-system-radiation/pyRTE-RRTMGP.git
```

After cloning the repository, enter the repository directory:

```bash
cd pyRTE-RRTMGP
```

2. Update the submodules:

```bash
git submodule update --init --recursive
```

3. Make sure you have conda installed. If not, you can install it from [here](https://docs.conda.io/en/latest/miniconda.html).
To make sure your conda setup is working, run the command below:

```bash
conda --version
```

If this runs without errors, you are good to go.

4. Install the conda build requirements (if you haven't already):
```bash
conda install conda-build conda-verify
```
5. Build the conda package locally:
```bash
conda build conda.recipe
```
6. Install the package in your current conda environment:
```bash
conda install -c ${CONDA_PREFIX}/conda-bld/ pyrte
```
Note: This will install the package in your current conda environment. If you want to install the package in a different environment, activate your environment before running the `conda install` command above.
### Installation with pip
You also have the option to build and install the package with pip. However, this is not recommended as it requires you to have a working Fortran compiler and other prerequisites installed on your system.
To install with pip, you first need to clone the repo (``git clone [email protected]:earth-system-radiation/pyRTE-RRTMGP.git``) and update the submodules (``git submodule update --init --recursive``) as described in the conda installation instructions above.
``` bash
git submodule update --init --recursive
Expand Down Expand Up @@ -112,9 +177,6 @@ Once built, the module will be located in a folder called `pyrte`
## Pytest Setup Instructions
* Run `pip3 install pytest`

### Pytest Usage
* Run `cd test/`
* Create/update env (if you haven't already) by running `pip3 install -r requirements-test.txt`
* Go to the 'tests' folder: `cd tests/`
* Install the test prerequisites (if you haven't already) by running `pip3 install -r requirements-test.txt`
* Run `pytest`
12 changes: 7 additions & 5 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ in planetary atmospheres. RTE+RRTMGP is described in a
:maxdepth: 2
:caption: Contents:

user_guide/installation


Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
.. Indices and tables
.. ==================
.. * :ref:`genindex`
.. * :ref:`modindex`
.. * :ref:`search`
97 changes: 97 additions & 0 deletions docs/source/user_guide/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Installation and Setup

pyRTE-RRTMGP is currently in early stages of development and is not yet available on conda forge.

To install the package, you can clone the repository and build and install the conda package locally.

## Prerequisites

pyRTE-RRTMGP is currently only tested on x86_64 architecture with Linux and MacOS.
The package might also work with other architectures (such as Apple Silicone or Linux ARM), but this is not tested.

To build and install the package, you need the conda package manager. If you don't have conda installed, you can install it from [here](https://docs.conda.io/en/latest/miniconda.html).

The package source code is hosted [on GitHub](https://github.com/earth-system-radiation/pyRTE-RRTMGP) and uses git submodules to include the [RTE+RRTMGP Fortran software](https://earth-system-radiation.github.io/rte-rrtmgp/). The easiest way to install pyRTE-RRTMGP is to use `git`. You can install git from [here](https://git-scm.com/downloads).

## Installation with conda (recommended)

1. Clone the repository:

```bash
git clone [email protected]:earth-system-radiation/pyRTE-RRTMGP.git
```

or

```bash
git clone https://github.com/earth-system-radiation/pyRTE-RRTMGP.git
```

After cloning the repository, enter the repository directory:

```bash
cd pyRTE-RRTMGP
```

2. Update the submodules:

```bash
git submodule update --init --recursive
```

3. Make sure you have conda installed. If not, you can install it from [here](https://docs.conda.io/en/latest/miniconda.html).
To make sure your conda setup is working, run the command below:

```bash
conda --version
```

If this runs without errors, you are good to go.

4. Install the conda build requirements (if you haven't already):
```bash
conda install conda-build conda-verify
```
5. Build the conda package locally:
```bash
conda build conda.recipe
```
6. Install the package in your current conda environment:
```bash
conda install -c ${CONDA_PREFIX}/conda-bld/ pyrte
```
Note: This will install the package in your current conda environment. If you want to install the package in a different environment, activate your environment before running the `conda install` command above.
## Installation with pip
You also have the option to build and install the package with pip. However, this is not recommended as it requires you to have a working Fortran compiler and other prerequisites installed on your system.
To install with pip, you first need to clone the repo (``git clone [email protected]:earth-system-radiation/pyRTE-RRTMGP.git``) and update the submodules (``git submodule update --init --recursive``) as described in the conda installation instructions (above)[#installation-with-conda-recommended].
Then, make sure you have the necessary dependencies installed:
```bash
Then, make sure you have the necessary dependencies installed:
```bash
sudo apt install -y \
libnetcdff-dev \
gfortran-10 \
python3-dev \
cmake
```
Next, run pip to compile the Fortran code, build, and install the package:
``` bash
pip install -e .
```
Once built, the module will be located in a folder called `pyrte`.
2 changes: 1 addition & 1 deletion tests/requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
numpy>=1.21.1
pytest>=7.4.0
pytest>=7.4.0

0 comments on commit bc198c5

Please sign in to comment.