Skip to content

spatialreference not loading correctly #659

@jtwhite79

Description

@jtwhite79

I know, I know, modelgrid and whatnot, but a lot of us still rely on SpatialReference. This code shows the problem:

import flopy
m = flopy.modflow.Modflow("test",xll=12345,yll=12345)
flopy.modflow.ModflowDis(m,10,10,10)
m.sr.xll = 12345
m.sr.yll = 12345
print(m.sr)
print(m.modelgrid)
m.write_input()
mm = flopy.modflow.Modflow.load("test.nam")
print(mm.sr)
print(mm.modelgrid)

The loaded model (mm) does not have the right sr information.

So Im sure someone will tell me to get with the times, which I have tried. I tried to use modelgrid, but unlike sr, which caches the xcentergrid and ycentergrid arrays after first call, modelgrid.xcellcenters is dynamically refilling the arrays with every call! I guess I get the arrays I need once and then process with them, but I like the encapsulation of caching them for users - this breaks the idea of "just find and replace sr with modelgrid". Anyway, can someone please fix sr?

Metadata

Metadata

Assignees

Labels

No labels
No labels

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