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

gwf: creating IC package very slow (version 0.6.1) #262

Closed
RdWitte opened this issue Sep 22, 2023 · 4 comments
Closed

gwf: creating IC package very slow (version 0.6.1) #262

RdWitte opened this issue Sep 22, 2023 · 4 comments

Comments

@RdWitte
Copy link

RdWitte commented Sep 22, 2023

Hi All,

Since I've updated nlmod from 0.5.3 to 0.6.1 the progress of creating the IC package has become very slow (ca. 6-8 min vs a few seconds). I have tried presenting different sets of initial heads (i.e. all 1's, or the actual initial heads), but the outcome is the same.
Although I don't really see what changes from 0.5.3 to 0.6.1 could have an impact on this, I was wondering if anyone else has encountered issues with this?

Issue occurs during:
gwf = nlmod.gwf.ds_to_gwf(ds)

image

@RdWitte RdWitte changed the title gwf: creating modflow IC slow (version 0.6.1) gwf: creating IC package very slow (version 0.6.1) Sep 22, 2023
@dbrakenhoff
Copy link
Collaborator

Thanks for posting this issue. I'm not sure but this might have to do with passing a DataArray to flopy instead of the actual underlying numpy array. We've run into bizarrely bad performance before related to that issue.

Does this issue also occur with one of the example notebooks? And can you post the versions of xarray, numpy and flopy for us?

@RdWitte
Copy link
Author

RdWitte commented Sep 22, 2023

I ran the IJmuiden notebook, results:
0.5.3 -> IC loading time <<1 sec.
0.6.1 -> IC loading time ~14 sec.

  • 0.5.3:
    Bottleneck==1.3.5
    contextily==1.2.0
    flopy==3.3.6
    geopandas==0.12.1
    geopy==2.3.0
    hydropandas==0.8.0
    imod==0.11.4
    matplotlib==3.6.2
    nlmod==0.5.3
    numpy==1.23.4
    pandas==1.5.3
    Shapely==2.0.1
    openpyxl==3.0.10
    geocube==0.4.2
    rioxarray==0.12.4

  • 0.6.1:
    Bottleneck==1.3.5
    contextily==1.3.0
    flopy==3.3.6
    geopandas==0.12.1
    geopy==2.3.0
    hydropandas==0.8.0
    imod==0.14.1
    matplotlib==3.6.2
    nlmod==0.6.1
    numpy==1.23.4
    pandas==1.5.3
    Shapely==2.0.1
    geocube==0.4.2
    openpyxl==3.1.2
    rioxarray==0.15.0

@dbrakenhoff
Copy link
Collaborator

This issue has been fixed in the dev branch (#200). It's what I mentioned before. When a DataArray is passed to flopy, performance becomes extremely slow. In the lastest version of nlmod we ensure all data from the model dataset is passed to flopy as numpy arrays.

For now there are two workarounds:

  • Update nlmod to the develop version pip install git+https://github.com/ArtesiaWater/nlmod.git@dev
  • Pass the starting heads to the IC package as a numpy array.

I'll check with the rest whether we can create a new release soon to address this issue.

@dbrakenhoff
Copy link
Collaborator

Fixed by new release v0.7.0, closing issue.

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