Skip to content

Commit

Permalink
Revert "Previous pull merge timeout. Fixing it."
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyangkang committed May 12, 2024
1 parent 0d172ab commit af69666
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 38 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/run_pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
pytesting:
runs-on: ubuntu-latest
strategy:
fail-fast: true
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
Expand All @@ -33,8 +33,7 @@ jobs:
- name: Run pytest
run: |
pytest -n auto --cov --no-cov-on-fail --cov-report=term-missing:skip-covered --cov-report xml:coverage.xml
timeout-minutes: 300 # Set the timeout to 1.5 hours for this step
pytest -n 2 --cov --no-cov-on-fail --cov-report=term-missing:skip-covered --cov-report xml:coverage.xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
Expand Down
2 changes: 1 addition & 1 deletion stemflow/utils/sphere_quadtree.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def get_one_ensemble_sphere_quadtree(
for time_block_index, bin_ in enumerate(temporal_bins):
time_start = bin_[0]
time_end = bin_[1]
sub_data = data[(data[Temporal1] >= time_start) & (data[Temporal1] < time_end)].copy()
sub_data = data[(data[Temporal1] >= time_start) & (data[Temporal1] < time_end)]
if len(sub_data) == 0:
continue

Expand Down
12 changes: 6 additions & 6 deletions stemflow/utils/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,17 +173,17 @@ def check_spatial_scale(x_min, x_max, y_min, y_max, grid_length_upper, grid_leng
warnings.warn(
"The grid_len_upper_threshold is significantly smaller than the scale of longitude and latitude (x and y). Be sure if this is desired."
)
if (grid_length_upper >= (x_max - x_min)) or (grid_length_upper >= (y_max - y_min)):
if (grid_length_upper >= (x_max - x_min) * 100) or (grid_length_upper >= (y_max - y_min) * 100):
warnings.warn(
"The grid_len_upper_threshold is larger than the scale of longitude and latitude (x and y). Be sure if this is desired."
"The grid_len_upper_threshold is significantly larger than the scale of longitude and latitude (x and y). Be sure if this is desired."
)
if (grid_length_lower <= (x_max - x_min) / 100) or (grid_length_lower <= (y_max - y_min) / 100):
warnings.warn(
"The grid_len_lower_threshold is significantly smaller than the scale of longitude and latitude (x and y). Be sure if this is desired."
)
if (grid_length_lower >= (x_max - x_min)) or (grid_length_lower >= (y_max - y_min)):
if (grid_length_lower >= (x_max - x_min) * 100) or (grid_length_lower >= (y_max - y_min) * 100):
warnings.warn(
"The grid_len_lower_threshold is larger than the scale of longitude and latitude (x and y). Be sure if this is desired."
"The grid_len_lower_threshold is significantly larger than the scale of longitude and latitude (x and y). Be sure if this is desired."
)


Expand All @@ -192,7 +192,7 @@ def check_temporal_scale(t_min, t_max, temporal_bin_interval):
warnings.warn(
"The temporal_bin_interval is significantly smaller than the scale of temporal parameters in provided data. Be sure if this is desired."
)
if temporal_bin_interval >= t_max - t_min:
if temporal_bin_interval >= (t_max - t_min) * 100:
warnings.warn(
"The temporal_bin_interval is larger than the scale of temporal parameters in provided data. Be sure if this is desired."
"The temporal_bin_interval is significantly larger than the scale of temporal parameters in provided data. Be sure if this is desired."
)
52 changes: 26 additions & 26 deletions tests/make_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ def make_STEMClassifier(fold_=2, min_req=1, ensemble_models_disk_saver=False, en
grid_len=30,
temporal_start=1,
temporal_end=366,
temporal_step=40,
temporal_bin_interval=80,
temporal_step=30,
temporal_bin_interval=60,
points_lower_threshold=30,
Spatio1="longitude",
Spatio2="latitude",
Expand All @@ -60,8 +60,8 @@ def make_parallel_STEMClassifier(
grid_len=30,
temporal_start=1,
temporal_end=366,
temporal_step=40,
temporal_bin_interval=80,
temporal_step=30,
temporal_bin_interval=60,
points_lower_threshold=30,
Spatio1="longitude",
Spatio2="latitude",
Expand Down Expand Up @@ -89,8 +89,8 @@ def make_STEMRegressor(fold_=2, min_req=1, ensemble_models_disk_saver=False, ens
grid_len=30,
temporal_start=1,
temporal_end=366,
temporal_step=40,
temporal_bin_interval=80,
temporal_step=30,
temporal_bin_interval=60,
points_lower_threshold=30,
Spatio1="longitude",
Spatio2="latitude",
Expand All @@ -112,12 +112,12 @@ def make_AdaSTEMClassifier(fold_=2, min_req=1, ensemble_models_disk_saver=False,
save_gridding_plot=True,
ensemble_fold=fold_,
min_ensemble_required=min_req,
grid_len_upper_threshold=50,
grid_len_lower_threshold=20,
grid_len_upper_threshold=40,
grid_len_lower_threshold=5,
temporal_start=1,
temporal_end=366,
temporal_step=40,
temporal_bin_interval=80,
temporal_step=30,
temporal_bin_interval=60,
points_lower_threshold=30,
Spatio1="longitude",
Spatio2="latitude",
Expand All @@ -141,12 +141,12 @@ def make_AdaSTEMRegressor(fold_=2, min_req=1, ensemble_models_disk_saver=False,
save_gridding_plot=True,
ensemble_fold=fold_,
min_ensemble_required=min_req,
grid_len_upper_threshold=50,
grid_len_lower_threshold=20,
grid_len_upper_threshold=40,
grid_len_lower_threshold=5,
temporal_start=1,
temporal_end=366,
temporal_step=40,
temporal_bin_interval=80,
temporal_step=30,
temporal_bin_interval=60,
points_lower_threshold=30,
Spatio1="longitude",
Spatio2="latitude",
Expand All @@ -172,12 +172,12 @@ def make_SphereAdaSTEMRegressor(
save_gridding_plot=True,
ensemble_fold=fold_,
min_ensemble_required=min_req,
grid_len_upper_threshold=8000,
grid_len_lower_threshold=500,
grid_len_upper_threshold=5000,
grid_len_lower_threshold=100,
temporal_start=1,
temporal_end=366,
temporal_step=40,
temporal_bin_interval=80,
temporal_step=30,
temporal_bin_interval=60,
points_lower_threshold=30,
Spatio1="longitude",
Spatio2="latitude",
Expand All @@ -198,12 +198,12 @@ def make_SphereAdaClassifier(fold_=2, min_req=1, ensemble_models_disk_saver=Fals
save_gridding_plot=True,
ensemble_fold=fold_,
min_ensemble_required=min_req,
grid_len_upper_threshold=8000,
grid_len_lower_threshold=500,
grid_len_upper_threshold=5000,
grid_len_lower_threshold=100,
temporal_start=1,
temporal_end=366,
temporal_step=40,
temporal_bin_interval=80,
temporal_step=30,
temporal_bin_interval=60,
points_lower_threshold=30,
Spatio1="longitude",
Spatio2="latitude",
Expand All @@ -226,12 +226,12 @@ def make_parallel_SphereAdaClassifier(
save_gridding_plot=True,
ensemble_fold=fold_,
min_ensemble_required=min_req,
grid_len_upper_threshold=8000,
grid_len_lower_threshold=500,
grid_len_upper_threshold=5000,
grid_len_lower_threshold=100,
temporal_start=1,
temporal_end=366,
temporal_step=40,
temporal_bin_interval=80,
temporal_step=30,
temporal_bin_interval=60,
points_lower_threshold=30,
Spatio1="longitude",
Spatio2="latitude",
Expand Down
2 changes: 1 addition & 1 deletion tests/set_up_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def get_data():
data = pickle.load(urlopen(url))
print("Done.")
x_names = get_x_names()
X = data.drop("count", axis=1)[x_names + ["longitude", "latitude"]].fillna(-1)
X = data.drop("count", axis=1)[x_names + ["longitude", "latitude"]]
y = data["count"].values

assert os.path.exists(len(data) > 0)
Expand Down
4 changes: 3 additions & 1 deletion tests/test_makegif.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

from stemflow.utils.plot_gif import make_sample_gif

from .make_models import make_STEMClassifier

size = 5000
fake_data = pd.DataFrame(
{
Expand Down Expand Up @@ -46,7 +48,7 @@ def test_make_gif():


def test_make_gif_changing_ranges():
fake_data_ = fake_data[(fake_data["x"] >= 0) & (fake_data["y"] >= 10) & (fake_data["DOY"] >= 20)].copy()
fake_data_ = fake_data[(fake_data["x"] >= 0) & (fake_data["y"] >= 10) & (fake_data["DOY"] >= 20)]

tmp_dir = "./stemflow_test_make_gif"
if not os.path.exists(tmp_dir):
Expand Down

0 comments on commit af69666

Please sign in to comment.