Skip to content

Commit

Permalink
Move to python 3.10 in CI and remove python 3.7 (#279)
Browse files Browse the repository at this point in the history
* fix deramp residual and optimizer

* Remove python 3.7 and add python 3.10 in CI and dependencies

* Add python 3.10 and remove python 3.7

* Initialize nan arrays with np.full to avoid RuntimeError

* Correct np.empty into np.full

* Remove the dem dtype in np.full as terrain attribute output can be a different type of numerical
  • Loading branch information
rhugonnet committed Aug 9, 2022
1 parent 649fdd8 commit 2d82903
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
matrix:
os: ["ubuntu-latest"]
python-version: ["3.7", "3.8", "3.9"]
python-version: ["3.8", "3.9", "3.10"]


# Run all shells using bash (including Windows)
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sphinx:
formats: []

python:
version: 3.7
version: 3.8
install:
- requirements: dev-requirements.txt
- method: pip
Expand Down
2 changes: 1 addition & 1 deletion dev-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: xdem-dev
channels:
- conda-forge
dependencies:
- python>=3.7
- python>=3.8
- proj>=7.2
- fiona
- shapely
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: xdem
channels:
- conda-forge
dependencies:
- python>=3.7
- python>=3.8
- proj>=7.2
- fiona
- shapely
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"opencv": ["opencv"],
"pytransform3d": ["pytransform3d"],
},
python_requires=">=3.7",
python_requires=">=3.8",
scripts=[],
zip_safe=False,
)
Expand Down
4 changes: 2 additions & 2 deletions xdem/terrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def _get_quadric_coefficients(
L = resolution

# Allocate the output.
output = np.empty((12,) + dem.shape, dtype=dem.dtype) + np.nan
output = np.full((12,) + dem.shape, fill_value=np.nan)

# Convert the string to a number (fewer bytes to compare each iteration)
if fill_method == "median":
Expand Down Expand Up @@ -337,7 +337,7 @@ def _get_windowed_indexes(
"""

# Allocate the outputs.
output = np.empty((5,) + dem.shape, dtype=dem.dtype) + np.nan
output = np.full((5,) + dem.shape, fill_value=np.nan)

# Half window size
hw = int(np.floor(window_size / 2))
Expand Down
6 changes: 3 additions & 3 deletions xdem/volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def hypsometric_binning(ddem: np.ndarray, ref_dem: np.ndarray, bins: Union[float
# Calculate statistics for each bin.
# If no values exist, all stats should be nans (except count with should be 0)
# medians, means, stds, nmads = (np.zeros(shape=bins.shape[0] - 1, dtype=ddem.dtype) * np.nan, ) * 4
values = np.zeros(shape=zbins.shape[0] - 1, dtype=ddem.dtype) * np.nan
values = np.full(shape=zbins.shape[0] - 1, fill_value=np.nan, dtype=ddem.dtype)
counts = np.zeros_like(values, dtype=int)
for i in np.arange(indices.min(), indices.max() + 1):
values_in_bin = ddem[indices == i]
Expand Down Expand Up @@ -549,8 +549,8 @@ def get_regional_hypsometric_signal(ddem: Union[np.ndarray, np.ma.masked_array],
unique_indices = np.unique(glacier_index_map)

# Create empty (ddem) value and (pixel) count arrays which will be filled iteratively.
values = np.empty((n_bins, unique_indices.shape[0]), dtype=float) * np.nan
counts = np.empty((n_bins, unique_indices.shape[0]), dtype=float) * np.nan
values = np.full((n_bins, unique_indices.shape[0]), fill_value=np.nan, dtype=float)
counts = np.full((n_bins, unique_indices.shape[0]), fill_value=np.nan, dtype=float)

# Start a counter of glaciers that are actually processed.
count = 0
Expand Down

0 comments on commit 2d82903

Please sign in to comment.