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

CFstore subspacing #129

Open
georgeoobrienNCAS opened this issue Nov 2, 2023 · 1 comment
Open

CFstore subspacing #129

georgeoobrienNCAS opened this issue Nov 2, 2023 · 1 comment
Milestone

Comments

@georgeoobrienNCAS
Copy link
Collaborator

Implement subspacing for axes queries (i.e. subset of months over time)
Important ones are time, latitude and longitude so just do those.

@georgeoobrienNCAS georgeoobrienNCAS added this to the CANARI-MVP milestone Nov 2, 2023
@davidhassell
Copy link
Collaborator

I've just been checking the time subspacing syntax, and thought I'd share for the record. cf.cellwi is probably the query of choice here (and for the X and Y axes, too).

>>> import cf
>>> f = cf.example_field(2)
>>> print(f)
Field: air_potential_temperature (ncvar%air_potential_temperature)
------------------------------------------------------------------
Data            : air_potential_temperature(time(36), latitude(5), longitude(8)) K
Cell methods    : area: mean
Dimension coords: time(36) = [1959-12-16 12:00:00, ..., 1962-11-16 00:00:00]
                : latitude(5) = [-75.0, ..., 75.0] degrees_north
                : longitude(8) = [22.5, ..., 337.5] degrees_east
                : air_pressure(1) = [850.0] hPa
>>> print(f.subspace(T=cf.cellwi(cf.dt(1959, 12, 1), cf.dt(1960, 5, 1))))
Field: air_potential_temperature (ncvar%air_potential_temperature)
------------------------------------------------------------------
Data            : air_potential_temperature(time(5), latitude(5), longitude(8)) K
Cell methods    : area: mean
Dimension coords: time(5) = [1959-12-16 12:00:00, ..., 1960-04-16 00:00:00]
                : latitude(5) = [-75.0, ..., 75.0] degrees_north
                : longitude(8) = [22.5, ..., 337.5] degrees_east
                : air_pressure(1) = [850.0] hPa

In this example cf.wi would give the same result but that is not always the case, since cf.wi queries representative cell values, rather than bounds extents.

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

No branches or pull requests

2 participants