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

Cube merge scalar coordinate signature comparison #484

Closed
bjlittle opened this issue May 1, 2013 · 3 comments
Closed

Cube merge scalar coordinate signature comparison #484

bjlittle opened this issue May 1, 2013 · 3 comments
Assignees

Comments

@bjlittle
Copy link
Member

bjlittle commented May 1, 2013

Require to review the current light weight scalar coordinate signature comparison between proto-cubes within cube merge e.g.

>>> import numpy as np
>>> import iris
>>> from iris.coords import DimCoord, AuxCoord
>>> cube = iris.cube.Cube(np.arange(12).reshape(3, 4), standard_name='air_temperature', units='K')
>>> cube.add_dim_coord(DimCoord(np.arange(3), standard_name='latitude', units='degrees'), 0)
>>> cube.add_dim_coord(DimCoord(np.arange(4), standard_name='longitude', units='degrees'), 1)
>>> other = cube.copy()
>>> cube.add_aux_coord(AuxCoord(np.array([10], dtype=np.int), standard_name='height', units='m'))
>>> other.add_aux_coord(AuxCoord([20.], bounds=[[15., 25.]], standard_name='height', units='m'))
>>> merged = iris.cube.CubeList([cube, other]).merge()[0]
>>> print merged
air_temperature / (K)               (height: 2; latitude: 3; longitude: 4)
     Dimension coordinates:
          height                           x            -             -
          latitude                         -            x             -
          longitude                        -            -             x
>>> merged.coord('height')
DimCoord(array([ 10.,  20.]), standard_name='height', units=Unit('m'))

Ref: #475

@rhattersley
Copy link
Member

Thanks for creating this @bjlittle and adding a nice concrete example.

For future reference, the problem is merge is not paying attention to:

  1. the dtype of scalar,
  2. whether the scalar has bounds.

Are there any other facets?

@bjlittle
Copy link
Member Author

bjlittle commented May 2, 2013

Apart from the cell point and bounds dtype, the meta-data associated with a scalar coordinate also contains the circular flag for DimCoord scalar coordinates. When the scalar coordinate is an AuxCoord clearly this doesn't apply.

With regards to string scalar coordinates we'd want to decide whether we force all similar string scalar coords to have the same length or not - at the moment merge will calculate the maximum similar scalar coord string length, which seems pretty flexible (and appropriate). Whereas we request that all extensive (vector) string auxiliary coordinates have the exact same length - which is okay by me.

Might want to consider the case when similar scalar coordinates have mixed types i.e. one cube has a height DimCoord scalar coordinate, whereas another has a height AuxCoord scalar coordinate. Should these be considered compatible? Dunno, but something else to ponder when head scratching over these collective issues.

Ummm think that's it ... for now.

@pelson
Copy link
Member

pelson commented Oct 24, 2017

Closing due to inactivity.

@pelson pelson closed this as completed Oct 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants