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

reduce warnings in tests #333

Merged
merged 8 commits into from
Mar 3, 2020
Merged

reduce warnings in tests #333

merged 8 commits into from
Mar 3, 2020

Conversation

aaronspring
Copy link
Collaborator

Description

  • ignore UserWarnings: these hint the user to better behaviour but dont break code if ignored
  • ignore some xarray upstream warnings
  • mark slow tests: can be ignore by pytest -m 'not slow': took the 20 slowest tests
  • mark tests on mistral

Closes #326

Type of change

Please delete options that are not relevant.

References

Please add any references to manuscripts, textbooks, etc.

@aaronspring aaronspring self-assigned this Mar 1, 2020
@aaronspring
Copy link
Collaborator Author

aaronspring commented Mar 1, 2020

7.78s call     climpred/tests/test_graphics.py::test_mpi_pm_plot_bootstrapped_skill_over_leadyear
5.51s call     climpred/tests/test_hindcastEnsemble_class.py::test_compute_metric
3.08s call     climpred/tests/test_compute_dims.py::test_bootstrap_hindcast_dim
2.50s call     climpred/tests/test_perfectModelEnsemble_class.py::test_bootstrap
2.39s call     climpred/tests/test_probabilistic.py::test_bootstrap_hindcast_da1d_not_nan_probabilistic[crpss_es-m2o]
2.35s call     climpred/tests/test_effective_p_value.py::test_eff_pearson_p_greater_or_equal_to_normal_p_hind_da_initialized_1d[m2o]
2.10s call     climpred/tests/test_metrics.py::test_new_metric_passed_to_bootstrap_compute
2.10s call     climpred/tests/test_bootstrap.py::test_bootstrap_hindcast_lazy[True-m2o]
1.98s call     climpred/tests/test_probabilistic.py::test_bootstrap_hindcast_da1d_not_nan_probabilistic[crpss-m2o]
1.98s call     climpred/tests/test_bootstrap.py::test_bootstrap_hindcast_lazy[True-e2o]
1.94s call     climpred/tests/test_bootstrap.py::test_bootstrap_hindcast_resample_dim[member]
1.92s call     climpred/tests/test_bootstrap.py::test_bootstrap_hindcast_lazy[False-m2o]
1.87s call     climpred/tests/test_compute_dims.py::test_bootstrap_pm_dim
1.76s call     climpred/tests/test_perfect_model_prediction.py::test_pvalue_from_bootstrapping[pearson_r]
1.75s call     climpred/tests/test_hindcastEnsemble_class.py::test_verify
1.70s call     climpred/tests/test_perfect_model_prediction.py::test_bootstrap_perfect_model_ds1d_not_nan
1.65s call     climpred/tests/test_probabilistic.py::test_bootstrap_hindcast_da1d_not_nan_probabilistic[brier_score-m2o]
1.65s call     climpred/tests/test_hindcast_prediction.py::test_bootstrap_hindcast_da1d_not_nan
1.64s call     climpred/tests/test_utils.py::test_bootstrap_pm_assign_attrs
1.58s call     climpred/tests/test_probabilistic.py::test_compute_perfect_model_da1d_not_nan_crpss_quadratic
pytest --durations 20 -m 'not slow'
==================================================================================== slowest 20 test durations ====================================================================================
2.25s call     climpred/tests/test_compute_dims.py::test_bootstrap_hindcast_dim
2.00s call     climpred/tests/test_hindcast_prediction.py::test_bootstrap_hindcast_keeps_lead_units
2.00s call     climpred/tests/test_hindcast_prediction.py::test_bootstrap_hindcast_da1d_not_nan
1.99s call     climpred/tests/test_graphics.py::test_mpi_pm_plot_bootstrapped_skill_over_leadyear
1.84s call     climpred/tests/test_utils.py::test_bootstrap_pm_assign_attrs
1.63s call     climpred/tests/test_metrics.py::test_hindcast_metric_weights[e2o-rmse]
1.48s call     climpred/tests/test_perfect_model_prediction.py::test_bootstrap_perfect_model_keeps_lead_units
1.47s call     climpred/tests/test_probabilistic.py::test_compute_perfect_model_da1d_not_nan_crpss_quadratic
1.44s call     climpred/tests/test_metrics.py::test_hindcast_metric_weights[e2o-mse]
1.38s call     climpred/tests/test_compute_dims.py::test_bootstrap_pm_dim
1.31s call     climpred/tests/test_versioning.py::test_show_versions[True]
1.25s call     climpred/tests/test_hindcastEnsemble_class.py::test_compute_metric
1.25s call     climpred/tests/test_perfectModelEnsemble_class.py::test_inplace
1.10s call     climpred/tests/test_perfectModelEnsemble_class.py::test_compute_uninitialized
1.09s call     climpred/tests/test_perfectModelEnsemble_class.py::test_get_uninitialized
1.08s call     climpred/tests/test_perfectModelEnsemble_class.py::test_generate_uninit
1.05s call     climpred/tests/test_perfectModelEnsemble_class.py::test_compute_persistence
1.03s call     climpred/tests/test_stats.py::test_rm_trend_3d_dataset

