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

[FB] [PI-3585] Change default units to "unknown" for all DimensionalMetadata #3713

Merged

Conversation

stephenworsley
Copy link
Contributor

In line with suggestions from #3585, default units for all DimensionalMetadata are now "unknown".

@stephenworsley
Copy link
Contributor Author

stephenworsley commented May 20, 2020

Two things to consider based on the tests which were erroring:

  1. PP loading relies on the default units in certain cases. I assume it would be appropriate to edit the PP loading to keep the same PP loading behaviour as before in most cases, however it will be worthwhile checking if this is indeed appropriate in all cases.
  2. Certain aux_factories require coordinate units to be dimensionless (i.e. "1"). Coordinates made with default units will now break aux_factory creation.

@stephenworsley
Copy link
Contributor Author

Another change which will have to be considered in order to fix the tests:

What should be the default unit for coord_categorisation.add_categorised_coord()? The default is currently "1", changing the default to "unknown" is probably correct, though there might need to be some discussion as to which unit is most correct.

@stephenworsley
Copy link
Contributor Author

stephenworsley commented May 21, 2020

This line creates a coordinate in the process of collapsing, I have for the moment reverted the behaviour back to giving a unit of "1", though that may not necessarily be the most appropriate unit and this will have to be decided on:

coord = iris.coords.AuxCoord(point, long_name=coord_name)


It looks like this line is specific to percentile aggregation and the coordinate should contain percentages. I have therefore chosen to give a unit of "percent" here.

@stephenworsley stephenworsley changed the title (WIP) Change default units to "unknown" for all DimensionalMetadata Change default units to "unknown" for all DimensionalMetadata May 22, 2020
@pp-mo
Copy link
Member

pp-mo commented May 29, 2020

Points you raised:

  • PP loading relies on the default units in certain cases. I assume it would be appropriate to edit the PP loading to keep the same PP loading behaviour as before in most cases, however it will be worthwhile checking if this is indeed appropriate in all cases.
    • 👍 I'm happy that your edits preserve existing behaviour.
    • I checked all cases where coords are created in PP loading.
    • Plus, all the tests still pass.
  • Certain aux_factories require coordinate units to be dimensionless (i.e. "1"). Coordinates made with default units will now break aux_factory creation.
    • I think that's ok and will be dealt with in file format loaders.
    • I think we should perform a code scan of all those, but
    • for now all existing tests are passing + that's good enough to start with.
  • What should be the default unit for coord_categorisation.add_categorised_coord()? The default is currently "1", changing the default to "unknown" is probably correct, though there might need to be some discussion as to which unit is most correct.
    • I note you haven't had to change anything in iris.coord_categorisation yet,
    • and again all existing tests pass.
    • The individual special functions cases may want some review. Let's do that after.
  • This line creates a coordinate in the process of collapsing... It looks like ... the coordinate should contain percentages. I have therefore chosen to give a unit of "percent" here.
    • 👍 I agree this looks right in this case.
    • it only affects percentile + weighted-percentile, and I think that is ok.

Copy link
Member

@pp-mo pp-mo left a comment

Choose a reason for hiding this comment

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

That is literally all I can find wrong with this -- otherwise, I agree with all the choices + it already covers everything I checked for.

@@ -834,8 +834,8 @@ def jan_offset(day, year):
units="days since 1970-01-01 00:00:00-00",
climatological=True,
)
lon_dim = DimCoord(lon, standard_name="longitude")
lat_dim = DimCoord(lat, standard_name="latitude")
lon_dim = DimCoord(lon, standard_name="longitude", units="1")
Copy link
Member

Choose a reason for hiding this comment

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

These 2 should surely be 'degrees'.

@pp-mo
Copy link
Member

pp-mo commented May 29, 2020

One tiny point, and I think we can merge this.

Then we can consider knockons from this into your other outstanding PRs

and the deferred issues I created above

@pp-mo
Copy link
Member

pp-mo commented Jun 1, 2020

Thanks @stephenworsley all checks, I'm good with this now !

@pp-mo pp-mo merged commit 3fdccac into SciTools:default_units Jun 1, 2020
@pp-mo pp-mo added this to the v3.0.0 milestone Jun 3, 2020
@abooton abooton changed the title Change default units to "unknown" for all DimensionalMetadata PI-3585: Change default units to "unknown" for all DimensionalMetadata Jun 3, 2020
stephenworsley added a commit to stephenworsley/iris that referenced this pull request Jun 8, 2020
… default_units_patch

* 'default_units' of https://github.com/SciTools/iris:
  Unify saving behaviour of "unknown" and "no_unit" (SciTools#3711)
  Change default loading unit from "1" to "unknown" (correct branch) (SciTools#3709)
  Change default units to "unknown" for all DimensionalMetadata (SciTools#3713)
  Update docs CubeList.extract method (SciTools#3694)
  Correct and improve dev-guide section on fixing graphics-tests. (SciTools#3683)
  New image hashes for mpl 3x2 (SciTools#3682)
  Switched use of datetime.weekday() to datetime.dayofwk. (SciTools#3687)
  Remove TestGribMessage (SciTools#3672)
  Removed iris.tests.integration.test_grib_load and related CML files. (SciTools#3670)
  Removed grib-specific test to iris-grib. (SciTools#3671)
  Fixed asv project name to 'scitools-iris'. (SciTools#3660)
  Remove cube iter (SciTools#3656)
  Remove test_grib_save.py (SciTools#3669)
  Remove test_grib2 integration tests (SciTools#3664)
  Remove uri callback test which is moved to iris-grib (SciTools#3665)
  2v4 mergeback picks (SciTools#3668)
  Remove test_grib_save_rules.py which has been moved to iris-grib (SciTools#3666)
  Removed ununused skipIf. (SciTools#3632)
  Remove grib-specific test. (SciTools#3663)
  Remove obsolete test. (SciTools#3662)
abooton added a commit to abooton/iris that referenced this pull request Jun 10, 2020
Squashed commit of the following:

commit 912f500
Author: stephenworsley <[email protected]>
Date:   Mon Jun 1 17:52:42 2020 +0100

    Unify saving behaviour of "unknown" and "no_unit" (SciTools#3711)

commit 3171b95
Author: stephenworsley <[email protected]>
Date:   Mon Jun 1 16:28:45 2020 +0100

    Change default loading unit from "1" to "unknown" (correct branch) (SciTools#3709)

commit 3fdccac
Author: stephenworsley <[email protected]>
Date:   Mon Jun 1 12:27:23 2020 +0100

    Change default units to "unknown" for all DimensionalMetadata (SciTools#3713)
abooton added a commit to abooton/iris that referenced this pull request Jun 10, 2020
Squashed commit of the following:

commit 912f500
Author: stephenworsley <[email protected]>
Date:   Mon Jun 1 17:52:42 2020 +0100

    Unify saving behaviour of "unknown" and "no_unit" (SciTools#3711)

commit 3171b95
Author: stephenworsley <[email protected]>
Date:   Mon Jun 1 16:28:45 2020 +0100

    Change default loading unit from "1" to "unknown" (correct branch) (SciTools#3709)

commit 3fdccac
Author: stephenworsley <[email protected]>
Date:   Mon Jun 1 12:27:23 2020 +0100

    Change default units to "unknown" for all DimensionalMetadata (SciTools#3713)
@abooton abooton changed the title PI-3585: Change default units to "unknown" for all DimensionalMetadata [FB] [PI-3585] Change default units to "unknown" for all DimensionalMetadata Jun 10, 2020
abooton added a commit to abooton/iris that referenced this pull request Aug 19, 2020
…its_merge

* upstream/default_units:
  fix test (SciTools#3732)
  Unify saving behaviour of "unknown" and "no_unit" (SciTools#3711)
  Change default loading unit from "1" to "unknown" (correct branch) (SciTools#3709)
  Change default units to "unknown" for all DimensionalMetadata (SciTools#3713)
trexfeathers pushed a commit that referenced this pull request Aug 19, 2020
* Change default units to "unknown" for all DimensionalMetadata (#3713)

* Change default loading unit from "1" to "unknown" (correct branch) (#3709)

* Unify saving behaviour of "unknown" and "no_unit" (#3711)

* fix test (#3732)

Co-authored-by: stephenworsley <[email protected]>
stephenworsley added a commit that referenced this pull request Aug 20, 2020
* Change default units to "unknown" for all DimensionalMetadata (#3713)

* Change default loading unit from "1" to "unknown" (correct branch) (#3709)

* Unify saving behaviour of "unknown" and "no_unit" (#3711)

* fix test (#3732)

Co-authored-by: stephenworsley <[email protected]>
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.

2 participants