Ticket #776 (closed defect: fixed)

Opened 12 years ago

Last modified 12 years ago

CSML unit test failures

Reported by: spascoe Owned by: domlowe
Priority: required Milestone: PROD Step2
Component: CSML Version:
Keywords: Cc:

Description (last modified by domlowe) (diff)

Some unit tests for subsetToGridSeries have been added at TI-02-CSML/trunk/csml/tests. These identify several problems with subsetting.

Running the tests

If you have nose installed (automatically installed with Pylons) just do:

$ nosetests csml.tests

Individual unit tests can be selected, e.g.

$ nosetests csml.tests.test_extract:TestExtractAll.test2

Test Data

The make_data.py script creates 4 NetCDF files, each containing a single GridSeries? of an artificial phenomena. The grids are as follows:

Each grid is named test_<lonMin>_<lonMax><lat-direction>.nc where:

  • lonMin: Minimum longitude. 0 or m180 (-180)
  • lonMax: Maximum longitude. 360 or 180
  • lat-direction: Increasing or decreasing latitude. "m" == (-90, 90), "p" == (90, -90).

Therefore the 4 grids are

  1. test_0_360p.nc
  2. test_0_360m.nc
  3. test_m180_180m.nc
  4. test_m180_180p.nc

In each case the grid point values are set such that var[lon, lat] == lat + lon.

Test Cases

Each test case has 4 tests running the same test on the 4 grids listed above.

TestCaseDescriptionFailuresNotes
TestExtractAll Extracts the whole grid without specifying lat/lon in the selector. test2 and test3 because the latitude axis is inverted to (-90, 90) without inverting the values. Fixed
TestExtractAll_360 Extracts the entire grid asking for longitude=(0, 360), latitude=(-90, 90) test3 and test4 because longitude selection of (0, 360) is truncated to the source domain (-180, 180), resulting in an output domain of (0, 180). Leave for now
TestExtractAll_180 Extracts the entire grid asking for longitude(-180, 180), latitude(-90, 90) test3 and test4 because the output grid is 1 latitude point short (shape == (36, 35)) Fixed, bug was in test data :-)
TestExtractShape Extract the quadrant lon=(0, 180), lat=(0, 90) and check the shape is (18, 18) None
TestLatOrdering Extract the quadrant lon=(0, 180), lat=(0, 90) and check latitude increases with grid index. None
TestLonOrdering Extract the quadrant lon=(0, 180), lat=(0, 90) and check longitude increases with grid index. None
TestExtractPoint Extracts a single grid box at lon=85, lat=42.5 Checks a single value is returned and that it has the value 85+42.5. None
TestExtractPointWithBounds Extracts a range lon=(80, 90), lat=(40, 45). This should corespond to a single grid point lon=85, lat=42.5. Checks a single value is returned and that it has the value 85+42.5. test 4 brings back a grid lon=(45, 85), lat=(37.5, 87.5)! The other tests raise exceptions in CDMS: CDMSError: axis length 37 does not match corresponding dimension 1 Fixed for tests 1-3, test 4 was a typo in test script

Some of these are probably more important to fix than others. For instance the !TestExtractAll_360 failure is arguably a valid response to a selection not in the source data's domain, however CDMS does the "right thing" in this situation. Others, particularly TestExtractAll.test2/3 and TestExtractPointWithBounds, are more critical.

Attachments

csml_wxs_WBeqOs.nc.gz Download (52.7 KB) - added by spascoe 12 years ago.
NetCDF of a subsetToGridSeries operation without specifying lat/lon domain

Change History

comment:1 Changed 12 years ago by spascoe

  • Component changed from T01_Discovery to T02_CSML

comment:2 Changed 12 years ago by domlowe

  • Status changed from new to assigned
  • Milestone changed from PROD Step1 to PROD Step2

Thanks Stephen. Changed the milestone to Prod Step 2 as I'm not going to get these all fixed next week (unless any of them are actually holding you up at the moment?).

Changed 12 years ago by spascoe

NetCDF of a subsetToGridSeries operation without specifying lat/lon domain

comment:3 Changed 12 years ago by spascoe

  • Priority changed from required to critical
  • Milestone changed from PROD Step2 to PROD Step1

TestExtractAll? needs fixing ASAP. For efficiency the WMS now subsets on time with CSML and does the geographical subsetting in CDMS. If the latitude domain is (90, -90) and no latitude domain is specified in the selector subsetToGridSeries inverts the latitude data but not the axis. Look at the attached file in xconv or ncview to see what I mean.

This problem affects the IPCC-DDC data because it is ordered lat=(90, -90).

comment:4 Changed 12 years ago by domlowe

  • Priority changed from critical to required
  • Description modified (diff)
  • Milestone changed from PROD Step1 to PROD Step2

Okay, fixed TestExtractAll, and have moved the rest to Prod 2 milestone.

comment:5 Changed 12 years ago by domlowe

  • Description modified (diff)

Updating notes.

comment:6 Changed 12 years ago by domlowe

  • Status changed from assigned to closed
  • Resolution set to fixed
  • Description modified (diff)
Note: See TracTickets for help on using tickets.