@coveralls
Copy link

coveralls commented Mar 1, 2020

Coverage Status

Coverage remained the same at 91.267% when pulling 5cc73d7 on AS_reduce_warnings_in_tests into 04ed527 on master.

@aaronspring
Copy link
Collaborator Author

there are still warnings but not too many now

======================================================================================== warnings summary =========================================================================================
climpred/tests/test_bootstrap.py::test_bootstrap_PM_no_lazy_results[True-m2m]
climpred/tests/test_bootstrap.py::test_bootstrap_PM_no_lazy_results[True-m2e]
climpred/tests/test_bootstrap.py::test_bootstrap_PM_no_lazy_results[True-m2c]
climpred/tests/test_bootstrap.py::test_bootstrap_PM_no_lazy_results[True-e2c]
climpred/tests/test_bootstrap.py::test_bootstrap_hindcast_lazy[True-e2o]
climpred/tests/test_bootstrap.py::test_bootstrap_hindcast_lazy[True-m2o]
  /Users/aaron.spring/anaconda3/envs/climpred-dev/lib/python3.6/site-packages/dask/array/core.py:350: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
    o = func(*args, **kwargs)

climpred/tests/test_bootstrap.py::test_bootstrap_PM_no_lazy_results[False-m2m]
climpred/tests/test_bootstrap.py::test_bootstrap_PM_no_lazy_results[False-m2e]
climpred/tests/test_bootstrap.py::test_bootstrap_PM_no_lazy_results[False-m2c]
climpred/tests/test_bootstrap.py::test_bootstrap_PM_no_lazy_results[False-e2c]
climpred/tests/test_bootstrap.py::test_bootstrap_hindcast_lazy[False-e2o]
climpred/tests/test_bootstrap.py::test_bootstrap_hindcast_lazy[False-m2o]
climpred/tests/test_bootstrap.py::test_bootstrap_hindcast_resample_dim[member]
climpred/tests/test_bootstrap.py::test_bootstrap_hindcast_resample_dim[init]
climpred/tests/test_compute_dims.py::test_bootstrap_pm_dim
climpred/tests/test_compute_dims.py::test_bootstrap_hindcast_dim
climpred/tests/test_graphics.py::test_mpi_pm_plot_bootstrapped_skill_over_leadyear
climpred/tests/test_hindcast_prediction.py::test_bootstrap_hindcast_da1d_not_nan
climpred/tests/test_hindcast_prediction.py::test_bootstrap_hindcast_keeps_lead_units
climpred/tests/test_metrics.py::test_new_metric_passed_to_bootstrap_compute
climpred/tests/test_metrics.py::test_new_metric_passed_to_bootstrap_compute
climpred/tests/test_perfect_model_prediction.py::test_pvalue_from_bootstrapping[rmse]
climpred/tests/test_perfect_model_prediction.py::test_pvalue_from_bootstrapping[pearson_r]
climpred/tests/test_perfect_model_prediction.py::test_bootstrap_perfect_model_da1d_not_nan
climpred/tests/test_perfect_model_prediction.py::test_bootstrap_perfect_model_keeps_lead_units
climpred/tests/test_probabilistic.py::test_bootstrap_perfect_model_da1d_not_nan_probabilistic[brier_score-m2m]
climpred/tests/test_probabilistic.py::test_bootstrap_perfect_model_da1d_not_nan_probabilistic[brier_score-m2c]
climpred/tests/test_probabilistic.py::test_bootstrap_perfect_model_da1d_not_nan_probabilistic[threshold_brier_score-m2m]
climpred/tests/test_probabilistic.py::test_bootstrap_perfect_model_da1d_not_nan_probabilistic[threshold_brier_score-m2c]
climpred/tests/test_probabilistic.py::test_bootstrap_perfect_model_da1d_not_nan_probabilistic[crps-m2m]
climpred/tests/test_probabilistic.py::test_bootstrap_perfect_model_da1d_not_nan_probabilistic[crps-m2c]
climpred/tests/test_probabilistic.py::test_bootstrap_perfect_model_da1d_not_nan_probabilistic[crpss-m2m]
climpred/tests/test_probabilistic.py::test_bootstrap_perfect_model_da1d_not_nan_probabilistic[crpss-m2c]
climpred/tests/test_probabilistic.py::test_bootstrap_perfect_model_da1d_not_nan_probabilistic[crpss_es-m2m]
climpred/tests/test_probabilistic.py::test_bootstrap_perfect_model_da1d_not_nan_probabilistic[crpss_es-m2c]
climpred/tests/test_probabilistic.py::test_bootstrap_hindcast_da1d_not_nan_probabilistic[brier_score-m2o]
climpred/tests/test_probabilistic.py::test_bootstrap_hindcast_da1d_not_nan_probabilistic[threshold_brier_score-m2o]
climpred/tests/test_probabilistic.py::test_bootstrap_hindcast_da1d_not_nan_probabilistic[crps-m2o]
climpred/tests/test_probabilistic.py::test_bootstrap_hindcast_da1d_not_nan_probabilistic[crpss-m2o]
climpred/tests/test_probabilistic.py::test_bootstrap_hindcast_da1d_not_nan_probabilistic[crpss_es-m2o]
climpred/tests/test_utils.py::test_bootstrap_pm_assign_attrs
  /Users/aaron.spring/anaconda3/envs/climpred-dev/lib/python3.6/site-packages/xarray/core/dataarray.py:669: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
    return key in self.data

