Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Linux compatibility without breaking ARM macOS compatibility #369

Merged
38 changes: 38 additions & 0 deletions .github/workflows/environments.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Tests of conda environments on both Linux and Mac

on:
push:
branches:
- main
- develop
pull_request:

timtroendle marked this conversation as resolved.
Show resolved Hide resolved
jobs:
environments-are-installable:
timtroendle marked this conversation as resolved.
Show resolved Hide resolved
name: Environments are installable
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
env:
- ./envs/geo.yaml
- ./envs/default.yaml
- ./envs/geo.yaml
- ./envs/hydro.yaml
- ./envs/shell.yaml
- ./envs/test.yaml
- ./envs/vis.yaml
- ./requirements-docs.yaml
- ./requirements-test.yaml
- ./templates/environment.yaml
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: latest
- name: ${{ matrix.env }} env
run: conda env create -f ${{ matrix.env }} -n environment_test --dry-run
18 changes: 16 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* **ADD** ability to run on Apple silicon devices (#263).
* Updated geo packages from gdal 3.2 -> 3.3.
* **ADD** re-execution triggers based on config and env changes (#264).
* **ADD** continuous integration test of all conda environments on both ARM macOS and Linux (#369).

### Updated (models)

Expand All @@ -37,6 +38,19 @@

### Updated (workflow)

* **UPDATE** environments to fix issues on Linux and Macos-arm64:
timtroendle marked this conversation as resolved.
Show resolved Hide resolved
* libnetcdf=4.8.1
* netCDF4=1.6.2
* hdf5=1.12.2

* **UPDATE** geo, hydro, and test-eurocalliope environments to handle libnetcdf=4.8.1:
* gdal=3.6.2
* libgdal=3.6.2
* fiona=1.9.1
* rasterio=1.3.6
* geopandas=0.13.2
* shapely=1.8.5

* **UPDATE** YAML templates and parametrisation restructured:
* Parametrisation moved to eurocalliopelib.
* Rules to parametrise split into smaller technology-specific rules, to ensure inputs are directly relevant to the files being parametrised.
Expand All @@ -49,8 +63,8 @@
* **UPDATE** Snakemake to v8.10.7 (#330)
* Ensures that conda environment builds ignore default package specifications (#289).
* Fixes localrules through integration of new `localrule` directive (#368).

* **UPDATE** source of fraction of shared coast for offshore wind capacity factor distribution from a fixed shape download to an internal rule which can handle ad hoc shapes (partial #238).
* **UPDATE** dropped support for Intel macOS. The workflow may still run on Intel macOS, but we do not actively maintain support (#369).

### Fixed (models)

Expand All @@ -65,7 +79,7 @@
* **FIX** fixed optimisation tolerance of hydro power plants from xtol to xatol (#266).
* **FIX** source of Exclusive Economic Zones (EEZ) to use a cache on [zenodo](https://sandbox.zenodo.org/records/45135) so that we can keep using v11 (#332). FIXME: update to actual zenodo record before next Euro-Calliope release.
* **FIX** fixed rule `download_basins_database`, which previously failed on some linux and mac machines, by requiring a more recent curl in the environment `envs/shell.yaml` (#267).
* **FIX** pin `h5py`, `hdf5` and `libnetcdf` in all environments which rely on `xarray`, to prevent issues on linux-x86 (#357).
* **FIX** pin `hdf5` and `libnetcdf` in all environments which rely on `xarray`, to prevent issues on linux-x86 (#357, #369).
timtroendle marked this conversation as resolved.
Show resolved Hide resolved

## 1.1.0 (2021-12-22)

Expand Down
2 changes: 1 addition & 1 deletion docs/workflow/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The build process will require an internet connection, several gigabytes of avai
## Prepare

!!! Info
The workflow is developed on macOS, tested on macOS and Linux, but it cannot run natively on Windows.
The workflow is developed mostly on ARM macOS, tested on ARM macOS and Linux, but it cannot run natively on Windows.

1. Download your copy of the latest Euro-Calliope release: [![workflow DOI](https://img.shields.io/badge/workflow-10.5281/zenodo.3949793-blue)](https://doi.org/10.5281/zenodo.3949793) (or [clone any version from GitHub](https://github.com/calliope-project/euro-calliope)).

Expand Down
9 changes: 4 additions & 5 deletions envs/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@ dependencies:
- python=3.9
- ipython=7.21.0
- ipdb=0.13.13
- numpy=1.20.2
- numpy=1.20.3
- pandas=1.2.3
- xlrd=2.0.1
- openpyxl=3.0.7
- pycountry=18.12.8
- jinja2=2.11.3
- pip=21.0.1
- xarray=0.17.0
- netCDF4=1.5.6
- hdf5=1.10
- h5py=3.1.0
- libnetcdf=4.7
- netCDF4=1.6.2
- hdf5=1.12.2
- libnetcdf=4.8.1
- pip:
- -e ./lib
- styleframe==4.2
22 changes: 11 additions & 11 deletions envs/geo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ channels:
dependencies:
- python=3.9
- ipdb=0.13.13
- numpy=1.20.2
- numpy=1.20.3
- scipy=1.6.2
- pandas=1.2.3
- gdal=3.3.1
- libgdal=3.3.1
- fiona=1.8.20
- rasterio=1.2.6
- gdal=3.6.2
- libgdal=3.6.2
- fiona=1.9.1
- rasterio=1.3.6
- rasterstats=0.14.0
- geos=3.9.1
- geopandas=0.9.0
- netcdf4=1.5.6
- geos=3.11.1
- geopandas=0.13.2
- xarray=0.17.0
- netCDF4=1.6.2
- hdf5=1.12.2
- libnetcdf=4.8.1
- jinja2=2.11.3
- networkx=2.5
- pycountry=18.12.8
- pip=21.0.1
- hdf5=1.10
- h5py=3.1.0
- libnetcdf=4.7
- shapely=1.8.5
- pip:
- -e ./lib[geo]
21 changes: 11 additions & 10 deletions envs/hydro.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,24 @@ channels:
dependencies:
- python=3.9
- ipdb=0.13.13
- numpy=1.20.2
- numpy=1.20.3
- pandas=1.2.3
- gdal=3.3.1
- fiona=1.8.20
- rasterio=1.2.6
- geopandas=0.9.0
- netcdf4=1.5.6
- gdal=3.6.2
- libgdal=3.6.2
- fiona=1.9.1
- rasterio=1.3.6
- geopandas=0.13.2
- xarray=0.16.2
- netCDF4=1.6.2
- hdf5=1.12.2
- libnetcdf=4.8.1
- dask=2021.3.1
- bottleneck=1.3.2
- cdsapi=0.5.1
- pycountry=18.12.8
- atlite=0.2.1
- pip=21.0.1
- hdf5=1.10
- h5py=3.1.0
- libnetcdf=4.7
- scipy=1.9.1 # sub-dependency of atlite. Update when updating numpy.
- pip=21.0.1
- shapely=1.8.5
- pip:
- -e ./lib[geo]
6 changes: 3 additions & 3 deletions envs/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ dependencies:
- pytest-html=3.2.0
- calliope=0.6.10
- pyomo=6.4.1
- hdf5=1.10
- h5py=3.1.0
- libnetcdf=4.7
- netCDF4=1.6.2
- hdf5=1.12.2
- libnetcdf=4.8.1
3 changes: 2 additions & 1 deletion lib/eurocalliopelib/geo/spatiotemporal.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import geopandas as gpd
import numpy as np
import pandas as pd
import pyproj
import xarray as xr
from geopandas.tools import overlay
from shapely.geometry import Point
Expand Down Expand Up @@ -42,7 +43,7 @@ def area_weighted_time_series(shapes, spatiotemporal, gridcell_overlap_threshold
def assert_correct_form(shapes, spatiotemporal):
assert shapes.crs
assert "crs" in spatiotemporal.attrs
assert shapes.crs == gpd.tools.crs.CRS(spatiotemporal.attrs["crs"])
assert shapes.crs == pyproj.CRS(spatiotemporal.attrs["crs"])
assert "y" in spatiotemporal.dims, "Expect dimension 'y'"
assert "x" in spatiotemporal.dims, "Expect dimension 'x'"
assert "timestep" in spatiotemporal.dims, "Expect dimension 'timestep'"
Expand Down
19 changes: 11 additions & 8 deletions requirements-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,25 @@ channels:
- conda-forge
dependencies:
- python=3.8
- numpy=1.20.2
- numpy=1.20.3
- scipy=1.6.2
- pandas=1.2.3
- gdal=3.3.1
- libgdal=3.3.1
- fiona=1.8.20
- rasterio=1.2.6
- gdal=3.6.2
- libgdal=3.6.2
- fiona=1.9.1
- rasterio=1.3.6
- rasterstats=0.14.0
- geos=3.9.1
- geopandas=0.9.0
- geos=3.11.1
- geopandas=0.13.2
- jinja2=2.11.3
- netcdf4=1.5.6
- xarray=0.17.0
- netCDF4=1.6.2
- hdf5=1.12.2
- libnetcdf=4.8.1
- pycountry=18.12.8
- pytest=7.3.1
- pytest-html=3.2.0
- pip=21.0.1
- shapely=1.8.5
- pip:
- -e ./lib[geo]
2 changes: 1 addition & 1 deletion scripts/shapes/gadm.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def _in_study_area(feature):


def _all_parts_in_study_area(feature, study_area):
unit = _to_multi_polygon(feature["geometry"])
unit = _to_multi_polygon(shapely.geometry.shape(feature["geometry"]))
if not study_area.contains(unit):
print(f"Removing parts of {_feature_name(feature)} outside of study area.")
new_unit = shapely.geometry.MultiPolygon([
Expand Down
3 changes: 2 additions & 1 deletion scripts/shapes/nuts.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ def _fix_country_feature(feature):


def _all_parts_in_study_area_and_crs(feature, src_crs, dst_crs, study_area):
unit = _to_multi_polygon(feature["geometry"])
unit = _to_multi_polygon(shapely.geometry.shape(feature["geometry"]))

if not study_area.contains(unit):
print(
"Removing parts of {} outside of study area.".format(
Expand Down
3 changes: 3 additions & 0 deletions templates/environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ dependencies:
- numpy=1.23
- pandas=1.5
- xarray=2022.3
- netCDF4=1.6.2
- hdf5=1.12.2
- libnetcdf=4.8.1
- gurobi=9.5.1
- calliope=0.6.10
- pyomo=6.4.1
Loading