Skip to content

Commit

Permalink
17 pop merge resample (#30)
Browse files Browse the repository at this point in the history
* chore: added dev work from experiment/pop-exploration

* feat: added skeleton merge and resample functions

* feat: raster merge input file handling

* feat: working raster merge func

* feat: sorted tif files list to simplify QA

* feat: added merge unit test dev

* feat: added merge raster unit test

* feat: working resample function

* docs: added raises to  merge function docstring

* fix: correct fixture scope

* test: added raster resampling test

* fix: added geos install for catopy

* docs: added comment to geos install

* chore: deleted utils placeholder.py

* docs: added dependencies section; restructured set-up section

* chore: added seaborn to

* docs: corrected typo

* feat: added defense on missing tif post regex

* chore: reset area of interest

* feat: added dir creation if not already exists

* feat: added references to 2015 data sources
  • Loading branch information
ethan-moss authored Aug 1, 2023
1 parent c3125b0 commit d90381a
Show file tree
Hide file tree
Showing 7 changed files with 1,748 additions and 16 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ jobs:
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install geos # required for cartopy installation
uses: ConorMacBride/install-package@v1
with:
brew: geos
apt: libgeos-dev
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
48 changes: 33 additions & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,20 @@ Please read [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md) before contributing.

### Set-up

| Set-up expectations | |
Set-up expectations:

| | |
| --- | --- |
| Env manager: | conda |
| Os: | macOS |
| Package manager: | pip |

Install Dependencies:

0. There are a few dependencies that need to be installed in advance. See the [dependencies section](#markdown-header-dependencies) for specific instructions and then return here once they have been installed.

Package set-up and installation:

1. Setup a new conda env: `conda create -n r5py python=3.9.13`
2. Activate the environment: `conda activate r5py`
3. Launch terminal and change directory to wherever you keep your GitHub repos: `cd ~/Documents`
Expand All @@ -31,25 +39,35 @@ Please read [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md) before contributing.
7. Update pip: `pip install --upgrade pip`
8. Install r5py & other reqs: `pip install -r requirements.txt`

**Java Development Kit**
Openjdk 11 is recommended by r5py docs. [sdkman](https://sdkman.io/) is used here.
Set-up check:

9. Get sdkman: `curl -s "https://get.sdkman.io" | bash`
10. Follow instructions in terminal, you’ll be asked to: `source “<SOME_PATH>.sdkman/bin/sdkman-init.sh"`
This will add sdkman env variables to: `~/.bash_profile` and possibly `~/.zshrc` too.
11. To see versions available on your os: `sdk list java`
12. Install the required version using the `identifier` column, eg: `sdk install java 11.0.19-amzn`
13. Check this is the currenty used java version: `sdk current java`
10. Run set-up pytests: `pytest --runsetup`.
11. If everything is working as expected, you should see some Java flavoured warnings about `--illegal-access` that you can ignore. But importantly look out for the message: `r5py has created the expected database files.`
12. If you've made it this far, you've earned yourself a coffee.

> Note: for macOS on ARM architectures (M1/M2 machines), sdkman does not currently provide a suitable openjdk11 version. Instead you can follow this [blog post, which introduces Java version mangaement using `jEnv`](https://blog.bigoodyssey.com/how-to-manage-multiple-java-version-in-macos-e5421345f6d0), and install AdoptOpenJDK-11. You can then continue with the remainder of the steps below.
#### Dependencies

**Set-up check**
##### Geos

14. Now you should be able to run the check setup script, from terminal: `python3 src/utils/check-setup.py`
15. If everything is working as expected, you should see some Java flavoured warnings about `--illegal-access` that you can ignore. But importantly look out for the message: `r5py has created the expected database files.`
16. Run set-up pytests: `pytest --runsetup`.
17. If you've made it this far, you've earned yourself a coffee.
`geos` is a dependency of the python package `cartopy`, which is used here for building and visualising static maps. See [this cartopy installation guidance note](https://github.com/SciTools/cartopy/blob/main/INSTALL) for more details on the installation process.

For macOS, this is straight forward using `brew`:

```console
brew install geos
```

##### Java Development Kit
Java is required for handling the transport network routing. Openjdk 11 is recommended by r5py docs. [sdkman](https://sdkman.io/) is used here.

> Note: for macOS on ARM architectures (M1/M2 machines), sdkman does not currently provide a suitable openjdk11 version. Instead you can follow this [blog post, which introduces Java version mangaement using `jEnv`](https://blog.bigoodyssey.com/how-to-manage-multiple-java-version-in-macos-e5421345f6d0), and install AdoptOpenJDK-11.
1. Get sdkman: `curl -s "https://get.sdkman.io" | bash`
2. Follow instructions in terminal, you’ll be asked to: `source “<SOME_PATH>.sdkman/bin/sdkman-init.sh"`
This will add sdkman env variables to: `~/.bash_profile` and possibly `~/.zshrc` too.
3. To see versions available on your os: `sdk list java`
4. Install the required version using the `identifier` column, eg: `sdk install java 11.0.19-amzn`
5. Check this is the currenty used java version: `sdk current java`.

### Pre-commit

Expand Down
Loading

0 comments on commit d90381a

Please sign in to comment.