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

Python testing framework and workflow #45

Draft
wants to merge 33 commits into
base: main
Choose a base branch
from

Conversation

ma595
Copy link

@ma595 ma595 commented Jan 31, 2023

Add python testing framework and github actions workflow for automated testing. The PR downloads US-ARc_sample* data and sets up the nighttime partitioning step. The test runs in a few seconds and the generated output (*.csv files) are compared for equality against reference output.

The nighttime partioning step was chosen as an integration test as it runs much faster than other steps in the ONEFlux pipeline (i.e. daytime partitioning). Python unit tests will be implemented in a later PR.

TODOs:

  • check copying of data for integration test
  • Rebase PR and edit commit messages.
  • check numerical precision of comparison - load csvs as dataframes - use np.isclose() fn. Number of columns and specific values of certain columns do not agree..
  • convert pre-existing unittest test tests/test_context.py to use pytest.
  • directory structures for C and python testing. tests/C, tests/python.
  • delete pre-existing unittest boilerplate and replace with pytest.
  • partitioning_nt integration test tests/python/integration/test_partitioning.py
  • workflow to deploy ONEFlux, pull relevant data for test, copy required input from expected output of US-ARc_sample* and execute integration test. .github/workflows/python-app.yaml

Fixes #46

@ma595 ma595 marked this pull request as draft January 31, 2023 18:34
@ma595 ma595 self-assigned this Jan 31, 2023
@ma595 ma595 changed the title Tests framework Testing framework Feb 2, 2023
@ma595 ma595 changed the title Testing framework Python testing framework Mar 2, 2023
@ma595 ma595 changed the title Python testing framework Python testing framework and workflow Mar 2, 2023
@ma595 ma595 mentioned this pull request Mar 15, 2023
6 tasks
@ma595 ma595 marked this pull request as ready for review April 4, 2023 09:54
@ma595 ma595 requested a review from gilbertozp April 4, 2023 09:54
@ma595 ma595 removed the request for review from gilbertozp April 4, 2023 11:16
@ma595 ma595 marked this pull request as draft April 4, 2023 11:16
… but numerical differences persist in many columns
@ma595
Copy link
Author

ma595 commented Apr 4, 2023

Coming back to this PR I am now noticing a number of differences between the 'new' computed output and the reference output. On the nee_y_1.25_US-ARc_2005.csv file, for instance, there are 48 columns in the generated file vs the expected 45. The additional columns are gpp_2_nongf, gpp_2rob_nongf and gpp_2e_nongf.

Eliminating these from the output and comparing floating points, most values agree except 3 or 4 columns including gpp_2rob. @gilbertozp could you check that I'm executing the test_partitioning_nt test correctly within the test_partitioning.py file ? I'll continue to investigate...

@ma595
Copy link
Author

ma595 commented Apr 13, 2023

Following up on this, I notice differences between reference US-ARc_sample_output and computed output on the following columns: rrefoptord_se, rrefopttrim_se, gpp_2, gpp_2rob, gpp_2e, and ls_status in the nee_y_1.25_US-ARc_2005.csv file. Any ideas @gilbertozp ?

I assume some steps are not deterministic, so should I ignore certain output columns?

@dorchard
Copy link

dorchard commented Jun 7, 2024

@gilbertozp is this blocked on the comment above from Matt? Or can this be merged?

@dorchard
Copy link

@gilbertozp is taking a look at this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Python testing with pytest
2 participants