Skip to content

Conversation

@pp-mo
Copy link
Member

@pp-mo pp-mo commented May 17, 2017

Unskip tests and fix problems relating to BMDI and fill value in PP save/load.
Addresses #2507.

This code is no longer allowing any usage of BMDI with integer fields.
There seems to be no official interpretation of what a missing data value might be in that case, and we don't seem to have any test data that requires it.

  • On load, we create cubes with no fill value.
  • On save, masked integer data will cause an error.
    These changes are reflected in the results files.

The remaining test changes are almost all to do with providing mock test fields with a ".core_data()" that returns an array, or a mock array.

@pp-mo pp-mo changed the title Pp tests Fix various disabled PP tests May 17, 2017
@QuLogic QuLogic added this to the dask milestone May 17, 2017
@DPeterK DPeterK self-assigned this May 18, 2017
@DPeterK
Copy link
Member

DPeterK commented May 18, 2017

On save, masked integer data will cause an error.

Could you provide the rationale for this decision?

Copy link
Member

@DPeterK DPeterK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pp-mo a few minor comments...

"""

# Before we can actually write to file, we need to calculate the header
# elements. First things first, make sure the data is big-endian
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is outside of your changes admittedly, but it seems that this comment (specifically about the endianness) may now be in the wrong place given the code that immediately follows it.

cube = iris.cube.Cube(field.core_data(),
cube_data = field.core_data()
cube_dtype = cube_data.dtype
if cube_dtype.kind in 'bui':
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, everywhere else this is expressed as 'biu'... could you perhaps maintain that consistency?

# Skip this test, there appears to be a long standing bug in PP saving
# for int32, which is made worse by assigning the 'default' bmdi of
# 1e30 into int arrays
@tests.skip_biggus
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to see these all being fixed! 💯

field.core_data.dtype = None
core_data_array.compute = None
# It must also have a recognisable dtype.
core_data_array.dtype = np.dtype('f4')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could set these attributes inside the mock call... but you would lose the chance to comment on each attribute, I guess.

@DPeterK
Copy link
Member

DPeterK commented May 18, 2017

@pp-mo you also have a couple of failing tests on Travis. Looks like they're both to do with resultant dtype.

@DPeterK DPeterK changed the title Fix various disabled PP tests Fix PP handling May 18, 2017
@DPeterK DPeterK changed the title Fix PP handling Fix PP bmdi handling May 18, 2017
@DPeterK DPeterK merged commit 9be1ae4 into SciTools:dask May 18, 2017
bjlittle pushed a commit to bjlittle/iris that referenced this pull request May 31, 2017
* Various un-skips.

* Checked new result for PPfields repr.

* Fix mock field data in TestVertical.

* Fix usage of BMDI in pp load and save.

* Fix test problem.

* Tidy out old comments.

* Use new field.realised_dtype where appropriate.

* More test fixes.

* Review changes, mostly cosmetic.
@QuLogic QuLogic modified the milestones: dask, v2.0 Aug 2, 2017
@lbdreyer lbdreyer mentioned this pull request Aug 4, 2017
@pp-mo pp-mo deleted the pp_tests branch January 8, 2019 13:48
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.

3 participants