Skip to content

How to group by actual winter season #939

@laurabaker-eng

Description

@laurabaker-eng

I recently discovered the function

field.collapse('T: mean',group=cf.djf())

However, I've discovered that rather than grouping by actual winter season, I think what it's doing is grouping by the Jan, Feb and Dec of the same calendar year.  Or at least, what it's producing is definitely not right!
Is there a way of doing this so that it actually gets the D,J,F from the same season?
What I've always done in the past is something along the lines of:

field_dec = field.subspace(time = cf.month(12))
field_jan = field.subspace(time = cf.month(1))
field_feb = field.subspace(time = cf.month(2))

field_djf = field_dec.copy()
field_djf.data[:-1] = (field_dec.data[:-1]+field_jan.data[1:]+field_feb.data[1:])/3.

But I'm wondering if there is a more efficient way of doing this, without manipulating the data itself?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionGeneral question

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions