Skip to content

waterbalance calculation is slow...? #873

Description

@JaccoHoogewoud

Hi,
I calculate the riverbudgets per day for a given zone, and store the values in a list.
It works but is unexpectedly (8 hours, for 11 years of daily data with grid aprox 320*320) slow, running the groundwatermodel is almost as fast (16 hours).

    bdg = imod.idf.open(f'{bdg_naam}_*.idf')
    zone =imod.idf.open(zone.idf)
    # select part of needed bdg
    bdg = bdg.sel(time=slice('2012-01-01', '2021-01-01'))
    bdg = bdg.where(zone>0)
    bdg = bdg.sum(dim='layer') # i have 4 layers
    bdg = bdg.where(bdg>0)     # only get the infiltration flux
    result =[]
    for datum in bdg.time:
        dagwaarde = bdg.sel(time=datum.values).sum().values.item()
        result.append([pd.Timestamp(datum.values),dagwaarde])

How should I speedup?

thx,
Jacco.

PS: I know this is not really a bug, but perhaps a lack of skill from my part. On the other hand it might be nice if there was a "how do i" do efficient waterbalance calculations.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions