Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Loop3D/map2loop into fix/…
Browse files Browse the repository at this point in the history
…add_data_checks
  • Loading branch information
AngRodrigues committed Jan 13, 2025
2 parents 0a85eac + 924c2cf commit 9eb8fed
Show file tree
Hide file tree
Showing 18 changed files with 246 additions and 187 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
fail-fast: false
matrix:
os: ${{ fromJSON(vars.BUILD_OS)}}
python-version: ${{ fromJSON(vars.PYTHON_VERSIONS)}}
python-version: ${{ fromJSON(vars.PYTHON_VERSIONS) }}
steps:
- uses: conda-incubator/setup-miniconda@v3
with:
Expand All @@ -27,10 +27,14 @@ jobs:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
shell: bash -l {0}
run: |
conda config --env --add channels conda-forge
conda config --env --add channels loop3d
conda config --env --set channel_priority strict
conda install -c conda-forge conda-build scikit-build-core numpy anaconda-client conda-libmamba-solver -y
conda build -c conda-forge -c loop3d --output-folder conda conda --python ${{matrix.python-version}}reve
conda config --set solver libmamba
conda build --output-folder conda conda --python ${{matrix.python-version}}
anaconda upload --label main conda/*/*.tar.bz2
- name: upload artifacts
uses: actions/upload-artifact@v4
with:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/linting_and_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ jobs:
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "style: style fixes by ruff and autoformatting by black"



testing:
name: Testing
runs-on: ubuntu-24.04
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:

sdist:
name: Build sdist
runs-on: ubuntu-24.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand All @@ -23,7 +23,7 @@ jobs:

publish:
name: Publish wheels to pypi
runs-on: ubuntu-24.04
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "3.2.0"
".": "3.2.1"
}
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [3.2.1](https://github.com/Loop3D/map2loop/compare/v3.2.0...v3.2.1) (2025-01-12)


### Bug Fixes

* include dependencies in site-packages - issue [#169](https://github.com/Loop3D/map2loop/issues/169) ([#170](https://github.com/Loop3D/map2loop/issues/170)) ([b33532b](https://github.com/Loop3D/map2loop/commit/b33532b56473148433fd192e182aadee028dc875))

## [3.2.0](https://github.com/Loop3D/map2loop/compare/v3.1.13...v3.2.0) (2024-12-16)


Expand Down
7 changes: 1 addition & 6 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
include LICENSE
include README.md

include map2loop/_datasets/clut_files/*.csv
include map2loop/_datasets/config_files/*.json
include map2loop/_datasets/geodata_files/hamersley/*

recursive-include tests *.py
include map2loop/_datasets/geodata_files/hamersley/*
80 changes: 24 additions & 56 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,100 +1,70 @@
![GitHub Release](https://img.shields.io/github/v/release/loop3d/map2loop)
[![DOI](https://img.shields.io/static/v1?label=DOI&message=10.5194/gmd-14-5063-2021&color=blue)](https://doi.org/10.5194/gmd-14-5063-2021)
![License](https://img.shields.io/github/license/loop3d/map2loop)
![PyPI - Downloads](https://img.shields.io/pypi/dm/map2loop?label=pip%20downloads)
![Conda Downloads](https://img.shields.io/conda/dn/loop3d/map2loop?label=Conda%20downloads)
[![Testing](https://github.com/Loop3D/map2loop/actions/workflows/linting_and_testing.yml/badge.svg)](https://github.com/Loop3D/map2loop/actions/workflows/linting_and_testing.yml)
[![Build and Deploy Documentation](https://github.com/Loop3D/map2loop/actions/workflows/documentation.yml/badge.svg)](https://github.com/Loop3D/map2loop/actions/workflows/documentation.yml)

# Map2Loop 3.1

# Map2Loop 3.2

Generate 3D geological model inputs from geological maps — a high-level implementation and extension of the original map2loop code developed by Prof. Mark Jessell at UWA. To see an example interactive model built with map2loop and LoopStructural, follow this link:

<a href="http://tectonique.net/models/brockman_syncline.html">3D Model from the Hamersley region, Western Australia</a>

## Install

You will need some flavour of conda (a Python package manager, [see here](https://docs.anaconda.com/anaconda/install/index.html)), as well as Python ≥ 3.8.
#### Option 1: Install with Anaconda

### Adding ```conda-forge``` to Anaconda channels
map2loop installation may run smoother if ```conda-forge``` is added to the channels.
To check for that, run
This is the simplest and recommended installation process, with:

```bash
conda config --show channels
conda install -c loop3d -c conda-forge map2loop
```
if conda-forge is not in the output, the channel can be added with:

#### Option 2: Install with pip
Installation with pip will require that GDAL is installed on your system prior to map2loop installation.
This is because GDAL cannot be installed <a href='https://hackernoon.com/hn-images/1*m4cnTYJWM7Rmpsju8dSHmQ.jpeg'>via pip</a> (at least not with one line of code), and the GDAL installation process will vary depending on your OS.

For more information on installing gdal, see <a href="https://pypi.org/project/GDAL/">GDAL's Pypi</a> page.

Once GDAL is available on your system, map2loop can be installed with:
```bash
conda config --add channels conda-forge
pip install map2loop
```

### Run

To just use map2loop, issue the following. <sup>*</sup>
#### Option 3: From source

```bash
git clone https://github.com/Loop3D/map2loop.git

cd map2loop

conda install -c loop3d --file dependencies.txt
conda install gdal

conda install -c loop3d -c conda-forge --file dependencies.txt

pip install .
```

<p><sup>*</sup> We're actively working towards a better approach - stay tuned! </p>

### Documentation

If you can call it that, is available <a href="https://loop3d.org/map2loop/">here</a>

### Development

If you want to tinker yourself/contribute, clone the source code with

#### Option 4: From source & developer mode:
```bash
git clone https://github.com/Loop3D/map2loop.git
```

Or get the source + example notebooks with
cd map2loop

```bash
git clone https://github.com/Loop3D/map2loop.git
git clone https://github.com/Loop3D/map2loop-3-notebooks
```
conda install gdal

Navigate into map2loop, and issue the following to install map2loop and its dependencies. _Note_: The 'develop' flag makes your source changes take effect on saving, so you only need to run this once
conda install -c loop3d -c conda-forge --file dependencies.txt

```bash
conda install -c loop3d --file dependencies.txt
pip install -e .
```

## Building with Docker

Fair warning, we recommend conda to almost everyone. With great software development power comes great environment setup inconvenience. You'll need to download and install the [docker containerisation software](https://docs.docker.com/get-docker/), and the docker and docker-compose CLI.

### Development

1. Clone this repo and navigate inside as per above
2. Run the following and click on the Jupyter server forwarded link to access and edit the notebooks

```bash
docker-compose up --build
```

3. To hop into a bash shell in a running container, open a terminal and issue

```bash
docker ps
```
### Documentation

Find the container name or ID and then run
Map2loop's documentation is available <a href="https://loop3d.org/map2loop/">here</a>

```bash
docker exec -it <container_NAMEorID> bash
# Probably -> docker exec -it map2loop_dev_1 bash
```

## Usage

Expand All @@ -118,8 +88,6 @@ bbox_3d = {
}
```

![sa example](docs/Untitled.png?raw=true)

Then, specify: the state, directory for the output, the bounding box and projection from above - and hit go! That's it.

```python
Expand Down
5 changes: 5 additions & 0 deletions conda/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mkdir %SP_DIR%\map2loop
copy %RECIPE_DIR%\..\LICENSE %SP_DIR%\map2loop\
copy %RECIPE_DIR%\..\README.md %SP_DIR%\map2loop\
copy %RECIPE_DIR%\..\dependencies.txt %SP_DIR%\map2loop\
%PYTHON% -m pip install .
6 changes: 6 additions & 0 deletions conda/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
mkdir -p $SP_DIR/map2loop
cp $RECIPE_DIR/../dependencies.txt $SP_DIR/map2loop/
cp $RECIPE_DIR/../LICENSE $SP_DIR/map2loop/
cp $RECIPE_DIR/../README.md $SP_DIR/map2loop/
$PYTHON -m pip install .
85 changes: 0 additions & 85 deletions conda/conda-build.py

This file was deleted.

6 changes: 0 additions & 6 deletions conda/conda_build_config.yaml

This file was deleted.

12 changes: 5 additions & 7 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ package:
source:
git_url: https://github.com/Loop3D/map2loop


build:
number: 0
script: "{{ PYTHON }} -m pip install . --no-deps"

requirements:
host:
Expand All @@ -20,17 +18,17 @@ requirements:
run:
- loopprojectfile ==0.2.2
- gdal
- map2model
- beartype
- python
- numpy
- pandas
- scipy
- geopandas
- shapely
- tqdm
- networkx
- owslib

- map2model
- beartype
- pytest
- scikit-learn

about:
home: "https://github.com/Loop3D/map2loop"
Expand Down
1 change: 0 additions & 1 deletion dependencies.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

numpy
scipy
geopandas
Expand Down
5 changes: 3 additions & 2 deletions map2loop/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class DependencyChecker:

def __init__(self, package_name, dependency_file="dependencies.txt"):
self.package_name = package_name
self.dependency_file = pathlib.Path(__file__).parent.parent / dependency_file
self.dependency_file = pathlib.Path(__file__).parent / dependency_file
self.required_version = self.get_required_version()
self.installed_version = self.get_installed_version()

Expand Down Expand Up @@ -93,7 +93,7 @@ def check_version(self):


def check_all_dependencies(dependency_file="dependencies.txt"):
dependencies_path = pathlib.Path(__file__).parent.parent / dependency_file
dependencies_path = pathlib.Path(__file__).parent / dependency_file
try:
with dependencies_path.open("r") as file:
for line in file:
Expand All @@ -108,6 +108,7 @@ def check_all_dependencies(dependency_file="dependencies.txt"):

checker = DependencyChecker(package_name, dependency_file=dependency_file)
checker.check_version()

except FileNotFoundError:
warnings.warn(
f"{dependency_file} not found. No dependencies checked for map2loop.",
Expand Down
Loading

0 comments on commit 9eb8fed

Please sign in to comment.