Skip to content

Commit

Permalink
Merge pull request #101 from rubisco-sfa/deps
Browse files Browse the repository at this point in the history
FIX: updates to deps and some cleanup
  • Loading branch information
nocollier authored Aug 28, 2024
2 parents c8eeb9c + f8f4a80 commit f3e38c1
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 94 deletions.
37 changes: 0 additions & 37 deletions .github/workflows/pypi.yaml

This file was deleted.

11 changes: 8 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,20 @@ steps:
versionSpec: "$(python.version)"
displayName: "Use Python $(python.version)"

- bash: echo "##vso[task.prependpath]$CONDA/bin"
displayName: Add conda to PATH

- script: conda env create --quiet --file ilamb.yml
displayName: Create conda environment

- script: |
sudo apt-get -y install libgeos-dev proj-bin libproj-dev libmpich-dev libhdf5-dev
python -m pip install --upgrade pip
python -m pip install shapely==1.8.5 requests
source activate ilamb
python -m pip install ./
python -c "import ILAMB; print('ILAMB v%s successfully installed' % (ILAMB.__version__))"
displayName: "Install ILAMB"
- script: |
source activate ilamb
cd test
export RDMAV_FORK_SAFE=1
export ILAMB_ROOT=./
Expand Down
9 changes: 5 additions & 4 deletions bin/ilamb-run
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ mpi4py.rc.threads = False
import logging

import yaml

from ILAMB.ModelResult import ModelResult

try:
Expand All @@ -33,12 +34,13 @@ import matplotlib.colors as clr
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from mpi4py import MPI
from netCDF4 import Dataset

from ILAMB import ilamblib as il
from ILAMB.Post import RegisterCustomColormaps
from ILAMB.Regions import Regions
from ILAMB.Scoreboard import Scoreboard
from mpi4py import MPI
from netCDF4 import Dataset

if "wetdry" not in plt.colormaps():
RegisterCustomColormaps()
Expand Down Expand Up @@ -956,8 +958,7 @@ if args.global_region:
# Setup study
T0 = time.time()
if rank == 0:
if not os.path.isdir(args.build_dir[0]):
os.makedirs(args.build_dir[0])
os.makedirs(args.build_dir[0], exist_ok=True)
if args.model_setup is None:
M = InitializeModels(
args.model_root[0],
Expand Down
23 changes: 0 additions & 23 deletions ilamb-sysmpi.yml

This file was deleted.

12 changes: 7 additions & 5 deletions ilamb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ channels:
- conda-forge
- defaults
dependencies:
- python=3
- python>=3.9
- numpy
- pandas
- matplotlib
- cartopy
- netCDF4
- cf-units
- sympy
- scipy
- mpi4py
- cf_units
- cython
- psutil
- scipy
- cftime
- tqdm
- pyarrow
- pyyaml
- requests
19 changes: 10 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,20 @@ def write_version_py(filename=os.path.join("src/ILAMB", "generated_version.py"))
scripts=["bin/ilamb-run", "bin/ilamb-fetch", "bin/ilamb-mean", "bin/ilamb-setup"],
zip_safe=False,
install_requires=[
"numpy<2",
"pandas>=1.0.0",
"matplotlib>=2.2",
"cartopy>=0.17.0",
"netCDF4>=1.1.4",
"cf_units>=2.0.0",
"sympy>=0.7.6",
"mpi4py>=1.3.1",
"scipy>=0.9.0",
"numpy",
"pandas",
"matplotlib",
"cartopy",
"netCDF4",
"cf-units",
"sympy",
"mpi4py",
"scipy",
"cftime",
"tqdm",
"pyarrow",
"pyyaml",
"requests",
],
extras_require={
"watershed": ["contextily", "geopandas", "dataretrieval", "pynhd"],
Expand Down
22 changes: 9 additions & 13 deletions test/score_diff.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
import numpy as np
import sys

import numpy as np
import pandas as pd

if len(sys.argv) != 3:
print("usage: python score_diff.py scores1.csv scores2.csv")
sys.exit(1)
gold = np.recfromcsv(sys.argv[1],encoding=None)
test = np.recfromcsv(sys.argv[2],encoding=None)
assert gold.dtype == test.dtype
ok = True
for model in gold.dtype.names[1:]:
if not np.allclose(test[model],gold[model]):
ok = False
diff = np.abs(test[model]-gold[model])/gold[model]
for i in range(diff.size):
if diff[i] > 1e-12:
print("%s | %s | %.6f%% " % (gold['variables'][i],model,diff[i]*100.))
if not ok:
gold = pd.read_csv(sys.argv[1]).set_index("Variables")
test = pd.read_csv(sys.argv[2]).set_index("Variables")
diff = np.abs(gold - test) / gold
if not (diff < 1e12).all()["LandTest"]:
print("Test failed")
print(diff[diff > 1e-12].dropna())
sys.exit(1)
print("Test passed")

0 comments on commit f3e38c1

Please sign in to comment.