climpred/tests/test_lead_time_resolutions.py::test_yearly_resolution_hindcast
climpred/tests/test_lead_time_resolutions.py::test_yearly_resolution_perfect_model
  /Users/aaron.spring/anaconda3/envs/climpred-dev/lib/python3.6/site-packages/numpy/core/_methods.py:161: RuntimeWarning: invalid value encountered in double_scalars
    ret = ret.dtype.type(ret / rcount)

climpred/tests/test_lead_time_resolutions.py::test_yearly_resolution_hindcast
climpred/tests/test_lead_time_resolutions.py::test_yearly_resolution_perfect_model
  /Users/aaron.spring/anaconda3/envs/climpred-dev/lib/python3.6/site-packages/xskillscore/core/np_deterministic.py:185: RuntimeWarning: invalid value encountered in double_scalars
    r = r_num / r_den

climpred/tests/test_relative_entropy.py::test_compute_relative_entropy
climpred/tests/test_relative_entropy.py::test_bootstrap_relative_entropy
climpred/tests/test_relative_entropy.py::test_plot_relative_entropy
climpred/tests/test_relative_entropy.py::test_plot_relative_entropy
  /Users/aaron.spring/anaconda3/envs/climpred-dev/lib/python3.6/site-packages/climpred-2.0.0.post15-py3.6.egg/climpred/relative_entropy.py:42: FutureWarning: `rcond` parameter will change to the default of machine precision times ``max(M, N)`` where M and N are the input matrix dimensions.
  To use the future default and silence this warning we advise to pass `rcond=None`, to keep using the old, explicitly pass `rcond=-1`.
    x, _, _, _ = np.linalg.lstsq(sigma_b, mu_x - mu_b)  # sigma_b \ (mu_x - mu_b)

climpred/tests/test_smoothing.py::test_compute_after_smooth_goddard_2013
  /Users/aaron.spring/anaconda3/envs/climpred-dev/lib/python3.6/site-packages/xskillscore/core/np_deterministic.py:185: RuntimeWarning: invalid value encountered in true_divide
    r = r_num / r_den

-- Docs: https://docs.pytest.org/en/latest/warnings.html

Results (183.37s):
     553 passed
       3 xfailed
      15 skipped

@aaronspring aaronspring requested a review from bradyrx March 1, 2020 21:35
@aaronspring
Copy link
Collaborator Author

this warnings comes from resetting the coords that drop in hindcast:
climpred/tests/test_utils.py::test_bootstrap_pm_assign_attrs /Users/aaron.spring/anaconda3/envs/climpred-dev/lib/python3.6/site-packages/xarray/core/dataarray.py:669: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison return key in self.data

@aaronspring
Copy link
Collaborator Author

then there is xskillscore warnings:
climpred/tests/test_lead_time_resolutions.py::test_yearly_resolution_perfect_model /Users/aaron.spring/anaconda3/envs/climpred-dev/lib/python3.6/site-packages/xskillscore/core/np_deterministic.py:185: RuntimeWarning: invalid value encountered in double_scalars r = r_num / r_den

@bradyrx
Copy link
Collaborator

bradyrx commented Mar 2, 2020

Reminder per our discussion to check the other warnings showing up in the Travis CI.

@aaronspring
Copy link
Collaborator Author

Reminder per our discussion to check the other warnings showing up in the Travis CI.

solved.

@bradyrx
Copy link
Collaborator

bradyrx commented Mar 2, 2020

I'm still seeing the following errors/warnings in CI:

  • FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison

  • DeprecationWarning: Call to deprecated function ESMP_FieldRegridStoreFile.

  • RuntimeWarning: invalid value encountered in double_scalars

  • FutureWarning: rcond parameter will change to the default of machine precision times max(M, N) where M and N are the input matrix dimensions.

  • RuntimeWarning: invalid value encountered in true_divide

  • DeprecationWarning: invalid escape sequence \i

Adding those should clear the rest out.

@bradyrx bradyrx merged commit a04ab6d into master Mar 3, 2020
@aaronspring
Copy link
Collaborator Author

we should keep the warnings a bit in eye. the elementwise thing I dont understand

@aaronspring aaronspring deleted the AS_reduce_warnings_in_tests branch March 3, 2020 04:12
@aaronspring aaronspring mentioned this pull request Sep 11, 2020
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

get rid of the sources of warnings in tests
3 participants