Skip to content

bug: very slow export with model_attributes_to_shapefile #1927

Description

@RyanConway91

Describe the bug
Not a true bug, just a performance FYI
'model_attributes_to_shapefile' gets hung up and did not write anything after ~20min for my large disv model. If I write my own version, its works pretty fast (<1 min)

f_out = r'C:\offline\mcwhpp\junk\mdl_shps\whpp.shp'
sim_ws = r'V:\23\62\1462\multi_comm_WHPP\mf6\calibration\current'
sim = fp.mf6.MFSimulation.load(sim_ws= sim_ws)
ml = sim.get_model('local')
grb = fp.mf6.utils.MfGrdFile(r'%s\mcwhpp_m.dis.grb'%sim_ws)
modelgrid = grb.modelgrid
epsg = 26915
modelgrid.set_coord_info(crs = pyproj.CRS.from_epsg(epsg))
if False:
    #never does anything
    fp.export.shapefile_utils.model_attributes_to_shapefile(path = f_out,ml = ml, modelgrid =modelgrid,package_names = ['npf'])
if True:
    #my version... works in ~1min
    dir_out = r'C:\offline\mcwhpp\junk\mdl_shps'
    d_pks = {'npf':{'k':ml.npf.k.array,'k33':ml.npf.k33.array}}
    for pk, d_att in d_pks.items():
        array_dict = {}
        for att,a in d_att.items():
            a_ls = a.reshape((modelgrid.nlay,modelgrid.ncpl))
            for l,_a in enumerate(a_ls):
                array_dict['%s_L%i'%(att,l+1)] = _a
        fp.export.shapefile_utils.write_grid_shapefile(r'%s\%s_grd.shp'%(dir_out,pk),mg = modelgrid, array_dict = array_dict)

Expected behavior
I expect 'model_attributes_to_shapefile' to work more quickly

Desktop (please complete the following information):

  • OS: Windows 10
  • Version '3.5.0.dev0'

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions