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

Record cell characteristics from aggregation cell conditions #692

Closed
davidhassell opened this issue Sep 19, 2023 · 2 comments · Fixed by #693
Closed

Record cell characteristics from aggregation cell conditions #692

davidhassell opened this issue Sep 19, 2023 · 2 comments · Fixed by #693
Labels
aggregation Rerlating to metadata-based field and domain aggregation enhancement New feature or request
Milestone

Comments

@davidhassell
Copy link
Collaborator

Since 3.15.2, the cells keyword of cf.aggregate allows fields to be aggregated sperately according to the characteristics of their dimension coordinates - namely cell spacing and cell size.

It would be useful to automatically record these characteristics on the aggregated fields, so that it is easy to see afterwards which conditions were passed.

Since the characteristics apply to dimension coordinate constructs only, they should be recorded on those constructs.

I propose four new DimensionCoordinate methods of [del|get|has|set]_cell_characterstics to allow the cell characteristics to be stored and subsequently accessed.

@davidhassell davidhassell added enhancement New feature or request aggregation Rerlating to metadata-based field and domain aggregation labels Sep 19, 2023
@davidhassell davidhassell added this to the Next release milestone Sep 19, 2023
@bnlawrence
Copy link

Would we have a controlled vocabulary of possible characteristics?

@davidhassell
Copy link
Collaborator Author

Would we have a controlled vocabulary of possible characteristics?

No - that would be up to a user application (such as cfstore) to map from a saved numerical-like characteristic of (say) {'cellsize': <CF Query: (wi [28, 31] day)>} to something that that application likes.

other examples of stored characteristics that apply to CANARI

  {'cellsize': <CF Query: (isclose 1 hour)>}

  {'cellsize': <CF Query: (isclose 0 hour)>,
   'spacing': <CF Query: (isclose 1 hour)>}

  {'cellsize': <CF Query: (isclose 3 hour)>}

  {'cellsize': <CF Query: (isclose 0 hour)>,
   'spacing': <CF Query: (isclose 3 hour)>}

  {'cellsize': <CF Query: (isclose 6 hour)>}

  {'cellsize': <CF Query: (isclose 0 hour)>,
   'spacing': <CF Query: (isclose 6 hour)>}

  {'cellsize': <CF Query: (isclose 1 day)>}

E.g.

if cf.wi(28, 31, 'd').equals(cellsize):
    cellsize = "1 month"
if cf.isclose(0, 'h').equals(cellsize) and cf.isclose(3, 'h').equals(spacing):
    cellsize = "0 hour"
    spacing = "3 hour"

It's possible to be more general if you know all characteristics are cf.Query objects (which you will know):

if char.operator in ('isclose', 'eq'):
    x = char.value
    char = f"{x.datum()} {x.Units.formatted(names=True)}"
elif cf.wi(28, 31, 'd').equals(char):
    char = "1 month"
elif cf.wi(360, 366, 'd').equals(char):
    char = "1 year"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aggregation Rerlating to metadata-based field and domain aggregation enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants