cpelley / iris

A powerful, easy to use, and community-driven Python library for analysing and visualising meteorological and oceanographic data sets.
http://scitools.org.uk/iris/
0 stars 0 forks source link

Alternative handling of modular coords in LinearInterpolator. #25

Closed pp-mo closed 10 years ago

pp-mo commented 10 years ago

Tweaked the calculation in a different way -- looking promising but not done yet ...

pp-mo commented 10 years ago

NOTES: The new lib/iris/analysis/_interpolator.py is really based on the previous version, rather than your current interp_refactor. But obviously, I've kept the new test.

The still-failiing tests from this now look like ...

itpp@eld238: /net/home/h05/itpp/git/iris/iris_main > python setup.py test >/home/h05/itpp/Iris/sprints/20140331/interp_review/interp_refactor_recirc_tests_ANOTHER.txt 2>&1 
itpp@eld238: /net/home/h05/itpp/git/iris/iris_main > grep "^test_.*\(FAIL\|ERROR\)" /home/h05/itpp/Iris/sprints/20140331/interp_review/interp_refactor_recirc_tests_ANOTHER.txt
test_pep8_conformance (iris.tests.test_coding_standards.TestCodeFormat) ... FAIL
test_colpex (iris.tests.test_merge.TestColpex) ... FAIL
test_netcdf_hybrid_height (iris.tests.test_netcdf.TestNetCDFSave) ... FAIL
test_trajectory_extraction (iris.tests.test_trajectory.TestTrajectory) ... FAIL
itpp@eld238: /net/home/h05/itpp/git/iris/iris_main > git status

Whereas previous version gives :

itpp@eld238: /home/h05/itpp/Iris/sprints/20140331/interp_review > grep "^test_.*\(FAIL\|ERROR\)" interp_refactor_recirc_tests_a157411_20110409.txt 
test_positive (iris.tests.analysis.test_interpolate.Test_linear__circular_wrapping) ... FAIL
test_symmetric (iris.tests.analysis.test_interpolate.Test_linear__circular_wrapping) ... ERROR
test_circular (iris.tests.test_interpolation.TestNearestLinearInterpolRealData) ... FAIL
test_pep8_conformance (iris.tests.test_coding_standards.TestCodeFormat) ... FAIL
test_colpex (iris.tests.test_merge.TestColpex) ... FAIL
test_netcdf_hybrid_height (iris.tests.test_netcdf.TestNetCDFSave) ... FAIL
test_trajectory_extraction (iris.tests.test_trajectory.TestTrajectory) ... FAIL
itpp@eld238: /home/h05/itpp/Iris/sprints/20140331/interp_review >

So, this change has lost us an ERROR, and some FAILs. There are now just 3 FAILS (ignoring the pep8 for now). I'm hopeful, from a quick look, that the remaining problems are just small numeric differences (whereas the previous version seemed to upset tests/analysis/test_interpolate.py quite seriously).

Please take a look @cpelley, if you're in before me tomorrow !

cpelley commented 10 years ago

Thanks for looking into this for me @pp-mo Taking one test at a time, the test_trajectory_extraction test failure concerns me.

Having looked at the numbers, it should not require any interpolation as the points exist... even if not, they are not within a 'reasonable' error in any case:

        # Pull out a single point - no interpolation required
        single_point = iris.analysis.trajectory.interpolate(
            cube, [('grid_latitude', [-0.1188]),
                   ('grid_longitude', [359.57958984])])
        expected = cube[..., 10, 0].data
        self.assertArrayAllClose(single_point[..., 0].data, expected, rtol=2.0e-7)
        self.assertCML(single_point, ('trajectory', 'single_point.cml'),
                       checksum=False)

Difference between expected and what is returned: min: 0.000e+00, max: 2.133e-02