openghg / openghg_inversions

University of Bristol Atmospheric Chemistry Research Group RHIME Inversion code (with openghg dependency)
MIT License
5 stars 0 forks source link

Add some basic tests #8

Closed gareth-j closed 5 months ago

gareth-j commented 1 year ago

I added some very simple tests for load_json with #9

brendan-m-murphy commented 10 months ago

I'm going to add a test that runs a full inversion. Hopefully I can make this reasonably fast.

So far, the things I can think of testing with a full inversion are:

  1. the inversion runs without errors
  2. by storing the result of the inversion with the current set up (and fixing random seeds), checking if the results are equal (or very close to) the stored result. Since assessing if the results of an inversion are "correct" is pretty difficult, I want to be able to test if changes are altering the way the inversion works. (For initial tidying of the code, I don't want to change the actual results.)

If anyone has any other testable ideas, let me know. These first tests are just for checking that changes don't break the code. As I tidy things up, I should be able to test individual components.

I will probably just use CH4 data and one site, but I could add more types of data. It would be nice to create synthetic data, but I haven't thought about what that would look like.

Later, I'll make tests for performance. I think running pytest on Blue Pebble should work, so I should be able to run "profiling" tests there. Maybe it would be easier to just write some scripts for performance testing, since they need to be run on BP (or Blue Crystal). Anyway, the current goal is to get enough tests to be able to change the code without worrying that it's breaking.

gareth-j commented 5 months ago

Done with #25