You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Love the "to_shapefile" functionality. Would like to suggest a fix that improved write time for me on a 362, 368 grid from 26m:31s to 1m:50s . My fix is probably a dumb approach, but I think the issue is real.
For large grids it appears to spend a lot of time in flopy_io.py::write_grid_shapefile() in the loop just prior to wr.save(filename), which I traced to the reference.py::get_vertices() call:
It appears to me (I am a python novice so forgive any stupidity that follows) that the reference.py::get_vertices() call that occurs over nrow by ncol is triggering an unnecessary recreation of the xgrid/ygrid properties every time it gets called:
I verified that this line (line 296) is the slow part of the method call. My ignorant way of fixing this was just to check whether xgrid/ygrid had been created during the property call, and to skip their recreation:
The text was updated successfully, but these errors were encountered:
I believe this was fixed on the develop branch, using the same approach that you are suggesting. Can you give that a try? We are working to get a release out sometime this week, if possible.
On develop branch in reference.py:
@property
def xgrid(self):
if self._xgrid is None:
self._set_xygrid()
return self._xgrid
@property
def ygrid(self):
if self._ygrid is None:
self._set_xygrid()
return self._ygrid
Well, that will teach me to check dev before spouting off. You are right, dev gives an identical result in terms of speed as my (actually, my colleague Marius') proposed change. At least it gave us an excuse to dig into the code a bit... =)
Love the "to_shapefile" functionality. Would like to suggest a fix that improved write time for me on a 362, 368 grid from 26m:31s to 1m:50s . My fix is probably a dumb approach, but I think the issue is real.
For large grids it appears to spend a lot of time in flopy_io.py::write_grid_shapefile() in the loop just prior to wr.save(filename), which I traced to the reference.py::get_vertices() call:
It appears to me (I am a python novice so forgive any stupidity that follows) that the reference.py::get_vertices() call that occurs over nrow by ncol is triggering an unnecessary recreation of the xgrid/ygrid properties every time it gets called:
I verified that this line (line 296) is the slow part of the method call. My ignorant way of fixing this was just to check whether xgrid/ygrid had been created during the property call, and to skip their recreation:
The text was updated successfully, but these errors were encountered: