forked from GlacioHack/xdem
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix sampling in
NuthKaab
and set better default values for other cl…
…asses (GlacioHack#439) * Use better default values and fix valid mask of Nuth and Kaab * Fix tests and lint * Fix values in example * Improve tests for subsampling in NuthKaab * Check with different rounding * Try to round c parameter as well * Check if the inconsistency is not arising because of SciPy * Like this? * COMME CA * Bon allez * Like this * Last try * Close to giving up * Next try * Next * Next * Try this * Like this? * ça va marcher oui * This * Like this * Change get yml script * Like this? * Again * Test CI like this * Test * Fix * Now? * Fix * Fixing version writing in env file * Add future annotations * Update python first * Try like this * Linting * Fix last tests * Linting * Unskip test
- Loading branch information
Showing
14 changed files
with
98 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
from __future__ import annotations | ||
|
||
import argparse | ||
|
||
import yaml # type: ignore | ||
|
||
|
||
def environment_yml_nopy(fn_env: str, py_version: str, add_deps: list[str] = None) -> None: | ||
""" | ||
Generate temporary environment-py3.XX.yml files forcing python versions for setup of continuous integration. | ||
:param fn_env: Filename path to environment.yml | ||
:param py_version: Python version to force. | ||
:param add_deps: Additional dependencies to solve for directly (for instance graphviz fails with mamba update). | ||
""" | ||
|
||
# Load the yml as dictionary | ||
yaml_env = yaml.safe_load(open(fn_env)) | ||
conda_dep_env = list(yaml_env["dependencies"]) | ||
|
||
# Force python version | ||
conda_dep_env_forced_py = ["python=" + py_version if "python" in dep else dep for dep in conda_dep_env] | ||
|
||
# Optionally, add other dependencies | ||
if add_deps is not None: | ||
conda_dep_env_forced_py.extend(add_deps) | ||
|
||
# Copy back to new yaml dict | ||
yaml_out = yaml_env.copy() | ||
yaml_out["dependencies"] = conda_dep_env_forced_py | ||
|
||
with open("environment-ci-py" + py_version + ".yml", "w") as outfile: | ||
yaml.dump(yaml_out, outfile, default_flow_style=False) | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser(description="Generate environment files for CI with fixed python versions.") | ||
parser.add_argument("fn_env", metavar="fn_env", type=str, help="Path to the generic environment file.") | ||
parser.add_argument( | ||
"--pyv", | ||
dest="py_version", | ||
default="3.9", | ||
type=str, | ||
help="List of Python versions to force.", | ||
) | ||
parser.add_argument( | ||
"--add", | ||
dest="add_deps", | ||
default=None, | ||
type=str, | ||
help="List of dependencies to add.", | ||
) | ||
args = parser.parse_args() | ||
environment_yml_nopy(fn_env=args.fn_env, py_version=args.py_version, add_deps=args.add_deps.split(",")) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ numpy | |
matplotlib | ||
pyproj>=3.4 | ||
rasterio>=1.3 | ||
scipy | ||
scipy<1.11.1 | ||
tqdm | ||
scikit-image | ||
scikit-gstat>=1.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters